@xopcai/xopc 0.0.468 → 0.0.470
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-CIV2R_El.js → agents-DZftplJc.js} +3 -3
- package/dist/gateway/static/root/assets/{api-Cl08_xtM.js → api-BnS9d0p6.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CncU5JvR.js → apps-page-CXKTWj1s.js} +1 -1
- package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
- package/dist/gateway/static/root/assets/{automation-task-card-sR61FFLn.js → automation-task-card-BNT3n0qu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BNzj3R7A.js → automations-page-DqrAOReO.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
- package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-B4Yqbxab.js → block-editor-jy5CCmhH.js} +9 -9
- package/dist/gateway/static/root/assets/{capabilities-CBSMm_jo.js → capabilities-CaJjMTli.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
- package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
- package/dist/gateway/static/root/assets/{chat-chart-block-CS-cORJt.js → chat-chart-block-B_c5sy7q.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D6LH3W5H.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CxeXJKxg.js → connected-providers-grid-DUHMZjyV.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Bsec3-eZ.js → connector-service-page-DLbBblN2.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-C0ZCUtxF.js → connectors-page-HHGB3r3Q.js} +1 -1
- package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
- package/dist/gateway/static/root/assets/{device-pairing-wizard-diuSsk-H.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DrpE2lQ3.js → extension-debug-page-DIAyDA-a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-hr60GwXQ.js → extension-iframe-host-CCe4R7L7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-aoF3x4-X.js → extension-message-router-BD0ZamBV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BfM8zli6.js → extension-page-C09dlV3J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BcSgVeKW.js → extension-provider-BhluafoX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Db5t2Mz0.js → extension-settings-page-CB8KLYoG.js} +1 -1
- package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
- package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
- package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
- package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
- package/dist/gateway/static/root/assets/{home-page-DsS2UT08.js → home-page-8KwhWlYt.js} +3 -3
- package/dist/gateway/static/root/assets/index-CQNwlXpQ.js +11 -0
- package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-0_PeJJqO.js → install-connector-dialog-BZjodnUC.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-yBqRl5Bi.js → local-apps-page-Ct8z2B7R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D9HGIYXx.js → management-settings-CUQd0FJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CiGdWuN3.js → markdown-view-Dm01GIXv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C2lp7UmI.js → media-plugins-jsWNdARw.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
- package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-provider-connect-BW7zcXfb.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Cw58-5P3.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
- package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-CDrzvI35.js → personal-profile-settings-CNI5Eor6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CoZ3qWSr.js → personal-settings-panel-BcrpYRn9.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-UHVwbC3H.js → phone-model-connection-DKvOEjWH.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-fS2IT-dK.js → phone-settings-page-DvX6okzz.js} +1 -1
- package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
- package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
- package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
- package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
- package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BMJ2x5m3.js → product-open-page-DXwOPgRP.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-lkkZPvMa.js → product-preview-content-DiQbeaCK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-DtUBJGs5.js → product-preview-modal-BU7Qojpq.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
- package/dist/gateway/static/root/assets/{projects-page-Dua6taaG.js → projects-page-DGATZB23.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-B6eZLEnh.js → providers-api-BXa2Aheb.js} +1 -1
- package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
- package/dist/gateway/static/root/assets/{remote-access-hub-Dy3-oGK1.js → remote-access-hub-_7tmWand.js} +1 -1
- package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
- package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-CsU74h1b.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
- package/dist/gateway/static/root/assets/{settings-page-ByFNIBfp.js → settings-page-bCW4rave.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-Bsn4Wa4p.js → setup-interaction-page-BYXDX0F2.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CstjOb7g.js → setup-status-panel-Bhda3jS2.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
- package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CkkHufmv.js → skills-page-CfhEcU8L.js} +1 -1
- package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
- package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
- package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
- package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-dtN1sSjU.js → task-result-evidence-Bmgta9z9.js} +1 -1
- package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
- package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
- package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
- package/dist/gateway/static/root/assets/{use-realtime-voice-lRHVixh4.js → use-realtime-voice-cugjs8cK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-DrWnW1aA.js → use-workspace-tree-Crfx5ctU.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Bw1_PGdD.js → user-model-page-BvnLbTYx.js} +1 -1
- package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
- package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
- package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DcZS4OMj.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CZF9iWPT.js → work-discovery-page-DappIHQq.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
- package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
- package/dist/gateway/static/root/index.html +90 -77
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/packages/gateway-contract/src/clarifications.js +20 -2
- package/dist/packages/gateway-contract/src/index.js +6 -4
- package/dist/packages/gateway-contract/src/space.js +23 -0
- package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/task-runs.js +1 -0
- package/dist/packages/gateway-contract/src/tasks.js +118 -6
- package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
- package/dist/packages/gateway-contract/src/video-generation.js +29 -4
- package/dist/src/agent/agent-manager.js +2 -2
- package/dist/src/agent/embedded/agent-profile-context.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
- package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
- package/dist/src/agent/orchestration/turn-recovery.js +25 -6
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service/webchat-tts.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/apply-patch.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -0
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-task-tool.js +12 -7
- package/dist/src/agent/tools/publish-artifacts.js +2 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -0
- package/dist/src/agent/tools/tool-media.d.ts +3 -1
- package/dist/src/agent/tools/tool-media.js +2 -0
- package/dist/src/agent/tools/xopc-use-tool.js +21 -4
- package/dist/src/agent-catalog/test-support.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +30 -6
- package/dist/src/automations/capabilities/write.js +2 -2
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/domain/types.d.ts +6 -0
- package/dist/src/automations/domain/validation.d.ts +60 -12
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.js +14 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +9 -9
- package/dist/src/computer/errors.d.ts +2 -2
- package/dist/src/computer/evaluation.d.ts +7 -7
- package/dist/src/computer/runtime.d.ts +4 -4
- package/dist/src/config/schema.d.ts +2 -2
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +2 -2
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/music-generation.js +2 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/space.d.ts +3 -0
- package/dist/src/gateway/hono/routes/space.js +105 -0
- package/dist/src/gateway/hono/routes/tasks.js +27 -28
- package/dist/src/gateway/hono/routes/video-generation.js +8 -5
- package/dist/src/gateway/html-preview-shell.d.ts +1 -1
- package/dist/src/gateway/html-preview-shell.js +3 -0
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +10 -3
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
- package/dist/src/home-intelligence/follow-ups.js +2 -1
- package/dist/src/home-intelligence/routines.js +1 -1
- package/dist/src/local-apps/automation-proposals.d.ts +54 -12
- package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
- package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
- package/dist/src/media/session-references.d.ts +4 -1
- package/dist/src/media/session-references.js +40 -8
- package/dist/src/music-generation/artifact.js +3 -1
- package/dist/src/music-generation/providers.js +26 -15
- package/dist/src/music-generation/repository.js +8 -1
- package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
- package/dist/src/music-generation/xopc-cloud.js +38 -0
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompt-context.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +16 -7
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +17 -7
- package/dist/src/personal-agent/request-service.js +6 -10
- package/dist/src/personal-agent/result-extraction.js +13 -13
- package/dist/src/personal-agent/schedules.d.ts +9 -0
- package/dist/src/personal-agent/schedules.js +44 -0
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +6 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -0
- package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
- package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
- package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
- package/dist/src/providers/xopc-cloud-media.js +67 -0
- package/dist/src/providers/xopc-cloud-model-source.js +4 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +1 -1
- package/dist/src/session/client-history.d.ts +4 -1
- package/dist/src/session/client-history.js +18 -0
- package/dist/src/session/compact-history.js +30 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/space/ingest.d.ts +36 -0
- package/dist/src/space/ingest.js +149 -0
- package/dist/src/space/repository.d.ts +39 -0
- package/dist/src/space/repository.js +325 -0
- package/dist/src/space/worker.d.ts +14 -0
- package/dist/src/space/worker.js +199 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +9 -2
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +8 -7
- package/dist/src/storage/sqlite/schema.sql +103 -0
- package/dist/src/storage/sqlite/transcript-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
- package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
- package/dist/src/tasks/capabilities/management.d.ts +15 -2
- package/dist/src/tasks/capabilities/management.js +8 -2
- package/dist/src/tasks/capabilities/read.js +14 -2
- package/dist/src/tasks/capabilities/relations.d.ts +13 -7
- package/dist/src/tasks/capabilities/write.d.ts +118 -2
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +7 -9
- package/dist/src/tasks/task-allocation-service.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +8 -2
- package/dist/src/tasks/task-application-service.js +94 -27
- package/dist/src/tasks/task-collaboration-repository.js +12 -1
- package/dist/src/tasks/task-context-assembler.js +9 -3
- package/dist/src/tasks/task-contract-planner.js +1 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
- package/dist/src/tasks/task-conversation-summary.js +3 -1
- package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
- package/dist/src/tasks/task-criterion-review-repository.js +70 -23
- package/dist/src/tasks/task-deliverables.d.ts +7 -0
- package/dist/src/tasks/task-deliverables.js +112 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-instruction-sequence.js +10 -3
- package/dist/src/tasks/task-json-acceptance.js +3 -5
- package/dist/src/tasks/task-origin-repository.d.ts +99 -1
- package/dist/src/tasks/task-origin-repository.js +67 -5
- package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
- package/dist/src/tasks/task-read-model-projector.js +123 -9
- package/dist/src/tasks/task-repository.d.ts +4 -1
- package/dist/src/tasks/task-repository.js +34 -11
- package/dist/src/tasks/task-research-repair.d.ts +2 -2
- package/dist/src/tasks/task-research-result.d.ts +1 -0
- package/dist/src/tasks/task-research-result.js +13 -3
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
- package/dist/src/tasks/task-result-delivery-repository.js +35 -17
- package/dist/src/tasks/task-result-delivery-service.js +22 -7
- package/dist/src/tasks/task-result-versions.d.ts +11 -0
- package/dist/src/tasks/task-result-versions.js +34 -0
- package/dist/src/tasks/task-run-coordinator.js +28 -15
- package/dist/src/tasks/task-run-dispatcher.js +29 -4
- package/dist/src/tasks/task-run-repository.d.ts +2 -0
- package/dist/src/tasks/task-run-repository.js +62 -19
- package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
- package/dist/src/tasks/task-workspace-verification.js +95 -0
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/video-generation/artifact.js +3 -1
- package/dist/src/video-generation/drafts.js +4 -0
- package/dist/src/video-generation/providers.d.ts +1 -0
- package/dist/src/video-generation/providers.js +37 -5
- package/dist/src/video-generation/repository.js +8 -1
- package/dist/src/video-generation/settings.d.ts +1 -0
- package/dist/src/video-generation/settings.js +10 -4
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BWpA-X_S.js +0 -9
- package/dist/gateway/static/root/assets/binary-plugins-BjEE5sVq.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-EmBa4Blq.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BQf7oyqc.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +0 -8
- package/dist/gateway/static/root/assets/channels-oyMymJDx.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +0 -71
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-CVQ7q0DU.js +0 -1
- package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
- package/dist/gateway/static/root/assets/index-DFa0pZhC.js +0 -11
- package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-OSinc6m6.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BJxQ_Jd5.js +0 -2
- package/dist/gateway/static/root/assets/models-hub-cache-CmdULYFt.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CVEG1JdF.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +0 -1
- package/dist/gateway/static/root/assets/notes-api-BQXOYFQ5.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Cc-c1Yhg.js +0 -8
- package/dist/gateway/static/root/assets/page-header-store-DwFwq_lI.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-B-Oes3ef.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
- package/dist/gateway/static/root/assets/personal-page-DWPu-iwK.js +0 -1
- package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-DrBclzH1.js +0 -7
- package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DGFUj6jS.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-DXxD6grq.js +0 -1
- package/dist/gateway/static/root/assets/right-workspace-store-BzXnZDK5.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-8KCgPcjp.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-BALhliq6.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-Cby6Nkib.js +0 -25
- package/dist/gateway/static/root/assets/share-preview-page-9pOnypJv.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CJdVDQqf.js +0 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BjBkKeIf.js +0 -3
- package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BEYkb8cs.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-CQeo2Ztn.js +0 -15
- package/dist/gateway/static/root/assets/use-personal-profile-CKm5FaTl.js +0 -1
- package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-CssuMBjt.js +0 -1
- package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-BfApIXLw.js +0 -2
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BRhsCs1S.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-BrofEVle.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{n as ee,r as _}from"./popover-select-CLsphyzA.js";import{t as te}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./secret-input-DsjfQmDn.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{t as w}from"./button-Cc4hUNTt.js";import{n as T}from"./interaction-BdhHBbYa.js";import{A as E,N as D,f as O,g as k,h as ne,j as A,k as j,p as M,w as N,z as P}from"./connectors-api-BUdH4tZQ.js";import{s as F}from"./form-field-width-DJw_jULe.js";import{n as I}from"./electron-env-DHOGevH3.js";import{t as L}from"./oauth-provider-connect-BW7zcXfb.js";import{t as re}from"./connection-usage-guide-CM5qgMcK.js";var R=g(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function z(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}var B=n(),V=e(t(),1),H=r();async function U(e,t){let n=await c(o(e),t);if(!n.ok)throw Error(n.error??`Connection request failed.`);return n.payload}function W({definition:e,instance:t,onClose:n,onChanged:r}){let i=s(e=>e.language)===`zh`,[c,d]=(0,V.useState)(t),[g,te]=(0,V.useState)(),[v,y]=(0,V.useState)(),[S,T]=(0,V.useState)(),[E,O]=(0,V.useState)(),[k,A]=(0,V.useState)(!1),[M,P]=(0,V.useState)(),F=c?.instanceId??e.id,I=(0,V.useCallback)(async()=>{let e=await U(`/api/connectors/${encodeURIComponent(F)}/accounts`);te(e),e.authorization&&y(e.authorization)},[F]);(0,V.useEffect)(()=>{c&&I().catch(e=>P(String(e)))},[c,I]);let L=v&&[`preparing`,`awaiting_user`,`verifying`].includes(v.status);(0,V.useEffect)(()=>{if(!L||!v)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U(`/api/connectors/authorizations/${v.id}`);if(e)return;y(t.authorization),t.authorization.status===`succeeded`&&(await I(),c&&await r(c))}catch(t){e||P(String(t))}finally{t=!1}}},i=()=>{n()},a=()=>{document.visibilityState===`visible`&&i()};i();let o=setInterval(i,1500);return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a),()=>{e=!0,clearInterval(o),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a)}},[L,v?.id,c,r,I]);let R=v?.challenge?.type===`qr_code`?v.challenge.artifactId:void 0;(0,V.useEffect)(()=>{if(!R){T(void 0);return}let e=!1,t;return a(o(`/api/connectors/authorizations/${R}/artifact`)).then(async n=>{if(!n.ok)throw Error(`QR code unavailable.`);let r=await n.blob();e||(t=URL.createObjectURL(r),T(t))}).catch(t=>{e||P(String(t))}),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[R]);let z=async t=>{A(!0),P(void 0);try{let n=c??await ne(e.id,{});d(n);let r=await U(`/api/connectors/${encodeURIComponent(n.instanceId)}/authorizations`,{method:`POST`,body:JSON.stringify({accountId:t})});y(r.authorization)}catch(e){P(e instanceof Error?e.message:String(e))}finally{A(!1)}},B=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/${encodeURIComponent(F)}/policy`,{method:`PATCH`,body:JSON.stringify({maxScope:e})}),await I()}catch(e){P(String(e))}finally{A(!1)}},W=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/accounts/${encodeURIComponent(e)}`,{method:`DELETE`}),await I()}catch(e){P(String(e))}finally{A(!1)}},G=async e=>{if(c){A(!0),P(void 0);try{if(e===`remove`)await N(F),await r(c),n();else if(e===`toggle`){let e=await j(F,!c.enabled);d(e),await r(e)}else{let e=await D(F);O(e.ok?i?`验证通过,可用操作:${e.toolCount}`:`Verified: ${e.toolCount} actions`:e.error??e.action??e.status)}}catch(e){P(String(e))}finally{A(!1)}}},K=()=>{c&&r(c),n()};return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||K()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`fixed inset-0 z-50 bg-black/40`}),(0,H.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge p-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(m,{className:`font-semibold`,children:e.displayName}),(0,H.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:i?`连接账号并设置允许的操作。`:`Connect an account and choose allowed actions.`})]}),(0,H.jsx)(w,{variant:`ghost`,onClick:K,"aria-label":i?`关闭`:`Close`,children:(0,H.jsx)(x,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:M}):null,c&&!g?(0,H.jsx)(C,{className:`h-24 w-full`}):null,c?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(w,{disabled:k||!!L,onClick:()=>void G(`toggle`),children:c.enabled?i?`停用`:`Disable`:i?`启用`:`Enable`}),(0,H.jsx)(w,{disabled:k||!!L||!c.enabled,onClick:()=>void G(`test`),children:i?`检查连接`:`Check connection`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L,onClick:()=>void G(`remove`),children:i?`移除连接`:`Remove connection`})]}):null,c?.enabled&&g?.accounts.some(e=>e.enabled&&e.status===`active`)?(0,H.jsx)(re,{target:{kind:`connector`,id:e.id,name:e.displayName},onStart:n}):null,E?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E}):null,g?.accounts.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label??e.id}),(0,H.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:String(e.identity.openId??e.identity.botId??e.identity.userId??e.id)}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.enabled&&e.status===`active`?i?`已连接`:`Connected`:i?`已断开`:`Disconnected`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(w,{variant:`secondary`,disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(e.id),children:i?`重新连接`:`Reconnect`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L||!e.enabled,onClick:()=>void W(e.id),children:i?`断开本地连接`:`Disconnect locally`})]})]},e.id)),g?.policy?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:i?`允许的操作`:`Allowed actions`}),(0,H.jsxs)(ee,{value:g.policy.maxScope,onChange:e=>void B(e.target.value),disabled:k,children:[(0,H.jsx)(_,{value:`read`,children:i?`仅查看`:`Read only`}),(0,H.jsx)(_,{value:`write`,children:i?`查看并执行操作`:`Read and write`})]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`写入操作需要确认。断开本地连接不会撤销第三方授权。`:`Writes require confirmation. Local disconnection does not revoke provider authorization.`})]}):null,v?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,"aria-live":`polite`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:v.status===`succeeded`?i?`账号验证成功`:`Account verified`:v.status===`preparing`?i?`正在准备授权…`:`Preparing authorization…`:v.status===`verifying`?i?`授权已完成,正在验证账号…`:`Authorization complete. Verifying account…`:L?i?`请完成当前步骤,返回后会自动检查结果。`:`Complete this step. We will check the result when you return.`:v.error??(i?`授权已结束,请重新连接。`:`Authorization ended. Connect again.`)}),L&&v.challenge&&v.challenge.totalSteps>1?(0,H.jsxs)(`p`,{className:`text-sm font-medium`,children:[i?`第 ${v.challenge.step} / ${v.challenge.totalSteps} 步`:`Step ${v.challenge.step} of ${v.challenge.totalSteps}`,v.challenge.step>1?i?`:上一步已完成,请打开新的授权页面继续。`:`: Previous step complete. Open the new authorization page to continue.`:i?`:完成后还需要继续授权账号。`:`: Account authorization follows this step.`]}):null,L&&v.challenge?.type===`open_url`?(0,H.jsx)(`a`,{href:v.challenge.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-accent underline`,children:i?`打开授权页面`:`Open authorization page`},v.challenge.url):null,L&&R?S?(0,H.jsx)(`img`,{src:S,alt:i?`授权二维码`:`Authorization QR code`,className:`mx-auto size-56 bg-white object-contain`}):(0,H.jsx)(C,{className:`mx-auto size-56`}):null,L?(0,H.jsx)(w,{variant:`secondary`,onClick:()=>{U(`/api/connectors/authorizations/${v.id}/cancel`,{method:`POST`}).then(()=>y({...v,status:`cancelled`,challenge:void 0})).catch(e=>P(String(e)))},children:i?`取消授权`:`Cancel authorization`}):null]}):null]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge p-4`,children:[(0,H.jsx)(w,{variant:`secondary`,onClick:K,children:i?`关闭`:`Close`}),(0,H.jsxs)(w,{disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(),children:[k?(0,H.jsx)(b,{className:`mr-2 size-4 animate-spin`}):null,i?`连接账号`:`Connect account`]})]})]})]})})}function G(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function K(e,t){return e.runtime.type===`composio`?t.connectorDescriptions[e.runtime.toolkit.toLowerCase()]??e.description:e.description}function q(e){return e instanceof Error?e.message:String(e)}function ie(e,t){let n=q(e);return/APIKey_InsufficientPermissions/i.test(n)||/["\\]?code["\\]?\s*:\s*812\b/i.test(n)||/session_management/i.test(n)&&/write access|write permission|at least ["\\]?write/i.test(n)?t.composioSessionWritePermissionRequired:n}var J={sm:{frame:`size-9 rounded-lg`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,fallback:`size-5`}};function ae(e){let t=(0,B.c)(14),{connector:n,size:r,className:i}=e,a=r===void 0?`md`:r,o=n?.branding?.logoUrl,[s,c]=(0,V.useState)(!1),l=J[a],u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{c(!1)},t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=[o],t[1]=o,t[2]=d),(0,V.useEffect)(u,d);let f;t[3]!==i||t[4]!==l.frame?(f=S(`flex shrink-0 items-center justify-center overflow-hidden`,l.frame,i),t[3]=i,t[4]=l.frame,t[5]=f):f=t[5];let p=n?.displayName,m;t[6]!==l.fallback||t[7]!==s||t[8]!==o?(m=o&&!s?(0,H.jsx)(`img`,{src:o,alt:``,loading:`lazy`,draggable:!1,className:`size-full object-contain`,onError:()=>c(!0)}):(0,H.jsx)(R,{className:S(`text-fg-muted`,l.fallback),"aria-hidden":!0}),t[6]=l.fallback,t[7]=s,t[8]=o,t[9]=m):m=t[9];let h;return t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,H.jsx)(`span`,{className:f,title:p,children:m}),t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13],h}var Y=S(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,F),oe=S(Y,`min-h-28 font-mono`);function se(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function ce(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function X({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=K(o,a),c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,g=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,j=o.understanding!=null,[N,F]=(0,V.useState)(!c),[z,B]=(0,V.useState)(null),[U,W]=(0,V.useState)(c),[q,J]=(0,V.useState)(null),[X,le]=(0,V.useState)(null),[Z,ue]=(0,V.useState)(!1),[Q,de]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!c)return;let e=!1;return O().then(t=>{e||(B(t),F(t.configured))}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||W(!1)}),()=>{e=!0}},[o.id,c]),(0,V.useEffect)(()=>{if(!g||!N)return;let e=!1;return ue(!0),M(g).then(t=>{e||le(t)}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||ue(!1)}),()=>{e=!0}},[N,g]);let fe=(0,V.useCallback)(async()=>{let n=I(),i=c&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),J(null),t({...e,installing:!0,error:null,result:null,health:null});try{if(c&&!N)throw Error(a.composioSetupSignInRequired);let s=c&&g?X??await M(g):null,l=e.config.authConfigId?.trim();if(s?.requiresCustomAuthConfig&&!l)throw Error(a.composioAuthConfigRequired);if(l){let e=s?.authConfigs.find(e=>e.id===l);if(!e||e.status!==`ENABLED`||!e.isEnabledForToolRouter)throw Error(a.composioAuthConfigUnavailable)}let u={};for(let t of o.setup.config??[]){let n=ce(t.type,e.config[t.key]??``);n!==void 0&&(u[t.key]=n)}l&&(u.authConfigId=l);let d=e.store?await k(e.store.packageName,{secrets:e.secrets,config:u},e.store.version,e.store.reviewHash):await ne(o.id,{secrets:e.secrets,config:u,definition:o.source===`registry`?o:void 0}),f=null;try{if(c){let e=await A(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await P(g,e.connectionId,12e4,e.attemptId);if(i?.close(),j&&Q){if(!t.accountId)throw Error(`Connector account is unavailable.`);await E(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:null,health:null,error:c?ie(n,a):n instanceof Error?n.message:String(n)}),await r(d);return}if(d.materialized.type===`cli`||d.materialized.type===`mcp`)try{f=await D(d.instanceId)}catch{f=null}t({...e,installing:!1,result:d,health:f}),await r(d)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[j,X,N,g,o,e,c,Q,t,r,a.composioAuthConfigRequired,a.composioAuthConfigUnavailable,a.composioSetupSignInRequired]),pe=X?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[],$=X?.requiresCustomAuthConfig===!0,me=N&&$&&!e.config.authConfigId?.trim();return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,H.jsxs)(p,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,c?`max-h-[calc(100dvh-2rem)] w-[min(100%-2rem,32rem)]`:`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,42rem)]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(ae,{connector:o,size:`lg`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(m,{className:`text-base font-semibold text-fg`,children:G(a.connectDialogTitle,{name:o.displayName})}),(0,H.jsx)(u,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:s})]})]}),(0,H.jsx)(d,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:S(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,T.focusRingPanel),"aria-label":a.modalClose,children:[(0,H.jsx)(x,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,H.jsx)(`div`,{className:S(`min-h-0 overflow-y-auto px-6 py-5`,!c&&`flex-1`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&U?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,"aria-busy":`true`,"aria-label":a.composioSetupTitle,children:[(0,H.jsx)(C,{className:`h-4 w-40`}),(0,H.jsx)(C,{className:`mt-2 h-3 w-72 max-w-full`}),(0,H.jsx)(C,{className:`mt-3 h-16 w-full rounded-xl`})]}):c&&!N?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.composioSetupHint}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(L,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:!1,onConnected:()=>{O().then(e=>{B(e),F(e.configured)})}})}),(0,H.jsx)(i,{to:`/settings/connector-service`,onClick:n,className:`mt-3 block text-xs text-accent-fg`,children:a.composioSetupByok})]}):null,c&&j?(0,H.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:Q,onChange:e=>de(e.currentTarget.checked)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:a.learnAfterConnect}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:a.learnAfterConnectHint})]})]}):null,c&&N&&z?.mode===`managed`?(0,H.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:$?a.composioCloudAuthUnavailable:a.composioSetupManaged}):null,c&&N&&z?.mode===`byok`?(0,H.jsxs)(`details`,{open:$,className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:a.composioAdvancedSettings}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioAuthConfigTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:$?a.composioAuthConfigRequiredHint:a.composioAuthConfigManaged})]}),z?.mode===`byok`?(0,H.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[a.composioAuthConfigManage,(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})]}):(0,H.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:a.composioSetupManaged})]}),Z?(0,H.jsx)(C,{className:`mt-3 h-10 w-full`}):(0,H.jsxs)(ee,{className:S(Y,`mt-3`),value:e.config.authConfigId??``,onChange:n=>t({...e,config:{...e.config,authConfigId:n.currentTarget.value},error:null}),children:[$?null:(0,H.jsx)(_,{value:``,children:a.composioAuthConfigManaged}),$&&!e.config.authConfigId?(0,H.jsx)(_,{value:``,disabled:!0,children:a.composioAuthConfigSelect}):null,pe.map(e=>(0,H.jsxs)(_,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),!Z&&$&&pe.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:a.composioAuthConfigEmpty}):null]}):null,c&&N&&z?.mode===`byok`?(0,H.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:a.composioSessionWritePermissionHint}):null,e.store?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,H.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.links??[]).length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-xl border border-edge bg-surface-base p-3`,children:(o.setup.links??[]).map(e=>{let t=e.external!==!1&&/^https:\/\//i.test(e.href);return(0,H.jsxs)(`a`,{href:t?e.href:`#${e.href}`,target:t?`_blank`:void 0,rel:t?`noopener noreferrer`:void 0,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent-fg hover:underline`,children:[e.label,t?(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):null]},`${e.label}:${e.href}`)})}):null,(o.setup.secrets??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,H.jsx)(y,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,H.jsx)(`textarea`,{className:oe,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,H.jsx)(`input`,{className:Y,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,H.jsx)(b,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:e.error}):null,q?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:q}):null,e.result&&e.health?.ok?(0,H.jsx)(re,{target:{kind:`connector`,id:o.id,name:o.displayName},onStart:n}):null,e.result?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:a.connectedBadge})}),(0,H.jsx)(`span`,{className:S(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:se(e.health?.status,a)})]}),(0,H.jsx)(`p`,{className:`mt-3`,children:e.health?.ok?a.connectionReady:e.health?a.connectionNeedsSetup:a.installedWithoutHealth}),e.health?.action?(0,H.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})}),(0,H.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,H.jsxs)(w,{variant:`primary`,disabled:!!e.result||e.installing||U||Z||me||c&&!N,onClick:()=>void fe(),children:[e.installing?(0,H.jsx)(b,{className:`size-4 animate-spin`}):e.result?(0,H.jsx)(te,{className:`size-4`}):(0,H.jsx)(R,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function le(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=e.draft.connector.runtime.type===`cli`?(0,H.jsx)(W,{definition:e.draft.connector,onClose:e.onClose,onChanged:e.onInstalled}):(0,H.jsx)(X,{...e}),t[0]=e,t[1]=n),n}export{G as a,R as c,K as i,ae as n,W as o,ie as r,z as s,le as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{n as ee,r as _}from"./popover-select-CLsphyzA.js";import{t as te}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./secret-input-DsjfQmDn.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{t as w}from"./button-Cc4hUNTt.js";import{n as T}from"./interaction-BdhHBbYa.js";import{A as E,N as D,f as O,g as k,h as ne,j as A,k as j,p as M,w as N,z as P}from"./connectors-api-BUdH4tZQ.js";import{s as F}from"./form-field-width-DJw_jULe.js";import{n as I}from"./electron-env-DHOGevH3.js";import{t as L}from"./oauth-provider-connect-BexlZuZ4.js";import{t as re}from"./connection-usage-guide-CM5qgMcK.js";var R=g(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function z(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}var B=n(),V=e(t(),1),H=r();async function U(e,t){let n=await c(o(e),t);if(!n.ok)throw Error(n.error??`Connection request failed.`);return n.payload}function W({definition:e,instance:t,onClose:n,onChanged:r}){let i=s(e=>e.language)===`zh`,[c,d]=(0,V.useState)(t),[g,te]=(0,V.useState)(),[v,y]=(0,V.useState)(),[S,T]=(0,V.useState)(),[E,O]=(0,V.useState)(),[k,A]=(0,V.useState)(!1),[M,P]=(0,V.useState)(),F=c?.instanceId??e.id,I=(0,V.useCallback)(async()=>{let e=await U(`/api/connectors/${encodeURIComponent(F)}/accounts`);te(e),e.authorization&&y(e.authorization)},[F]);(0,V.useEffect)(()=>{c&&I().catch(e=>P(String(e)))},[c,I]);let L=v&&[`preparing`,`awaiting_user`,`verifying`].includes(v.status);(0,V.useEffect)(()=>{if(!L||!v)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U(`/api/connectors/authorizations/${v.id}`);if(e)return;y(t.authorization),t.authorization.status===`succeeded`&&(await I(),c&&await r(c))}catch(t){e||P(String(t))}finally{t=!1}}},i=()=>{n()},a=()=>{document.visibilityState===`visible`&&i()};i();let o=setInterval(i,1500);return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a),()=>{e=!0,clearInterval(o),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a)}},[L,v?.id,c,r,I]);let R=v?.challenge?.type===`qr_code`?v.challenge.artifactId:void 0;(0,V.useEffect)(()=>{if(!R){T(void 0);return}let e=!1,t;return a(o(`/api/connectors/authorizations/${R}/artifact`)).then(async n=>{if(!n.ok)throw Error(`QR code unavailable.`);let r=await n.blob();e||(t=URL.createObjectURL(r),T(t))}).catch(t=>{e||P(String(t))}),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[R]);let z=async t=>{A(!0),P(void 0);try{let n=c??await ne(e.id,{});d(n);let r=await U(`/api/connectors/${encodeURIComponent(n.instanceId)}/authorizations`,{method:`POST`,body:JSON.stringify({accountId:t})});y(r.authorization)}catch(e){P(e instanceof Error?e.message:String(e))}finally{A(!1)}},B=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/${encodeURIComponent(F)}/policy`,{method:`PATCH`,body:JSON.stringify({maxScope:e})}),await I()}catch(e){P(String(e))}finally{A(!1)}},W=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/accounts/${encodeURIComponent(e)}`,{method:`DELETE`}),await I()}catch(e){P(String(e))}finally{A(!1)}},G=async e=>{if(c){A(!0),P(void 0);try{if(e===`remove`)await N(F),await r(c),n();else if(e===`toggle`){let e=await j(F,!c.enabled);d(e),await r(e)}else{let e=await D(F);O(e.ok?i?`验证通过,可用操作:${e.toolCount}`:`Verified: ${e.toolCount} actions`:e.error??e.action??e.status)}}catch(e){P(String(e))}finally{A(!1)}}},K=()=>{c&&r(c),n()};return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||K()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`fixed inset-0 z-50 bg-black/40`}),(0,H.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge p-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(m,{className:`font-semibold`,children:e.displayName}),(0,H.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:i?`连接账号并设置允许的操作。`:`Connect an account and choose allowed actions.`})]}),(0,H.jsx)(w,{variant:`ghost`,onClick:K,"aria-label":i?`关闭`:`Close`,children:(0,H.jsx)(x,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:M}):null,c&&!g?(0,H.jsx)(C,{className:`h-24 w-full`}):null,c?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(w,{disabled:k||!!L,onClick:()=>void G(`toggle`),children:c.enabled?i?`停用`:`Disable`:i?`启用`:`Enable`}),(0,H.jsx)(w,{disabled:k||!!L||!c.enabled,onClick:()=>void G(`test`),children:i?`检查连接`:`Check connection`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L,onClick:()=>void G(`remove`),children:i?`移除连接`:`Remove connection`})]}):null,c?.enabled&&g?.accounts.some(e=>e.enabled&&e.status===`active`)?(0,H.jsx)(re,{target:{kind:`connector`,id:e.id,name:e.displayName},onStart:n}):null,E?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E}):null,g?.accounts.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label??e.id}),(0,H.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:String(e.identity.openId??e.identity.botId??e.identity.userId??e.id)}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.enabled&&e.status===`active`?i?`已连接`:`Connected`:i?`已断开`:`Disconnected`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(w,{variant:`secondary`,disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(e.id),children:i?`重新连接`:`Reconnect`}),(0,H.jsx)(w,{variant:`ghost`,disabled:k||!!L||!e.enabled,onClick:()=>void W(e.id),children:i?`断开本地连接`:`Disconnect locally`})]})]},e.id)),g?.policy?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:i?`允许的操作`:`Allowed actions`}),(0,H.jsxs)(ee,{value:g.policy.maxScope,onChange:e=>void B(e.target.value),disabled:k,children:[(0,H.jsx)(_,{value:`read`,children:i?`仅查看`:`Read only`}),(0,H.jsx)(_,{value:`write`,children:i?`查看并执行操作`:`Read and write`})]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`写入操作需要确认。断开本地连接不会撤销第三方授权。`:`Writes require confirmation. Local disconnection does not revoke provider authorization.`})]}):null,v?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,"aria-live":`polite`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:v.status===`succeeded`?i?`账号验证成功`:`Account verified`:v.status===`preparing`?i?`正在准备授权…`:`Preparing authorization…`:v.status===`verifying`?i?`授权已完成,正在验证账号…`:`Authorization complete. Verifying account…`:L?i?`请完成当前步骤,返回后会自动检查结果。`:`Complete this step. We will check the result when you return.`:v.error??(i?`授权已结束,请重新连接。`:`Authorization ended. Connect again.`)}),L&&v.challenge&&v.challenge.totalSteps>1?(0,H.jsxs)(`p`,{className:`text-sm font-medium`,children:[i?`第 ${v.challenge.step} / ${v.challenge.totalSteps} 步`:`Step ${v.challenge.step} of ${v.challenge.totalSteps}`,v.challenge.step>1?i?`:上一步已完成,请打开新的授权页面继续。`:`: Previous step complete. Open the new authorization page to continue.`:i?`:完成后还需要继续授权账号。`:`: Account authorization follows this step.`]}):null,L&&v.challenge?.type===`open_url`?(0,H.jsx)(`a`,{href:v.challenge.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-accent underline`,children:i?`打开授权页面`:`Open authorization page`},v.challenge.url):null,L&&R?S?(0,H.jsx)(`img`,{src:S,alt:i?`授权二维码`:`Authorization QR code`,className:`mx-auto size-56 bg-white object-contain`}):(0,H.jsx)(C,{className:`mx-auto size-56`}):null,L?(0,H.jsx)(w,{variant:`secondary`,onClick:()=>{U(`/api/connectors/authorizations/${v.id}/cancel`,{method:`POST`}).then(()=>y({...v,status:`cancelled`,challenge:void 0})).catch(e=>P(String(e)))},children:i?`取消授权`:`Cancel authorization`}):null]}):null]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge p-4`,children:[(0,H.jsx)(w,{variant:`secondary`,onClick:K,children:i?`关闭`:`Close`}),(0,H.jsxs)(w,{disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(),children:[k?(0,H.jsx)(b,{className:`mr-2 size-4 animate-spin`}):null,i?`连接账号`:`Connect account`]})]})]})]})})}function G(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function K(e,t){return e.runtime.type===`composio`?t.connectorDescriptions[e.runtime.toolkit.toLowerCase()]??e.description:e.description}function q(e){return e instanceof Error?e.message:String(e)}function ie(e,t){let n=q(e);return/APIKey_InsufficientPermissions/i.test(n)||/["\\]?code["\\]?\s*:\s*812\b/i.test(n)||/session_management/i.test(n)&&/write access|write permission|at least ["\\]?write/i.test(n)?t.composioSessionWritePermissionRequired:n}var J={sm:{frame:`size-9 rounded-lg`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,fallback:`size-5`}};function ae(e){let t=(0,B.c)(14),{connector:n,size:r,className:i}=e,a=r===void 0?`md`:r,o=n?.branding?.logoUrl,[s,c]=(0,V.useState)(!1),l=J[a],u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{c(!1)},t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=[o],t[1]=o,t[2]=d),(0,V.useEffect)(u,d);let f;t[3]!==i||t[4]!==l.frame?(f=S(`flex shrink-0 items-center justify-center overflow-hidden`,l.frame,i),t[3]=i,t[4]=l.frame,t[5]=f):f=t[5];let p=n?.displayName,m;t[6]!==l.fallback||t[7]!==s||t[8]!==o?(m=o&&!s?(0,H.jsx)(`img`,{src:o,alt:``,loading:`lazy`,draggable:!1,className:`size-full object-contain`,onError:()=>c(!0)}):(0,H.jsx)(R,{className:S(`text-fg-muted`,l.fallback),"aria-hidden":!0}),t[6]=l.fallback,t[7]=s,t[8]=o,t[9]=m):m=t[9];let h;return t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,H.jsx)(`span`,{className:f,title:p,children:m}),t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13],h}var Y=S(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,F),oe=S(Y,`min-h-28 font-mono`);function se(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function ce(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function X({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=K(o,a),c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,g=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,j=o.understanding!=null,[N,F]=(0,V.useState)(!c),[z,B]=(0,V.useState)(null),[U,W]=(0,V.useState)(c),[q,J]=(0,V.useState)(null),[X,le]=(0,V.useState)(null),[Z,ue]=(0,V.useState)(!1),[Q,de]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!c)return;let e=!1;return O().then(t=>{e||(B(t),F(t.configured))}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||W(!1)}),()=>{e=!0}},[o.id,c]),(0,V.useEffect)(()=>{if(!g||!N)return;let e=!1;return ue(!0),M(g).then(t=>{e||le(t)}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||ue(!1)}),()=>{e=!0}},[N,g]);let fe=(0,V.useCallback)(async()=>{let n=I(),i=c&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),J(null),t({...e,installing:!0,error:null,result:null,health:null});try{if(c&&!N)throw Error(a.composioSetupSignInRequired);let s=c&&g?X??await M(g):null,l=e.config.authConfigId?.trim();if(s?.requiresCustomAuthConfig&&!l)throw Error(a.composioAuthConfigRequired);if(l){let e=s?.authConfigs.find(e=>e.id===l);if(!e||e.status!==`ENABLED`||!e.isEnabledForToolRouter)throw Error(a.composioAuthConfigUnavailable)}let u={};for(let t of o.setup.config??[]){let n=ce(t.type,e.config[t.key]??``);n!==void 0&&(u[t.key]=n)}l&&(u.authConfigId=l);let d=e.store?await k(e.store.packageName,{secrets:e.secrets,config:u},e.store.version,e.store.reviewHash):await ne(o.id,{secrets:e.secrets,config:u,definition:o.source===`registry`?o:void 0}),f=null;try{if(c){let e=await A(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await P(g,e.connectionId,12e4,e.attemptId);if(i?.close(),j&&Q){if(!t.accountId)throw Error(`Connector account is unavailable.`);await E(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:null,health:null,error:c?ie(n,a):n instanceof Error?n.message:String(n)}),await r(d);return}if(d.materialized.type===`cli`||d.materialized.type===`mcp`)try{f=await D(d.instanceId)}catch{f=null}t({...e,installing:!1,result:d,health:f}),await r(d)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[j,X,N,g,o,e,c,Q,t,r,a.composioAuthConfigRequired,a.composioAuthConfigUnavailable,a.composioSetupSignInRequired]),pe=X?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[],$=X?.requiresCustomAuthConfig===!0,me=N&&$&&!e.config.authConfigId?.trim();return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,H.jsxs)(p,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,c?`max-h-[calc(100dvh-2rem)] w-[min(100%-2rem,32rem)]`:`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,42rem)]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(ae,{connector:o,size:`lg`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(m,{className:`text-base font-semibold text-fg`,children:G(a.connectDialogTitle,{name:o.displayName})}),(0,H.jsx)(u,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:s})]})]}),(0,H.jsx)(d,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:S(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,T.focusRingPanel),"aria-label":a.modalClose,children:[(0,H.jsx)(x,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,H.jsx)(`div`,{className:S(`min-h-0 overflow-y-auto px-6 py-5`,!c&&`flex-1`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&U?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,"aria-busy":`true`,"aria-label":a.composioSetupTitle,children:[(0,H.jsx)(C,{className:`h-4 w-40`}),(0,H.jsx)(C,{className:`mt-2 h-3 w-72 max-w-full`}),(0,H.jsx)(C,{className:`mt-3 h-16 w-full rounded-xl`})]}):c&&!N?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.composioSetupHint}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(L,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:!1,onConnected:()=>{O().then(e=>{B(e),F(e.configured)})}})}),(0,H.jsx)(i,{to:`/settings/connector-service`,onClick:n,className:`mt-3 block text-xs text-accent-fg`,children:a.composioSetupByok})]}):null,c&&j?(0,H.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:Q,onChange:e=>de(e.currentTarget.checked)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:a.learnAfterConnect}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:a.learnAfterConnectHint})]})]}):null,c&&N&&z?.mode===`managed`?(0,H.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:$?a.composioCloudAuthUnavailable:a.composioSetupManaged}):null,c&&N&&z?.mode===`byok`?(0,H.jsxs)(`details`,{open:$,className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:a.composioAdvancedSettings}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioAuthConfigTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:$?a.composioAuthConfigRequiredHint:a.composioAuthConfigManaged})]}),z?.mode===`byok`?(0,H.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[a.composioAuthConfigManage,(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})]}):(0,H.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:a.composioSetupManaged})]}),Z?(0,H.jsx)(C,{className:`mt-3 h-10 w-full`}):(0,H.jsxs)(ee,{className:S(Y,`mt-3`),value:e.config.authConfigId??``,onChange:n=>t({...e,config:{...e.config,authConfigId:n.currentTarget.value},error:null}),children:[$?null:(0,H.jsx)(_,{value:``,children:a.composioAuthConfigManaged}),$&&!e.config.authConfigId?(0,H.jsx)(_,{value:``,disabled:!0,children:a.composioAuthConfigSelect}):null,pe.map(e=>(0,H.jsxs)(_,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),!Z&&$&&pe.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:a.composioAuthConfigEmpty}):null]}):null,c&&N&&z?.mode===`byok`?(0,H.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:a.composioSessionWritePermissionHint}):null,e.store?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,H.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.links??[]).length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-xl border border-edge bg-surface-base p-3`,children:(o.setup.links??[]).map(e=>{let t=e.external!==!1&&/^https:\/\//i.test(e.href);return(0,H.jsxs)(`a`,{href:t?e.href:`#${e.href}`,target:t?`_blank`:void 0,rel:t?`noopener noreferrer`:void 0,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent-fg hover:underline`,children:[e.label,t?(0,H.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):null]},`${e.label}:${e.href}`)})}):null,(o.setup.secrets??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,H.jsx)(y,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,H.jsx)(`textarea`,{className:oe,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,H.jsx)(`input`,{className:Y,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,H.jsx)(b,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:e.error}):null,q?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:q}):null,e.result&&e.health?.ok?(0,H.jsx)(re,{target:{kind:`connector`,id:o.id,name:o.displayName},onStart:n}):null,e.result?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:a.connectedBadge})}),(0,H.jsx)(`span`,{className:S(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:se(e.health?.status,a)})]}),(0,H.jsx)(`p`,{className:`mt-3`,children:e.health?.ok?a.connectionReady:e.health?a.connectionNeedsSetup:a.installedWithoutHealth}),e.health?.action?(0,H.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})}),(0,H.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,H.jsxs)(w,{variant:`primary`,disabled:!!e.result||e.installing||U||Z||me||c&&!N,onClick:()=>void fe(),children:[e.installing?(0,H.jsx)(b,{className:`size-4 animate-spin`}):e.result?(0,H.jsx)(te,{className:`size-4`}):(0,H.jsx)(R,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function le(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=e.draft.connector.runtime.type===`cli`?(0,H.jsx)(W,{definition:e.draft.connector,onClose:e.onClose,onChanged:e.onInstalled}):(0,H.jsx)(X,{...e}),t[0]=e,t[1]=n),n}export{G as a,R as c,K as i,ae as n,W as o,ie as r,z as s,le as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,l as c,n as l,o as u}from"./locale-store-Cit_aHqC.js";import{t as d}from"./resource-unavailable-fk26VrOL.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-CY7CS_D3.js";import{t as y}from"./arrow-left-D880xG-P.js";import{t as b}from"./check-DUBLcKHA.js";import{n as x,r as S}from"./popover-select-CLsphyzA.js";import{t as C}from"./circle-check-C23XjkUj.js";import{t as w}from"./circle-x-DFsCKeya.js";import{t as T}from"./clock-3-DnrAnuyZ.js";import{t as E}from"./external-link-DjqjBmc3.js";import{n as D,r as ee,t as te}from"./power-off-CwwQ7Gp7.js";import{t as ne}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./history-DXH_9jsE.js";import{t as O}from"./loader-circle-CifKLtgG.js";import{t as ie}from"./panel-left-C8MqSXRZ.js";import{t as ae}from"./power-ZI-pBczI.js";import{t as oe}from"./refresh-cw-BRlGaq2w.js";import{t as se}from"./rotate-ccw-JM1TBLpp.js";import{t as ce}from"./shield-check-BU58siTV.js";import{t as le}from"./sparkles-DHlfQFAF.js";import{t as ue}from"./trash-2-DusmjVPV.js";import{t as de}from"./triangle-alert-2JXFNNKU.js";import{t as fe}from"./x-B_N4OPjy.js";import{t as k}from"./skeleton-DzdOeGYz.js";import{c as A,d as pe,p as me}from"./product-delivery-4gEqUIsK.js";import{a as he,i as ge}from"./vendor-swr-CdRzEUwF.js";import{t as j}from"./button-Cc4hUNTt.js";import{i as _e}from"./theme-store-C1MxmBg7.js";import{t as ve}from"./page-header-store-1-lflHAx.js";import{n as ye,r as M,t as be}from"./extension-message-router-BD0ZamBV.js";import{i as xe,n as Se,r as Ce,t as N}from"./extension-authoritative-grants-BqtUnmq-.js";import{i as we,n as Te,r as Ee,t as De}from"./runtime-health-zDkHcOZO.js";import{a as Oe,c as ke,d as Ae,f as je,l as Me,n as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./api-V4P8zfkJ.js";import{r as P}from"./date-formatters-DukWSVwc.js";import{n as Re,t as ze}from"./tab-completion-input-CxtEp0aP.js";import{t as Be}from"./page-context-capture-button-Cn4zi3Mt.js";var F=e(t(),1);function Ve(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}var I=r();function He({appId:e,sourceHash:t,mode:n,resourceScopes:r,scenarioId:i,runKey:a,title:o,hidden:d=!1,onMessage:f}){let p=c(e=>e.baseUrl),m=c(e=>e.conversationId),[h,g]=(0,F.useState)(null),_=h?.hostBaseUrl===p&&h?.hostNamespace===m&&h.appId===e&&h.sourceHash===t&&h.mode===n&&h.hostRunKey===a&&h.hostScopes===r&&h.hostScenario===i?h:null,[v,y]=(0,F.useState)(``),b=(0,F.useRef)(null),x=(0,F.useRef)(f);x.current=f;let S=(0,F.useRef)(null),C=l(e=>e.language),w=_e(e=>e.resolved),T=e=>{let t=e instanceof Error?e.message:String(e);y(t),x.current({source:`xopc-local-app-preview`,version:1,type:`error`,detail:{kind:`runner_error`,message:t.slice(0,500)}})},E=(0,F.useRef)(T);E.current=T,(0,F.useEffect)(()=>{let o=!0,l,d=new AbortController,f=e=>c.getState().baseUrl===p?u(s(`/api/local-app-previews/sessions/${encodeURIComponent(e)}`),{method:`DELETE`,keepalive:!0}).catch(()=>{}):Promise.resolve(),h=()=>{o=!1,d.abort(),l&&f(l.id)};return window.addEventListener(`pagehide`,h),g(null),y(``),(async()=>{for(let a=0;;a++)try{return await u(s(`/api/local-app-previews/${encodeURIComponent(e)}/sessions`),{method:`POST`,signal:d.signal,body:JSON.stringify({sourceHash:t,mode:n,resourceScopes:r,scenarioId:i})})}catch(e){let t=e instanceof Error?e.message:String(e);if(!o||a>=2||!/Too many isolated preview workers|Close another preview/.test(t)||(await new Promise(e=>{let t=()=>{clearTimeout(n),d.signal.removeEventListener(`abort`,t),e()},n=setTimeout(t,1e3);d.signal.addEventListener(`abort`,t,{once:!0})}),!o))throw e}})().then(s=>{if(l=A.parse(s.session),l.appId!==e||l.sourceHash!==t||l.mode!==n)throw Error(`Preview authorization does not match the requested draft`);if(!o){f(l.id);return}g({...l,hostBaseUrl:p,hostNamespace:m,hostRunKey:a,hostScopes:r,hostScenario:i})}).catch(e=>{o&&E.current(e)}),()=>{window.removeEventListener(`pagehide`,h),h()}},[e,t,n,r,i,a,p,m]),(0,F.useLayoutEffect)(()=>{let e=b.current;if(!_||!e)return;let t=new be;ye(t),S.current=t,t.registerIframe(_.extensionId,e,_.permissions,_.sourceHash,_.id,!0,_.id);let n=Ee(e,e=>{!e||typeof e!=`object`||`runId`in e&&e.runId!==_.id||x.current({...e,sourceHash:_.sourceHash})},{runId:_.id,beforeRun:async()=>{t.sendInit(_.extensionId,M(_e.getState().resolved),l.getState().language),await t.whenIdle(_.extensionId)},onError:e=>E.current(e)});return()=>{n(),t.dispose(),S.current=null}},[_]),(0,F.useEffect)(()=>{_&&S.current?.sendEvent(_.extensionId,`theme.changed`,M(w))},[_,w]);let D=_?`${s(_.previewUrl)}${_.previewUrl.includes(`?`)?`&`:`?`}xopcHostRun=1&xopcPreviewMode=${_.mode}${i?`&xopcAcceptance=1&xopcScenario=${encodeURIComponent(i)}`:``}`:``;return v&&!d?(0,I.jsx)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:v}):_?(0,I.jsx)(`iframe`,{ref:b,title:o,src:D,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,"aria-hidden":d||void 0,tabIndex:d?-1:void 0,lang:C,className:d?`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`:`min-h-0 w-full flex-1 bg-white`,onError:()=>E.current(Error(`Preview document failed to load`)),onLoad:()=>S.current?.sendInit(_.extensionId,M(_e.getState().resolved),C)},_.id):d?null:(0,I.jsx)(k,{className:`min-h-0 w-full flex-1`})}var Ue=n();function We(e){let t=(0,Ue.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let l=a?`产品场景`:`Product scenarios`,u;t[0]===l?u=t[1]:(u=(0,I.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,f;t[2]===d?f=t[3]:(f=(0,I.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,I.jsxs)(`div`,{children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m=i!==null,h;t[7]===i?h=t[8]:(h=i===`all`?(0,I.jsx)(O,{className:`size-3 animate-spin`}):(0,I.jsx)(oe,{className:`size-3`}),t[7]=i,t[8]=h);let g=a?`全部重跑`:`Run all`,_;t[9]!==o||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,I.jsxs)(j,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:m,children:[h,g]}),t[9]=o,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==p||t[15]!==_?(v=(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[p,_]}),t[14]=p,t[15]=_,t[16]=v):v=t[16];let y=a?`产品场景验收结果`:`Product scenario acceptance results`,b;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,I.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,I.jsx)(O,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,I.jsx)(C,{className:`size-3.5 text-success`}):n===`failed`?(0,I.jsx)(w,{className:`size-3.5 text-danger`}):(0,I.jsx)(T,{className:`size-3.5 text-fg-subtle`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,I.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,I.jsx)(j,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,I.jsx)(oe,{className:`size-3`})})]}),n===`running`?(0,I.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,I.jsxs)(`div`,{className:`mt-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,I.jsxs)(j,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>t.failureKind===`runner`?s(e.id):c(e,t),children:[(0,I.jsx)(D,{className:`size-3`}),t.failureKind===`runner`?a?`恢复资源并重试`:`Retry preview`:a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,I.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,I.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],b=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=b}else b=t[23];let x;t[30]!==y||t[31]!==b?(x=(0,I.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":y,children:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S;return t[33]!==v||t[34]!==x?(S=(0,I.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[v,x]}),t[33]=v,t[34]=x,t[35]=S):S=t[35],S}function Ge({extensionId:e,name:t,zh:n}){let{data:r,error:i,mutate:a}=ge([`local-app-access`,e],()=>Se(e)),[o,c]=(0,F.useState)(!1),[l,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(``);async function m(t){if(!(!r?.manifestDigest||l)){d(!0),p(``);try{await N(e,r.manifestDigest,t),await a(),c(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(){if(!(!r?.manifestDigest||l)){d(!0),p(``);try{await u(s(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`DELETE`,body:JSON.stringify({manifestDigest:r.manifestDigest})}),await a()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,I.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[!r&&!i?(0,I.jsx)(k,{className:`h-12`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r?.granted?n?`已授权,可随时缩小数据范围或撤销访问。`:`Access granted. You can narrow the data scope or revoke access.`:n?`尚未授权访问。`:`Access has not been granted.`}),(0,I.jsx)(j,{className:`w-full`,disabled:!r||l,onClick:()=>c(!0),children:n?`管理数据访问范围`:`Manage data access`}),r?.granted?(0,I.jsx)(j,{variant:`ghost`,className:`w-full text-danger`,disabled:l,onClick:()=>void h(),children:n?`撤销应用授权`:`Revoke app access`}):null]}),f||i?(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:f||String(i)}):null,r?(0,I.jsx)(Ce,{open:o,onOpenChange:c,extensionId:e,extensionName:t,permissions:r.permissions,localApp:!0,resourceScopes:r.resourceScopes,error:f,confirmDisabled:l||!r.manifestDigest,onConfirm:e=>void m(e)}):null]})}function Ke(e,t){return P(e,t)}function qe(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function Je(){let{appId:e}=i(),t=e===`new`,n=l(e=>e.language)===`zh`,r=l(e=>e.language),s=c(e=>e.baseUrl),u=c(e=>e.conversationId),w=JSON.stringify([e,s,u]),T=o(),{mutate:A}=he(),_e=ve(e=>e.setPageHeader),ye=ve(e=>e.clearPageHeader),{data:M,isLoading:be,error:Se,mutate:Ce}=ge(!t&&e?[`local-app`,e]:null,()=>Ne(e)),{data:N,isLoading:Ee,mutate:P}=ge(!t&&e?[`local-app-validation`,e]:null,()=>je(e)),[Ue,Je]=(0,F.useState)(``),[Ye,Xe]=(0,F.useState)(``),[L,R]=(0,F.useState)(!1),[Ze,z]=(0,F.useState)(null),[Qe,$e]=(0,F.useState)(!1),[et,tt]=(0,F.useState)(!1),[nt,rt]=(0,F.useState)(0),[it,at]=(0,F.useState)(`sample`),[ot,st]=(0,F.useState)(!1),[ct,lt]=(0,F.useState)(``),[ut,dt]=(0,F.useState)(``),[ft,pt]=(0,F.useState)(``),[mt,ht]=(0,F.useState)(``),[gt,_t]=(0,F.useState)(0),[vt,yt]=(0,F.useState)(()=>me.parse({})),[bt,xt]=(0,F.useState)(),B=it===`readonly`&&(ut!==N?.sourceHash||ft!==w)?`sample`:it,St=B===`readonly`?bt:void 0,Ct=B===`readonly`?gt:nt;(0,F.useEffect)(()=>{yt(me.parse({})),st(!1),lt(``)},[w]),(0,F.useEffect)(()=>{it===`readonly`&&B!==`readonly`&&(at(`sample`),xt(void 0),dt(``),pt(``))},[it,B]);let[wt,Tt]=(0,F.useState)(``),[V,Et]=(0,F.useState)(!1),[H,Dt]=(0,F.useState)(!1),[U,Ot]=(0,F.useState)(`booting`),[W,kt]=(0,F.useState)(null),[G,At]=(0,F.useState)(null),[K,jt]=(0,F.useState)({}),[q,Mt]=(0,F.useState)(`all`),[Nt,Pt]=(0,F.useState)(0),[Ft,It]=(0,F.useState)(0),[Lt,Rt]=(0,F.useState)(null),[J,zt]=(0,F.useState)(null),[Bt,Vt]=(0,F.useState)([]),[Ht,Ut]=(0,F.useState)(!1),Wt=(0,F.useRef)(new Set),Y=(0,F.useRef)(null),Gt=(0,F.useRef)(null),Kt=(0,F.useRef)(null),X=(0,F.useRef)(null),Z=(0,F.useRef)(``),Q=(0,F.useMemo)(()=>N?.acceptanceScenarios??[],[N?.sourceHash]),qt=(0,F.useMemo)(()=>{if(!Q.length)return null;let e=Q.map(e=>K[e.id]).filter(e=>!!e);return e.length===Q.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Q.length,scenarios:e}:null},[Q,K]),$=(0,F.useMemo)(()=>{if(!G)return null;if(!N?.acceptanceScenarioCount)return G;if(!qt)return null;let e=qt.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:qt.status,message:e?`${e.name}: ${e.message}`:`${qt.scenarioCount} product scenario(s) passed`},n=[...G.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:G.interactiveCount}},[G,qt,N?.acceptanceScenarioCount]),Jt=(0,F.useCallback)(async(e,t)=>{let n=await ke(e.id);Wt.current.add(n),T(we(n,t))},[T]),Yt=(0,F.useCallback)(async(e=!0)=>{if(!M)return null;Dt(!0),z(null);try{let t=await je(M.id);if(e){let e=X.current===t.sourceHash;X.current=t.sourceHash??null,Mt(`all`),Pt(0),e&&rt(e=>e+1)}return await P(t,{revalidate:!1}),t}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{Dt(!1)}},[M,P]);(0,F.useEffect)(()=>{if(!M)return;Wt.current=new Set(M.developmentConversationId?[M.developmentConversationId]:[]);let e=e=>{let t=e.detail?.key;!t||!Wt.current.has(t)||(Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,Yt(!0)},750))};return window.addEventListener(`session-transcript-updated`,e),()=>{window.removeEventListener(`session-transcript-updated`,e),Y.current!==null&&window.clearTimeout(Y.current)}},[M,Yt]),(0,F.useEffect)(()=>{Vt(M?.acceptanceRuns??[])},[M?.acceptanceRuns]),(0,F.useEffect)(()=>{X.current=null},[M?.id]),(0,F.useEffect)(()=>{!N?.sourceHash||X.current===N.sourceHash||(X.current=N.sourceHash,Mt(`all`),Pt(0))},[M?.id,N?.sourceHash]),(0,F.useLayoutEffect)(()=>{if(!M)return;Ot(`booting`),kt(null),At(null),zt(null),Ut(!1),Z.current=``;let e=window.setTimeout(()=>Ot(e=>e===`failed`?e:`timeout`),7e3);return Gt.current=t=>{if(t&&typeof t==`object`&&`sourceHash`in t&&t.sourceHash!==N?.sourceHash)return;let n=pe(t);if(n){if(n.type===`ready`){Ot(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),At(n.detail),zt(t&&typeof t==`object`&&`sourceHash`in t?String(t.sourceHash):N?.sourceHash??null);return}n.type!==`criteria`&&(window.clearTimeout(e),kt(n.detail),Ot(`failed`))}},()=>{window.clearTimeout(e),Gt.current=null}},[M?.id,N?.sourceHash,Ct,B,St,w]),(0,F.useLayoutEffect)(()=>{if(!M||N?.status!==`healthy`||!Q.length){Rt(null);return}let e=q===`all`?Q[Nt]:Q.find(e=>e.id===q),t=e?[e]:[];if(!t.length)return;Rt(q),jt(e=>{if(q===`all`&&Nt===0)return{};let t={...e};return delete t[q],t});let r=!1,i=e=>{jt(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),Rt(null)},a=window.setTimeout(()=>i(r?n?`场景在 20 秒内未完成。`:`Scenario did not finish within 20 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),2e4);return Kt.current=e=>{if(e&&typeof e==`object`&&`sourceHash`in e&&e.sourceHash!==N?.sourceHash)return;let t=pe(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),jt(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),q===`all`&&Nt+1<Q.length?(Pt(e=>e+1),It(e=>e+1)):Rt(null)):t.type===`error`&&(window.clearTimeout(a),i(De(t.detail))))},()=>{window.clearTimeout(a),Kt.current=null}},[Q,M?.id,Ft,q,Nt,nt,N?.status,n,w]),(0,F.useEffect)(()=>{if(!M||!$||!J||J!==N?.sourceHash)return;let e=`${M.id}:${J}:${JSON.stringify($)}`;Z.current!==e&&(Z.current=e,Ut(!0),Fe(M.id,J,$).then(t=>{Z.current===e&&Vt(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{Z.current===e&&X.current===J&&(Z.current=``,Ut(!1),z(t instanceof Error?t.message:String(t)))}).finally(()=>{Z.current===e&&Ut(!1)}))},[$,J,M,N?.sourceHash]);let Xt=(0,F.useCallback)(async e=>{if(M){Et(!0),z(null);try{await Jt(M,e)}catch(e){z(e instanceof Error?e.message:String(e)),Et(!1)}}},[M,Jt]);(0,F.useLayoutEffect)(()=>(_e({startExtra:(0,I.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回应用工坊`:`Back to App Studio`,children:(0,I.jsx)(y,{className:`size-4`})}),main:(0,I.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:M?.name||(t?n?`创建应用`:`Create app`:n?`应用详情`:`App details`)}),end:M?(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(Be,{resource:{kind:`local_app`,id:M.id,revision:N?.sourceHash??``},disabled:L||V||H||!N?.sourceHash}),(0,I.jsx)(j,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,I.jsxs)(a,{to:`/projects/${encodeURIComponent(M.projectId)}`,children:[(0,I.jsx)(ne,{className:`size-4`}),n?`项目`:`Project`]})}),(0,I.jsxs)(j,{className:`h-9`,onClick:()=>void Xt(),disabled:V,children:[V?(0,I.jsx)(O,{className:`size-4 animate-spin`}):(0,I.jsx)(D,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>ye()),[M,t,L,V,H,N?.sourceHash,ye,Xt,_e,n]);async function Zt(e){e.preventDefault(),R(!0),z(null);try{let e=await Ie({name:Ue,idea:Ye});await A(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Jt(e,t)}catch{T(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){z(e instanceof Error?e.message:String(e))}finally{R(!1)}}async function Qt(){if(M){R(!0),z(null);try{let e=await Oe(M.id);await Ce(e,{revalidate:!1}),await P(),await Promise.all([A(`local-apps-list`),A(`gateway-extensions-list`)]),$e(!1)}catch(e){z(e instanceof Error?e.message:String(e))}finally{R(!1)}}}async function $t(e){R(!0),z(null);try{let t=await e();return await Ce(t,{revalidate:!1}),await P(),await Promise.all([A(`local-apps-list`),A(`gateway-extensions-list`)]),!0}catch(e){return z(e instanceof Error?e.message:String(e)),!1}finally{R(!1)}}async function en(e){M&&await $t(()=>Le(M.id,e))}async function tn(e){M&&await $t(()=>Me(M.id,e))}async function nn(){M&&await $t(()=>Ae(M.id))&&tt(!1)}async function rn(e){if(!(!M||!e.length)){z(null);try{let t=await Pe(M.id,{sourceHash:N?.sourceHash,locale:n?`zh`:`en`,diagnostics:e});if(t.action===`retry`){rt(e=>e+1),on();return}await Xt(t.prompt)}catch(e){z(e instanceof Error?e.message:String(e))}}}function an(){rn([...N?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...W?[{phase:W.kind===`runner_error`?`runner`:`runtime`,code:W.kind,message:De(W)}]:[],...$?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`&&W?.kind!==`runner_error`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(K).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...U===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]].filter(e=>e.phase!==`runner`))}function on(){Mt(`all`),Pt(0),It(e=>e+1)}function sn(e){Mt(e),Pt(0),It(e=>e+1)}function cn(e,t){if(t.failureKind===`runner`){sn(e.id);return}rn([{phase:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let ln=Bt.findIndex(e=>qe(e,J,$)),un=ln>=0?Bt[ln]:null,dn=ln>=0?Bt[ln+1]??null:Bt[0]??null,fn=Te($),pn=dn?dn.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],mn=N?.status===`failed`||U===`failed`&&W?.kind!==`runner_error`||$?.checks.some(e=>e.status===`failed`&&e.id!==`criteria`&&W?.kind!==`runner_error`)||Object.values(K).some(e=>e.status===`failed`&&e.failureKind!==`runner`),hn=pn.filter(e=>!fn.includes(e)).length;async function gn(){(await Yt(!1))?.status===`healthy`&&$e(!0)}return t?(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,I.jsxs)(`div`,{className:`grid w-full min-w-0 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,I.jsxs)(`form`,{onSubmit:Zt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,I.jsx)(le,{className:`size-4`}),n?`告诉编程智能体你的想法`:`Tell Coder your idea`]}),(0,I.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,I.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会创建项目,并在对话中由编程智能体根据你的想法开发应用。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,I.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,I.jsx)(ze,{value:Ue,onChange:e=>Je(e.target.value),suggestion:Ve(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:Je,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,I.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,I.jsx)(Re,{value:Ye,onChange:e=>Xe(e.target.value),suggestion:Ve(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Xe,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Ze?(0,I.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Ze}):null,(0,I.jsxs)(j,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:L||!Ue.trim()||!Ye.trim(),children:[L?(0,I.jsx)(O,{className:`size-4 animate-spin`}):(0,I.jsx)(D,{className:`size-4`}),n?`开始开发对话`:`Continue with Coder`]})]}),(0,I.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,I.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,I.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,I.jsx)(ie,{className:`size-7`})}),(0,I.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,I.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):be?(0,I.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,I.jsx)(k,{className:`rounded-xl`}),(0,I.jsx)(k,{className:`rounded-xl`}),(0,I.jsx)(k,{className:`rounded-xl`})]}):Se||!M?(0,I.jsx)(d,{kind:`app`,missing:!Se||/not found|404/i.test(String(Se)),backTo:`/local-apps`,retry:()=>void Ce()}):(0,I.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,I.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,I.jsx)(le,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,I.jsx)(`div`,{className:`mt-4 min-w-0 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:M.idea}),(0,I.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,I.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,I.jsx)(C,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续开发会打开对应项目的对话,编程智能体可以参考当前应用继续修改。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,I.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Xt(wt)},children:[(0,I.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,I.jsx)(Re,{id:`local-app-change-request`,value:wt,onChange:e=>Tt(e.target.value),suggestion:Ve(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:Tt,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,I.jsxs)(j,{type:`submit`,className:`mt-2 w-full`,disabled:V||!wt.trim(),children:[V?(0,I.jsx)(O,{className:`size-4 animate-spin`}):(0,I.jsx)(D,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,I.jsxs)(j,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Xt(),disabled:V,children:[(0,I.jsx)(ne,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,I.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,I.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`size-2 rounded-full ${N?.status===`failed`||U===`failed`||U===`timeout`||$?.status===`failed`?`bg-danger`:N?.status===`healthy`&&U===`healthy`&&$?.status===`passed`&&un?.sourceHash===N.sourceHash&&!Ht?`bg-success`:`bg-fg-subtle`}`}),U===`failed`||U===`timeout`?n?`预览运行异常`:`Preview runtime issue`:N?.status===`failed`||$?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:U===`booting`||!$?n?`自动验收中`:`Running acceptance`:Ht||un?.sourceHash!==N?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,I.jsxs)(j,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Yt(!0),disabled:H,children:[H?(0,I.jsx)(O,{className:`size-3.5 animate-spin`}):(0,I.jsx)(oe,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-3 py-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsxs)(x,{"aria-label":n?`预览数据`:`Preview data`,value:B,onChange:e=>{e.target.value===`readonly`?(lt(N?.sourceHash??``),ht(w),st(!0)):(at(e.target.value),xt(void 0))},children:[(0,I.jsx)(S,{value:`sample`,children:n?`示例数据`:`Sample data`}),(0,I.jsx)(S,{value:`readonly`,children:n?`真实数据 · 只读`:`Real data · read only`}),(0,I.jsx)(S,{value:`isolated`,children:n?`隔离写入体验`:`Isolated writes`})]})}),(0,I.jsx)(`p`,{className:`order-last basis-full text-[11px] text-fg-muted`,children:B===`readonly`?n?`仅使用本次授权的数据,写入已禁止。`:`Only approved live data. Production writes are blocked.`:n?`使用独立示例数据;修改和存储不会影响正式数据。自动验收始终使用独立隔离环境。`:`Separate example data and storage. Acceptance always runs in its own isolated environment.`}),B===`readonly`?(0,I.jsx)(j,{variant:`ghost`,onClick:()=>{at(`sample`),xt(void 0)},children:n?`停止真实数据预览`:`Stop live preview`}):null]}),N?.sourceHash?(0,I.jsx)(He,{appId:M.id,sourceHash:N.sourceHash,mode:B,resourceScopes:St,runKey:Ct,title:`${M.name} preview`,onMessage:e=>Gt.current?.(e)}):(0,I.jsx)(k,{className:`min-h-0 flex-1`}),N?.status===`healthy`&&N.sourceHash&&Q.length>0&&Lt!==null?(0,I.jsx)(He,{appId:M.id,sourceHash:N.sourceHash,mode:`isolated`,hidden:!0,scenarioId:q===`all`?Q[Nt]?.id:q,runKey:nt*1e6+Ft,title:`${M.name} acceptance runner`,onMessage:e=>Kt.current?.(e)}):null,(0,I.jsx)(v,{open:ot,onOpenChange:st,children:(0,I.jsxs)(h,{children:[(0,I.jsx)(f,{className:`fixed inset-0 z-50 bg-scrim`}),(0,I.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(680px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,I.jsx)(_,{className:`text-base font-semibold text-fg`,children:n?`选择本次只读预览的数据`:`Choose data for this read-only preview`}),(0,I.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:n?`仅授权当前草稿,15 分钟后过期。源码变化或停止预览后授权失效;自动验收不会使用这些真实数据。`:`Applies to this draft for 15 minutes. Editing the source or stopping preview revokes access. Acceptance never uses this live data.`}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,I.jsx)(xe,{extensionId:M.extensionId,permissions:(N?.permissions??M.permissions).filter(e=>/^capability:xopc\.(notes|tasks|projects)\.(get|list|list_milestones|list_updates)$/.test(e)),value:vt,onChange:yt,zh:n})}),(0,I.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,I.jsx)(m,{asChild:!0,children:(0,I.jsx)(j,{children:n?`取消`:`Cancel`})}),(0,I.jsx)(j,{variant:`primary`,disabled:ct!==N?.sourceHash||mt!==w,onClick:()=>{xt(vt),dt(ct),pt(mt),_t(e=>e+1),at(`readonly`),st(!1)},children:n?`启动只读预览`:`Start read-only preview`})]})]})]})})]}),(0,I.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.installationState===`not_installed`?n?`尚未安装`:`Not installed`:M.enabled?n?`版本 ${M.activeVersion} 正在使用`:`Version ${M.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,I.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${M.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,I.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,I.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,M.draftVersion]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,I.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:M.activeVersion?`v${M.activeVersion}`:`—`})]})]}),(0,I.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,I.jsx)(ee,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),Ee||H?(0,I.jsx)(O,{className:`size-3.5 animate-spin text-fg-muted`}):N?.status===`healthy`?(0,I.jsx)(C,{className:`size-4 text-success`}):(0,I.jsx)(de,{className:`size-4 text-danger`})]}),N?(0,I.jsxs)(`div`,{className:`mt-2`,children:[(0,I.jsx)(`p`,{className:`text-xs leading-5 ${N.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:N.status===`healthy`?N.hasDraftChanges?n?`${N.changedFileCount} 个文件有改动,可以安装新版本。`:`${N.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:N.issues[0]?.message}),N.changedFiles.length?(0,I.jsx)(`ul`,{className:`mt-2 space-y-1`,children:N.changedFiles.slice(0,4).map(e=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,I.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,N.changedFileCount>4?(0,I.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${N.changedFileCount-4} 个文件`:`${N.changedFileCount-4} more files`}):null,(0,I.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,I.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,I.jsx)(`span`,{className:`size-2 rounded-full ${U===`healthy`?`bg-success`:U===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${U===`failed`||U===`timeout`?`text-danger`:`text-fg-muted`}`,children:W?De(W):U===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:U===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,I.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,I.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,I.jsx)(`span`,{className:`size-2 rounded-full ${$?.status===`passed`?`bg-success`:$?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),$?(0,I.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:$.checks.map(e=>(0,I.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,I.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,I.jsx)(`span`,{children:e.message})]},e.id))}):(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:N?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${N.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${N.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),Ht?(0,I.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,I.jsx)(O,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):un?(0,I.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:dn?n?`相比上次:已修复 ${hn} 项,仍有 ${fn.length} 项。`:`Since the previous run: ${hn} fixed, ${fn.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,I.jsx)(We,{scenarios:Q,results:K,runningTarget:Lt,zh:n,onRunAll:on,onRunScenario:sn,onAskCoder:cn})]}),W?.kind===`runner_error`||U===`timeout`?(0,I.jsx)(j,{className:`mt-3 w-full`,onClick:()=>{rt(e=>e+1),on()},children:n?`恢复资源并重试`:`Retry preview`}):null,mn?(0,I.jsxs)(j,{className:`mt-3 w-full`,onClick:an,disabled:V,children:[(0,I.jsx)(D,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,I.jsx)(k,{className:`mt-2 h-12 rounded-lg`})]}),(0,I.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,I.jsx)(ce,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,I.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(N?.permissions??M.permissions).map(e=>(0,I.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))}),M.installationState===`installed`?(0,I.jsx)(Ge,{extensionId:M.extensionId,name:M.name,zh:n}):null]}),(0,I.jsx)(j,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void gn(),disabled:L||Ee||H||N?.status!==`healthy`||M.installationState===`installed`&&N?.hasDraftChanges===!1,children:M.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),M.installationState===`installed`?(0,I.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,I.jsxs)(j,{className:`min-w-0 flex-1`,onClick:()=>void en(!M.enabled),disabled:L,children:[M.enabled?(0,I.jsx)(te,{className:`size-4`}):(0,I.jsx)(ae,{className:`size-4`}),M.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,I.jsx)(j,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>tt(!0),disabled:L,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,I.jsx)(ue,{className:`size-4`})})]}):null,(0,I.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,I.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,I.jsx)(re,{className:`size-4`}),n?`版本历史`:`Release history`]}),M.releases.length?(0,I.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:M.releases.map(e=>(0,I.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,I.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,I.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Ke(e.createdAt,r)})]}),e.isActive?null:(0,I.jsxs)(j,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void tn(e.id),disabled:L,children:[(0,I.jsx)(se,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,I.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Ze?(0,I.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Ze}):null]}),(0,I.jsx)(v,{open:Qe,onOpenChange:$e,children:(0,I.jsxs)(h,{children:[(0,I.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,I.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(_,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,I.jsx)(p,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,I.jsx)(m,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,I.jsx)(fe,{className:`size-4`})})]}),(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,I.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:M.name}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.extensionId})]}),(0,I.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,I.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,I.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:N?.changedFileCount??0})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,I.jsx)(`dd`,{className:`mt-1 font-medium ${$?.status===`passed`&&J===N?.sourceHash?`text-success`:`text-warning`}`,children:$?.status===`passed`&&J===N?.sourceHash?n?`已通过`:`Passed`:n?`未通过或尚未完成`:`Failed or incomplete`})]})]}),N?.changedFiles.length?(0,I.jsx)(`ul`,{className:`mt-3 space-y-1`,children:N.changedFiles.slice(0,5).map(e=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,I.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,$?.status!==`passed`||J!==N?.sourceHash?(0,I.jsxs)(`div`,{role:`status`,className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:[(0,I.jsx)(`p`,{children:n?`自动验收未通过或尚未完成。你仍可安装,部分功能可能无法正常使用。`:`Automatic acceptance failed or is incomplete. You can still install; some features may not work.`}),fn.length?(0,I.jsx)(`ul`,{className:`mt-2 list-inside list-disc`,children:fn.map(e=>(0,I.jsx)(`li`,{children:e},e))}):null]}):null,(0,I.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,I.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(N?.permissions??M.permissions).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,I.jsx)(b,{className:`size-4 text-success`}),e,M.installationState===`installed`&&N?.permissionDelta.added.includes(e)?(0,I.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),M.installationState===`installed`&&N?.permissionDelta.added.length?(0,I.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,I.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,I.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,I.jsx)(m,{asChild:!0,children:(0,I.jsx)(j,{children:n?`取消`:`Cancel`})}),(0,I.jsxs)(j,{variant:`primary`,onClick:()=>void Qt(),disabled:L,children:[L?(0,I.jsx)(O,{className:`size-4 animate-spin`}):(0,I.jsx)(E,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,I.jsx)(v,{open:et,onOpenChange:tt,children:(0,I.jsxs)(h,{children:[(0,I.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,I.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(_,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,I.jsx)(p,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但项目、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,I.jsx)(m,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,I.jsx)(fe,{className:`size-4`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,I.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:M.name}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,I.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,I.jsx)(m,{asChild:!0,children:(0,I.jsx)(j,{children:n?`取消`:`Cancel`})}),(0,I.jsxs)(j,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void nn(),disabled:L,children:[L?(0,I.jsx)(O,{className:`size-4 animate-spin`}):(0,I.jsx)(ue,{className:`size-4`}),n?`卸载但保留项目`:`Uninstall and keep Project`]})]})]})]})})]})}export{Je as LocalAppWorkbenchPage};
|
package/dist/gateway/static/root/assets/{local-apps-page-yBqRl5Bi.js → local-apps-page-Ct8z2B7R.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./arrow-right-DSSvoX71.js";import{t as s}from"./box-DvYoGszj.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./skeleton-DzdOeGYz.js";import{i as u}from"./vendor-swr-CdRzEUwF.js";import{t as d}from"./button-Cc4hUNTt.js";import{t as f}from"./page-header-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./arrow-right-DSSvoX71.js";import{t as s}from"./box-DvYoGszj.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./skeleton-DzdOeGYz.js";import{i as u}from"./vendor-swr-CdRzEUwF.js";import{t as d}from"./button-Cc4hUNTt.js";import{t as f}from"./page-header-store-1-lflHAx.js";import{o as p}from"./api-V4P8zfkJ.js";var m=n(),h=e(t(),1),g=r();function _(){let e=(0,m.c)(20),t=a(x)===`zh`,n=f(b),r=f(y),{data:l,isLoading:_,error:S}=u(`local-apps-list`,p),C,w;e[0]!==r||e[1]!==n||e[2]!==t?(C=()=>(n({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Studio`}),end:(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),w=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=C,e[4]=w):(C=e[3],w=e[4]),(0,h.useLayoutEffect)(C,w);let T=t?`创建属于你的 XOPC 应用`:`Build your own apps for XOPC`,E;e[5]===T?E=e[6]:(E=(0,g.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:T}),e[5]=T,e[6]=E);let D=t?`创建、预览并持续改进自己的工具,需要时可以添加到侧栏。`:`Create, preview, and improve your own tools, then add them to the sidebar when they are ready.`,O;e[7]===D?O=e[8]:(O=(0,g.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D}),e[7]=D,e[8]=O);let k;e[9]!==E||e[10]!==O?(k=(0,g.jsxs)(`div`,{className:`mb-7 max-w-2xl`,children:[E,O]}),e[9]=E,e[10]=O,e[11]=k):k=e[11];let A;e[12]!==l||e[13]!==S||e[14]!==_||e[15]!==t?(A=_?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(v)}):S?(0,g.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:S instanceof Error?S.message:String(S)}):l?.length?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,g.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,g.jsx)(s,{className:`size-5`})}),(0,g.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,g.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,g.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,g.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`编辑应用`:`Edit app`,(0,g.jsx)(o,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,g.jsxs)(`div`,{className:`px-6 py-16 text-center`,children:[(0,g.jsx)(s,{className:`mx-auto size-8 text-fg-subtle`}),(0,g.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有应用`:`No apps yet`}),(0,g.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用草稿,并用项目保存后续开发记录。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[12]=l,e[13]=S,e[14]=_,e[15]=t,e[16]=A):A=e[16];let j;return e[17]!==k||e[18]!==A?(j=(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 pb-8 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:(0,g.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[k,A]})}),e[17]=k,e[18]=A,e[19]=j):j=e[19],j}function v(e,t){return(0,g.jsx)(l,{className:`h-44 rounded-xl`},t)}function y(e){return e.clearPageHeader}function b(e){return e.setPageHeader}function x(e){return e.language}export{_ as LocalAppsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./chevron-down-ccbiQQz_.js";import{n as _,r as v}from"./popover-select-CLsphyzA.js";import{n as y,t as b}from"./sliding-segmented-DagP0myu.js";import{t as x}from"./download-Dk-ZjtO6.js";import{t as S}from"./file-text-D12HbeVy.js";import{t as C}from"./folder-CN-pC3XL.js";import{t as w}from"./gauge-C78eD2BA.js";import{t as T}from"./list-filter-CIPvpfLA.js";import{t as E}from"./refresh-cw-BRlGaq2w.js";import{t as D}from"./search-DA7gz22f.js";import{t as O}from"./terminal-oKqqZdiG.js";import{t as k}from"./x-B_N4OPjy.js";import{t as A}from"./cn-0WouolD0.js";import{t as j}from"./skeleton-DzdOeGYz.js";import{u as M}from"./session-api-CkOliupg.js";import{a as N}from"./gateway-realtime-BnwNxbyc.js";import{t as P}from"./button-Cc4hUNTt.js";import{a as F,i as I,o as L,s as R}from"./dist-GJ8-1PAx.js";import{i as z,o as B,s as V}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as H}from"./copy-to-clipboard-HOJ79TWv.js";import{o as ee,t as te}from"./form-field-width-DJw_jULe.js";import{t as U}from"./refresh-button-DiWdGAaX.js";import{t as W}from"./date-time-picker--LGC1D3b.js";import{n as ne}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";var G=e(t(),1),K=n();function q(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.conversationId&&t.set(`conversationId`,e.conversationId),e.transcriptId&&t.set(`transcriptId`,e.transcriptId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function J(e){return c(a(`/api/logs${q(e)}`))}async function Y(){return(await c(a(`/api/logs/files`))).files??[]}async function X(){return(await c(a(`/api/logs/modules`))).modules??[]}async function Z(){let e=await c(a(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function Q(){return(await c(a(`/api/logs/dir`))).dir??``}async function re(){return(await c(a(`/api/logs/level`))).level??`info`}async function ie(e,t){return c(a(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function ae(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await c(a(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var oe=500,se=class{_callbacks;_cleanup;constructor(e){this._callbacks=e}connect(e,t){this.disconnect();let n=new Set(e?.length?e:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);this._cleanup=N(`logs`,{onEvent:e=>{if(e.event!==`log.entry`||!e.data||typeof e.data!=`object`)return;let r=e.data;!n.has(r.level)||t&&r.module!==t||this._callbacks.onEntry(r)},onGap:()=>this._callbacks.onError(`Live log replay gap; refresh the log query`)}),this._callbacks.onConnected()}disconnect(){this._cleanup?.(),this._cleanup=void 0}};function ce(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,oe)}var le=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function ue(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function de(e){return e.toSorted((e,t)=>ue(t)-ue(e))}var fe=new Set(le),pe=[`error`,`fatal`],me=[`warn`,`error`,`fatal`],he=[`info`,`warn`,`error`,`fatal`];function ge(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();fe.has(e)&&t.add(e)}return t}function _e(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ve(e,t){return e.size===t.length&&t.every(t=>e.has(t))}function ye(e){return e.size===0?`all`:ve(e,pe)?`errors`:ve(e,me)?`warnPlus`:ve(e,he)?`infoPlus`:e.size===le.length&&le.every(t=>e.has(t))?`verbose`:`custom`}function be(e){let t=ye(e);return t===`custom`?`other`:t}function xe(e){switch(e){case`all`:return new Set;case`errors`:return new Set(pe);case`warnPlus`:return new Set(me);case`infoPlus`:return new Set(he);case`verbose`:return new Set(le)}}function Se(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ce(e){return String(e.module||e.service||e.extension||`—`)}function we(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function Te(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function Ee(e){try{return new Date(e).toLocaleString()}catch{return e}}function De(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Oe(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function ke(e){return String(e).toLowerCase()}function Ae(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function je(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function Me(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function Ne(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&Ce(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.transcriptIdFilter&&e.transcriptId!==t.transcriptIdFilter&&e.conversationId!==t.transcriptIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,Ce(e),Ae(e),e.requestId,e.conversationId,e.transcriptId,Me(e)?.message,Me(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Pe(e,t){let n=[];for(let r of le){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function Fe(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return _e(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setTranscriptIdFilter`:return e.transcriptIdFilter===t.value?e:{...e,transcriptIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&_e(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.transcriptIdFilter===n.transcriptIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,transcriptIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Ie={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function Le(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:de(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:de([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:de(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:de(ce(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:de(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Re(e){let t=l(e).logs,n=o(e=>e.conversationId),r=!!n,[a,s]=i(),c=(0,G.useRef)(a),[u,d]=(0,G.useReducer)(Fe,void 0,()=>{let e=c.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:ge(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,transcriptIdFilter:e.get(`transcriptId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[f,p]=(0,G.useReducer)(Le,Ie),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)([]),[w,T]=(0,G.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,transcriptIdFilter:j,dateFrom:N,dateTo:P,autoRefresh:F}=u,{logs:I,loading:L,error:R,hasMore:z,modules:B,files:V,stats:H,logDir:ee}=f,te=(0,G.useCallback)(e=>d({type:`setSearchInput`,value:e}),[]),U=(0,G.useCallback)(e=>d({type:`setLevels`,value:e}),[]),W=(0,G.useCallback)(e=>d({type:`setModule`,value:e}),[]),ne=(0,G.useCallback)(e=>d({type:`setRequestIdFilter`,value:e}),[]),K=(0,G.useCallback)(e=>d({type:`setTranscriptIdFilter`,value:e}),[]),q=(0,G.useCallback)(e=>d({type:`setDateFrom`,value:e}),[]),re=(0,G.useCallback)(e=>d({type:`setDateTo`,value:e}),[]),ie=(0,G.useCallback)(e=>d({type:`setAutoRefresh`,value:e}),[]),oe=(0,G.useMemo)(()=>be(O),[O]),ce=e=>{if(e===`other`){y(!0);return}d({type:`setLevels`,value:xe(e)})},le=D.length>0||O.size>0||!!k||!!A||!!j||!!N||!!P,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!A+ +!!j+(N||P?1:0);(0,G.useEffect)(()=>{let e=setTimeout(()=>d({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,G.useEffect)(()=>{let e=a.get(`q`)??``;d({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:ge(a.get(`level`)),moduleFilter:a.get(`module`)??``,requestIdFilter:a.get(`requestId`)??``,transcriptIdFilter:a.get(`transcriptId`)??``,dateFrom:a.get(`from`)??``,dateTo:a.get(`to`)??``,autoRefresh:a.get(`live`)===`1`}})},[a]),(0,G.useEffect)(()=>{let e=new URLSearchParams(a),t=D.trim();t?e.set(`q`,t):e.delete(`q`),O.size>0?e.set(`level`,Array.from(O).sort().join(`,`)):e.delete(`level`),k?e.set(`module`,k):e.delete(`module`),A?e.set(`requestId`,A):e.delete(`requestId`),j?e.set(`transcriptId`,j):e.delete(`transcriptId`),N?e.set(`from`,N):e.delete(`from`),P?e.set(`to`,P):e.delete(`to`),F?e.set(`live`,`1`):e.delete(`live`),e.toString()!==a.toString()&&s(e,{replace:!0})},[F,N,P,D,k,A,j,a,O,s]);let de=(0,G.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:A||void 0,transcriptId:j||void 0,from:N||void 0,to:P||void 0,limit:50}),[D,O,k,A,j,N,P]),fe=(0,G.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,transcriptIdFilter:j,dateFrom:N,dateTo:P}),[D,O,k,A,j,N,P]),pe=(0,G.useRef)(fe);return pe.current=fe,(0,G.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),ae({from:N||void 0,to:P||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,N,P]),(0,G.useEffect)(()=>{if(!r)return;let e=!1;return p({type:`queryStart`}),(async()=>{try{let t=await J({...de,offset:0});if(e)return;p({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||p({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,G.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([X(),Z(),Y()]);e||p({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,G.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([Y(),Q()]);e||p({type:`filesSuccess`,files:t,logDir:n})}catch{e||p({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,G.useEffect)(()=>{if(!F||!r)return;let e=new se({onConnected:()=>{},onEntry:e=>{Ne(e,pe.current)&&p({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{Z().then(e=>{p({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[F,r,n,O,k]),(0,G.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[b]),{L:t,hasToken:r,logs:I,loading:L,error:R,hasMore:z,searchInput:E,setSearchInput:te,selectedLevels:O,setSelectedLevels:U,moduleFilter:k,setModuleFilter:W,requestIdFilter:A,transcriptIdFilter:j,dateFrom:N,setDateFrom:q,dateTo:P,setDateTo:re,modules:B,files:V,stats:H,selectedLog:m,setSelectedLog:h,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:y,logDir:ee,autoRefresh:F,setAutoRefresh:ie,copiedDetail:b,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>d({type:`clearAll`}),toggleDialogLevel:e=>d({type:`toggleLevel`,level:e}),handleLoadMore:()=>{L||!z||(async()=>{p({type:`queryStart`});try{let e=await J({...de,offset:I.length});p({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{p({type:`queryStart`});try{let e=await J({...de,offset:0}),[t,n]=await Promise.all([Z(),Y()]);p({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:oe,handleLevelSegment:ce,filterByRequestId:(0,G.useCallback)(e=>{h(null),ne(e)},[ne]),filterByTranscriptId:(0,G.useCallback)(e=>{h(null),K(e)},[K]),filterByErrorSummary:(0,G.useCallback)(e=>{d({type:`setSearchInput`,value:e.errName}),d({type:`setDebouncedSearch`,value:e.errName}),e.module&&d({type:`setModule`,value:e.module}),d({type:`setLevels`,value:xe(`errors`)})},[]),openChatForSession:(0,G.useCallback)(e=>{let t=e.conversationId?.trim();if(t){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:t}}));return}let n=e.transcriptId?.trim();n&&M({transcriptId:n}).then(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e.conversationId}}))}).catch(()=>{})},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function ze(e){let t=(0,K.c)(36),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,G.useState)(!1);if(!i&&r.length===0)return null;let c;t[0]===r?c=t[1]:(c=r.reduce(Ve,0),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(Be),t[2]=u):u=t[2];let d;t[3]===n.errorSummaryTitle?d=t[4]:(d=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=d);let f;t[5]===n.errorSummaryHint?f=t[6]:(f=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==r.length||t[11]!==i||t[12]!==l?(m=i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{className:`h-5 w-8 rounded-md`}),(0,$.jsx)(j,{className:`h-5 w-10 rounded-md`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,l]})]}),t[10]=r.length,t[11]=i,t[12]=l,t[13]=m):m=t[13];let h=o&&`rotate-180`,_;t[14]===h?_=t[15]:(_=A(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,h),t[14]=h,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,$.jsx)(g,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[16]=_,t[17]=v);let y;t[18]!==m||t[19]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[m,v]}),t[18]=m,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==y||t[23]!==p?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:u,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-4 text-left transition-colors hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset sm:px-5`,children:[p,y]}),t[21]=o,t[22]=y,t[23]=p,t[24]=b):b=t[24];let x;t[25]!==n.module||t[26]!==n.phase||t[27]!==n.time||t[28]!==o||t[29]!==r||t[30]!==i||t[31]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`mx-1 mb-1 flex flex-col gap-1 rounded-lg bg-surface-base/45 p-1 [&>li]:rounded-lg`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:A(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,Te(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[25]=n.module,t[26]=n.phase,t[27]=n.time,t[28]=o,t[29]=r,t[30]=i,t[31]=a,t[32]=x):x=t[32];let S;return t[33]!==b||t[34]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,children:[b,x]}),t[33]=b,t[34]=x,t[35]=S):S=t[35],S}function Be(e){return!e}function Ve(e,t){return e+t.count}function He(e){let t=(0,K.c)(75),{log:n,labels:r,onFilterByRequestId:i,onFilterByTranscriptId:a,onOpenChat:o}=e,s=n.level??`info`,c=typeof n.requestId==`string`?n.requestId:``,l=typeof n.conversationId==`string`?n.conversationId:``,u=typeof n.transcriptId==`string`?n.transcriptId:``,d;t[0]===n?d=t[1]:(d=Ae(n),t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Me(n),t[2]=n,t[3]=p);let m=p,h=s===`error`||s===`fatal`,g;t[4]===r.message?g=t[5]:(g=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=g);let _=h&&`border-red-500/40`,v;t[6]===_?v=t[7]:(v=A(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,_),t[6]=_,t[7]=v);let y=n.message||`—`,b;t[8]!==v||t[9]!==y?(b=(0,$.jsx)(`pre`,{className:v,children:y}),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]!==g||t[12]!==b?(x=(0,$.jsxs)(`div`,{children:[g,b]}),t[11]=g,t[12]=b,t[13]=x):x=t[13];let S;t[14]!==m||t[15]!==r.stackTrace?(S=m?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),m.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:m.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:m.stack})]}):null,t[14]=m,t[15]=r.stackTrace,t[16]=S):S=t[16];let C;t[17]===r.time?C=t[18]:(C=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=C);let w;t[19]===n.timestamp?w=t[20]:(w=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=w);let T;t[21]===r.level?T=t[22]:(T=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=T);let E=h&&`font-medium text-red-600 dark:text-red-400`,D;t[23]===E?D=t[24]:(D=A(`text-fg`,E),t[23]=E,t[24]=D);let O;t[25]===s?O=t[26]:(O=ke(s),t[25]=s,t[26]=O);let k;t[27]!==D||t[28]!==O?(k=(0,$.jsx)(`span`,{className:D,children:O}),t[27]=D,t[28]=O,t[29]=k):k=t[29];let j;t[30]===r.module?j=t[31]:(j=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=j);let M;t[32]===n?M=t[33]:(M=Ce(n),t[32]=n,t[33]=M);let N;t[34]===M?N=t[35]:(N=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:M}),t[34]=M,t[35]=N);let F;t[36]!==r.phase||t[37]!==f?(F=f===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:f})]}),t[36]=r.phase,t[37]=f,t[38]=F):F=t[38];let I;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==c?(I=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:c}),i?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(c),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=c,t[43]=I):I=t[43];let L;t[44]!==r.conversationId||t[45]!==r.openChat||t[46]!==o||t[47]!==l?(L=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.conversationId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),o?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({conversationId:l}),children:r.openChat}):null]})]}):null,t[44]=r.conversationId,t[45]=r.openChat,t[46]=o,t[47]=l,t[48]=L):L=t[48];let R;t[49]!==r.filterByTranscriptId||t[50]!==r.openChat||t[51]!==r.transcriptId||t[52]!==a||t[53]!==o||t[54]!==u?(R=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.transcriptId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:u}),a?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(u),children:r.filterByTranscriptId}):null,o?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({transcriptId:u}),children:r.openChat}):null]})]}):null,t[49]=r.filterByTranscriptId,t[50]=r.openChat,t[51]=r.transcriptId,t[52]=a,t[53]=o,t[54]=u,t[55]=R):R=t[55];let z;t[56]!==C||t[57]!==w||t[58]!==T||t[59]!==k||t[60]!==j||t[61]!==N||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==R?(z=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[C,w,T,k,j,N,F,I,L,R]}),t[56]=C,t[57]=w,t[58]=T,t[59]=k,t[60]=j,t[61]=N,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==r.metadata||t[68]!==n.meta?(B=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[67]=r.metadata,t[68]=n.meta,t[69]=B):B=t[69];let V;return t[70]!==z||t[71]!==B||t[72]!==x||t[73]!==S?(V=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[x,S,z,B]}),t[70]=z,t[71]=B,t[72]=x,t[73]=S,t[74]=V):V=t[74],V}function Ue(e){let t=(0,K.c)(50),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:o,onCopiedJson:s,onFilterByRequestId:c,onFilterByTranscriptId:l,onOpenChat:g}=e,_=r!==null,v;t[0]===i?v=t[1]:(v=e=>!e&&i(),t[0]=i,t[1]=v);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(u,{className:A(`xopc-dialog-overlay fixed inset-0 bg-scrim`,B)}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=A(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,z,`dark:border-edge`),t[3]=x):x=t[3];let S;t[4]===n.details?S=t[5]:(S=(0,$.jsx)(m,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=S);let C;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==s||t[12]!==o?(C=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{H(typeof r.message==`string`?r.message:``).then(e=>{e&&o()})},children:[(0,$.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{H(JSON.stringify(r,null,2)).then(e=>{e&&s()})},children:[(0,$.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=s,t[12]=o,t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(k,{className:`size-5`,strokeWidth:1.75}),t[14]=w):w=t[14];let T;t[15]===n.close?T=t[16]:(T=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:w})}),t[15]=n.close,t[16]=T);let E;t[17]!==C||t[18]!==T?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[C,T]}),t[17]=C,t[18]=T,t[19]=E):E=t[19];let D;t[20]!==S||t[21]!==E?(D=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[S,E]}),t[20]=S,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==n.conversationId||t[24]!==n.filterByRequestId||t[25]!==n.filterByTranscriptId||t[26]!==n.level||t[27]!==n.message||t[28]!==n.metadata||t[29]!==n.module||t[30]!==n.openChat||t[31]!==n.phase||t[32]!==n.requestId||t[33]!==n.stackTrace||t[34]!==n.time||t[35]!==n.transcriptId||t[36]!==r||t[37]!==c||t[38]!==l||t[39]!==g?(O=r?(0,$.jsx)(He,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,conversationId:n.conversationId,transcriptId:n.transcriptId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterByTranscriptId:n.filterByTranscriptId,openChat:n.openChat},onFilterByRequestId:c,onFilterByTranscriptId:l,onOpenChat:g}):null,t[23]=n.conversationId,t[24]=n.filterByRequestId,t[25]=n.filterByTranscriptId,t[26]=n.level,t[27]=n.message,t[28]=n.metadata,t[29]=n.module,t[30]=n.openChat,t[31]=n.phase,t[32]=n.requestId,t[33]=n.stackTrace,t[34]=n.time,t[35]=n.transcriptId,t[36]=r,t[37]=c,t[38]=l,t[39]=g,t[40]=O):O=t[40];let j;t[41]===O?j=t[42]:(j=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:O}),t[41]=O,t[42]=j);let M;t[43]!==D||t[44]!==j?(M=(0,$.jsxs)(f,{children:[b,(0,$.jsxs)(p,{className:x,"aria-describedby":void 0,children:[D,j]})]}),t[43]=D,t[44]=j,t[45]=M):M=t[45];let N;return t[46]!==_||t[47]!==M||t[48]!==v?(N=(0,$.jsx)(h,{open:_,onOpenChange:v,children:M}),t[46]=_,t[47]=M,t[48]=v,t[49]=N):N=t[49],N}function We(e){let t=(0,K.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(u,{className:A(`xopc-dialog-overlay fixed inset-0 bg-scrim`,B)}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=A(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,z,`dark:border-edge`),t[1]=c):c=t[1];let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(C,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=l):l=t[2];let g;t[3]===n.logFiles?g=t[4]:(g=(0,$.jsxs)(m,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[l,n.logFiles]}),t[3]=n.logFiles,t[4]=g);let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(k,{className:`size-5`,strokeWidth:1.75}),t[5]=_):_=t[5];let v;t[6]===n.close?v=t[7]:(v=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:_})}),t[6]=n.close,t[7]=v);let y;t[8]!==g||t[9]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[g,v]}),t[8]=g,t[9]=v,t[10]=y):y=t[10];let b;t[11]!==n.filesEmpty||t[12]!==a?(b=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(Ge)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=b):b=t[13];let x;t[14]!==n.logDir||t[15]!==o?(x=o?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:o})]}):null,t[14]=n.logDir,t[15]=o,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,$.jsxs)(f,{children:[s,(0,$.jsxs)(p,{className:c,children:[y,b,x]})]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let w;return t[21]!==i||t[22]!==r||t[23]!==S?(w=(0,$.jsx)(h,{open:r,onOpenChange:i,children:S}),t[21]=i,t[22]=r,t[23]=S,t[24]=w):w=t[24],w}function Ge(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:De(e.size)}),(0,$.jsx)(`span`,{children:Ee(e.modified)})]})]},e.name)}function Ke(e){let t=(0,K.c)(56),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:o,dateTo:s,onDateToChange:c,selectedLevels:l,onToggleLevel:g}=e,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(u,{className:A(`xopc-dialog-overlay fixed inset-0 bg-scrim`,B)}),t[0]=_):_=t[0];let v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=A(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,z,`dark:border-edge`),t[1]=v):v=t[1];let y;t[2]===n.filtersDialogTitle?y=t[3]:(y=(0,$.jsx)(m,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=y);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-5`,strokeWidth:1.75}),t[4]=b):b=t[4];let x;t[5]===n.close?x=t[6]:(x=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:b})}),t[5]=n.close,t[6]=x);let S;t[7]!==y||t[8]!==x?(S=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[y,x]}),t[7]=y,t[8]=x,t[9]=S):S=t[9];let C;t[10]===n.filtersDialogDesc?C=t[11]:(C=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=C);let w;t[12]===n.timeRange?w=t[13]:(w=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=w);let T;t[14]!==n.from||t[15]!==a||t[16]!==o?(T=(0,$.jsx)(W,{label:n.from,value:a,defaultTime:`00:00`,onChange:o,className:`text-xs text-fg-muted`}),t[14]=n.from,t[15]=a,t[16]=o,t[17]=T):T=t[17];let E;t[18]!==n.to||t[19]!==s||t[20]!==c?(E=(0,$.jsx)(W,{label:n.to,value:s,defaultTime:`23:59`,onChange:c,className:`text-xs text-fg-muted`}),t[18]=n.to,t[19]=s,t[20]=c,t[21]=E):E=t[21];let D;t[22]!==E||t[23]!==T?(D=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[T,E]}),t[22]=E,t[23]=T,t[24]=D):D=t[24];let O;t[25]===n.levelCustom?O=t[26]:(O=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[25]=n.levelCustom,t[26]=O);let j;t[27]===n.levelCustomHint?j=t[28]:(j=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[27]=n.levelCustomHint,t[28]=j);let M=n.level,N;t[29]!==n.levelNames||t[30]!==g||t[31]!==l?(N=le.map(e=>(0,$.jsx)(`button`,{type:`button`,className:A(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,l.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>g(e),children:n.levelNames[e]},e)),t[29]=n.levelNames,t[30]=g,t[31]=l,t[32]=N):N=t[32];let F;t[33]!==n.level||t[34]!==N?(F=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":M,children:N}),t[33]=n.level,t[34]=N,t[35]=F):F=t[35];let I;t[36]!==D||t[37]!==O||t[38]!==j||t[39]!==F||t[40]!==w?(I=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[w,D,O,j,F]}),t[36]=D,t[37]=O,t[38]=j,t[39]=F,t[40]=w,t[41]=I):I=t[41];let L;t[42]===i?L=t[43]:(L=()=>i(!1),t[42]=i,t[43]=L);let R;t[44]!==n.filtersDone||t[45]!==L?(R=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(P,{type:`button`,className:`w-full rounded-xl`,onClick:L,children:n.filtersDone})}),t[44]=n.filtersDone,t[45]=L,t[46]=R):R=t[46];let V;t[47]!==I||t[48]!==R||t[49]!==S||t[50]!==C?(V=(0,$.jsxs)(f,{children:[_,(0,$.jsxs)(p,{className:v,"aria-describedby":`log-filters-desc`,children:[S,C,I,R]})]}),t[47]=I,t[48]=R,t[49]=S,t[50]=C,t[51]=V):V=t[51];let H;return t[52]!==i||t[53]!==r||t[54]!==V?(H=(0,$.jsx)(h,{open:r,onOpenChange:i,children:V}),t[52]=i,t[53]=r,t[54]=V,t[55]=H):H=t[55],H}function qe(e){let t=(0,K.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:o,moduleFilter:s,onModuleFilterChange:c,modules:l,onOpenFilters:u,activeFilterCount:d,hasActiveFilters:f,onClearFilters:p,autoRefresh:m}=e,h=n.filters,g;t[0]===n.presetAll?g=t[1]:(g={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=g);let y;t[2]===n.presetErrors?y=t[3]:(y={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=y);let x;t[4]===n.presetWarnPlus?x=t[5]:(x={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=x);let S;t[6]===n.presetInfoPlus?S=t[7]:(S={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=S);let C;t[8]===n.presetVerbose?C=t[9]:(C={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=C);let w;t[10]===n.presetOther?w=t[11]:(w={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=w);let E;t[12]!==g||t[13]!==y||t[14]!==x||t[15]!==S||t[16]!==C||t[17]!==w?(E=[g,y,x,S,C,w],t[12]=g,t[13]=y,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E):E=t[18];let O;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==E?(O=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(b,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:E,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=E,t[23]=O):O=t[23];let j;t[24]===n.searchPlaceholder?j=t[25]:(j=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(D,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=M):M=t[26];let N;t[27]===o?N=t[28]:(N=e=>o(e.target.value),t[27]=o,t[28]=N);let F=n.searchPlaceholder,I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=A(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,te),t[29]=I):I=t[29];let L;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==N?(L=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:N,placeholder:F,autoComplete:`off`,spellCheck:!1,className:I}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=N,t[33]=L):L=t[33];let R;t[34]!==j||t[35]!==L?(R=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[j,M,L]}),t[34]=j,t[35]=L,t[36]=R):R=t[36];let z;t[37]===c?z=t[38]:(z=e=>c(e.target.value),t[37]=c,t[38]=z);let B=n.module,V=n.module,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=A(ee,`h-10 w-full min-w-0 rounded-md py-0`),t[39]=H):H=t[39];let U;t[40]===n.allModules?U=t[41]:(U=(0,$.jsx)(v,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=U);let W;t[42]===l?W=t[43]:(W=l.map(Je),t[42]=l,t[43]=W);let ne;t[44]!==n.module||t[45]!==s||t[46]!==z||t[47]!==U||t[48]!==W?(ne=(0,$.jsxs)(_,{id:`log-module`,value:s,onChange:z,"aria-label":B,title:V,className:H,children:[U,W]}),t[44]=n.module,t[45]=s,t[46]=z,t[47]=U,t[48]=W,t[49]=ne):ne=t[49];let G;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(T,{className:`size-4`,strokeWidth:1.75}),t[50]=G):G=t[50];let q;t[51]===d?q=t[52]:(q=d>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:d}):null,t[51]=d,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==u||t[55]!==q?(J=(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:u,children:[G,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=u,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==f||t[59]!==p?(Y=f?(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:p,children:[(0,$.jsx)(k,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=f,t[59]=p,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let Z;t[64]!==R||t[65]!==ne||t[66]!==X?(Z=(0,$.jsxs)(`div`,{className:`grid gap-2 lg:grid-cols-[minmax(16rem,1fr)_minmax(12rem,16rem)_auto] lg:items-center`,children:[R,ne,X]}),t[64]=R,t[65]=ne,t[66]=X,t[67]=Z):Z=t[67];let Q;t[68]!==n.liveHint||t[69]!==m?(Q=m?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=m,t[70]=Q):Q=t[70];let re;return t[71]!==n.filters||t[72]!==Z||t[73]!==Q||t[74]!==O?(re=(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":h,children:[O,Z,Q]}),t[71]=n.filters,t[72]=Z,t[73]=Q,t[74]=O,t[75]=re):re=t[75],re}function Je(e){return(0,$.jsx)(v,{value:e,children:e},e)}function Ye(e){let t=(0,K.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:c,onFilterByRequestId:l}=e,u;t[0]!==i||t[1]!==r.length?(u=i&&r.length===0?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,"aria-busy":`true`,children:Array.from({length:8}).map(Xe)}):null,t[0]=i,t[1]=r.length,t[2]=u):u=t[2];let d;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==c?(d=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl bg-surface-hover/20 py-16 text-center`,children:[(0,$.jsx)(S,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:c,children:[(0,$.jsx)(E,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=c,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==l||t[13]!==s||t[14]!==o?(f=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[Se(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20 p-1 text-sm leading-6`,children:[(0,$.jsxs)(`div`,{className:`hidden items-center gap-3 px-3 py-2 text-xs font-medium text-fg-subtle md:flex`,"aria-hidden":!0,children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0`,children:n.time}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0`,children:n.level}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 sm:w-[5.25rem]`,children:n.requestId}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 xl:block`,children:n.phase}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 lg:block`,children:n.module}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:n.message})]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=Ae(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{className:`rounded-lg bg-surface-base/45`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:A(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`bg-red-500/5`),children:[(0,$.jsx)(`span`,{className:`w-[4.75rem] shrink-0 font-mono text-xs tabular-nums text-fg-subtle sm:w-[5.25rem] sm:text-sm`,children:Te(e.timestamp)}),(0,$.jsx)(`span`,{className:A(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:ke(t)}),(0,$.jsx)(`span`,{className:`hidden w-[4.5rem] shrink-0 truncate font-mono sm:block sm:w-[5.25rem]`,children:r?l?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),l(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l(r))},children:Oe(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:Oe(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:Ce(e),children:Ce(e)}),(0,$.jsx)(`span`,{className:A(`min-w-0 flex-1 truncate`,`text-fg`),children:we(e)})]})},je(e))})})]}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(E,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(g,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=l,t[13]=s,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==u||t[17]!==d||t[18]!==f?(p=(0,$.jsxs)($.Fragment,{children:[u,d,f]}),t[16]=u,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function Xe(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function Ze(e){let t=(0,K.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-10 sm:px-5 xl:px-6`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function Qe(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function $e(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`transcriptId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.transcriptId??``,e.message??``].map(e=>Qe(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
|
|
2
|
+
`)}function et(e,t,n){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),URL.revokeObjectURL(i)}function tt(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){et(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}et($e(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function nt(e){let t=(0,K.c)(32),{L:n,logs:r,disabled:i}=e,a=i||r.length===0,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(x,{className:`size-4`,strokeWidth:1.75}),t[0]=o):o=t[0];let s;t[1]===n.exportLogs?s=t[2]:(s=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=s);let c;t[3]!==n.exportLogs||t[4]!==a||t[5]!==s?(c=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,disabled:a,title:n.exportLogs,children:[o,s]})}),t[3]=n.exportLogs,t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=A(`w-52 rounded-xl border border-edge bg-surface-overlay p-2 shadow-popover outline-none`,V,`dark:border-edge`),t[7]=l):l=t[7];let u;t[8]===n.exportLogs?u=t[9]:(u=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=u);let d;t[10]===n.exportHint?d=t[11]:(d=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=d);let f;t[12]===r?f=t[13]:(f=()=>tt(r,`json`),t[12]=r,t[13]=f);let p;t[14]!==n.exportJson||t[15]!==f?(p=(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:f,children:n.exportJson}),t[14]=n.exportJson,t[15]=f,t[16]=p):p=t[16];let m;t[17]===r?m=t[18]:(m=()=>tt(r,`csv`),t[17]=r,t[18]=m);let h;t[19]!==n.exportCsv||t[20]!==m?(h=(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:m,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==h||t[23]!==p?(g=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[p,h]}),t[22]=h,t[23]=p,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==u||t[27]!==d?(_=(0,$.jsx)(F,{children:(0,$.jsxs)(I,{side:`bottom`,align:`end`,sideOffset:6,className:l,children:[u,d,g]})}),t[25]=g,t[26]=u,t[27]=d,t[28]=_):_=t[28];let v;return t[29]!==_||t[30]!==c?(v=(0,$.jsxs)(L,{children:[c,_]}),t[29]=_,t[30]=c,t[31]=v):v=t[31],v}function rt(e){let t=(0,K.c)(38),{L:n}=e,[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(`info`),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(null),d,f;t[0]!==n.logLevelLoadError||t[1]!==r?(d=()=>{if(!r)return;let e=!1;return re().then(t=>{e||o(t)}).catch(t=>{e||u(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},f=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,G.useEffect)(d,f);let p;t[4]===n.logLevelSaveError?p=t[5]:(p=e=>{c(!0),u(null),ie(e).then(e=>{o(e.current),i(!1)}).catch(e=>{u(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>c(!1))},t[4]=n.logLevelSaveError,t[5]=p);let m=p,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[6]=h):h=t[6];let g;t[7]===n.logLevelTitle?g=t[8]:(g=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=g);let _;t[9]===a?_=t[10]:(_=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a}),t[9]=a,t[10]=_);let v;t[11]!==n.logLevelTitle||t[12]!==g||t[13]!==_?(v=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,title:n.logLevelTitle,children:[h,g,_]})}),t[11]=n.logLevelTitle,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=A(`w-56 rounded-xl border border-edge bg-surface-overlay p-3 shadow-popover outline-none`,V,`dark:border-edge`),t[15]=y):y=t[15];let b;t[16]===n.logLevelTitle?b=t[17]:(b=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=b);let x;t[18]===n.logLevelHint?x=t[19]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=x);let S;t[20]!==n.levelNames||t[21]!==m||t[22]!==a||t[23]!==s?(S=le.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>m(e),className:A(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,a===e?`bg-accent/10 font-medium text-accent`:`text-fg hover:bg-surface-hover`),children:[(0,$.jsx)(`span`,{children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] uppercase text-fg-subtle`,children:e})]})},e)),t[20]=n.levelNames,t[21]=m,t[22]=a,t[23]=s,t[24]=S):S=t[24];let C;t[25]===S?C=t[26]:(C=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:S}),t[25]=S,t[26]=C);let T;t[27]===l?T=t[28]:(T=l?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:l}):null,t[27]=l,t[28]=T);let E;t[29]!==x||t[30]!==C||t[31]!==T||t[32]!==b?(E=(0,$.jsx)(F,{children:(0,$.jsxs)(I,{side:`bottom`,align:`end`,sideOffset:6,className:y,children:[b,x,C,T]})}),t[29]=x,t[30]=C,t[31]=T,t[32]=b,t[33]=E):E=t[33];let D;return t[34]!==r||t[35]!==E||t[36]!==v?(D=(0,$.jsxs)(L,{open:r,onOpenChange:i,children:[v,E]}),t[34]=r,t[35]=E,t[36]=v,t[37]=D):D=t[37],D}function it(e){let t=(0,K.c)(49),{L:n,autoRefresh:r,onAutoRefreshChange:i,fileCount:a,onOpenFiles:o,loading:s,onRefreshAll:c,logs:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,$.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-lg`,children:n.title}),t[0]=n.title,t[1]=u);let d;t[2]===n.subtitle?d=t[3]:(d=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:n.subtitle}),t[2]=n.subtitle,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=r?`live`:`paused`,m;t[7]===i?m=t[8]:(m=e=>i(e===`live`),t[7]=i,t[8]=m);let h;t[9]===n.refreshManual?h=t[10]:(h={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=h);let g;t[11]===n.refreshLive?g=t[12]:(g={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=[h,g],t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==_?(v=(0,$.jsx)(`div`,{className:`w-full sm:w-52`,children:(0,$.jsx)(b,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:_,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]===n?y=t[22]:(y=(0,$.jsx)(rt,{L:n}),t[21]=n,t[22]=y);let x;t[23]!==n||t[24]!==s||t[25]!==l?(x=(0,$.jsx)(nt,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=x):x=t[26];let S;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(C,{className:`size-4`,strokeWidth:1.75}),t[27]=S):S=t[27];let w;t[28]===a?w=t[29]:(w=a>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-1.5 text-xs text-fg-muted`,children:a}):null,t[28]=a,t[29]=w);let T;t[30]!==n.logFiles||t[31]!==o||t[32]!==w?(T=(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:n.logFiles,"aria-label":n.logFiles,onClick:o,children:[S,w]}),t[30]=n.logFiles,t[31]=o,t[32]=w,t[33]=T):T=t[33];let E;t[34]!==n.refresh||t[35]!==s||t[36]!==c?(E=(0,$.jsx)(U,{className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,loading:s,label:n.refresh,onClick:c}),t[34]=n.refresh,t[35]=s,t[36]=c,t[37]=E):E=t[37];let D;t[38]!==y||t[39]!==x||t[40]!==T||t[41]!==E?(D=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1 sm:self-center`,children:[y,x,T,E]}),t[38]=y,t[39]=x,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==v?(O=(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 flex-col gap-2 rounded-xl bg-surface-hover/20 p-2 sm:flex-row sm:items-center sm:justify-between`,children:[v,D]}),t[43]=D,t[44]=v,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==f?(k=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[f,O]}),t[46]=O,t[47]=f,t[48]=k):k=t[48],k}function at(e){let t=(0,K.c)(33),{L:n,stats:r}=e,i;t[0]===r.byLevel?i=t[1]:(i=r.byLevel??{},t[0]=r.byLevel,t[1]=i);let a;t[2]!==n.levelNames||t[3]!==i?(a=Pe(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=a):a=t[4];let o=a,s=r.runtime?.errorsLast24h;if(!o&&s==null)return null;let c;t[5]===n.statsRegion?c=t[6]:(c=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=c);let l;t[7]===o?l=t[8]:(l=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null,t[7]=o,t[8]=l);let u;t[9]!==n.runtimeErrors||t[10]!==s?(u=s!=null&&s>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-red-600 dark:text-red-400`,children:[n.runtimeErrors,` `,s]})]}):null,t[9]=n.runtimeErrors,t[10]=s,t[11]=u):u=t[11];let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded-lg border border-transparent px-1 py-0.5 text-left text-xs leading-5 text-fg-subtle transition-colors duration-150 ease-out hover:border-edge-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel dark:hover:border-edge`,children:[c,l,u]})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(f=A(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-overlay p-3 shadow-popover outline-none`,V,`dark:border-edge`),t[16]=f):f=t[16];let p;t[17]===n.statsDetailTitle?p=t[18]:(p=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=p);let m;t[19]===n.statsHint?m=t[20]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=m);let h;t[21]!==n.levelNames||t[22]!==r.byLevel?(h=le.map(e=>{let t=r.byLevel?.[e]??0;return t===0?null:(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize text-fg`,children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:t})]},e)}),t[21]=n.levelNames,t[22]=r.byLevel,t[23]=h):h=t[23];let g;t[24]===h?g=t[25]:(g=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==g||t[27]!==p||t[28]!==m?(_=(0,$.jsx)(F,{children:(0,$.jsxs)(I,{side:`bottom`,align:`start`,sideOffset:6,className:f,children:[p,m,g]})}),t[26]=g,t[27]=p,t[28]=m,t[29]=_):_=t[29];let v;return t[30]!==_||t[31]!==d?(v=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(L,{children:[d,_]})}),t[30]=_,t[31]=d,t[32]=v):v=t[32],v}function ot(){let e=(0,K.c)(89),{L:t,hasToken:n,logs:r,loading:i,error:a,hasMore:o,searchInput:c,setSearchInput:l,selectedLevels:u,moduleFilter:d,setModuleFilter:f,dateFrom:p,setDateFrom:m,dateTo:h,setDateTo:g,modules:_,files:v,stats:y,selectedLog:b,setSelectedLog:x,filesOpen:S,setFilesOpen:C,filtersOpen:w,setFiltersOpen:T,logDir:E,autoRefresh:D,setAutoRefresh:O,copiedDetail:k,setCopiedDetail:A,hasActiveFilters:j,activeFilterCount:M,clearFilters:N,toggleDialogLevel:P,handleLoadMore:F,refreshAll:I,levelSegment:L,handleLevelSegment:R,filterByRequestId:z,filterByTranscriptId:B,filterByErrorSummary:V,openChatForSession:H,errorSummary:ee,errorSummaryLoading:te}=Re(s(st));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Ze,{L:t}),e[0]=t,e[1]=n),n}let U;e[2]===C?U=e[3]:(U=()=>C(!0),e[2]=C,e[3]=U);let W;e[4]!==t||e[5]!==D||e[6]!==v.length||e[7]!==i||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==U?(W=(0,$.jsx)(it,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:v.length,onOpenFiles:U,loading:i,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=v.length,e[7]=i,e[8]=r,e[9]=I,e[10]=O,e[11]=U,e[12]=W):W=e[12];let G;e[13]===a?G=e[14]:(G=a?(0,$.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:a}):null,e[13]=a,e[14]=G);let q;e[15]!==t||e[16]!==y?(q=y?(0,$.jsx)(at,{L:t,stats:y}):null,e[15]=t,e[16]=y,e[17]=q):q=e[17];let J;e[18]!==t||e[19]!==ee||e[20]!==te||e[21]!==V?(J=(0,$.jsx)(ze,{L:t,items:ee,loading:te,onSelectItem:V}),e[18]=t,e[19]=ee,e[20]=te,e[21]=V,e[22]=J):J=e[22];let Y;e[23]===T?Y=e[24]:(Y=()=>T(!0),e[23]=T,e[24]=Y);let X;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==d||e[33]!==_||e[34]!==c||e[35]!==f||e[36]!==l||e[37]!==Y?(X=(0,$.jsx)(qe,{L:t,levelSegment:L,onLevelSegment:R,searchInput:c,onSearchInputChange:l,moduleFilter:d,onModuleFilterChange:f,modules:_,onOpenFilters:Y,activeFilterCount:M,hasActiveFilters:j,onClearFilters:N,autoRefresh:D}),e[25]=t,e[26]=M,e[27]=D,e[28]=N,e[29]=R,e[30]=j,e[31]=L,e[32]=d,e[33]=_,e[34]=c,e[35]=f,e[36]=l,e[37]=Y,e[38]=X):X=e[38];let Z;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==o||e[43]!==i||e[44]!==r||e[45]!==I||e[46]!==x?(Z=(0,$.jsx)(Ye,{L:t,logs:r,loading:i,hasMore:o,onSelectLog:x,onLoadMore:F,onRefreshAll:I,onFilterByRequestId:z}),e[39]=t,e[40]=z,e[41]=F,e[42]=o,e[43]=i,e[44]=r,e[45]=I,e[46]=x,e[47]=Z):Z=e[47];let Q;e[48]!==t||e[49]!==p||e[50]!==h||e[51]!==w||e[52]!==u||e[53]!==m||e[54]!==g||e[55]!==T||e[56]!==P?(Q=(0,$.jsx)(Ke,{L:t,open:w,onOpenChange:T,dateFrom:p,onDateFromChange:m,dateTo:h,onDateToChange:g,selectedLevels:u,onToggleLevel:P}),e[48]=t,e[49]=p,e[50]=h,e[51]=w,e[52]=u,e[53]=m,e[54]=g,e[55]=T,e[56]=P,e[57]=Q):Q=e[57];let re;e[58]===x?re=e[59]:(re=()=>x(null),e[58]=x,e[59]=re);let ie,ae;e[60]===A?(ie=e[61],ae=e[62]):(ie=()=>A(`message`),ae=()=>A(`json`),e[60]=A,e[61]=ie,e[62]=ae);let oe;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==H||e[68]!==b||e[69]!==ie||e[70]!==ae||e[71]!==re?(oe=(0,$.jsx)(Ue,{L:t,log:b,onClose:re,copiedDetail:k,onCopiedMessage:ie,onCopiedJson:ae,onFilterByRequestId:z,onFilterByTranscriptId:B,onOpenChat:H}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=H,e[68]=b,e[69]=ie,e[70]=ae,e[71]=re,e[72]=oe):oe=e[72];let se;e[73]!==t||e[74]!==v||e[75]!==S||e[76]!==E||e[77]!==C?(se=(0,$.jsx)(We,{L:t,open:S,onOpenChange:C,files:v,logDir:E}),e[73]=t,e[74]=v,e[75]=S,e[76]=E,e[77]=C,e[78]=se):se=e[78];let ce;return e[79]!==W||e[80]!==oe||e[81]!==se||e[82]!==G||e[83]!==q||e[84]!==J||e[85]!==X||e[86]!==Z||e[87]!==Q?(ce=(0,$.jsxs)(ne,{gap:`gap-6`,children:[W,G,q,J,X,Z,Q,oe,se]}),e[79]=W,e[80]=oe,e[81]=se,e[82]=G,e[83]=q,e[84]=J,e[85]=X,e[86]=Z,e[87]=Q,e[88]=ce):ce=e[88],ce}function st(e){return e.language}export{ot as LogsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./activity-YogQEteU.js";import{t as _}from"./chevron-left-DqFhpbvK.js";import{t as v}from"./chevron-right-BweFrslA.js";import{n as y,r as b,t as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./laptop-CI3hBVrl.js";import{n as C,t as ee}from"./shield-off-2jsucUds.js";import{t as w}from"./plus-Q2yW6OE7.js";import{t as T}from"./search-DA7gz22f.js";import{t as E}from"./smartphone-DSSsQFqA.js";import{t as te}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-DzdOeGYz.js";import{s as k}from"./session-api-CkOliupg.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{t as M}from"./button-Cc4hUNTt.js";import{i as ne,o as N}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as P}from"./page-tabs-oeTY7z3_.js";import{t as F}from"./confirm-dialog-DrA5mTQp.js";import{t as I}from"./refresh-button-DiWdGAaX.js";import{n as L}from"./index.module-Cd9ENXfk.js";import{n as R}from"./settings-loading-skeleton-CAoOV17i.js";import{a as z,i as B,n as re,o as ie,r as ae,t as oe}from"./management-api-DG-yZnHK.js";import{n as se,t as ce}from"./settings-page-header-B9Y_eGcH.js";import{t as le}from"./settings-page-layout-D1MgJ5zP.js";import{t as V}from"./device-pairing-wizard-diuSsk-H.js";var H=n(),U=e(t(),1),W=r();function ue({operationId:e,zh:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(``);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:n,onClick:async()=>{r(!0);try{let n=(await c(o(`/api/endpoint-tools/provider-operations/${encodeURIComponent(e)}`))).payload.receipt?.state;a(n===`succeeded`?t?`设备报告已完成,Gateway 未收到结果。`:`Device reported completion. Gateway did not receive the result.`:n===`running`?t?`设备仍在执行。`:`Device is still running.`:t?`设备未确认结果。`:`Device has not confirmed the outcome.`)}catch{a(t?`暂时无法核对设备状态。`:`Unable to check device status.`)}finally{r(!1)}},children:n?t?`核对中…`:`Checking…`:t?`核对设备状态`:`Check device status`}),i?(0,W.jsx)(`p`,{role:`status`,className:`text-right text-xs text-fg-muted`,children:i}):null]})}async function de(e=`GET`,t,n){let r=await a(o(`/api/endpoint-tools/target-authorizations`+(n?`/`+encodeURIComponent(n):``)),{method:e,...t?{body:JSON.stringify(t)}:{}});if(!r.ok)throw Error(r.status===403?`owner`:`unavailable`);return(await r.json()).payload}function fe({devices:e,zh:t}){let n=A(`device-single-call-grants`,()=>de(),{refreshInterval:5e3,shouldRetryOnError:!1}),r=A(n.error?null:`device-grant-conversations`,()=>k({limit:100}),{shouldRetryOnError:!1}),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(`weather`),[f,p]=(0,U.useState)(`approximate`),[m,h]=(0,U.useState)(`restaurant`),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1);if(n.error)return null;let b=e.flatMap(e=>e.endpoints.map(t=>({...t,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))),S=b.find(e=>e.endpointId===c)?.tools.find(e=>e.descriptor.name.endsWith(`.device.get_location`))?.descriptor.name,C=async()=>{if(!(!S||!i||!o)){_(!0),y(!1);try{await de(`POST`,{conversationId:i,requestorPrincipalId:o,targetEndpointId:c,toolName:S,arguments:{purpose:u,precision:f,...u===`nearby`?{category:m}:{}}}),await n.mutate()}catch{y(!0)}finally{_(!1)}}};return(0,W.jsxs)(`section`,{className:`mb-5 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,W.jsx)(`h3`,{className:`font-semibold text-fg`,children:t?`跨设备单次授权`:`Single-call device authorization`}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t?`为指定会话和来源设备授权一次定位查询,60 秒后失效。目标设备仍需确认;授权后请在来源设备继续请求。`:`Authorize one location query for a conversation and source device. Expires in 60 seconds; target-device consent is still required. Continue the request from the source device.`}),n.isLoading||r.isLoading?(0,W.jsx)(O,{className:`mt-3 h-28`}):(0,W.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,W.jsx)(x,{value:i,onChange:a,placeholder:t?`选择会话`:`Conversation`,ariaLabel:t?`会话`:`Conversation`,options:(r.data?.items??[]).map(e=>({value:e.key,label:e.name||e.key}))}),(0,W.jsx)(x,{value:o,onChange:s,placeholder:t?`消息来源设备`:`Source device`,ariaLabel:t?`消息来源设备`:`Source device`,options:e.filter(e=>e.endpoints.length>0).map(e=>({value:e.id,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))}),(0,W.jsx)(x,{value:c,onChange:l,placeholder:t?`使用哪台设备的位置`:`Location device`,ariaLabel:t?`目标设备`:`Target device`,options:b.filter(e=>e.tools.some(e=>e.descriptor.name.endsWith(`.device.get_location`))).map(e=>({value:e.endpointId,label:e.label}))}),(0,W.jsx)(x,{placeholder:t?`用途`:`Purpose`,value:u,onChange:e=>d(e),ariaLabel:t?`用途`:`Purpose`,options:[{value:`weather`,label:t?`查询天气`:`Weather`},{value:`nearby`,label:t?`附近地点`:`Nearby places`}],allowEmpty:!1}),(0,W.jsx)(x,{placeholder:t?`精度`:`Precision`,value:f,onChange:e=>p(e),ariaLabel:t?`精度`:`Precision`,options:[{value:`approximate`,label:t?`大致位置`:`Approximate`},{value:`precise`,label:t?`精确位置`:`Precise`}],allowEmpty:!1}),u===`nearby`?(0,W.jsx)(x,{placeholder:t?`地点类型`:`Category`,value:m,onChange:h,ariaLabel:t?`附近地点类型`:`Place category`,options:[`restaurant`,`cafe`,`pharmacy`,`park`].map((e,n)=>({value:e,label:t?[`餐厅`,`咖啡馆`,`药店`,`公园`][n]:e})),allowEmpty:!1}):null,(0,W.jsx)(M,{variant:`primary`,disabled:g||!i||!o||!S,onClick:()=>void C(),children:t?`允许一次`:`Allow once`})]}),v?(0,W.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-fg-muted`,children:t?`授权失败,请检查设备连接后重试。`:`Authorization failed. Check the device connection.`}):null,(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:n.data?.map(r=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-fg-muted`,children:[(0,W.jsxs)(`span`,{children:[e.find(e=>e.endpoints.some(e=>e.endpointId===r.targetEndpointId))?.displayName??(t?`设备`:`Device`),` · `,r.state===`running`?t?`执行中`:`Running`:t?`等待本次调用`:`Awaiting one call`]}),(0,W.jsx)(M,{disabled:g,onClick:()=>{_(!0),de(`DELETE`,void 0,r.id).then(()=>n.mutate()).catch(()=>y(!0)).finally(()=>_(!1))},children:t?`撤销`:`Revoke`})]},r.id))})]})}var pe={ready:[`可用`,`Ready`],offline:[`离线`,`Offline`],authorization_required:[`等待批准`,`Approval required`],needs_foreground:[`需要设备前台运行`,`Foreground required`],permission_missing:[`缺少设备权限`,`Device permission required`],resource_busy:[`资源占用中`,`Resource busy`],unavailable:[`暂不可用`,`Unavailable`]};function me({principalId:e,zh:t}){let n=o(`/api/endpoint-tools/providers`),{data:r,error:i,mutate:a}=A(`${n}?principalId=${encodeURIComponent(e)}`,e=>c(e),{refreshInterval:15e3}),[s,l]=(0,U.useState)(),[u,d]=(0,U.useState)(!1),f=r?.payload.filter(t=>t.principalId===e),p=async t=>{l(t.provider.localId),d(!1);try{await c(n+`/admission`,{method:`POST`,body:JSON.stringify({principalId:e,localId:t.provider.localId,expectedDigest:t.digest,allowed:!t.admitted})}),await a()}catch{d(!0),await a()}finally{l(void 0)}};return(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`设备能力`:`Device capabilities`}),!r&&!i?(0,W.jsx)(O,{className:`h-24 w-full rounded-xl`}):null,i||u?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`能力信息更新失败,请刷新后重试。`:`Unable to update capabilities. Refresh and retry.`}):null,f?.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`此设备尚未上报扩展能力。`:`No additional capabilities reported.`}):null,f?.map(e=>(0,W.jsxs)(`article`,{className:`space-y-2 rounded-xl border border-edge-subtle p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,W.jsx)(`h4`,{className:`break-words text-sm font-medium text-fg`,children:e.provider.title}),(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:(pe[e.status]??pe.unavailable)[+!t]})]}),(0,W.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.provider.summary}),(0,W.jsxs)(`details`,{className:`text-xs text-fg-subtle`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer`,children:t?`${e.provider.tools.length} 项能力及权限`:`${e.provider.tools.length} tools and permissions`}),(0,W.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.provider.tools.map(e=>(0,W.jsxs)(`li`,{className:`break-words`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:e.title}),(0,W.jsx)(`p`,{children:e.description}),(0,W.jsxs)(`p`,{children:[e.effect,` · `,e.sensitivity,` · `,e.confirmation===`always`?t?`每次确认`:`Confirm each call`:t?`按批准范围执行`:`Approved scope`,e.requiredPermissions.length?` · ${e.requiredPermissions.join(`, `)}`:``]})]},e.name))})]}),(0,W.jsx)(M,{variant:`secondary`,disabled:s!==void 0,onClick:()=>void p(e),children:s===e.provider.localId?t?`保存中…`:`Saving…`:e.admitted?t?`撤销能力批准`:`Revoke approval`:t?`批准这些能力`:`Approve capabilities`})]},e.provider.localId))]})}var he=720*60*60*1e3;function ge(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function G(e){return ge(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function _e(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ve(e,t=Date.now()){return G(e)===`offline`&&(e.lastSeenAt??e.createdAt)<t-he}function ye(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=G(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ve(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function be(e){return e.length>8?e.slice(-8):e}function xe(e){let t=(0,H.c)(61),{device:n,busy:r,onClose:i,onRevoke:a,onRename:o}=e,c=s(Se),g;t[0]===c?g=t[1]:(g=l(c),t[0]=c,t[1]=g);let _=g.endpointToolsSettings,v=c===`zh`?`zh-CN`:`en`,y;t[2]===v?y=t[3]:(y=new Intl.DateTimeFormat(v,{dateStyle:`medium`,timeStyle:`short`}),t[2]=v,t[3]=y);let b=y,x;t[4]===n?x=t[5]:(x=n?G(n):`offline`,t[4]=n,t[5]=x);let S=x,C=n!==null,w;t[6]===i?w=t[7]:(w=e=>!e&&i(),t[6]=i,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,W.jsx)(u,{className:D(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=D(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,ne),t[9]=E):E=t[9];let O=n?.displayName??_.deviceDetails,k;t[10]===O?k=t[11]:(k=(0,W.jsx)(m,{className:`truncate text-base font-semibold text-fg`,children:O}),t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=n?(0,W.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,be(n.id)]}):null,t[12]=n,t[13]=A);let j;t[14]!==k||t[15]!==A?(j=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[14]=k,t[15]=A,t[16]=j):j=t[16];let P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,W.jsx)(te,{className:`size-5`,"aria-hidden":!0}),t[17]=P):P=t[17];let F;t[18]===_.close?F=t[19]:(F=(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(M,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":_.close,children:P})}),t[18]=_.close,t[19]=F);let I;t[20]!==j||t[21]!==F?(I=(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[j,F]}),t[20]=j,t[21]=F,t[22]=I):I=t[22];let L;t[23]!==_.accessActive||t[24]!==_.accessRevoked||t[25]!==_.accessTitle||t[26]!==_.createdAt||t[27]!==_.endpointCount||t[28]!==_.endpointsTitle||t[29]!==_.identityId||t[30]!==_.identityTitle||t[31]!==_.lastSeen||t[32]!==_.never||t[33]!==_.noAccessIdentity||t[34]!==_.noOnlineEndpoints||t[35]!==_.noPermissions||t[36]!==_.permissions||t[37]!==_.status||t[38]!==_.statusLabel||t[39]!==_.toolCount||t[40]!==n||t[41]!==b||t[42]!==c||t[43]!==o||t[44]!==S?(L=n?(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[n.principal&&S!==`revoked`&&o?(0,W.jsx)(Ce,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,W.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,W.jsx)(K,{label:_.statusLabel,value:_.status[S]}),(0,W.jsx)(K,{label:_.lastSeen,value:n.lastSeenAt?b.format(n.lastSeenAt):_.never}),(0,W.jsx)(K,{label:_.endpointCount,value:String(n.endpoints.length)}),(0,W.jsx)(K,{label:_.toolCount,value:String(_e(n))})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.accessTitle}),(0,W.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:n.access.revokedAt?_.accessRevoked:_.accessActive}),(0,W.jsx)(`p`,{className:`mt-1`,children:n.access.requestProofVersion===1?c===`zh`?`设备请求签名已启用`:`Device request signing enabled`:c===`zh`?`请求签名未启用,设备不可用`:`Request signing is missing; device unavailable`}),(0,W.jsxs)(`p`,{className:`mt-1 break-words`,children:[_.permissions,`: `,n.access.scopes.join(`, `)||_.noPermissions]})]}):(0,W.jsx)(`p`,{children:_.noAccessIdentity})})]}),n.principal&&S!==`revoked`?(0,W.jsx)(me,{principalId:n.id,zh:c===`zh`},n.id):null,n.access&&!n.access.revokedAt&&[`ios`,`android`,`harmonyos`].includes(n.platform??``)?(0,W.jsx)(we,{device:n,zh:c===`zh`},n.id):null,(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.endpointsTitle}),(0,W.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,W.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,W.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,W.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[_.status[e.availability],` · v`,e.appVersion]})]}),(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,W.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.title}),(0,W.jsxs)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:[t.requiresForeground?c===`zh`?`需要设备在前台 · `:`Requires foreground · `:``,t.confirmation===`always`?c===`zh`?`每次确认`:`Confirm each time`:c===`zh`?`按已授权范围调用`:`Uses the authorized scope`]})]},t.name)})})]},e.connectionId))]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.identityTitle}),n.principal&&S!==`revoked`&&o?(0,W.jsx)(Ce,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,W.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,W.jsx)(K,{label:_.identityId,value:n.id,breakAll:!0}),(0,W.jsx)(`div`,{className:`mt-3`,children:(0,W.jsx)(K,{label:_.createdAt,value:b.format(n.createdAt)})})]})]})]}):null,t[23]=_.accessActive,t[24]=_.accessRevoked,t[25]=_.accessTitle,t[26]=_.createdAt,t[27]=_.endpointCount,t[28]=_.endpointsTitle,t[29]=_.identityId,t[30]=_.identityTitle,t[31]=_.lastSeen,t[32]=_.never,t[33]=_.noAccessIdentity,t[34]=_.noOnlineEndpoints,t[35]=_.noPermissions,t[36]=_.permissions,t[37]=_.status,t[38]=_.statusLabel,t[39]=_.toolCount,t[40]=n,t[41]=b,t[42]=c,t[43]=o,t[44]=S,t[45]=L):L=t[45];let R;t[46]!==r||t[47]!==_.removeDevice||t[48]!==_.revoking||t[49]!==n||t[50]!==a||t[51]!==S?(R=n&&S!==`revoked`?(0,W.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,W.jsxs)(M,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,W.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r?_.revoking:_.removeDevice]})}):null,t[46]=r,t[47]=_.removeDevice,t[48]=_.revoking,t[49]=n,t[50]=a,t[51]=S,t[52]=R):R=t[52];let z;t[53]!==I||t[54]!==L||t[55]!==R?(z=(0,W.jsxs)(f,{children:[T,(0,W.jsxs)(p,{className:E,"aria-describedby":void 0,children:[I,L,R]})]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z):z=t[56];let B;return t[57]!==z||t[58]!==C||t[59]!==w?(B=(0,W.jsx)(h,{open:C,onOpenChange:w,children:z}),t[57]=z,t[58]=C,t[59]=w,t[60]=B):B=t[60],B}function Se(e){return e.language}function K(e){let t=(0,H.c)(10),{label:n,value:r,breakAll:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=D(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,W.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Ce({device:e,zh:t,onRename:n}){let[r,i]=(0,U.useState)(e.displayName),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:async t=>{if(t.preventDefault(),!(a||!r.trim())){o(!0),c(!1);try{await n(e,r.trim())}catch{c(!0)}finally{o(!1)}}},children:[(0,W.jsxs)(`label`,{className:`block text-sm text-fg`,children:[t?`设备名称`:`Device name`,(0,W.jsx)(`input`,{value:r,maxLength:80,onChange:e=>i(e.target.value),className:`mt-2 h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-fg`})]}),(0,W.jsx)(M,{type:`submit`,variant:`secondary`,disabled:a||!r.trim()||r.trim()===e.displayName,children:a?t?`保存中…`:`Saving…`:t?`保存名称`:`Save name`}),s?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`保存失败,请刷新设备信息后重试。`:`Unable to save. Refresh device information and retry.`}):null]})}function we({device:e,zh:t}){let n=e.access?.scopes.includes(`phone.control`)?`control`:e.access?.scopes.includes(`phone.view`)?`view`:`none`,[r,i]=(0,U.useState)(n),[a,s]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1);return(0,U.useEffect)(()=>i(n),[n]),(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`云手机访问`:`Cloud phone access`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`移动端配对后默认可查看并接管。可在此关闭,或撤销整个设备的授权。`:`Mobile pairing includes viewing and control by default. Disable it here or revoke the device entirely.`}),(0,W.jsxs)(y,{value:r,disabled:a,onChange:async t=>{let n=t.target.value;s(!0),u(!1);try{await c(o(`/api/phone/device-access/${encodeURIComponent(e.id)}`),{method:`PATCH`,body:JSON.stringify({access:n})}),i(n),await j(o(`/api/endpoint-tools/devices`))}catch{u(!0)}finally{s(!1)}},children:[(0,W.jsx)(b,{value:`none`,children:t?`不允许`:`Not allowed`}),(0,W.jsx)(b,{value:`view`,children:t?`仅查看`:`View only`}),(0,W.jsx)(b,{value:`control`,children:t?`查看并接管`:`View and control`})]}),l?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`授权保存失败,请重试。`:`Unable to save phone access.`}):null]})}function Te(e){let t=(0,H.c)(19),{onPaired:n}=e,[r,a]=i(),o=s(Ee),c;t[0]===o?c=t[1]:(c=l(o),t[0]=o,t[1]=c);let u=c.endpointToolsSettings.deviceAccess,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={open:!1},t[2]=d):d=t[2];let[f,p]=(0,U.useState)(d),m,h;t[3]!==r||t[4]!==a?(m=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(p({open:!0,target:e}),a(q,{replace:!0}))},h=[r,a],t[3]=r,t[4]=a,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,U.useEffect)(m,h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p({open:!0}),_=(0,W.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;t[9]===u.addDevice?v=t[10]:(v=(0,W.jsxs)(M,{variant:`primary`,onClick:g,children:[_,u.addDevice]}),t[9]=u.addDevice,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>p(t=>({...t,open:e})),t[11]=y):y=t[11];let b;t[12]!==f.open||t[13]!==f.target||t[14]!==n?(b=(0,W.jsx)(V,{open:f.open,onOpenChange:y,onPaired:n,targetKind:f.target}),t[12]=f.open,t[13]=f.target,t[14]=n,t[15]=b):b=t[15];let x;return t[16]!==v||t[17]!==b?(x=(0,W.jsxs)(W.Fragment,{children:[v,b]}),t[16]=v,t[17]=b,t[18]=x):x=t[18],x}function q(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function Ee(e){return e.language}var De=5e3,J=20,Oe=20;function Y(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function ke(e){let t=(0,H.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=D(`rounded-full px-2 py-0.5 text-xs font-medium`,Y(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,W.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function X(){let e=s(e=>e.language),t=l(e).endpointToolsSettings,[n,r]=i(),a=n.get(`view`)===`activity`?`activity`:`devices`,[o,c]=(0,U.useState)(null),[u,d]=(0,U.useState)([]),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[y,b]=(0,U.useState)(``),[w,te]=(0,U.useState)(`active`),[O,k]=(0,U.useState)(``),[j,ne]=(0,U.useState)(1),[N,V]=(0,U.useState)(()=>new Set),[H,de]=(0,U.useState)(``),[pe]=L(H,250),[me,he]=(0,U.useState)(``),[ge,Se]=(0,U.useState)(``),[K,Ce]=(0,U.useState)(``),[we,q]=(0,U.useState)(1),Ee={page:we,pageSize:Oe,query:pe,principalId:me,status:ge,effect:K},Y=A(B(),ae,{refreshInterval:De}),X=A(a===`activity`?oe(Ee):null,()=>re(Ee),{refreshInterval:De,keepPreviousData:!0}),Ae=(0,U.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(Y.isLoading&&!Y.data)return(0,W.jsx)(se,{children:(0,W.jsx)(R,{sections:2})});let Z=Y.data??[],je=X.data?.items??[],Me=Z.filter(e=>G(e)===`online`).length,Ne=Z.filter(e=>G(e)!==`revoked`).length,Pe=Z.filter(e=>ve(e)).length,Fe=[...new Set(Z.map(e=>e.platform))].toSorted(),Q=ye(Z,{query:y,status:w,platform:O}),Ie=Math.max(1,Math.ceil(Q.length/J)),$=Math.min(j,Ie),Le=Q.slice(($-1)*J,$*J),Re=Le.reduce((e,t)=>(G(t)!==`revoked`&&e.push(t.id),e),[]),ze=Re.length>0&&Re.every(e=>N.has(e)),Be=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Ve=async()=>{await Promise.all([Y.mutate(),a===`activity`?X.mutate():Promise.resolve()])},He=async()=>{if(!(u.length===0||f)){p(!0),h(!1);try{await ie(u.map(e=>e.id)),d([]),V(new Set),await Y.mutate()}catch{h(!0)}finally{p(!1)}}},Ue=e=>{e(),ne(1),V(new Set)};return(0,W.jsxs)(se,{children:[(0,W.jsx)(ce,{title:t.title,subtitle:t.subtitle,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Ve}),(0,W.jsx)(Te,{onPaired:()=>void Y.mutate()})]})}),Y.error||X.error?(0,W.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,W.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:Ne,filter:`active`},{label:t.onlineDevices,value:Me,filter:`online`},{label:t.staleDevices,value:Pe,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,W.jsxs)(`button`,{type:`button`,className:D(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":w===n,onClick:()=>{Ue(()=>te(n)),Be(`devices`)},children:[(0,W.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,W.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,W.jsx)(P,{items:[{id:`devices`,label:t.devicesTab,icon:C,count:Ne},{id:`activity`,label:t.activityTab,icon:g,count:X.data?.total}],activeTab:a,onChange:Be,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,W.jsxs)(le,{id:`devices`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,W.jsx)(fe,{devices:Z,zh:e===`zh`}),(0,W.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,W.jsxs)(`label`,{className:`relative block`,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,W.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:y,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>Ue(()=>b(e.target.value))})]}),(0,W.jsx)(x,{value:w,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>Ue(()=>te(e))}),(0,W.jsx)(x,{value:O,options:Fe.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>Ue(()=>k(e))})]}),N.size>0?(0,W.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(N.size))}),(0,W.jsxs)(M,{variant:`secondary`,className:`text-danger`,onClick:()=>{h(!1),d(Z.filter(e=>N.has(e.id)))},children:[(0,W.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Z.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Q.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,W.jsxs)(`label`,{className:D(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Re.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,W.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:ze,disabled:Re.length===0,className:`size-4 accent-accent`,onChange:e=>{V(t=>{let n=new Set(t);for(let t of Re)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,W.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Le.map(e=>{let n=G(e),r=e.kind===`mobile`?E:S;return(0,W.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`label`,{className:D(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,W.jsx)(`input`,{type:`checkbox`,checked:N.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{V(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,W.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,W.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,W.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,W.jsx)(ke,{status:n,label:t.status[n]})]}),(0,W.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,be(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Ae.format(e.lastSeenAt):t.never]})]}),(0,W.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(_e(e)))}),(0,W.jsx)(v,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String(($-1)*J+1)).replace(`{{to}}`,String(Math.min($*J,Q.length))).replace(`{{total}}`,String(Q.length))}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:$<=1,onClick:()=>ne(e=>Math.max(1,e-1)),children:(0,W.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:$>=Ie,onClick:()=>ne(e=>Math.min(Ie,e+1)),children:(0,W.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,W.jsxs)(le,{id:`activity`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,W.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,W.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,W.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:H,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{de(e.target.value),q(1)}})]}),(0,W.jsx)(x,{value:me,options:Z.map(e=>({value:e.id,label:`${e.displayName} · ${be(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{he(e),q(1)}}),(0,W.jsx)(x,{value:ge,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Se(e),q(1)}}),(0,W.jsx)(x,{value:K,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Ce(e),q(1)}})]}),X.isLoading&&!X.data?(0,W.jsx)(R,{sections:1}):null,je.length===0&&!X.isLoading?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,W.jsx)(`div`,{className:`space-y-2`,children:je.map(n=>(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:n.toolName}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Ae.format(n.startedAt),` · `,t.effects[n.effect],` · `,n.endpointId]}),n.errorMessage?(0,W.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:n.errorMessage}):null]}),(0,W.jsxs)(`div`,{className:`flex max-w-xs flex-col items-end gap-1`,children:[(0,W.jsx)(ke,{status:n.status,label:n.errorCode===`OUTCOME_UNKNOWN`?e===`zh`?`结果未知`:`Outcome unknown`:t.status[n.status]}),n.operationId&&n.toolName.startsWith(`provider_`)&&n.errorCode===`OUTCOME_UNKNOWN`?(0,W.jsx)(ue,{operationId:n.operationId,zh:e===`zh`}):null]})]},n.id))}),X.data&&X.data.total>0?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((X.data.page-1)*X.data.pageSize+1)).replace(`{{to}}`,String(Math.min(X.data.page*X.data.pageSize,X.data.total))).replace(`{{total}}`,String(X.data.total))}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:X.data.page<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:(0,W.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:X.data.page>=X.data.totalPages,onClick:()=>q(e=>Math.min(X.data.totalPages,e+1)),children:(0,W.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,W.jsx)(xe,{device:o,busy:f,onRename:async(e,t)=>{await z(e.id,t,e.settingsRevision??0);let n=await Y.mutate();c(n?.find(t=>t.id===e.id)??null)},onClose:()=>c(null),onRevoke:e=>{c(null),h(!1),d([e])}}),(0,W.jsx)(F,{open:u.length>0,title:u.length>1?t.removeManyTitle:t.removeTitle,description:`${u.length>1?t.removeManyDescription.replace(`{{count}}`,String(u.length)):t.removeDescription.replace(`{{name}}`,u[0]?.displayName??``)}${m?`\n\n${t.revokeError}`:``}`,confirmLabel:f?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void He(),onCancel:()=>{f||d([])}})]})}export{X as EndpointToolsManagementSettings};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./activity-YogQEteU.js";import{t as _}from"./chevron-left-DqFhpbvK.js";import{t as v}from"./chevron-right-BweFrslA.js";import{n as y,r as b,t as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./laptop-CI3hBVrl.js";import{n as C,t as ee}from"./shield-off-2jsucUds.js";import{t as w}from"./plus-Q2yW6OE7.js";import{t as T}from"./search-DA7gz22f.js";import{t as E}from"./smartphone-DSSsQFqA.js";import{t as te}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-DzdOeGYz.js";import{s as k}from"./session-api-CkOliupg.js";import{i as A,o as j}from"./vendor-swr-CdRzEUwF.js";import{t as M}from"./button-Cc4hUNTt.js";import{i as ne,o as N}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as P}from"./page-tabs-oeTY7z3_.js";import{t as F}from"./confirm-dialog-DrA5mTQp.js";import{t as I}from"./refresh-button-DiWdGAaX.js";import{n as L}from"./index.module-Cd9ENXfk.js";import{n as R}from"./settings-loading-skeleton-CAoOV17i.js";import{a as z,i as B,n as re,o as ie,r as ae,t as oe}from"./management-api-DG-yZnHK.js";import{n as se,t as ce}from"./settings-page-header-B9Y_eGcH.js";import{t as le}from"./settings-page-layout-D1MgJ5zP.js";import{t as V}from"./device-pairing-wizard-eWeHH6Ru.js";var H=n(),U=e(t(),1),W=r();function ue({operationId:e,zh:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(``);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:n,onClick:async()=>{r(!0);try{let n=(await c(o(`/api/endpoint-tools/provider-operations/${encodeURIComponent(e)}`))).payload.receipt?.state;a(n===`succeeded`?t?`设备报告已完成,Gateway 未收到结果。`:`Device reported completion. Gateway did not receive the result.`:n===`running`?t?`设备仍在执行。`:`Device is still running.`:t?`设备未确认结果。`:`Device has not confirmed the outcome.`)}catch{a(t?`暂时无法核对设备状态。`:`Unable to check device status.`)}finally{r(!1)}},children:n?t?`核对中…`:`Checking…`:t?`核对设备状态`:`Check device status`}),i?(0,W.jsx)(`p`,{role:`status`,className:`text-right text-xs text-fg-muted`,children:i}):null]})}async function de(e=`GET`,t,n){let r=await a(o(`/api/endpoint-tools/target-authorizations`+(n?`/`+encodeURIComponent(n):``)),{method:e,...t?{body:JSON.stringify(t)}:{}});if(!r.ok)throw Error(r.status===403?`owner`:`unavailable`);return(await r.json()).payload}function fe({devices:e,zh:t}){let n=A(`device-single-call-grants`,()=>de(),{refreshInterval:5e3,shouldRetryOnError:!1}),r=A(n.error?null:`device-grant-conversations`,()=>k({limit:100}),{shouldRetryOnError:!1}),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(`weather`),[f,p]=(0,U.useState)(`approximate`),[m,h]=(0,U.useState)(`restaurant`),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1);if(n.error)return null;let b=e.flatMap(e=>e.endpoints.map(t=>({...t,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))),S=b.find(e=>e.endpointId===c)?.tools.find(e=>e.descriptor.name.endsWith(`.device.get_location`))?.descriptor.name,C=async()=>{if(!(!S||!i||!o)){_(!0),y(!1);try{await de(`POST`,{conversationId:i,requestorPrincipalId:o,targetEndpointId:c,toolName:S,arguments:{purpose:u,precision:f,...u===`nearby`?{category:m}:{}}}),await n.mutate()}catch{y(!0)}finally{_(!1)}}};return(0,W.jsxs)(`section`,{className:`mb-5 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,W.jsx)(`h3`,{className:`font-semibold text-fg`,children:t?`跨设备单次授权`:`Single-call device authorization`}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t?`为指定会话和来源设备授权一次定位查询,60 秒后失效。目标设备仍需确认;授权后请在来源设备继续请求。`:`Authorize one location query for a conversation and source device. Expires in 60 seconds; target-device consent is still required. Continue the request from the source device.`}),n.isLoading||r.isLoading?(0,W.jsx)(O,{className:`mt-3 h-28`}):(0,W.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,W.jsx)(x,{value:i,onChange:a,placeholder:t?`选择会话`:`Conversation`,ariaLabel:t?`会话`:`Conversation`,options:(r.data?.items??[]).map(e=>({value:e.key,label:e.name||e.key}))}),(0,W.jsx)(x,{value:o,onChange:s,placeholder:t?`消息来源设备`:`Source device`,ariaLabel:t?`消息来源设备`:`Source device`,options:e.filter(e=>e.endpoints.length>0).map(e=>({value:e.id,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))}),(0,W.jsx)(x,{value:c,onChange:l,placeholder:t?`使用哪台设备的位置`:`Location device`,ariaLabel:t?`目标设备`:`Target device`,options:b.filter(e=>e.tools.some(e=>e.descriptor.name.endsWith(`.device.get_location`))).map(e=>({value:e.endpointId,label:e.label}))}),(0,W.jsx)(x,{placeholder:t?`用途`:`Purpose`,value:u,onChange:e=>d(e),ariaLabel:t?`用途`:`Purpose`,options:[{value:`weather`,label:t?`查询天气`:`Weather`},{value:`nearby`,label:t?`附近地点`:`Nearby places`}],allowEmpty:!1}),(0,W.jsx)(x,{placeholder:t?`精度`:`Precision`,value:f,onChange:e=>p(e),ariaLabel:t?`精度`:`Precision`,options:[{value:`approximate`,label:t?`大致位置`:`Approximate`},{value:`precise`,label:t?`精确位置`:`Precise`}],allowEmpty:!1}),u===`nearby`?(0,W.jsx)(x,{placeholder:t?`地点类型`:`Category`,value:m,onChange:h,ariaLabel:t?`附近地点类型`:`Place category`,options:[`restaurant`,`cafe`,`pharmacy`,`park`].map((e,n)=>({value:e,label:t?[`餐厅`,`咖啡馆`,`药店`,`公园`][n]:e})),allowEmpty:!1}):null,(0,W.jsx)(M,{variant:`primary`,disabled:g||!i||!o||!S,onClick:()=>void C(),children:t?`允许一次`:`Allow once`})]}),v?(0,W.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-fg-muted`,children:t?`授权失败,请检查设备连接后重试。`:`Authorization failed. Check the device connection.`}):null,(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:n.data?.map(r=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-fg-muted`,children:[(0,W.jsxs)(`span`,{children:[e.find(e=>e.endpoints.some(e=>e.endpointId===r.targetEndpointId))?.displayName??(t?`设备`:`Device`),` · `,r.state===`running`?t?`执行中`:`Running`:t?`等待本次调用`:`Awaiting one call`]}),(0,W.jsx)(M,{disabled:g,onClick:()=>{_(!0),de(`DELETE`,void 0,r.id).then(()=>n.mutate()).catch(()=>y(!0)).finally(()=>_(!1))},children:t?`撤销`:`Revoke`})]},r.id))})]})}var pe={ready:[`可用`,`Ready`],offline:[`离线`,`Offline`],authorization_required:[`等待批准`,`Approval required`],needs_foreground:[`需要设备前台运行`,`Foreground required`],permission_missing:[`缺少设备权限`,`Device permission required`],resource_busy:[`资源占用中`,`Resource busy`],unavailable:[`暂不可用`,`Unavailable`]};function me({principalId:e,zh:t}){let n=o(`/api/endpoint-tools/providers`),{data:r,error:i,mutate:a}=A(`${n}?principalId=${encodeURIComponent(e)}`,e=>c(e),{refreshInterval:15e3}),[s,l]=(0,U.useState)(),[u,d]=(0,U.useState)(!1),f=r?.payload.filter(t=>t.principalId===e),p=async t=>{l(t.provider.localId),d(!1);try{await c(n+`/admission`,{method:`POST`,body:JSON.stringify({principalId:e,localId:t.provider.localId,expectedDigest:t.digest,allowed:!t.admitted})}),await a()}catch{d(!0),await a()}finally{l(void 0)}};return(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`设备能力`:`Device capabilities`}),!r&&!i?(0,W.jsx)(O,{className:`h-24 w-full rounded-xl`}):null,i||u?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`能力信息更新失败,请刷新后重试。`:`Unable to update capabilities. Refresh and retry.`}):null,f?.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`此设备尚未上报扩展能力。`:`No additional capabilities reported.`}):null,f?.map(e=>(0,W.jsxs)(`article`,{className:`space-y-2 rounded-xl border border-edge-subtle p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,W.jsx)(`h4`,{className:`break-words text-sm font-medium text-fg`,children:e.provider.title}),(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:(pe[e.status]??pe.unavailable)[+!t]})]}),(0,W.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.provider.summary}),(0,W.jsxs)(`details`,{className:`text-xs text-fg-subtle`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer`,children:t?`${e.provider.tools.length} 项能力及权限`:`${e.provider.tools.length} tools and permissions`}),(0,W.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.provider.tools.map(e=>(0,W.jsxs)(`li`,{className:`break-words`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg`,children:e.title}),(0,W.jsx)(`p`,{children:e.description}),(0,W.jsxs)(`p`,{children:[e.effect,` · `,e.sensitivity,` · `,e.confirmation===`always`?t?`每次确认`:`Confirm each call`:t?`按批准范围执行`:`Approved scope`,e.requiredPermissions.length?` · ${e.requiredPermissions.join(`, `)}`:``]})]},e.name))})]}),(0,W.jsx)(M,{variant:`secondary`,disabled:s!==void 0,onClick:()=>void p(e),children:s===e.provider.localId?t?`保存中…`:`Saving…`:e.admitted?t?`撤销能力批准`:`Revoke approval`:t?`批准这些能力`:`Approve capabilities`})]},e.provider.localId))]})}var he=720*60*60*1e3;function ge(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function G(e){return ge(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function _e(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ve(e,t=Date.now()){return G(e)===`offline`&&(e.lastSeenAt??e.createdAt)<t-he}function ye(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=G(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ve(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function be(e){return e.length>8?e.slice(-8):e}function xe(e){let t=(0,H.c)(61),{device:n,busy:r,onClose:i,onRevoke:a,onRename:o}=e,c=s(Se),g;t[0]===c?g=t[1]:(g=l(c),t[0]=c,t[1]=g);let _=g.endpointToolsSettings,v=c===`zh`?`zh-CN`:`en`,y;t[2]===v?y=t[3]:(y=new Intl.DateTimeFormat(v,{dateStyle:`medium`,timeStyle:`short`}),t[2]=v,t[3]=y);let b=y,x;t[4]===n?x=t[5]:(x=n?G(n):`offline`,t[4]=n,t[5]=x);let S=x,C=n!==null,w;t[6]===i?w=t[7]:(w=e=>!e&&i(),t[6]=i,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,W.jsx)(u,{className:D(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=D(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,ne),t[9]=E):E=t[9];let O=n?.displayName??_.deviceDetails,k;t[10]===O?k=t[11]:(k=(0,W.jsx)(m,{className:`truncate text-base font-semibold text-fg`,children:O}),t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=n?(0,W.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,be(n.id)]}):null,t[12]=n,t[13]=A);let j;t[14]!==k||t[15]!==A?(j=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[14]=k,t[15]=A,t[16]=j):j=t[16];let P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,W.jsx)(te,{className:`size-5`,"aria-hidden":!0}),t[17]=P):P=t[17];let F;t[18]===_.close?F=t[19]:(F=(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(M,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":_.close,children:P})}),t[18]=_.close,t[19]=F);let I;t[20]!==j||t[21]!==F?(I=(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[j,F]}),t[20]=j,t[21]=F,t[22]=I):I=t[22];let L;t[23]!==_.accessActive||t[24]!==_.accessRevoked||t[25]!==_.accessTitle||t[26]!==_.createdAt||t[27]!==_.endpointCount||t[28]!==_.endpointsTitle||t[29]!==_.identityId||t[30]!==_.identityTitle||t[31]!==_.lastSeen||t[32]!==_.never||t[33]!==_.noAccessIdentity||t[34]!==_.noOnlineEndpoints||t[35]!==_.noPermissions||t[36]!==_.permissions||t[37]!==_.status||t[38]!==_.statusLabel||t[39]!==_.toolCount||t[40]!==n||t[41]!==b||t[42]!==c||t[43]!==o||t[44]!==S?(L=n?(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[n.principal&&S!==`revoked`&&o?(0,W.jsx)(Ce,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,W.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,W.jsx)(K,{label:_.statusLabel,value:_.status[S]}),(0,W.jsx)(K,{label:_.lastSeen,value:n.lastSeenAt?b.format(n.lastSeenAt):_.never}),(0,W.jsx)(K,{label:_.endpointCount,value:String(n.endpoints.length)}),(0,W.jsx)(K,{label:_.toolCount,value:String(_e(n))})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.accessTitle}),(0,W.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:n.access.revokedAt?_.accessRevoked:_.accessActive}),(0,W.jsx)(`p`,{className:`mt-1`,children:n.access.requestProofVersion===1?c===`zh`?`设备请求签名已启用`:`Device request signing enabled`:c===`zh`?`请求签名未启用,设备不可用`:`Request signing is missing; device unavailable`}),(0,W.jsxs)(`p`,{className:`mt-1 break-words`,children:[_.permissions,`: `,n.access.scopes.join(`, `)||_.noPermissions]})]}):(0,W.jsx)(`p`,{children:_.noAccessIdentity})})]}),n.principal&&S!==`revoked`?(0,W.jsx)(me,{principalId:n.id,zh:c===`zh`},n.id):null,n.access&&!n.access.revokedAt&&[`ios`,`android`,`harmonyos`].includes(n.platform??``)?(0,W.jsx)(we,{device:n,zh:c===`zh`},n.id):null,(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.endpointsTitle}),(0,W.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,W.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,W.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,W.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[_.status[e.availability],` · v`,e.appVersion]})]}),(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,W.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.title}),(0,W.jsxs)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:[t.requiresForeground?c===`zh`?`需要设备在前台 · `:`Requires foreground · `:``,t.confirmation===`always`?c===`zh`?`每次确认`:`Confirm each time`:c===`zh`?`按已授权范围调用`:`Uses the authorized scope`]})]},t.name)})})]},e.connectionId))]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.identityTitle}),n.principal&&S!==`revoked`&&o?(0,W.jsx)(Ce,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,W.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,W.jsx)(K,{label:_.identityId,value:n.id,breakAll:!0}),(0,W.jsx)(`div`,{className:`mt-3`,children:(0,W.jsx)(K,{label:_.createdAt,value:b.format(n.createdAt)})})]})]})]}):null,t[23]=_.accessActive,t[24]=_.accessRevoked,t[25]=_.accessTitle,t[26]=_.createdAt,t[27]=_.endpointCount,t[28]=_.endpointsTitle,t[29]=_.identityId,t[30]=_.identityTitle,t[31]=_.lastSeen,t[32]=_.never,t[33]=_.noAccessIdentity,t[34]=_.noOnlineEndpoints,t[35]=_.noPermissions,t[36]=_.permissions,t[37]=_.status,t[38]=_.statusLabel,t[39]=_.toolCount,t[40]=n,t[41]=b,t[42]=c,t[43]=o,t[44]=S,t[45]=L):L=t[45];let R;t[46]!==r||t[47]!==_.removeDevice||t[48]!==_.revoking||t[49]!==n||t[50]!==a||t[51]!==S?(R=n&&S!==`revoked`?(0,W.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,W.jsxs)(M,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,W.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r?_.revoking:_.removeDevice]})}):null,t[46]=r,t[47]=_.removeDevice,t[48]=_.revoking,t[49]=n,t[50]=a,t[51]=S,t[52]=R):R=t[52];let z;t[53]!==I||t[54]!==L||t[55]!==R?(z=(0,W.jsxs)(f,{children:[T,(0,W.jsxs)(p,{className:E,"aria-describedby":void 0,children:[I,L,R]})]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z):z=t[56];let B;return t[57]!==z||t[58]!==C||t[59]!==w?(B=(0,W.jsx)(h,{open:C,onOpenChange:w,children:z}),t[57]=z,t[58]=C,t[59]=w,t[60]=B):B=t[60],B}function Se(e){return e.language}function K(e){let t=(0,H.c)(10),{label:n,value:r,breakAll:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=D(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,W.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Ce({device:e,zh:t,onRename:n}){let[r,i]=(0,U.useState)(e.displayName),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`form`,{className:`space-y-2`,onSubmit:async t=>{if(t.preventDefault(),!(a||!r.trim())){o(!0),c(!1);try{await n(e,r.trim())}catch{c(!0)}finally{o(!1)}}},children:[(0,W.jsxs)(`label`,{className:`block text-sm text-fg`,children:[t?`设备名称`:`Device name`,(0,W.jsx)(`input`,{value:r,maxLength:80,onChange:e=>i(e.target.value),className:`mt-2 h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-fg`})]}),(0,W.jsx)(M,{type:`submit`,variant:`secondary`,disabled:a||!r.trim()||r.trim()===e.displayName,children:a?t?`保存中…`:`Saving…`:t?`保存名称`:`Save name`}),s?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`保存失败,请刷新设备信息后重试。`:`Unable to save. Refresh device information and retry.`}):null]})}function we({device:e,zh:t}){let n=e.access?.scopes.includes(`phone.control`)?`control`:e.access?.scopes.includes(`phone.view`)?`view`:`none`,[r,i]=(0,U.useState)(n),[a,s]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1);return(0,U.useEffect)(()=>i(n),[n]),(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`云手机访问`:`Cloud phone access`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`移动端配对后默认可查看并接管。可在此关闭,或撤销整个设备的授权。`:`Mobile pairing includes viewing and control by default. Disable it here or revoke the device entirely.`}),(0,W.jsxs)(y,{value:r,disabled:a,onChange:async t=>{let n=t.target.value;s(!0),u(!1);try{await c(o(`/api/phone/device-access/${encodeURIComponent(e.id)}`),{method:`PATCH`,body:JSON.stringify({access:n})}),i(n),await j(o(`/api/endpoint-tools/devices`))}catch{u(!0)}finally{s(!1)}},children:[(0,W.jsx)(b,{value:`none`,children:t?`不允许`:`Not allowed`}),(0,W.jsx)(b,{value:`view`,children:t?`仅查看`:`View only`}),(0,W.jsx)(b,{value:`control`,children:t?`查看并接管`:`View and control`})]}),l?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`授权保存失败,请重试。`:`Unable to save phone access.`}):null]})}function Te(e){let t=(0,H.c)(19),{onPaired:n}=e,[r,a]=i(),o=s(Ee),c;t[0]===o?c=t[1]:(c=l(o),t[0]=o,t[1]=c);let u=c.endpointToolsSettings.deviceAccess,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={open:!1},t[2]=d):d=t[2];let[f,p]=(0,U.useState)(d),m,h;t[3]!==r||t[4]!==a?(m=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(p({open:!0,target:e}),a(q,{replace:!0}))},h=[r,a],t[3]=r,t[4]=a,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,U.useEffect)(m,h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p({open:!0}),_=(0,W.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;t[9]===u.addDevice?v=t[10]:(v=(0,W.jsxs)(M,{variant:`primary`,onClick:g,children:[_,u.addDevice]}),t[9]=u.addDevice,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>p(t=>({...t,open:e})),t[11]=y):y=t[11];let b;t[12]!==f.open||t[13]!==f.target||t[14]!==n?(b=(0,W.jsx)(V,{open:f.open,onOpenChange:y,onPaired:n,targetKind:f.target}),t[12]=f.open,t[13]=f.target,t[14]=n,t[15]=b):b=t[15];let x;return t[16]!==v||t[17]!==b?(x=(0,W.jsxs)(W.Fragment,{children:[v,b]}),t[16]=v,t[17]=b,t[18]=x):x=t[18],x}function q(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function Ee(e){return e.language}var De=5e3,J=20,Oe=20;function Y(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function ke(e){let t=(0,H.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=D(`rounded-full px-2 py-0.5 text-xs font-medium`,Y(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,W.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function X(){let e=s(e=>e.language),t=l(e).endpointToolsSettings,[n,r]=i(),a=n.get(`view`)===`activity`?`activity`:`devices`,[o,c]=(0,U.useState)(null),[u,d]=(0,U.useState)([]),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[y,b]=(0,U.useState)(``),[w,te]=(0,U.useState)(`active`),[O,k]=(0,U.useState)(``),[j,ne]=(0,U.useState)(1),[N,V]=(0,U.useState)(()=>new Set),[H,de]=(0,U.useState)(``),[pe]=L(H,250),[me,he]=(0,U.useState)(``),[ge,Se]=(0,U.useState)(``),[K,Ce]=(0,U.useState)(``),[we,q]=(0,U.useState)(1),Ee={page:we,pageSize:Oe,query:pe,principalId:me,status:ge,effect:K},Y=A(B(),ae,{refreshInterval:De}),X=A(a===`activity`?oe(Ee):null,()=>re(Ee),{refreshInterval:De,keepPreviousData:!0}),Ae=(0,U.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(Y.isLoading&&!Y.data)return(0,W.jsx)(se,{children:(0,W.jsx)(R,{sections:2})});let Z=Y.data??[],je=X.data?.items??[],Me=Z.filter(e=>G(e)===`online`).length,Ne=Z.filter(e=>G(e)!==`revoked`).length,Pe=Z.filter(e=>ve(e)).length,Fe=[...new Set(Z.map(e=>e.platform))].toSorted(),Q=ye(Z,{query:y,status:w,platform:O}),Ie=Math.max(1,Math.ceil(Q.length/J)),$=Math.min(j,Ie),Le=Q.slice(($-1)*J,$*J),Re=Le.reduce((e,t)=>(G(t)!==`revoked`&&e.push(t.id),e),[]),ze=Re.length>0&&Re.every(e=>N.has(e)),Be=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Ve=async()=>{await Promise.all([Y.mutate(),a===`activity`?X.mutate():Promise.resolve()])},He=async()=>{if(!(u.length===0||f)){p(!0),h(!1);try{await ie(u.map(e=>e.id)),d([]),V(new Set),await Y.mutate()}catch{h(!0)}finally{p(!1)}}},Ue=e=>{e(),ne(1),V(new Set)};return(0,W.jsxs)(se,{children:[(0,W.jsx)(ce,{title:t.title,subtitle:t.subtitle,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Ve}),(0,W.jsx)(Te,{onPaired:()=>void Y.mutate()})]})}),Y.error||X.error?(0,W.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,W.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:Ne,filter:`active`},{label:t.onlineDevices,value:Me,filter:`online`},{label:t.staleDevices,value:Pe,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,W.jsxs)(`button`,{type:`button`,className:D(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":w===n,onClick:()=>{Ue(()=>te(n)),Be(`devices`)},children:[(0,W.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,W.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,W.jsx)(P,{items:[{id:`devices`,label:t.devicesTab,icon:C,count:Ne},{id:`activity`,label:t.activityTab,icon:g,count:X.data?.total}],activeTab:a,onChange:Be,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,W.jsxs)(le,{id:`devices`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,W.jsx)(fe,{devices:Z,zh:e===`zh`}),(0,W.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,W.jsxs)(`label`,{className:`relative block`,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,W.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:y,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>Ue(()=>b(e.target.value))})]}),(0,W.jsx)(x,{value:w,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>Ue(()=>te(e))}),(0,W.jsx)(x,{value:O,options:Fe.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>Ue(()=>k(e))})]}),N.size>0?(0,W.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(N.size))}),(0,W.jsxs)(M,{variant:`secondary`,className:`text-danger`,onClick:()=>{h(!1),d(Z.filter(e=>N.has(e.id)))},children:[(0,W.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Z.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Q.length===0?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,W.jsxs)(`label`,{className:D(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Re.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,W.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:ze,disabled:Re.length===0,className:`size-4 accent-accent`,onChange:e=>{V(t=>{let n=new Set(t);for(let t of Re)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,W.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Le.map(e=>{let n=G(e),r=e.kind===`mobile`?E:S;return(0,W.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`label`,{className:D(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,W.jsx)(`input`,{type:`checkbox`,checked:N.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{V(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,W.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,W.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,W.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,W.jsx)(ke,{status:n,label:t.status[n]})]}),(0,W.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,be(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Ae.format(e.lastSeenAt):t.never]})]}),(0,W.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(_e(e)))}),(0,W.jsx)(v,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String(($-1)*J+1)).replace(`{{to}}`,String(Math.min($*J,Q.length))).replace(`{{total}}`,String(Q.length))}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:$<=1,onClick:()=>ne(e=>Math.max(1,e-1)),children:(0,W.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:$>=Ie,onClick:()=>ne(e=>Math.min(Ie,e+1)),children:(0,W.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,W.jsxs)(le,{id:`activity`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,W.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,W.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,W.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,W.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:H,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{de(e.target.value),q(1)}})]}),(0,W.jsx)(x,{value:me,options:Z.map(e=>({value:e.id,label:`${e.displayName} · ${be(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{he(e),q(1)}}),(0,W.jsx)(x,{value:ge,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Se(e),q(1)}}),(0,W.jsx)(x,{value:K,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Ce(e),q(1)}})]}),X.isLoading&&!X.data?(0,W.jsx)(R,{sections:1}):null,je.length===0&&!X.isLoading?(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,W.jsx)(`div`,{className:`space-y-2`,children:je.map(n=>(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:n.toolName}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Ae.format(n.startedAt),` · `,t.effects[n.effect],` · `,n.endpointId]}),n.errorMessage?(0,W.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:n.errorMessage}):null]}),(0,W.jsxs)(`div`,{className:`flex max-w-xs flex-col items-end gap-1`,children:[(0,W.jsx)(ke,{status:n.status,label:n.errorCode===`OUTCOME_UNKNOWN`?e===`zh`?`结果未知`:`Outcome unknown`:t.status[n.status]}),n.operationId&&n.toolName.startsWith(`provider_`)&&n.errorCode===`OUTCOME_UNKNOWN`?(0,W.jsx)(ue,{operationId:n.operationId,zh:e===`zh`}):null]})]},n.id))}),X.data&&X.data.total>0?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((X.data.page-1)*X.data.pageSize+1)).replace(`{{to}}`,String(Math.min(X.data.page*X.data.pageSize,X.data.total))).replace(`{{total}}`,String(X.data.total))}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:X.data.page<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:(0,W.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,W.jsx)(M,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:X.data.page>=X.data.totalPages,onClick:()=>q(e=>Math.min(X.data.totalPages,e+1)),children:(0,W.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,W.jsx)(xe,{device:o,busy:f,onRename:async(e,t)=>{await z(e.id,t,e.settingsRevision??0);let n=await Y.mutate();c(n?.find(t=>t.id===e.id)??null)},onClose:()=>c(null),onRevoke:e=>{c(null),h(!1),d([e])}}),(0,W.jsx)(F,{open:u.length>0,title:u.length>1?t.removeManyTitle:t.removeTitle,description:`${u.length>1?t.removeManyDescription.replace(`{{count}}`,String(u.length)):t.removeDescription.replace(`{{name}}`,u[0]?.displayName??``)}${m?`\n\n${t.revokeError}`:``}`,confirmLabel:f?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void He(),onCancel:()=>{f||d([])}})]})}export{X as EndpointToolsManagementSettings};
|