@xopcai/xopc 0.0.386 → 0.0.388
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 +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D-86VOlb.js → agent-avatar-dicebear-44LqtGte.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-SmeUVHY8.js → agent-defaults-settings-panel-2VA4eKPf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BVT3wXq5.js → agent-plugin-dialog-DRhTOw_O.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-D7rLQFhX.js → agents-BemUH_Yf.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CUR7n5iP.js → app-management-settings-panel-CR_cc7rj.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BCotSGep.js → appearance-settings-CYofu-su.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-hk0bo9LT.js → apps-page-CHjWvDjk.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CqxuUwox.js → automations-page-BIF0skon.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-11_Z69pr.js → automations-workspace-DOwtT4sS.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-eldB84Mj.js → block-editor-C_RD603p.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D4TaUPYT.js → browser-automations-page-B-Ezk_8l.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BXRlxeGV.js → browser-settings-page-BSmmTBn4.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-DVj9n65C.js → capabilities-BX1rCiVm.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BkKgImWi.js → capabilities-CW389yo6.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CyYlueEd.js → capabilities-page-xZgTYYDn.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-uVEgfvo0.js → capabilities-settings-panel-oqkuOjcR.js} +3 -3
- package/dist/gateway/static/root/assets/{capability-header-actions-BXv0xu56.js → capability-header-actions-Chuhscdb.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-fNb3SOzm.js → channels-Dq2C2k9M.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CnLtparQ.js → chat-terminal-dock-srB_M-aQ.js} +1 -1
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-xM0AnOlP.js → computer-settings-page-Af00Kjc0.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CdG2WUb6.js → connector-service-page-3W0_7-4L.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BRd08GH6.js → connectors-page-BZk-Gou5.js} +1 -1
- package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-DIBbE-O8.js → date-picker-DBgZBmik.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DDD8zokD.js → dependency-picker-BDJ406kH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-KlF390Xn.js → desktop-pet-Do1XPn6U.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CgqQMKDC.js → desktop-pet-settings-LKeVh6OH.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BR6isfG2.js → device-pairing-wizard-CvZpnSVw.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-vPQsW05P.js → directory-picker-path-field-BMLHoL6g.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-ZHLPrLbH.js → extension-debug-page-B0wTBCx4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DJ42KFRN.js → extension-page-vR2r4uUB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-6IcsyNaV.js → extension-provider-CJZ5EVpQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D7-5v0V4.js → extension-settings-page-1tbWe5xQ.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-DnYn7qOV.js → fallback-models-CW6a1-GK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Bwe3JWX-.js → gateway-settings-vQWTUx2c.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DefTxF3q.js → highlighted-body-KQOG7T2V-BM__yiMn.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-hfWuVtcG.js +2 -0
- package/dist/gateway/static/root/assets/{imports-page-CTdBYZib.js → imports-page-CuR6RSUM.js} +1 -1
- package/dist/gateway/static/root/assets/index-CNH8vwcY.js +260 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CXKp57O_.js → keyboard-shortcuts-settings-DpyqH2cP.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DzD_OzGY.js → local-app-workbench-page-B4hIoxV8.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-B0E0vttg.js → local-apps-page-S7lUpENM.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
- package/dist/gateway/static/root/assets/{logs-page-eL4fYcMl.js → logs-page-CSlZT1-L.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DSpjodMC.js → management-settings-BYCL5CwV.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-i9N5shss.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CsY5tQp5.js → note-detail-panel-CJ5Earr_.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-D09LjNoj.js → notes-page-CPGk8-n1.js} +5 -5
- package/dist/gateway/static/root/assets/{page-context-capture-button-DO-aP3D9.js → page-context-capture-button-C2bSXVbz.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-E8F2aGNB.js → personal-page-BjTt5R3s.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-Cn16lm5l.js +1 -0
- package/dist/gateway/static/root/assets/{product-preview-content-B-cz-pIV.js → product-preview-content-CowgeuoG.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-WhefAh8E.js → project-detail-page-CyKx4PyN.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CyqAs0tO.js → projects-page--_hXxUMC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BwhRGL6m.js → remote-access-hub-Bq_eqQYf.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-o26dmPNq.js → runtime-tools-settings-panel-BgCATci5.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-D_e19kv_.js → scenes-page-DxE3jRPR.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DLLdqUC3.js → schema-form-I6pzJJzg.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-2I-nFJcE.js → send-session-input-C293-Hbx.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-Co5ozD0l.js → session-manager-COd9RECl.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-DX6INsiS.js → sessions-page-CQkGFnJM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Dtlsvsci.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-Bc_zxxRu.js → settings-page-Dy5oQDbx.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-FpF_cPPr.js → setup-status-panel-CrAazq4r.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BOCcPBqQ.js → share-preview-page-BF2WaO43.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CInxjxgJ.js → shares-settings-BNMhs-Vd.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-Bjd8WAA4.js → skill-api-RIjxQs-Y.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-8CKS3Oo2.js → skills-page-XVOxILQn.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BgQdsrNw.js → system-settings-panel-C8aLy8T_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BnG5ehZ6.js → task-detail-page-o1O2IDVP.js} +2 -2
- package/dist/gateway/static/root/assets/{task-expandable-content-BCuc70Vc.js → task-expandable-content-C9ohICpw.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CY7MoDGf.js → tunnel-api-JkDu1wiC.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-s8Sv_PIG.js → usage-page-B8K6Y4ro.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-D0S2iZF4.js → use-composer-attachments-rgW7h4sD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BElqELib.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CyWrEtHY.js → user-model-page-C1QX47VR.js} +2 -2
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DmZXLs1v.js → work-discovery-overlay-BshsEDRO.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BdLOzHm4.js → workflow-run-setup-panel-CRG3paWy.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Cx3I3AV5.js → workflows-page-c-AoSVzm.js} +3 -3
- package/dist/gateway/static/root/assets/{workspace-api-Du7-xJ0q.js → workspace-api-JWHOFos6.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-D8B136vW.js → xopc-cloud-account-card-PDSIicr1.js} +1 -1
- package/dist/gateway/static/root/index.html +15 -15
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/result-reference.js +25 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
- package/dist/packages/gateway-contract/src/task-research-result.js +1 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
- package/dist/packages/gateway-contract/src/turn-outcome.js +1 -0
- package/dist/src/agent/agent-manager.js +16 -16
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +9 -9
- package/dist/src/agent/child-agent-factory.js +1 -1
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/context/coordinator.js +2 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -5
- package/dist/src/agent/embedded/run-turn.js +13 -13
- package/dist/src/agent/embedded/session-runner.js +3 -3
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
- package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
- package/dist/src/agent/external-tools/cliProvider.js +4 -4
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
- package/dist/src/agent/external-tools/gateway-tools.js +3 -3
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +4 -4
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/index.js +3 -3
- package/dist/src/agent/memory/context-budget.js +1 -1
- package/dist/src/agent/memory/context-recovery.js +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
- package/dist/src/agent/prompt/response-language.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +8 -4
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service/process-direct-streaming.js +7 -6
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +21 -21
- package/dist/src/agent/session/session-config-service.js +3 -3
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/source-context/index.js +2 -2
- package/dist/src/agent/source-context/result-context.d.ts +2 -0
- package/dist/src/agent/source-context/result-context.js +32 -0
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +7 -7
- package/dist/src/agent/tools/create-share-tool.js +3 -3
- package/dist/src/agent/tools/dataBatch.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/exec-command.js +47 -2
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +35 -28
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.js +6 -6
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/personal-attention-tool.js +2 -2
- package/dist/src/agent/tools/personal-performance.d.ts +2 -0
- package/dist/src/agent/tools/personal-performance.js +82 -0
- package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +3 -3
- package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
- package/dist/src/agent/tools/personal-result-tool.js +106 -0
- package/dist/src/agent/tools/personal-task-tool.d.ts +11 -1
- package/dist/src/agent/tools/personal-task-tool.js +110 -6
- package/dist/src/agent/tools/publish-artifacts.js +2 -2
- package/dist/src/agent/tools/read.js +2 -2
- package/dist/src/agent/tools/review-workspace.js +21 -2
- package/dist/src/agent/tools/send-media.js +2 -2
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +122 -3
- package/dist/src/agent/tools/task-evidence.d.ts +3 -0
- package/dist/src/agent/tools/task-evidence.js +71 -0
- package/dist/src/agent/tools/task-result-tool.js +24 -4
- package/dist/src/agent/tools/tool-media.js +1 -1
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +2 -2
- package/dist/src/agent/tools/xopc-use-tool.js +26 -5
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +2 -2
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/domain/index.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/capabilities/store-connector.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/builtins/config.js +4 -4
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/context.js +2 -2
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +7 -7
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/mcp.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +4 -4
- package/dist/src/cli/extension-cli-register.js +6 -6
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +5 -5
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/cli/runtime.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +4 -4
- package/dist/src/connectors/connected-source-understanding.js +4 -4
- package/dist/src/connectors/connection-recovery-service.js +5 -5
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +1 -1
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/runtime.js +2 -2
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/agent-plugins/auth.js +1 -1
- package/dist/src/extensions/agent-plugins/credentials.js +1 -1
- package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
- package/dist/src/extensions/api.js +4 -4
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +3 -3
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/device-routes.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -3
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +2 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
- package/dist/src/gateway/hono/routes/models.js +5 -5
- package/dist/src/gateway/hono/routes/notes.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +5 -5
- package/dist/src/gateway/hono/routes/sessions.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +2 -2
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +7 -7
- package/dist/src/gateway/hono/routes/voice.js +7 -7
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +3 -3
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +24 -5
- package/dist/src/gateway/service/session-command-service.js +2 -2
- package/dist/src/gateway/service/session-input-coordinator.js +2 -2
- package/dist/src/gateway/service.js +72 -41
- package/dist/src/gateway/session-context-summary.js +4 -4
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/compatibility.js +1 -1
- package/dist/src/imports/inventory.js +3 -3
- package/dist/src/imports/productImport.js +2 -2
- package/dist/src/imports/runtime.js +1 -1
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +9 -9
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -2
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/knowledge-memory/repository.js +1 -1
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/mcp/gateway-http-client.js +1 -1
- package/dist/src/media/session-references.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/memory-learning/source-learning.js +4 -4
- package/dist/src/memory-learning/task-receipts.js +1 -1
- package/dist/src/notes/agent-context.js +4 -4
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/communication.js +1 -0
- package/dist/src/personal-agent/performance.d.ts +83 -0
- package/dist/src/personal-agent/performance.js +65 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +1 -0
- package/dist/src/personal-agent/proactivity/routes.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +7 -7
- package/dist/src/personal-agent/prompt-context.js +9 -7
- package/dist/src/personal-agent/prompts.js +7 -4
- package/dist/src/personal-agent/reply-composer.js +86 -15
- package/dist/src/personal-agent/request-delivery.js +5 -3
- package/dist/src/personal-agent/request-service.js +5 -5
- package/dist/src/personal-agent/result-extraction.d.ts +42 -0
- package/dist/src/personal-agent/result-extraction.js +209 -0
- package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
- package/dist/src/personal-agent/result-read-continuations.js +78 -0
- package/dist/src/personal-agent/result-reader.d.ts +43 -0
- package/dist/src/personal-agent/result-reader.js +461 -0
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
- package/dist/src/scenes/taskFollowUp/resources.js +2 -2
- package/dist/src/scenes/taskFollowUp/service.js +6 -6
- package/dist/src/session/client-history.d.ts +1 -1
- package/dist/src/session/client-history.js +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-context-for-llm.js +2 -0
- package/dist/src/session/store.js +5 -5
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/hosted-session-share.js +2 -2
- package/dist/src/share/session-share-service.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +9 -9
- package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
- package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tasks/task-allocation-service.js +64 -13
- package/dist/src/tasks/task-application-service.d.ts +18 -0
- package/dist/src/tasks/task-application-service.js +135 -4
- package/dist/src/tasks/task-collaboration-delivery.js +1 -1
- package/dist/src/tasks/task-context-assembler.js +10 -7
- package/dist/src/tasks/task-contract-definition.d.ts +3 -0
- package/dist/src/tasks/task-contract-planner.js +50 -16
- package/dist/src/tasks/task-conversation-repository.js +1 -1
- package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
- package/dist/src/tasks/task-evidence-ranges.js +20 -0
- package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
- package/dist/src/tasks/task-execution-capabilities.js +117 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.d.ts +56 -0
- package/dist/src/tasks/task-handoff.js +510 -0
- package/dist/src/tasks/task-main-update-decision-service.js +3 -3
- package/dist/src/tasks/task-model-call.js +1 -1
- package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
- package/dist/src/tasks/task-read-model-projector.js +12 -1
- package/dist/src/tasks/task-research-repair.js +6 -2
- package/dist/src/tasks/task-research-result.d.ts +16 -2
- package/dist/src/tasks/task-research-result.js +126 -42
- package/dist/src/tasks/task-result-delivery-repository.js +27 -4
- package/dist/src/tasks/task-result-delivery-service.js +38 -10
- package/dist/src/tasks/task-run-coordinator.js +7 -5
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +3 -2
- package/dist/src/tui/backends/embedded-backend.js +13 -13
- package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +2 -2
- package/dist/src/tui/tui-commands.js +5 -5
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +4 -4
- package/dist/src/tui/tui.js +6 -6
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/access-policy.js +2 -2
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +7 -7
- package/dist/src/voice/realtime/runtime.js +4 -4
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/service.js +7 -7
- package/dist/src/workflows/context/workflow-context.js +1 -1
- package/dist/src/workflows/engine/workflow-engine.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +7 -7
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/constants-CpWu0oHS.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BtSy2hRV.js +0 -2
- package/dist/gateway/static/root/assets/index-B08iR7fT.js +0 -260
- package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BTrk2wWv.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-aUoA-uPw.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C4_gW1vw.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"./search-DA7gz22f.js";import{t as a}from"./button-aIC072nz.js";import{a as o,i as s,o as c,s as l}from"./dist-C3DSFZCi.js";import{U as u}from"./index-
|
|
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"./search-DA7gz22f.js";import{t as a}from"./button-aIC072nz.js";import{a as o,i as s,o as c,s as l}from"./dist-C3DSFZCi.js";import{U as u}from"./index-CNH8vwcY.js";var d=n(),f=e(t(),1),p=r(),m=(0,f.memo)(function(e){let t=(0,d.c)(8),{value:n,onChange:r,placeholder:a,ariaLabel:o}=e,s=o===void 0?a:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(i,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===r?l=t[2]:(l=e=>r(e.currentTarget.value),t[1]=r,t[2]=l);let u;return t[3]!==s||t[4]!==a||t[5]!==l||t[6]!==n?(u=(0,p.jsxs)(`label`,{className:`relative flex h-11 min-w-0 w-full cursor-text items-center rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-fg shadow-none focus-within:border-accent/60 focus-within:ring-2 focus-within:ring-accent/30 md:h-9`,children:[c,(0,p.jsx)(`input`,{type:`search`,"aria-label":s,enterKeyHint:`search`,value:n,onChange:l,placeholder:a,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent text-base leading-normal text-fg caret-current placeholder:text-fg-muted focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 md:text-sm`})]}),t[3]=s,t[4]=a,t[5]=l,t[6]=n,t[7]=u):u=t[7],u});function h(e){let t=(0,d.c)(8),{contribution:n}=e,r=u(`(min-width: 768px)`),f;t[0]!==n||t[1]!==r?(f=n?.search?r?(0,p.jsx)(`div`,{className:`min-w-0 max-w-60 flex-1`,children:n.search}):(0,p.jsxs)(c,{children:[(0,p.jsx)(l,{asChild:!0,children:(0,p.jsx)(a,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":n.searchLabel,title:n.searchLabel,children:(0,p.jsx)(i,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(o,{children:(0,p.jsx)(s,{align:`end`,sideOffset:8,className:`z-50 w-[min(20rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-panel p-2 shadow-popover`,children:n.search})})]}):null,t[0]=n,t[1]=r,t[2]=f):f=t[2];let m=n?.secondary,h=n?.primary,g=n?.overflow,_;return t[3]!==f||t[4]!==m||t[5]!==h||t[6]!==g?(_=(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 xl:w-[27rem] 2xl:w-[31rem]`,children:[f,m,h,g]}),t[3]=f,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7],_}export{m as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{s as a,t as o}from"./popover-select-DHC7J4lG.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./rotate-ccw-JM1TBLpp.js";import{t as f}from"./settings-2-D-csvaET.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./messages-DTqbfje6.js";import{t as h}from"./cn-0WouolD0.js";import{a as g,c as _,i as v,n as y,r as b}from"./locale-store-uRu_DsWm.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-aIC072nz.js";import{t as ee}from"./interaction-BdhHBbYa.js";import{t as A}from"./skeleton-BI5TyibZ.js";import{i as j,o as M}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$o as N,En as P,Mo as F,So as I,Tn as L,W as R,_i as z,bn as B,li as te,mi as ne,wn as re,zr as ie}from"./index-B08iR7fT.js";import{r as ae}from"./settings-page-layout-Dx5S-Msc.js";import{t as oe}from"./browser-BLJWD7WI.js";import{n as se}from"./settings-loading-skeleton-BTqvr_Fw.js";import{t as ce}from"./schema-form-DLLdqUC3.js";var V=e(t(),1),H=n();async function le(){return(await g(b(`/api/channels/status`))).payload?.channels||[]}function ue(){return b(`/api/channels/status`)}var de=le;function fe(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}var pe=e(oe(),1),U=r();async function W(e){let t=await v(b(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function G(e){return e?.type===`poll`&&e.phase===`done`}function K(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function q(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function J(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function me({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,V.useMemo)(()=>fe(e),[e]),o=(0,V.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[s,d]=(0,V.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,V.useEffect)(()=>{d({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let f=(0,V.useCallback)(async(n,i)=>{d(e=>({...e,busy:!0,error:null}));try{let a=await W({channelId:e.id,actionId:n,locale:t,input:i});d(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.conversationId?{actionId:a.statusAction,conversationId:a.conversationId,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){d(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,V.useEffect)(()=>{let t=q(s.payload,e.id);if(!t){d(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return d(e=>e.generatedQr?{...e,generatedQr:null}:e),pe.toDataURL(t,{width:220,margin:1}).then(e=>{n||d(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,s.payload]),(0,V.useEffect)(()=>{let n=s.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||W({channelId:e.id,actionId:n.actionId,locale:t,input:{conversationId:n.conversationId}}).then(async e=>{i||(d(t=>({...t,payload:e,poll:G(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),G(e)&&window.clearInterval(a))}).catch(e=>{i||d(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,s.poll]);let p=a?.[1].label??(e.configured?n.reconnect:n.connect),m=e.actions?.[`doctor.run`]?.label??n.diagnose,g=K(s.payload),_=q(s.payload,e.id),v=_?s.generatedQr:J(s.payload),y=a?.[1].result===`qr`&&(s.busy||s.payload?.type===`qr`||s.payload?.type===`poll`),b=s.payload?.type===`form`?s.payload:null,x=s.payload?.type===`diagnostics`?s.payload.checks:null;return(0,U.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:h(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,U.jsxs)(k,{type:`button`,variant:`primary`,disabled:s.busy,onClick:()=>void f(a[0]),children:[s.busy?(0,U.jsx)(u,{className:`size-4 animate-spin`}):(0,U.jsx)(N,{className:`size-4`}),p]}):null,e.actions?.[`doctor.run`]?(0,U.jsxs)(k,{type:`button`,variant:`secondary`,disabled:s.busy,onClick:()=>void f(`doctor.run`),children:[(0,U.jsx)(F,{className:`size-4`}),m]}):null]})]}),g?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:g}):null,s.error?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:s.error}):null,y?(0,U.jsxs)(`div`,{className:h(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base p-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,U.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:v?(0,U.jsx)(`img`,{src:v,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,U.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,U.jsx)(A,{className:`size-48 rounded-md`})})}),(0,U.jsxs)(`div`,{className:h(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[v?(0,U.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,U.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,U.jsx)(A,{className:`h-4 w-48 max-w-full`}),(0,U.jsx)(A,{className:`h-4 w-36 max-w-full`})]}),_?(0,U.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:_,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,U.jsx)(l,{className:`size-3.5`})]}):null]})]}):null,s.payload?.type===`poll`&&s.payload.phase===`done`?(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,U.jsx)(c,{className:s.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,U.jsx)(`span`,{className:s.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:s.payload.message??(s.payload.ok?n.complete:n.failed)})]}):null,b?(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(ce,{schema:b.schema,values:s.formDraft,onChange:e=>d(t=>({...t,formDraft:e})),disabled:s.busy,labels:o}),(0,U.jsx)(k,{type:`button`,variant:`primary`,disabled:s.busy,onClick:()=>void f(b.submitAction,s.formDraft),children:n.saveSetup})]}):null,x?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:x.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var he=40;function Y(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ge(e,t){return e.find(e=>e.id===Y(t))?.agentId?.trim().toLowerCase()??``}function _e(e,t,n){let r=Y(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:he,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function ve(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function ye(e,t,n){let r=ve(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function be(e,t=!1){return e===`drawer`?h(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,j):h(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,j,`rounded-2xl border border-edge bg-surface-overlay outline-none dark:border-edge`)}function xe(e){let t=(0,H.c)(33),{presentation:n,open:r,onOpenChange:i,title:o,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:m,headerExtra:g}=e,_=m===void 0?!1:m,v=n===`drawer`,[y,b]=(0,V.useState)(null),O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,U.jsx)(x,{className:h(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,M)}),t[0]=O):O=t[0];let A;t[1]!==n||t[2]!==_?(A=be(n,_),t[1]=n,t[2]=_,t[3]=A):A=t[3];let j;t[4]===c?j=t[5]:(j=c?(0,U.jsx)(E,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=j);let N;t[6]===l?N=t[7]:(N=l?(0,U.jsx)(S,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=N);let P;t[8]!==u||t[9]!==s||t[10]!==g||t[11]!==v||t[12]!==o?(P=v?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,U.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:o}):null,s?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(k,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,U.jsx)(p,{className:`size-5`,strokeWidth:1.75})})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:h(ee,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,U.jsx)(p,{className:`size-4`})})}),g]}),t[8]=u,t[9]=s,t[10]=g,t[11]=v,t[12]=o,t[13]=P):P=t[13];let F=v?`p-4`:`p-6`,I;t[14]===F?I=t[15]:(I=h(`min-h-0 flex-1 overflow-y-auto`,F),t[14]=F,t[15]=I);let L;t[16]!==d||t[17]!==I?(L=(0,U.jsx)(`div`,{className:I,children:d}),t[16]=d,t[17]=I,t[18]=L):L=t[18];let R;t[19]!==f||t[20]!==y||t[21]!==j||t[22]!==N||t[23]!==P||t[24]!==L?(R=(0,U.jsxs)(a,{layer:`modal`,portalContainer:y,children:[j,N,P,L,f]}),t[19]=f,t[20]=y,t[21]=j,t[22]=N,t[23]=P,t[24]=L,t[25]=R):R=t[25];let z;t[26]!==R||t[27]!==A?(z=(0,U.jsxs)(w,{children:[O,(0,U.jsx)(T,{ref:b,className:A,onOpenAutoFocus:Se,children:R})]}),t[26]=R,t[27]=A,t[28]=z):z=t[28];let B;return t[29]!==i||t[30]!==r||t[31]!==z?(B=(0,U.jsx)(D,{open:r,onOpenChange:i,children:z}),t[29]=i,t[30]=r,t[31]=z,t[32]=B):B=t[32],B}function Se(e){return e.preventDefault()}var Ce=(0,V.memo)(function(e){let t=(0,H.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,U.jsx)(te,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function we(e){let t=(0,H.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,U.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,U.jsx)(k,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,U.jsx)(k,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,U.jsx)(k,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,U.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,U.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}function Te(e){return b(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function Ee(e){return(await g(Te(e))).payload?.channels??[]}function De(e,t){let n=(0,H.c)(14),r;n[0]!==e||n[1]!==t?(r=e?Te(t):null,n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===t?i=n[4]:(i=()=>Ee(t),n[3]=t,n[4]=i);let a;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},n[5]=a):a=n[5];let{data:o,error:s,isLoading:c,isValidating:l,mutate:u}=O(r,i,a),d;n[6]===o?d=n[7]:(d=o??[],n[6]=o,n[7]=d);let f;return n[8]!==s||n[9]!==c||n[10]!==l||n[11]!==u||n[12]!==d?(f={entries:d,isLoading:c,isValidating:l,error:s,mutate:u},n[8]=s,n[9]=c,n[10]=l,n[11]=u,n[12]=d,n[13]=f):f=n[13],f}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,H.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,V.useEffect)(i,a)}function Me(e){return e?b(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await g(b(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`],Fe=`max-w-7xl`,Ie=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`;async function Le(){let e=await g(b(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Re(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function ze(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function X(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Be(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function Ve(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function He(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ue(e){if(!e)return[];let t=e.uiHints??{},n=Z(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=X(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=new Set([`dmPolicy`,`groupPolicy`,`allowFrom`,`groupAllowFrom`]),a=[...Object.keys(t).filter(e=>!e.includes(`*`)&&i.has(e.split(`.`).at(-1)??``)),...Object.keys(Z(e.configSchema?.properties)?e.configSchema.properties:{}).filter(e=>i.has(e))],o=Object.entries(t).filter(([,e])=>!Z(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...o,...a,...n,...r])).filter(e=>!Pe.includes(e))}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function We(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function Ge(e,t){let n={...We(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!Z(r)||!Z(r[n]))break;let o=Z(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...We(r[n]),properties:{}}),e===t.length-1){o[n]=We(r[n]);break}i=r[n],a=o[n]}}return n}function Ke(e){let t=e.properties;if(!Z(t))return!1;for(let[e,n]of Object.entries(t))Z(n)&&n.type===`object`&&Ke(n)&&delete t[e];return Object.keys(t).length===0}function qe(e,t){let n=We(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!Z(i))break;if(e===t.length-1){delete i[n];break}if(!Z(i[n]))break;r=i[n]}}return Ke(n),n}function Je(e){return e.type===`object`&&Z(e.properties)&&Object.keys(e.properties).length>0}function Q(e,t){let n=e;for(let e of t.split(`.`)){if(!Z(n))return;n=n[e]}return n}function Ye(e){let t=e.accounts;return Z(t)?Object.values(t).filter(e=>Z(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Xe(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ze(e,t,n){let r=[],i=X(e);if(i.issues.length>0&&r.push($(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Xe(e,Q(t,e),n);i&&r.push(i)}let a=Ye(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Qe(e,t){let n=X(e),r=fe(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function $e(e,t){let n=fe(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function et(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function $(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function tt({entry:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useMemo)(()=>!e.ui?.icon||t?null:new URL(b(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Re(e.ui.icon)}`)).toString(),[t,e.extensionId,e.ui?.icon]);return(0,U.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:r?(0,U.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>n(!0)}):(0,U.jsx)(z,{sourceChannel:e.id,className:`size-7`})})}function nt(e){let t=(0,H.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,o;t[0]===i?o=t[1]:(o=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=o);let s=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,c=r&&`cursor-not-allowed opacity-60`,l;t[2]!==s||t[3]!==c?(l=h(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,s,c),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=n?`translate-x-5`:`translate-x-0.5`,d;t[5]===u?d=t[6]:(d=h(`size-5 rounded-full bg-white shadow-surface transition-transform`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,U.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==l||t[14]!==f?(p=(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:o,className:l,children:f}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function rt(e){let t=(0,H.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:o,ch:s,onOpen:c,onToggle:l,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=X(n),t[0]=n,t[1]=f);let p=f,m,g,_,v,y,b,x;if(t[2]!==a||t[3]!==s||t[4]!==r||t[5]!==n||t[6]!==c||t[7]!==d||t[8]!==l||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ze(n,r,s),o=et(n,s);m=!p.enabled&&p.ready?l:i===`stopped`?d:c,b=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let u;t[19]===n?u=t[20]:(u=(0,U.jsx)(tt,{entry:n}),t[19]=n,t[20]=u);let f;t[21]===n.label?f=t[22]:(f=(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=f);let S;t[23]===i?S=t[24]:(S=h(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,He(i)),t[23]=i,t[24]=S);let C;t[25]!==s||t[26]!==i?(C=Be(i,s),t[25]=s,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,U.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==f?(T=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[f,w]}),t[31]=w,t[32]=f,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==u?(E=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[u,T]}),t[34]=T,t[35]=u,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==s.toggleChannel||t[38]!==n.label?(O=s.toggleChannel.replace(`{{channel}}`,n.label),t[37]=s.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==l||t[42]!==p.enabled||t[43]!==O?(k=(0,U.jsx)(nt,{checked:D,disabled:a,label:O,onToggle:l}),t[40]=a,t[41]=l,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(x=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=x):x=t[47],g=`button`,_=c,v=`mt-5 min-h-[6.25rem] text-left`,y=p.ready?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,U.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(at)}):null]}):(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:s.cardSetupTitle}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??$e(n,s)}),o.length>0?(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:o.map(it)}):null]}),t[2]=a,t[3]=s,t[4]=r,t[5]=n,t[6]=c,t[7]=d,t[8]=l,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else m=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[48]!==g||t[49]!==_||t[50]!==v||t[51]!==y?(S=(0,U.jsx)(`button`,{type:g,onClick:_,className:v,children:y}),t[48]=g,t[49]=_,t[50]=v,t[51]=y,t[52]=S):S=t[52];let C=a||o,w;t[53]!==a||t[54]!==o?(w=a||o?(0,U.jsx)(u,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=o,t[55]=w):w=t[55];let T;t[56]!==s||t[57]!==n||t[58]!==o||t[59]!==i?(T=o?s.restartingChannel:i===`stopped`?s.restartChannel:Qe(n,s),t[56]=s,t[57]=n,t[58]=o,t[59]=i,t[60]=T):T=t[60];let E;t[61]!==m||t[62]!==w||t[63]!==T||t[64]!==C?(E=(0,U.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,U.jsxs)(k,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:C,children:[w,T]})}),t[61]=m,t[62]=w,t[63]=T,t[64]=C,t[65]=E):E=t[65];let D;return t[66]!==E||t[67]!==b||t[68]!==x||t[69]!==S?(D=(0,U.jsxs)(`article`,{className:b,children:[x,S,E]}),t[66]=E,t[67]=b,t[68]=x,t[69]=S,t[70]=D):D=t[70],D}function it(e){return(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function at(e){return(0,U.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function ot(e){let t=(0,H.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:o,ch:l,onRestart:f,onCheck:p,onManageConnection:m}=e,g=n===`running`?c:n===`stopped`||n===`needs_setup`?s:u,_=n===`running`&&`text-emerald-600 dark:text-emerald-400`,v=n===`stopped`&&`text-red-600 dark:text-red-400`,y=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,b=n===`disabled`&&`text-fg-muted`,x=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,S;t[0]!==_||t[1]!==v||t[2]!==y||t[3]!==b||t[4]!==x?(S=h(`mt-0.5 size-5 shrink-0`,_,v,y,b,x),t[0]=_,t[1]=v,t[2]=y,t[3]=b,t[4]=x,t[5]=S):S=t[5];let C;t[6]!==g||t[7]!==S?(C=(0,U.jsx)(g,{className:S}),t[6]=g,t[7]=S,t[8]=C):C=t[8];let w;t[9]===l.connectionStatus?w=t[10]:(w=(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=w);let T;t[11]!==l||t[12]!==n?(T=Ve(n,l),t[11]=l,t[12]=n,t[13]=T):T=t[13];let E;t[14]===T?E=t[15]:(E=(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==E||t[17]!==w?(D=(0,U.jsxs)(`div`,{children:[w,E]}),t[16]=E,t[17]=w,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==C?(O=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[C,D]}),t[19]=D,t[20]=C,t[21]=O):O=t[21];let ee=i||r,A;t[22]===i?A=t[23]:(A=i?(0,U.jsx)(u,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=A);let j=i?l.checkingConnection:l.checkConnection,M;t[24]!==p||t[25]!==ee||t[26]!==A||t[27]!==j?(M=(0,U.jsxs)(k,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:ee,onClick:p,children:[A,j]}),t[24]=p,t[25]=ee,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==f||t[33]!==r||t[34]!==n?(N=n===`stopped`?(0,U.jsxs)(k,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:f,children:[r?(0,U.jsx)(u,{className:`size-4 animate-spin`}):(0,U.jsx)(d,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=f,t[33]=r,t[34]=n,t[35]=N):N=t[35];let P;t[36]!==o||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==m||t[41]!==r||t[42]!==a?(P=o?(0,U.jsx)(k,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:m,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=o,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=m,t[41]=r,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==M||t[45]!==N||t[46]!==P?(F=(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[M,N,P]}),t[44]=M,t[45]=N,t[46]=P,t[47]=F):F=t[47];let I;return t[48]!==O||t[49]!==F?(I=(0,U.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[O,F]})}),t[48]=O,t[49]=F,t[50]=I):I=t[50],I}function st(e){let t=(0,H.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=X(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl bg-amber-50 px-4 py-3 text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,U.jsx)(I,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,U.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,U.jsx)(`li`,{children:$(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,U.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,U.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,U.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,U.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ct({channelId:e,onHeaderActionChange:t}){let n=y(e=>e.language),r=m(n),a=_(e=>!!e.conversationId),s=i(),c=P(e),u=De(a,n),d=u.entries,{data:p,mutate:g,isValidating:x}=O(a?ue():null,de,{revalidateOnFocus:!0}),{data:S,mutate:C}=O(a?`channels-config-map`:null,Le,{revalidateOnFocus:!1}),w=S?.channels??{},T=S?.bindings??[],{data:E}=O(a?`channel-routing-agents`:null,ne,{revalidateOnFocus:!1}),D=(0,V.useMemo)(()=>d.find(e=>e.id===c),[c,d]),k=D?ze(D):null,{data:ee,mutate:A}=O(a&&k?Me(k):null,()=>Ne(k)),[j,M]=(0,V.useState)(null),[N,F]=(0,V.useState)(!1),[I,z]=(0,V.useState)(null),[te,oe]=(0,V.useState)(null),[H,le]=(0,V.useState)(!1),[pe,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=j??ee??{},J=r.channelsSettings,he=(0,V.useMemo)(()=>D?.configSchema??{type:`object`,properties:{}},[D?.configSchema]),Y=(0,V.useMemo)(()=>qe(he,Pe),[he]),ve=(0,V.useMemo)(()=>Ue(D),[D]),be=(0,V.useMemo)(()=>Ge(Y,ve),[ve,Y]),Se=(0,V.useMemo)(()=>qe(Y,ve),[ve,Y]),Te=(0,V.useMemo)(()=>Je(be),[be]),Ee=D?G??ge(T,D.id):``,Oe=(0,V.useMemo)(()=>(E?.items??[]).map(e=>{let t=B(e,r.agentsSettings);return{value:e.id,label:t===e.id?t:`${t} · ${e.id}`}}),[E?.items,r.agentsSettings]),Ae=E?.items.find(e=>e.id===E.defaultId),Re=Ae?B(Ae,r.agentsSettings):E?.defaultId??``,Ve=(0,V.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),Z=(0,V.useMemo)(()=>new Map((p??[]).map(e=>[e.name,e])),[p]),We=p!==void 0,Ke=(0,V.useCallback)(e=>ye(e,Z.get(e.id),We),[Z,We]),Q=(0,V.useCallback)(async()=>{await Promise.all([u.mutate(),g()])},[u,g]);je((0,V.useCallback)(e=>{let t=ke(e);t&&g(t,!1)},[g]),a);let Ye=(0,V.useMemo)(()=>a?{secondary:(0,U.jsx)(Ce,{ch:J,refreshing:u.isValidating||x,saveOk:!1,onRefresh:()=>void Q()})}:null,[u.isValidating,J,a,x,Q]);(0,V.useLayoutEffect)(()=>(t?.(Ye),()=>t?.(null)),[Ye,t]);let Xe=(0,V.useCallback)(e=>{s(L(e)),M(null),K(null),W(null)},[s]),Ze=(0,V.useCallback)(()=>{s(re),M(null),K(null),W(null)},[s]),Qe=(0,V.useCallback)(async e=>{oe(e.id),W(null);try{let t=await v(b(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},[Q]);(0,V.useEffect)(()=>{K(null),le(!1)},[D?.id]);let $e=(0,V.useCallback)(async()=>{if(!D||!j&&G===null)return!1;let e=ze(D);F(!0),W(null);try{let t=await v(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({...j?{channels:{[e]:j}}:{},...G===null?{}:{bindings:_e(T,D.id,G)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return j&&await A(j,!1),await C(),await u.mutate(),M(null),K(null),!0}catch(e){return W(e instanceof Error?e.message:String(e)),!1}finally{F(!1)}},[D,G,T,u,j,C,A]),et=(0,V.useCallback)(async e=>{let t=X(e),n=ze(e),r=D?.id===e.id?j:null;if(!t.enabled&&!t.ready&&!r){Xe(e.id);return}z(e.id),W(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await v(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await u.mutate(),await C(),await g(),D?.id===e.id&&(await A(),M(null))}catch(e){W(e instanceof Error?e.message:String(e))}finally{z(null)}},[D?.id,u,j,C,A,g,Xe]),$=D?.ui?.modal,it=$?.placement!==`replace-config`,at=D?Ke(D):`checking`,ct=D?!X(D).ready||H:!1;return a?(0,U.jsxs)(ae,{gap:`gap-4`,className:Fe,padding:Ie,children:[u.isLoading?(0,U.jsx)(se,{sections:2}):u.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(u.error)}):(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:d.map(e=>(0,U.jsx)(rt,{entry:e,config:w[ze(e)]?.config,runtime:Ke(e),busy:I===e.id,restarting:te===e.id,ch:J,onOpen:()=>Xe(e.id),onToggle:()=>void et(e),onRestart:()=>void Qe(e)},e.id))}),pe?(0,U.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:pe}):null,(0,U.jsx)(xe,{presentation:`modal`,open:!!D,onOpenChange:e=>{e||Ze()},closeAriaLabel:J.close,srTitle:D?.label??J.selectChannel,srDescription:D?.description,wide:!0,footer:D?(0,U.jsx)(we,{ch:J,dirty:!!j||G!==null,saving:N,onCancel:Ze,onDiscard:()=>{M(null),K(null)},onSave:$e}):null,children:D?(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(tt,{entry:D}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:D.label}),(0,U.jsx)(`span`,{className:h(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,He(at)),children:Be(at,J)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:!X(D).ready&&fe(D)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,D.label):D.description}),D.docsPath?(0,U.jsxs)(`a`,{href:D.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,U.jsx)(l,{className:`size-3.5`})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,U.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:X(D).enabled?J.enabledLabel:J.disabledLabel}),(0,U.jsx)(nt,{checked:X(D).enabled,disabled:I===D.id,label:J.toggleChannel.replace(`{{channel}}`,D.label),onToggle:()=>void et(D)})]})]})}),(0,U.jsx)(ot,{runtime:at,restarting:te===D.id,checking:x,showConnectionOptions:H,canManageConnection:X(D).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void Qe(D),onCheck:()=>void Q(),onManageConnection:()=>le(e=>!e)}),(0,U.jsx)(st,{entry:D,ch:J}),ct&&$?.placement!==`replace-config`?(0,U.jsx)(me,{entry:D,locale:n,messages:J,compact:!0,onChanged:async()=>{await A(),await Q(),await C()}},D.id):null,$?.entrypoint&&$.placement===`before-config`?(0,U.jsx)(ie,{extensionId:D.extensionId,extensionName:D.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:D.id,entry:D,config:q}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,U.jsx)(ie,{extensionId:D.extensionId,extensionName:D.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:D.id,entry:D,config:q}}):null,it&&Te?(0,U.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,U.jsx)(ce,{schema:be,values:q,onChange:e=>M(e),disabled:N,labels:Ve})]}):null,(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(f,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,U.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,U.jsx)(o,{value:Ee,options:Oe,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Re||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:N||!E,onChange:e=>K(e)})]})]}),it&&Je(Se)?(0,U.jsx)(R,{title:J.advancedConfiguration,summary:J.messageHandlingHint,children:(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(f,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,U.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,U.jsx)(ce,{schema:Se,values:q,onChange:e=>M(e),disabled:N,labels:Ve})})]})}):null,pe?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:pe}):null]}):null})]}):(0,U.jsx)(ae,{gap:`gap-3`,className:Fe,padding:Ie,children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})})}export{ct as ChannelsSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE--EKdQGRF.js";import{s as a,t as o}from"./popover-select-DHC7J4lG.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./rotate-ccw-JM1TBLpp.js";import{t as f}from"./settings-2-D-csvaET.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./messages-DTqbfje6.js";import{t as h}from"./cn-0WouolD0.js";import{a as g,c as _,i as v,n as y,r as b}from"./locale-store-uRu_DsWm.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-aIC072nz.js";import{t as ee}from"./interaction-BdhHBbYa.js";import{t as A}from"./skeleton-BI5TyibZ.js";import{i as j,o as M}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$o as N,En as P,Mo as F,So as I,Tn as L,W as R,_i as z,bn as B,li as te,mi as ne,wn as re,zr as ie}from"./index-CNH8vwcY.js";import{r as ae}from"./settings-page-layout-Dx5S-Msc.js";import{t as oe}from"./browser-BLJWD7WI.js";import{n as se}from"./settings-loading-skeleton-BTqvr_Fw.js";import{t as ce}from"./schema-form-I6pzJJzg.js";var V=e(t(),1),H=n();async function le(){return(await g(b(`/api/channels/status`))).payload?.channels||[]}function ue(){return b(`/api/channels/status`)}var de=le;function fe(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}var pe=e(oe(),1),U=r();async function W(e){let t=await v(b(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function G(e){return e?.type===`poll`&&e.phase===`done`}function K(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function q(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function J(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function me({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,V.useMemo)(()=>fe(e),[e]),o=(0,V.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[s,d]=(0,V.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,V.useEffect)(()=>{d({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let f=(0,V.useCallback)(async(n,i)=>{d(e=>({...e,busy:!0,error:null}));try{let a=await W({channelId:e.id,actionId:n,locale:t,input:i});d(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.conversationId?{actionId:a.statusAction,conversationId:a.conversationId,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){d(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,V.useEffect)(()=>{let t=q(s.payload,e.id);if(!t){d(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return d(e=>e.generatedQr?{...e,generatedQr:null}:e),pe.toDataURL(t,{width:220,margin:1}).then(e=>{n||d(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,s.payload]),(0,V.useEffect)(()=>{let n=s.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||W({channelId:e.id,actionId:n.actionId,locale:t,input:{conversationId:n.conversationId}}).then(async e=>{i||(d(t=>({...t,payload:e,poll:G(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),G(e)&&window.clearInterval(a))}).catch(e=>{i||d(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,s.poll]);let p=a?.[1].label??(e.configured?n.reconnect:n.connect),m=e.actions?.[`doctor.run`]?.label??n.diagnose,g=K(s.payload),_=q(s.payload,e.id),v=_?s.generatedQr:J(s.payload),y=a?.[1].result===`qr`&&(s.busy||s.payload?.type===`qr`||s.payload?.type===`poll`),b=s.payload?.type===`form`?s.payload:null,x=s.payload?.type===`diagnostics`?s.payload.checks:null;return(0,U.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:h(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,U.jsxs)(k,{type:`button`,variant:`primary`,disabled:s.busy,onClick:()=>void f(a[0]),children:[s.busy?(0,U.jsx)(u,{className:`size-4 animate-spin`}):(0,U.jsx)(N,{className:`size-4`}),p]}):null,e.actions?.[`doctor.run`]?(0,U.jsxs)(k,{type:`button`,variant:`secondary`,disabled:s.busy,onClick:()=>void f(`doctor.run`),children:[(0,U.jsx)(F,{className:`size-4`}),m]}):null]})]}),g?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:g}):null,s.error?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:s.error}):null,y?(0,U.jsxs)(`div`,{className:h(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base p-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,U.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:v?(0,U.jsx)(`img`,{src:v,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,U.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,U.jsx)(A,{className:`size-48 rounded-md`})})}),(0,U.jsxs)(`div`,{className:h(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[v?(0,U.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,U.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,U.jsx)(A,{className:`h-4 w-48 max-w-full`}),(0,U.jsx)(A,{className:`h-4 w-36 max-w-full`})]}),_?(0,U.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:_,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,U.jsx)(l,{className:`size-3.5`})]}):null]})]}):null,s.payload?.type===`poll`&&s.payload.phase===`done`?(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,U.jsx)(c,{className:s.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,U.jsx)(`span`,{className:s.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:s.payload.message??(s.payload.ok?n.complete:n.failed)})]}):null,b?(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(ce,{schema:b.schema,values:s.formDraft,onChange:e=>d(t=>({...t,formDraft:e})),disabled:s.busy,labels:o}),(0,U.jsx)(k,{type:`button`,variant:`primary`,disabled:s.busy,onClick:()=>void f(b.submitAction,s.formDraft),children:n.saveSetup})]}):null,x?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:x.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var he=40;function Y(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ge(e,t){return e.find(e=>e.id===Y(t))?.agentId?.trim().toLowerCase()??``}function _e(e,t,n){let r=Y(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:he,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function ve(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function ye(e,t,n){let r=ve(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function be(e,t=!1){return e===`drawer`?h(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,j):h(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,j,`rounded-2xl border border-edge bg-surface-overlay outline-none dark:border-edge`)}function xe(e){let t=(0,H.c)(33),{presentation:n,open:r,onOpenChange:i,title:o,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:m,headerExtra:g}=e,_=m===void 0?!1:m,v=n===`drawer`,[y,b]=(0,V.useState)(null),O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,U.jsx)(x,{className:h(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,M)}),t[0]=O):O=t[0];let A;t[1]!==n||t[2]!==_?(A=be(n,_),t[1]=n,t[2]=_,t[3]=A):A=t[3];let j;t[4]===c?j=t[5]:(j=c?(0,U.jsx)(E,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=j);let N;t[6]===l?N=t[7]:(N=l?(0,U.jsx)(S,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=N);let P;t[8]!==u||t[9]!==s||t[10]!==g||t[11]!==v||t[12]!==o?(P=v?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,U.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:o}):null,s?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(k,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,U.jsx)(p,{className:`size-5`,strokeWidth:1.75})})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(C,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:h(ee,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,U.jsx)(p,{className:`size-4`})})}),g]}),t[8]=u,t[9]=s,t[10]=g,t[11]=v,t[12]=o,t[13]=P):P=t[13];let F=v?`p-4`:`p-6`,I;t[14]===F?I=t[15]:(I=h(`min-h-0 flex-1 overflow-y-auto`,F),t[14]=F,t[15]=I);let L;t[16]!==d||t[17]!==I?(L=(0,U.jsx)(`div`,{className:I,children:d}),t[16]=d,t[17]=I,t[18]=L):L=t[18];let R;t[19]!==f||t[20]!==y||t[21]!==j||t[22]!==N||t[23]!==P||t[24]!==L?(R=(0,U.jsxs)(a,{layer:`modal`,portalContainer:y,children:[j,N,P,L,f]}),t[19]=f,t[20]=y,t[21]=j,t[22]=N,t[23]=P,t[24]=L,t[25]=R):R=t[25];let z;t[26]!==R||t[27]!==A?(z=(0,U.jsxs)(w,{children:[O,(0,U.jsx)(T,{ref:b,className:A,onOpenAutoFocus:Se,children:R})]}),t[26]=R,t[27]=A,t[28]=z):z=t[28];let B;return t[29]!==i||t[30]!==r||t[31]!==z?(B=(0,U.jsx)(D,{open:r,onOpenChange:i,children:z}),t[29]=i,t[30]=r,t[31]=z,t[32]=B):B=t[32],B}function Se(e){return e.preventDefault()}var Ce=(0,V.memo)(function(e){let t=(0,H.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,U.jsx)(te,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function we(e){let t=(0,H.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,U.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,U.jsx)(k,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,U.jsx)(k,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,U.jsx)(k,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,U.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,U.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}function Te(e){return b(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function Ee(e){return(await g(Te(e))).payload?.channels??[]}function De(e,t){let n=(0,H.c)(14),r;n[0]!==e||n[1]!==t?(r=e?Te(t):null,n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===t?i=n[4]:(i=()=>Ee(t),n[3]=t,n[4]=i);let a;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},n[5]=a):a=n[5];let{data:o,error:s,isLoading:c,isValidating:l,mutate:u}=O(r,i,a),d;n[6]===o?d=n[7]:(d=o??[],n[6]=o,n[7]=d);let f;return n[8]!==s||n[9]!==c||n[10]!==l||n[11]!==u||n[12]!==d?(f={entries:d,isLoading:c,isValidating:l,error:s,mutate:u},n[8]=s,n[9]=c,n[10]=l,n[11]=u,n[12]=d,n[13]=f):f=n[13],f}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,H.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,V.useEffect)(i,a)}function Me(e){return e?b(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await g(b(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`],Fe=`max-w-7xl`,Ie=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`;async function Le(){let e=await g(b(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Re(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function ze(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function X(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Be(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function Ve(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function He(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ue(e){if(!e)return[];let t=e.uiHints??{},n=Z(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=X(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=new Set([`dmPolicy`,`groupPolicy`,`allowFrom`,`groupAllowFrom`]),a=[...Object.keys(t).filter(e=>!e.includes(`*`)&&i.has(e.split(`.`).at(-1)??``)),...Object.keys(Z(e.configSchema?.properties)?e.configSchema.properties:{}).filter(e=>i.has(e))],o=Object.entries(t).filter(([,e])=>!Z(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...o,...a,...n,...r])).filter(e=>!Pe.includes(e))}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function We(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function Ge(e,t){let n={...We(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!Z(r)||!Z(r[n]))break;let o=Z(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...We(r[n]),properties:{}}),e===t.length-1){o[n]=We(r[n]);break}i=r[n],a=o[n]}}return n}function Ke(e){let t=e.properties;if(!Z(t))return!1;for(let[e,n]of Object.entries(t))Z(n)&&n.type===`object`&&Ke(n)&&delete t[e];return Object.keys(t).length===0}function qe(e,t){let n=We(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!Z(i))break;if(e===t.length-1){delete i[n];break}if(!Z(i[n]))break;r=i[n]}}return Ke(n),n}function Je(e){return e.type===`object`&&Z(e.properties)&&Object.keys(e.properties).length>0}function Q(e,t){let n=e;for(let e of t.split(`.`)){if(!Z(n))return;n=n[e]}return n}function Ye(e){let t=e.accounts;return Z(t)?Object.values(t).filter(e=>Z(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Xe(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ze(e,t,n){let r=[],i=X(e);if(i.issues.length>0&&r.push($(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Xe(e,Q(t,e),n);i&&r.push(i)}let a=Ye(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Qe(e,t){let n=X(e),r=fe(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function $e(e,t){let n=fe(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function et(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function $(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function tt({entry:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useMemo)(()=>!e.ui?.icon||t?null:new URL(b(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Re(e.ui.icon)}`)).toString(),[t,e.extensionId,e.ui?.icon]);return(0,U.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:r?(0,U.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>n(!0)}):(0,U.jsx)(z,{sourceChannel:e.id,className:`size-7`})})}function nt(e){let t=(0,H.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,o;t[0]===i?o=t[1]:(o=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=o);let s=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,c=r&&`cursor-not-allowed opacity-60`,l;t[2]!==s||t[3]!==c?(l=h(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,s,c),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=n?`translate-x-5`:`translate-x-0.5`,d;t[5]===u?d=t[6]:(d=h(`size-5 rounded-full bg-white shadow-surface transition-transform`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,U.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==l||t[14]!==f?(p=(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:o,className:l,children:f}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function rt(e){let t=(0,H.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:o,ch:s,onOpen:c,onToggle:l,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=X(n),t[0]=n,t[1]=f);let p=f,m,g,_,v,y,b,x;if(t[2]!==a||t[3]!==s||t[4]!==r||t[5]!==n||t[6]!==c||t[7]!==d||t[8]!==l||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ze(n,r,s),o=et(n,s);m=!p.enabled&&p.ready?l:i===`stopped`?d:c,b=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let u;t[19]===n?u=t[20]:(u=(0,U.jsx)(tt,{entry:n}),t[19]=n,t[20]=u);let f;t[21]===n.label?f=t[22]:(f=(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=f);let S;t[23]===i?S=t[24]:(S=h(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,He(i)),t[23]=i,t[24]=S);let C;t[25]!==s||t[26]!==i?(C=Be(i,s),t[25]=s,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,U.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==f?(T=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[f,w]}),t[31]=w,t[32]=f,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==u?(E=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[u,T]}),t[34]=T,t[35]=u,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==s.toggleChannel||t[38]!==n.label?(O=s.toggleChannel.replace(`{{channel}}`,n.label),t[37]=s.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==l||t[42]!==p.enabled||t[43]!==O?(k=(0,U.jsx)(nt,{checked:D,disabled:a,label:O,onToggle:l}),t[40]=a,t[41]=l,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(x=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=x):x=t[47],g=`button`,_=c,v=`mt-5 min-h-[6.25rem] text-left`,y=p.ready?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,U.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(at)}):null]}):(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:s.cardSetupTitle}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??$e(n,s)}),o.length>0?(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:o.map(it)}):null]}),t[2]=a,t[3]=s,t[4]=r,t[5]=n,t[6]=c,t[7]=d,t[8]=l,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else m=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[48]!==g||t[49]!==_||t[50]!==v||t[51]!==y?(S=(0,U.jsx)(`button`,{type:g,onClick:_,className:v,children:y}),t[48]=g,t[49]=_,t[50]=v,t[51]=y,t[52]=S):S=t[52];let C=a||o,w;t[53]!==a||t[54]!==o?(w=a||o?(0,U.jsx)(u,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=o,t[55]=w):w=t[55];let T;t[56]!==s||t[57]!==n||t[58]!==o||t[59]!==i?(T=o?s.restartingChannel:i===`stopped`?s.restartChannel:Qe(n,s),t[56]=s,t[57]=n,t[58]=o,t[59]=i,t[60]=T):T=t[60];let E;t[61]!==m||t[62]!==w||t[63]!==T||t[64]!==C?(E=(0,U.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,U.jsxs)(k,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:C,children:[w,T]})}),t[61]=m,t[62]=w,t[63]=T,t[64]=C,t[65]=E):E=t[65];let D;return t[66]!==E||t[67]!==b||t[68]!==x||t[69]!==S?(D=(0,U.jsxs)(`article`,{className:b,children:[x,S,E]}),t[66]=E,t[67]=b,t[68]=x,t[69]=S,t[70]=D):D=t[70],D}function it(e){return(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function at(e){return(0,U.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function ot(e){let t=(0,H.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:o,ch:l,onRestart:f,onCheck:p,onManageConnection:m}=e,g=n===`running`?c:n===`stopped`||n===`needs_setup`?s:u,_=n===`running`&&`text-emerald-600 dark:text-emerald-400`,v=n===`stopped`&&`text-red-600 dark:text-red-400`,y=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,b=n===`disabled`&&`text-fg-muted`,x=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,S;t[0]!==_||t[1]!==v||t[2]!==y||t[3]!==b||t[4]!==x?(S=h(`mt-0.5 size-5 shrink-0`,_,v,y,b,x),t[0]=_,t[1]=v,t[2]=y,t[3]=b,t[4]=x,t[5]=S):S=t[5];let C;t[6]!==g||t[7]!==S?(C=(0,U.jsx)(g,{className:S}),t[6]=g,t[7]=S,t[8]=C):C=t[8];let w;t[9]===l.connectionStatus?w=t[10]:(w=(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=w);let T;t[11]!==l||t[12]!==n?(T=Ve(n,l),t[11]=l,t[12]=n,t[13]=T):T=t[13];let E;t[14]===T?E=t[15]:(E=(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==E||t[17]!==w?(D=(0,U.jsxs)(`div`,{children:[w,E]}),t[16]=E,t[17]=w,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==C?(O=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[C,D]}),t[19]=D,t[20]=C,t[21]=O):O=t[21];let ee=i||r,A;t[22]===i?A=t[23]:(A=i?(0,U.jsx)(u,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=A);let j=i?l.checkingConnection:l.checkConnection,M;t[24]!==p||t[25]!==ee||t[26]!==A||t[27]!==j?(M=(0,U.jsxs)(k,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:ee,onClick:p,children:[A,j]}),t[24]=p,t[25]=ee,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==f||t[33]!==r||t[34]!==n?(N=n===`stopped`?(0,U.jsxs)(k,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:f,children:[r?(0,U.jsx)(u,{className:`size-4 animate-spin`}):(0,U.jsx)(d,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=f,t[33]=r,t[34]=n,t[35]=N):N=t[35];let P;t[36]!==o||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==m||t[41]!==r||t[42]!==a?(P=o?(0,U.jsx)(k,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:m,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=o,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=m,t[41]=r,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==M||t[45]!==N||t[46]!==P?(F=(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[M,N,P]}),t[44]=M,t[45]=N,t[46]=P,t[47]=F):F=t[47];let I;return t[48]!==O||t[49]!==F?(I=(0,U.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[O,F]})}),t[48]=O,t[49]=F,t[50]=I):I=t[50],I}function st(e){let t=(0,H.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=X(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl bg-amber-50 px-4 py-3 text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,U.jsx)(I,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,U.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,U.jsx)(`li`,{children:$(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,U.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,U.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,U.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,U.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ct({channelId:e,onHeaderActionChange:t}){let n=y(e=>e.language),r=m(n),a=_(e=>!!e.conversationId),s=i(),c=P(e),u=De(a,n),d=u.entries,{data:p,mutate:g,isValidating:x}=O(a?ue():null,de,{revalidateOnFocus:!0}),{data:S,mutate:C}=O(a?`channels-config-map`:null,Le,{revalidateOnFocus:!1}),w=S?.channels??{},T=S?.bindings??[],{data:E}=O(a?`channel-routing-agents`:null,ne,{revalidateOnFocus:!1}),D=(0,V.useMemo)(()=>d.find(e=>e.id===c),[c,d]),k=D?ze(D):null,{data:ee,mutate:A}=O(a&&k?Me(k):null,()=>Ne(k)),[j,M]=(0,V.useState)(null),[N,F]=(0,V.useState)(!1),[I,z]=(0,V.useState)(null),[te,oe]=(0,V.useState)(null),[H,le]=(0,V.useState)(!1),[pe,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=j??ee??{},J=r.channelsSettings,he=(0,V.useMemo)(()=>D?.configSchema??{type:`object`,properties:{}},[D?.configSchema]),Y=(0,V.useMemo)(()=>qe(he,Pe),[he]),ve=(0,V.useMemo)(()=>Ue(D),[D]),be=(0,V.useMemo)(()=>Ge(Y,ve),[ve,Y]),Se=(0,V.useMemo)(()=>qe(Y,ve),[ve,Y]),Te=(0,V.useMemo)(()=>Je(be),[be]),Ee=D?G??ge(T,D.id):``,Oe=(0,V.useMemo)(()=>(E?.items??[]).map(e=>{let t=B(e,r.agentsSettings);return{value:e.id,label:t===e.id?t:`${t} · ${e.id}`}}),[E?.items,r.agentsSettings]),Ae=E?.items.find(e=>e.id===E.defaultId),Re=Ae?B(Ae,r.agentsSettings):E?.defaultId??``,Ve=(0,V.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),Z=(0,V.useMemo)(()=>new Map((p??[]).map(e=>[e.name,e])),[p]),We=p!==void 0,Ke=(0,V.useCallback)(e=>ye(e,Z.get(e.id),We),[Z,We]),Q=(0,V.useCallback)(async()=>{await Promise.all([u.mutate(),g()])},[u,g]);je((0,V.useCallback)(e=>{let t=ke(e);t&&g(t,!1)},[g]),a);let Ye=(0,V.useMemo)(()=>a?{secondary:(0,U.jsx)(Ce,{ch:J,refreshing:u.isValidating||x,saveOk:!1,onRefresh:()=>void Q()})}:null,[u.isValidating,J,a,x,Q]);(0,V.useLayoutEffect)(()=>(t?.(Ye),()=>t?.(null)),[Ye,t]);let Xe=(0,V.useCallback)(e=>{s(L(e)),M(null),K(null),W(null)},[s]),Ze=(0,V.useCallback)(()=>{s(re),M(null),K(null),W(null)},[s]),Qe=(0,V.useCallback)(async e=>{oe(e.id),W(null);try{let t=await v(b(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},[Q]);(0,V.useEffect)(()=>{K(null),le(!1)},[D?.id]);let $e=(0,V.useCallback)(async()=>{if(!D||!j&&G===null)return!1;let e=ze(D);F(!0),W(null);try{let t=await v(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({...j?{channels:{[e]:j}}:{},...G===null?{}:{bindings:_e(T,D.id,G)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return j&&await A(j,!1),await C(),await u.mutate(),M(null),K(null),!0}catch(e){return W(e instanceof Error?e.message:String(e)),!1}finally{F(!1)}},[D,G,T,u,j,C,A]),et=(0,V.useCallback)(async e=>{let t=X(e),n=ze(e),r=D?.id===e.id?j:null;if(!t.enabled&&!t.ready&&!r){Xe(e.id);return}z(e.id),W(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await v(b(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await u.mutate(),await C(),await g(),D?.id===e.id&&(await A(),M(null))}catch(e){W(e instanceof Error?e.message:String(e))}finally{z(null)}},[D?.id,u,j,C,A,g,Xe]),$=D?.ui?.modal,it=$?.placement!==`replace-config`,at=D?Ke(D):`checking`,ct=D?!X(D).ready||H:!1;return a?(0,U.jsxs)(ae,{gap:`gap-4`,className:Fe,padding:Ie,children:[u.isLoading?(0,U.jsx)(se,{sections:2}):u.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(u.error)}):(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:d.map(e=>(0,U.jsx)(rt,{entry:e,config:w[ze(e)]?.config,runtime:Ke(e),busy:I===e.id,restarting:te===e.id,ch:J,onOpen:()=>Xe(e.id),onToggle:()=>void et(e),onRestart:()=>void Qe(e)},e.id))}),pe?(0,U.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:pe}):null,(0,U.jsx)(xe,{presentation:`modal`,open:!!D,onOpenChange:e=>{e||Ze()},closeAriaLabel:J.close,srTitle:D?.label??J.selectChannel,srDescription:D?.description,wide:!0,footer:D?(0,U.jsx)(we,{ch:J,dirty:!!j||G!==null,saving:N,onCancel:Ze,onDiscard:()=>{M(null),K(null)},onSave:$e}):null,children:D?(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(tt,{entry:D}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:D.label}),(0,U.jsx)(`span`,{className:h(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,He(at)),children:Be(at,J)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:!X(D).ready&&fe(D)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,D.label):D.description}),D.docsPath?(0,U.jsxs)(`a`,{href:D.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,U.jsx)(l,{className:`size-3.5`})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,U.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:X(D).enabled?J.enabledLabel:J.disabledLabel}),(0,U.jsx)(nt,{checked:X(D).enabled,disabled:I===D.id,label:J.toggleChannel.replace(`{{channel}}`,D.label),onToggle:()=>void et(D)})]})]})}),(0,U.jsx)(ot,{runtime:at,restarting:te===D.id,checking:x,showConnectionOptions:H,canManageConnection:X(D).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void Qe(D),onCheck:()=>void Q(),onManageConnection:()=>le(e=>!e)}),(0,U.jsx)(st,{entry:D,ch:J}),ct&&$?.placement!==`replace-config`?(0,U.jsx)(me,{entry:D,locale:n,messages:J,compact:!0,onChanged:async()=>{await A(),await Q(),await C()}},D.id):null,$?.entrypoint&&$.placement===`before-config`?(0,U.jsx)(ie,{extensionId:D.extensionId,extensionName:D.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:D.id,entry:D,config:q}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,U.jsx)(ie,{extensionId:D.extensionId,extensionName:D.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:D.id,entry:D,config:q}}):null,it&&Te?(0,U.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,U.jsx)(ce,{schema:be,values:q,onChange:e=>M(e),disabled:N,labels:Ve})]}):null,(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(f,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,U.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,U.jsx)(o,{value:Ee,options:Oe,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Re||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:N||!E,onChange:e=>K(e)})]})]}),it&&Je(Se)?(0,U.jsx)(R,{title:J.advancedConfiguration,summary:J.messageHandlingHint,children:(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(f,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,U.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,U.jsx)(ce,{schema:Se,values:q,onChange:e=>M(e),disabled:N,labels:Ve})})]})}):null,pe?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:pe}):null]}):null})]}):(0,U.jsx)(ae,{gap:`gap-3`,className:Fe,padding:Ie,children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})})}export{ct as ChannelsSettingsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./plus-Q2yW6OE7.js";import{t as i}from"./x-B_N4OPjy.js";import{t as a}from"./messages-DTqbfje6.js";import{n as o}from"./locale-store-uRu_DsWm.js";import{u as s}from"./session-api-CzVTrG8n.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{Fo as u,M as d,N as f,j as p}from"./index-B08iR7fT.js";var m=2,h=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,te=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?_(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&g(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ne=`Terminal input`,re={get:()=>ne,set:e=>ne=e},ie=`Too much output to announce, navigate to rows manually to read`,b={get:()=>ie,set:e=>ie=e};function ae(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function S(e,t,n,r){e.stopPropagation(),e.clipboardData&&se(e.clipboardData.getData(`text/plain`),t,n,r)}function se(e,t,n,r){e=ae(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ce(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){ce(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function w(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},de=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},fe=``,pe=` `,me=class e{constructor(){this.fg=0,this.bg=0,this.extended=new he}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},he=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends me{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new he,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ge=`di$target`,_e=`di$dependencies`,ve=new Map;function ye(e){return e[_e]||[]}function E(e){if(ve.has(e))return ve.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);be(t,e,r)};return t._id=e,ve.set(e,t),t}function be(e,t,n){t[ge]===t?t[_e].push({id:e,index:n}):(t[_e]=[{id:e,index:n}],t[ge]=t)}var D=E(`BufferService`),xe=E(`CoreMouseService`),Se=E(`CoreService`),Ce=E(`CharsetService`),we=E(`InstantiationService`),Te=E(`LogService`),O=E(`OptionsService`),Ee=E(`OscLinkService`),De=E(`UnicodeService`),Oe=E(`DecorationService`),ke=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ae(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};ke=v([y(0,D),y(1,O),y(2,Ee)],ke);function Ae(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./plus-Q2yW6OE7.js";import{t as i}from"./x-B_N4OPjy.js";import{t as a}from"./messages-DTqbfje6.js";import{n as o}from"./locale-store-uRu_DsWm.js";import{u as s}from"./session-api-CzVTrG8n.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{Fo as u,M as d,N as f,j as p}from"./index-CNH8vwcY.js";var m=2,h=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,te=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?_(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&g(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ne=`Terminal input`,re={get:()=>ne,set:e=>ne=e},ie=`Too much output to announce, navigate to rows manually to read`,b={get:()=>ie,set:e=>ie=e};function ae(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function S(e,t,n,r){e.stopPropagation(),e.clipboardData&&se(e.clipboardData.getData(`text/plain`),t,n,r)}function se(e,t,n,r){e=ae(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ce(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){ce(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function w(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},de=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},fe=``,pe=` `,me=class e{constructor(){this.fg=0,this.bg=0,this.extended=new he}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},he=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends me{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new he,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ge=`di$target`,_e=`di$dependencies`,ve=new Map;function ye(e){return e[_e]||[]}function E(e){if(ve.has(e))return ve.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);be(t,e,r)};return t._id=e,ve.set(e,t),t}function be(e,t,n){t[ge]===t?t[_e].push({id:e,index:n}):(t[_e]=[{id:e,index:n}],t[ge]=t)}var D=E(`BufferService`),xe=E(`CoreMouseService`),Se=E(`CoreService`),Ce=E(`CharsetService`),we=E(`InstantiationService`),Te=E(`LogService`),O=E(`OptionsService`),Ee=E(`OscLinkService`),De=E(`UnicodeService`),Oe=E(`DecorationService`),ke=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ae(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};ke=v([y(0,D),y(1,O),y(2,Ee)],ke);function Ae(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var je=E(`CharSizeService`),Me=E(`CoreBrowserService`),Ne=E(`MouseService`),Pe=E(`RenderService`),Fe=E(`SelectionService`),Ie=E(`CharacterJoinerService`),Le=E(`ThemeService`),Re=E(`LinkProviderService`),ze=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ge.isErrorNoTelemetry(e)?new Ge(e.message+`
|
|
4
4
|
|
package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./preload-helper-zJ_50EbN.js";var r=e(t(),1),i=e=>{throw TypeError(e)},a=(e,t,n)=>t.has(e)||i(`Cannot `+n),o=(e,t,n)=>(a(e,t,`read from private field`),n?n.call(e):t.get(e)),s=(e,t,n)=>t.has(e)?i(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),c=(e,t,n,r)=>(a(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),l=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,u=/^[\\/]{2}/;function d(e,t){return t+e.replace(/\\/g,`/`)}var f=`popstate`;function p(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function m(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=x(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),y(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:b(t))}function r(e,t){g(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return S(t,n,r,e)}function h(e,t){if(e===!1||e==null)throw Error(t)}function g(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _(){return Math.random().toString(36).substring(2,10)}function v(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function y(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?x(t):t,state:n,key:t&&t.key||r||_(),mask:i}}function b({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function x(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function S(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:_.location,delta:t})}function m(e,t){s=`PUSH`;let r=p(e)?e:y(_.location,e,t);n&&n(r,e),l=u()+1;let d=v(r,l),f=_.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:_.location,delta:1})}function h(e,t){s=`REPLACE`;let r=p(e)?e:y(_.location,e,t);n&&n(r,e),l=u();let i=v(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function g(e){return C(i,e)}let _={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(f,d),c=e,()=>{i.removeEventListener(f,d),c=null}},createHref(e){return t(i,e)},createURL:g,encodeLocation(e){let t=g(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:m,replace:h,go(e){return o.go(e)}};return _}function C(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),h(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:b(t);return i=i.replace(/ $/,`%20`),!n&&u.test(i)&&(i=r+i),new URL(i,r)}function w(e){return{defaultValue:e}}var T,E=class{constructor(e){if(s(this,T,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(o(this,T).has(e))return o(this,T).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){o(this,T).set(e,t)}};T=new WeakMap;var D=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function O(e){return D.has(e)}var k=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function A(e){return k.has(e)}function j(e){return e.index===!0}function M(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(h(e.index!==!0||!e.children,`Cannot specify children on an index route`),h(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),j(e)){let n={...e,id:s};return r[s]=N(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=N(n,t(n)),e.children&&(n.children=M(e.children,t,o,r,i)),n}})}function N(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function P(e,t,n=`/`){return F(e,t,n,!1)}function F(e,t,n,r,i){let a=V((typeof t==`string`?x(t):t).pathname||`/`,n);if(a==null)return null;let o=i??I(e),s=null,c=pe(a);for(let e=0;s==null&&e<o.length;++e)s=R(o[e],c,r);return s}function ee(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function I(e){let t=te(e);return re(t),t}function te(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;h(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=U([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(h(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),te(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ue(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=fe(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ne(e.path))a(e,t,!0,n)}),t}function ne(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ne(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function re(e){e.sort((e,t)=>e.score===t.score?de(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ie=/^:[\w-]+$/,ae=3,oe=2,L=1,se=10,ce=-2,le=e=>e===`*`;function ue(e,t){let n=e.split(`/`),r=n.length;return n.some(le)&&(r+=ce),t&&(r+=oe),n.filter(e=>!le(e)).reduce((e,t)=>e+(ie.test(t)?ae:t===``?L:se),r)}function de(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function R(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?B(u,l,s.matcher,s.compiledParams):z(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:U([a,d.pathname]),pathnameBase:Ce(U([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=U([a,d.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fe(e.path,e.caseSensitive,e.end);return B(e,t,n,r)}function B(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function fe(e,t=!1,n=!0){g(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function pe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return g(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function me({basename:e,pathname:t}){return t===`/`?e:U([e,t])}var he=e=>l.test(e);function ge(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?x(e):e,a;return n?(n=xe(n),a=n.startsWith(`/`)?_e(n.substring(1),`/`):_e(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function _e(e,t){let n=Se(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function H(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ve(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ye(e){let t=ve(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function be(e,t,n,r=!1){let i;typeof e==`string`?i=x(e):(i={...e},h(!i.pathname||!i.pathname.includes(`?`),H(`?`,`pathname`,`search`,i)),h(!i.pathname||!i.pathname.includes(`#`),H(`#`,`pathname`,`hash`,i)),h(!i.search||!i.search.includes(`#`),H(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ge(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var xe=e=>e.replace(/[\\/]{2,}/g,`/`),U=e=>xe(e.join(`/`)),Se=e=>e.replace(/\/+$/,``),Ce=e=>Se(e).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],De=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Oe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function W(e){return U(e.map(e=>e.route.path).filter(Boolean))||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!l.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=u.test(n)?new URL(d(n,e.protocol)):new URL(n),a=V(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{g(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var G=Symbol(`Uninstrumented`);function je(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=K(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=K(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[G]??i,a=K(n[e],t,(...e)=>Ne(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[G]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[G]??e,r=K(n.middleware,t,(...e)=>Ne(e[0]));return r?(r[G]=t,r):e})),r}function Me(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[G]??e.navigate,r=K(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?b(n):`.`,...Pe(e,r??{})}});r&&(r[G]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[G]??e.fetch,r=K(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Pe(e,i??{})}});r&&(r[G]=t,e.fetch=r)}return e}function K(e,t,n){return e.length===0?null:async(...r)=>{let i=await q(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function q(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=q(e,t,n,r-1),a=await o,h(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function Ne(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:Fe(t),params:{...r},pattern:i,context:Ie(n)}}function Pe(e,t){return{currentUrl:b(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Fe(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Ie(e){if(Re(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Le=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Re(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Le}var ze=[`POST`,`PUT`,`PATCH`,`DELETE`],Be=new Set(ze),Ve=[`GET`,...ze],He=new Set(Ve),Ue=new Set([301,302,303,307,308]),We=new Set([307,308]),Ge={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ke={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},qe={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Je=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Ye=`remix-router-transitions`,Xe=Symbol(`ResetLoaderData`),Ze,Qe,$e,et,tt=class{constructor(e){s(this,Ze),s(this,Qe),s(this,$e),s(this,et),c(this,Ze,e),c(this,Qe,I(e))}get stableRoutes(){return o(this,Ze)}get activeRoutes(){return o(this,$e)??o(this,Ze)}get branches(){return o(this,et)??o(this,Qe)}get hasHMRRoutes(){return o(this,$e)!=null}setRoutes(e){c(this,Ze,e),c(this,Qe,I(e))}setHmrRoutes(e){c(this,$e,e),c(this,et,I(e))}commitHmrRoutes(){o(this,$e)&&(c(this,Ze,o(this,$e)),c(this,Qe,o(this,et)),c(this,$e,void 0),c(this,et,void 0))}};Ze=new WeakMap,Qe=new WeakMap,$e=new WeakMap,et=new WeakMap;function nt(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;h(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Je,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...je(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new tt(M(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||yt,u={...e.future},d=null,f=new Set,p=null,m=null,_=null,v=null,b=e.hydrationData!=null,S=F(s.activeRoutes,e.history.location,c,!1,s.branches),w=!1,T=null,D,O;if(S==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Ut(s.activeRoutes);D=!0,O=!D,S=n,T={[r.id]:t}}else if(S&&!e.hydrationData&&nt(S,s.activeRoutes,e.history.location.pathname).active&&(S=null),!S){D=!1,O=!D,S=[];let t=nt(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(w=!0,S=t.matches)}else if(S.some(e=>e.route.lazy))D=!1,O=!D;else if(!S.some(e=>st(e.route)))D=!0,O=!D;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=S;if(n){let e=S.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}O=!1,D=!0,r.forEach(e=>{let r=ct(e.route,t,n);O||=r.renderFallback,D&&=!r.shouldLoad})}let k,A={historyAction:e.history.action,location:e.history.location,matches:S,initialized:D,renderFallback:O,navigation:Ge,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:new Map,blockers:new Map},j=`POP`,N=null,P=!1,I,te=!1,ne=new Map,re=null,ie=!1,ae=!1,oe=new Set,L=new Map,se=0,ce=-1,le=new Map,ue=new Set,de=new Map,R=new Map,z=new Set,B=new Map,fe,pe=null;function me(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(fe){fe(),fe=void 0;return}g(B.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ye({currentLocation:A.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{fe=e});e.history.go(r*-1),Ue(i,{state:`blocked`,location:n,proceed(){Ue(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(A.blockers);e.set(i,qe),H({blockers:e})}}),N?.resolve(),N=null;return}return xe(t,n)}),n){fn(t,ne);let e=()=>pn(t,ne);t.addEventListener(`pagehide`,e),re=()=>t.removeEventListener(`pagehide`,e)}return A.initialized||xe(`POP`,A.location,{initialHydration:!0}),k}function ge(){d&&d(),re&&re(),f.clear(),I&&I.abort(),A.fetchers.forEach((e,t)=>Fe(A.fetchers,t)),A.blockers.forEach((e,t)=>He(t))}function _e(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(A,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function H(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),A={...A,...e};let n=[],r=[];A.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!A.fetchers.has(e)&&!L.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(A,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Fe(A.fetchers,e)),r.forEach(e=>A.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=A.actionData!=null&&A.navigation.formMethod!=null&&X(A.navigation.formMethod)&&A.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?A.actionData:null;let o=n.loaderData?Bt(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,c=A.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,qe)));let l=ie?!1:et(t,n.matches||A.matches),u=P===!0||A.navigation.formMethod!=null&&X(A.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),ie||j===`POP`||(j===`PUSH`?e.history.push(t,t.state):j===`REPLACE`&&e.history.replace(t,t.state));let d;if(j===`POP`){let e=ne.get(A.location.pathname);e&&e.has(t.pathname)?d={currentLocation:A.location,nextLocation:t}:ne.has(t.pathname)&&(d={currentLocation:t,nextLocation:A.location})}else if(te){let e=ne.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ne.set(A.location.pathname,e)),d={currentLocation:A.location,nextLocation:t}}H({...n,actionData:a,loaderData:o,historyAction:j,location:t,initialized:!0,renderFallback:!1,navigation:Ge,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),j=`POP`,P=!1,te=!1,ie=!1,ae=!1,N?.resolve(),N=null,pe?.resolve(),pe=null}async function ye(t,n){if(N?.resolve(),N=null,typeof t==`number`){N||=mn();let n=N.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=at(!1,it(A.location,A.matches,c,t,n?.fromRouteId,n?.relative),n),o;n?.mask&&(o={pathname:``,search:``,hash:``,...typeof n.mask==`string`?x(n.mask):{...A.location.mask,...n.mask}});let s=A.location,l=y(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&X(i.formMethod)&&i.formAction===A.location.pathname+A.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ye({currentLocation:s,nextLocation:l,historyAction:d});if(m){Ue(m,{state:`blocked`,location:l,proceed(){Ue(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),ye(t,n)},reset(){let e=new Map(A.blockers);e.set(m,qe),H({blockers:e})}});return}await xe(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function be(){pe||=mn(),G(),H({revalidation:`loading`});let e=pe.promise;return A.navigation.state===`submitting`?e:A.navigation.state===`idle`?(xe(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),e):(xe(j||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:te===!0}),e)}async function xe(t,n,r){I&&I.abort(),I=null,j=t,ie=(r&&r.startUninterruptedRevalidation)===!0,$e(A.location,A.matches),P=(r&&r.preventScrollReset)===!0,te=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&A.matches&&A.matches.length>0&&!w?A.matches:F(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&A.initialized&&!ae&&Kt(A.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){ve(n,{matches:a},{flushSync:o});return}let l=nt(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=Xe(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;I=new AbortController;let d=Pt(e.history,n,I.signal,r&&r.submission),f=e.getContext?await e.getContext():new E,p;if(r&&r.pendingError)p=[Ht(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&X(r.submission.formMethod)){let i=await U(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(Y(t)&&Oe(t.error)&&t.error.status===404){I=null,ve(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=sn(n,a,t,r.submission),o=!1,l.active=!1,d=Pt(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await Se(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(I=null,ve(n,{matches:h||a,...Vt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function U(t,n,i,l,u,d,f,p,m={}){if(G(),H({navigation:cn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await rt(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Ut(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Ht(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Xe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=an(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:J(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await ke(t,n,Tt(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(Zt(h)){let n;return n=m&&m.replace!=null?m.replace:Nt(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===A.location.pathname+A.location.search,await W(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Y(h)){let e=Ht(l,g.route.id);return(m&&m.replace)!==!0&&(j=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function Se(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||sn(n,i,l,p),x=p||m||on(b),S=!ie&&!g;if(d){if(S){let e=Ce(v);H({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await rt(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Ut(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Ht(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Xe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=ot(t,u,a,o,e.history,A,i,x,n,g?[]:r,g===!0,ae,oe,z,de,ue,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(ce=++se,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&T.length===0){let e=new Map(A.fetchers),t=ze(e);return ve(n,{matches:i,loaderData:{},errors:v&&Y(v[1])?{[v[0]]:v[1].error}:null,...Vt(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Ce(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=we(T)),H(e,{flushSync:_})}T.forEach(e=>{Le(e.key),e.controller&&L.set(e.key,e.controller)});let E=()=>T.forEach(e=>Le(e.key));I&&I.signal.addEventListener(`abort`,E);let{loaderResults:D,fetcherResults:O}=await Ae(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener(`abort`,E),T.forEach(e=>L.delete(e.key));let k=Wt(D);if(k)return await W(t,k.result,!0,{replace:h}),{shortCircuited:!0};if(k=Wt(O),k)return ue.add(k.key),await W(t,k.result,!0,{replace:h}),{shortCircuited:!0};let j=new Map(A.fetchers),{loaderData:M,errors:N}=zt(A,i,D,v,T,O,j);g&&A.errors&&(N={...A.errors,...N});let P=ze(j),F=Be(ce,j),ee=P||F||T.length>0;return{matches:i,loaderData:M,errors:N,...ee?{workingFetchers:j}:{}}}function Ce(e){if(e&&!Y(e[1]))return{[e[0]]:e[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function we(e){let t=new Map(A.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=ln(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Te(t,n,r,i){Le(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=it(A.location,A.matches,c,r,n,i?.relative),u=F(o,l,c,!1,s.branches),d=nt(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){q(t,n,J(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=at(!0,l,i);if(m){q(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new E,g=(i&&i.preventScrollReset)===!0;if(p&&X(p.formMethod)){await Ee(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}de.set(t,{routeId:n,path:f}),await De(t,n,f,u,h,d.active,a,g,p)}async function Ee(t,n,i,l,u,d,f,p,m,g){G(),de.delete(t),K(t,un(m,A.fetchers.get(t)),{flushSync:f});let _=new AbortController,v=Pt(e.history,i,_.signal,m);if(d){let e=await rt(l,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){q(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{q(t,n,J(404,{pathname:i}),{flushSync:f});return}}let y=an(l,i);if(!y.route.action&&!y.route.lazy){q(t,n,J(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}L.set(t,_);let b=se,x=Tt(a,o,v,i,l,y,r,u),S=await ke(v,i,x,u,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){L.get(t)===_&&L.delete(t);return}if(z.has(t)){if(Zt(C)||Y(C)){K(t,dn(void 0));return}}else{if(Zt(C))if(L.delete(t),ce>b){K(t,dn(void 0));return}else return ue.add(t),K(t,ln(m)),W(v,C,!1,{fetcherSubmission:m,preventScrollReset:p});if(Y(C)){q(t,n,C.error);return}}let w=A.navigation.location||A.location,T=Pt(e.history,w,_.signal),E=s.activeRoutes,D=A.navigation.state===`idle`?A.matches:F(E,A.navigation.location,c,!1,s.branches);h(D,`Didn't find any matches after fetcher action`);let O=++se;le.set(t,O);let{dsMatches:k,revalidatingFetchers:M}=ot(T,u,a,o,e.history,A,D,m,w,r,!1,ae,oe,z,de,ue,E,c,e.patchRoutesOnNavigation!=null,s.branches,[y.route.id,C],g),N=ln(m,C.data),P=new Map(A.fetchers);P.set(t,N),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=P.get(t),r=ln(void 0,n?n.data:void 0);P.set(t,r),Le(t),e.controller&&L.set(t,e.controller)}),H({fetchers:P});let ee=()=>M.forEach(e=>Le(e.key));_.signal.addEventListener(`abort`,ee);let{loaderResults:te,fetcherResults:ne}=await Ae(k,M,T,w,u);if(_.signal.aborted)return;_.signal.removeEventListener(`abort`,ee),le.delete(t),L.delete(t),M.forEach(e=>L.delete(e.key));let re=A.fetchers.has(t),ie=e=>{if(!re)return e;let n=new Map(e.fetchers);return n.set(t,dn(C.data)),{...e,fetchers:n}},R=Wt(te);if(R)return A=ie(A),W(T,R.result,!1,{preventScrollReset:p});if(R=Wt(ne),R)return ue.add(R.key),A=ie(A),W(T,R.result,!1,{preventScrollReset:p});let B=new Map(A.fetchers);re&&B.set(t,dn(C.data));let{loaderData:fe,errors:pe}=zt(A,D,te,void 0,M,ne,B);Be(O,B),A.navigation.state===`loading`&&O>ce?(h(j,`Expected pending action`),I&&I.abort(),ve(A.navigation.location,{matches:D,loaderData:fe,errors:pe,fetchers:B})):(H({errors:pe,loaderData:Bt(A.loaderData,fe,D,pe),fetchers:B}),ae=!1)}async function De(t,n,i,s,c,l,u,d,f){let p=A.fetchers.get(t);K(t,ln(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Pt(e.history,i,m.signal);if(l){let e=await rt(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){q(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{q(t,n,J(404,{pathname:i}),{flushSync:u});return}}let g=an(s,i);L.set(t,m);let _=se,v=await ke(h,i,Tt(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(L.get(t)===m&&L.delete(t),!h.signal.aborted){if(z.has(t)){K(t,dn(void 0));return}if(Zt(y))if(ce>_){K(t,dn(void 0));return}else{ue.add(t),await W(h,y,!1,{preventScrollReset:d});return}if(Y(y)){q(t,n,y.error);return}K(t,dn(y.data))}}async function W(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(N?.resolve(),N=null),i.response.headers.has(`X-Remix-Revalidate`)&&(ae=!0);let d=i.response.headers.get(`Location`);h(d,`Expected a Location header on the redirect Response`),d=Nt(d,new URL(r.url),c,e.history);let f=y(A.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(he(d)){let n=C(t,d,!0);e=n.origin!==t.location.origin||V(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}I=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:g,formEncType:_}=A.navigation;!o&&!s&&m&&g&&_&&(o=on(A.navigation));let v=o||s;We.has(i.response.status)&&v&&X(v.formMethod)?await xe(p,f,{submission:{...v,formAction:d},preventScrollReset:l||P,enableViewTransition:a?te:void 0}):await xe(p,f,{overrideNavigation:sn(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||P,enableViewTransition:a?te:void 0})}async function ke(e,t,n,r,i){let a,o={};try{a=await Et(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!X(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!A.loaderData.hasOwnProperty(e.route.id)&&(!A.errors||!A.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(Xt(r)){let i=r.result;o[t]={type:`redirect`,response:At(i,e,t,n,c)}}else o[t]=await kt(r);return o}async function Ae(e,t,n,r,i){let a=ke(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await ke(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:J(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function G(){ae=!0,de.forEach((e,t)=>{L.has(t)&&oe.add(t),Le(t)})}function K(e,t,n={}){let r=new Map(A.fetchers);r.set(e,t),H({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function q(e,t,n,r={}){let i=Ht(A.matches,t),a=new Map(A.fetchers);Fe(a,e),H({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Ne(e){return R.set(e,(R.get(e)||0)+1),z.has(e)&&z.delete(e),A.fetchers.get(e)||Ke}function Pe(e,t){Le(e,t?.reason),K(e,dn(null))}function Fe(e,t){let n=A.fetchers.get(t);L.has(t)&&!(n&&n.state===`loading`&&le.has(t))&&Le(t),de.delete(t),le.delete(t),ue.delete(t),z.delete(t),oe.delete(t),e.delete(t)}function Ie(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),z.add(e)):R.set(e,t),H({fetchers:new Map(A.fetchers)})}function Le(e,t){let n=L.get(e);n&&(n.abort(t),L.delete(e))}function Re(e,t){for(let n of e){let e=t.get(n);h(e,`Expected fetcher: ${n}`);let r=dn(e.data);t.set(n,r)}}function ze(e){let t=[],n=!1;for(let r of ue){let i=e.get(r);h(i,`Expected fetcher: ${r}`),i.state===`loading`&&(ue.delete(r),t.push(r),n=!0)}return Re(t,e),n}function Be(e,t){let n=[];for(let[r,i]of le)if(i<e){let e=t.get(r);h(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Le(r),le.delete(r),n.push(r))}return Re(n,t),n.length>0}function Ve(e,t){let n=A.blockers.get(e)||qe;return B.get(e)!==t&&B.set(e,t),n}function He(e){A.blockers.delete(e),B.delete(e)}function Ue(e,t){let n=A.blockers.get(e)||qe;h(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(A.blockers);r.set(e,t),H({blockers:r})}function Ye({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&g(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=A.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Xe(e){let t=J(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Ut(n);return{notFoundMatches:r,route:i,error:t}}function Ze(e,t,n){if(m=e,v=t,_=n||null,!b&&A.navigation===Ge){b=!0;let e=et(A.location,A.matches);e!=null&&H({restoreScrollPosition:e})}return()=>{m=null,v=null,_=null}}function Qe(e,t){return _&&_(e,t.map(e=>ee(e,A.loaderData)))||e.key}function $e(e,t){if(m&&v){let n=Qe(e,t);m[n]=v()}}function et(e,t){if(m){let n=Qe(e,t),r=m[n];if(typeof r==`number`)return r}return null}function nt(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:F(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:F(n,r,c,!0,e)}}return{active:!1,matches:null}}async function rt(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||ft(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=F(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=F(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&<(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=F(s.activeRoutes,n,c,!0,u),!f||lt(l,f))return{type:`success`,matches:null};l=f}}function lt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function ut(e){o={},s.setHmrRoutes(M(e,a,void 0,o))}function dt(e,t,n=!1){ft(e,t,s,o,a,n),s.hasHMRRoutes||H({})}return k={get basename(){return c},get future(){return u},get state(){return A},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:me,subscribe:_e,enableScrollRestoration:Ze,navigate:ye,fetch:Te,revalidate:be,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ne,resetFetcher:Pe,deleteFetcher:Ie,dispose:ge,getBlocker:Ve,deleteBlocker:He,patchRoutes:dt,_internalFetchControllers:L,_internalSetRoutes:ut,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){H(e)}},e.instrumentations&&(k=Me(k,e.instrumentations.map(e=>e.router).filter(Boolean))),k}function rt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function it(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=be(r||`.`,ye(o),V(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=rn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=me({basename:n,pathname:c.pathname})),b(c)}function at(e,t,n){if(!n||!rt(n))return{path:t};if(n.formMethod&&!nn(n.formMethod))return{path:t,error:J(405,{method:n.formMethod})};let r=()=>({path:t,error:J(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Gt(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!X(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
|
|
2
2
|
`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!X(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}h(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=It(n.formData),s=n.formData;else if(n.body instanceof FormData)o=It(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Lt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Lt(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(X(c.formMethod))return{path:t,submission:c};let l=x(t);return e&&l.search&&rn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:b(l),submission:c}}function ot(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?Y(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&Y(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=W(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!st(s))f=!1;else if(u){let{shouldLoad:e}=ct(s,a.loaderData,a.errors);f=e}else lt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return wt(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?ut(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return wt(n,r,e,c,k,i,l,t,dt(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=F(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=an(b,e.path),C=new AbortController,w=Pt(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=Tt(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=Tt(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};dt(S,a)&&(T=Tt(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function st(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ct(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!st(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function lt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function ut(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function dt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function ft(e,t,n,r,i,a){let o;if(e){let t=r[e];h(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>pt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=M(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=M([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function pt(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>pt(e,t)))??!1:!1}var mt=new WeakMap,ht=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(h(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=mt.get(i);o||(o={},mt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=O(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)g(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)g(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},gt=new WeakMap;function _t(e,t,n,r,i){let a=n[e.id];if(h(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=gt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{h(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=A(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?g(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?g(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return gt.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=ht({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function vt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function yt(e){return e.matches.some(e=>e.route.middleware)?bt(e,()=>vt(e)):vt(e)}function bt(e,t){return xt(e,t,e=>{if(tn(e))throw e;return e},Jt,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=Ht(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function xt(e,t,n,r,i){let{matches:a,...o}=e;return await St(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function St(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await St(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Ct(e,t,n,r,i){let a=ht({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=_t(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function wt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Ct(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?dt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?dt(a,{...l,defaultShouldRevalidate:e}):dt(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!X(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(X(n.method)||!p)?Dt({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Tt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?wt(e,t,n,r,W(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Ct(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Et(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Ft(t,n),pattern:W(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return bt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Dt({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=X(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Ft(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw J(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw J(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Ot(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function kt(e){let{result:t,type:n}=e;if($t(t)){let e;try{e=await Ot(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new De(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Qt(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:qt(t),statusCode:Oe(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Oe(t)?t.status:void 0}:Qt(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function At(e,t,n,r,i){let a=e.headers.get(`Location`);if(h(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!he(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=it(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var jt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Mt(e){try{return jt.includes(new URL(e).protocol)}catch{return!1}}function Nt(e,t,n,r){if(he(e)){let r=e,i=u.test(r)?new URL(d(r,t.protocol)):new URL(r);if(Mt(i.toString()))throw Error(`Invalid redirect location`);let a=V(i.pathname,n)!=null;if(i.origin===t.origin&&a)return xe(i.pathname)+i.search+i.hash}try{if(Mt(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Pt(e,t,n,r){let i=e.createURL(Gt(t)).toString(),a={signal:n};if(r&&X(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=It(r.formData):a.body=r.formData}return new Request(i,a)}function Ft(e,t){let n=new URL(e.url),r=typeof t==`string`?x(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function It(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Lt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Rt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Y(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(h(!Zt(f),`Cannot handle redirect results in processLoaderData`),Y(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Ht(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Xe),c||(c=!0,s=Oe(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function zt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Rt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(h(s,`Did not find corresponding fetcher result`),Y(s)){let t=Ht(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(Zt(s))h(!1,`Unhandled fetcher revalidation redirect`);else{let e=dn(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Bt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Xe).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Vt(e){return e?Y(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ht(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function Ut(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function J(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new De(e||500,o,Error(s),!0)}function Wt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Zt(r))return{key:n,result:r}}}function Gt(e){return b({...typeof e==`string`?x(e):e,hash:``})}function Kt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function qt(e){return new De(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Jt(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Yt(t))}function Yt(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Xt(e){return $t(e.result)&&Ue.has(e.result.status)}function Y(e){return e.type===`error`}function Zt(e){return(e&&e.type)===`redirect`}function Qt(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function $t(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function en(e){return Ue.has(e)}function tn(e){return $t(e)&&en(e.status)&&e.headers.has(`Location`)}function nn(e){return He.has(e.toUpperCase())}function X(e){return Be.has(e.toUpperCase())}function rn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function an(e,t){let n=typeof t==`string`?x(t).search:t.search;if(e[e.length-1].route.index&&rn(n||``))return e[e.length-1];let r=ve(e);return r[r.length-1]}function on(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function sn(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function cn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function ln(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function un(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function dn(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function fn(e,t){try{let n=e.sessionStorage.getItem(Ye);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function pn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Ye,JSON.stringify(n))}catch(e){g(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function mn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var hn=r.createContext(null);hn.displayName=`DataRouter`;var gn=r.createContext(null);gn.displayName=`DataRouterState`;var _n=r.createContext(!1);function vn(){return r.useContext(_n)}var yn=r.createContext({isTransitioning:!1});yn.displayName=`ViewTransition`;var bn=r.createContext(new Map);bn.displayName=`Fetchers`;var xn=r.createContext(null);xn.displayName=`Await`;var Z=r.createContext(null);Z.displayName=`Navigation`;var Sn=r.createContext(null);Sn.displayName=`Location`;var Q=r.createContext({outlet:null,matches:[],isDataRoute:!1});Q.displayName=`Route`;var Cn=r.createContext(null);Cn.displayName=`RouteError`;var wn=`REACT_ROUTER_ERROR`,Tn=`REDIRECT`,En=`ROUTE_ERROR_RESPONSE`;function Dn(e){if(e.startsWith(`${wn}:${Tn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function On(e){if(e.startsWith(`${wn}:${En}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new De(t.status,t.statusText,t.data)}catch{}}function kn(e,{relative:t}={}){h(An(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:i}=r.useContext(Z),{hash:a,pathname:o,search:s}=Bn(e,{relative:t}),c=o;return n!==`/`&&(c=o===`/`?n:U([n,o])),i.createHref({pathname:c,search:s,hash:a})}function An(){return r.useContext(Sn)!=null}function $(){return h(An(),`useLocation() may be used only in the context of a <Router> component.`),r.useContext(Sn).location}function jn(){return r.useContext(Sn).navigationType}function Mn(e){h(An(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=$();return r.useMemo(()=>z(e,pe(t)),[t,e])}var Nn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Pn(e){r.useContext(Z).static||r.useLayoutEffect(e)}function Fn(){let{isDataRoute:e}=r.useContext(Q);return e?or():In()}function In(){h(An(),`useNavigate() may be used only in the context of a <Router> component.`);let e=r.useContext(hn),{basename:t,navigator:n}=r.useContext(Z),{matches:i}=r.useContext(Q),{pathname:a}=$(),o=JSON.stringify(ye(i)),s=r.useRef(!1);return Pn(()=>{s.current=!0}),r.useCallback((r,i={})=>{if(g(s.current,Nn),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=be(r,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:U([t,c.pathname])),(i.replace?n.replace:n.push)(c,i.state,i)},[t,n,o,a,e])}var Ln=r.createContext(null);function Rn(e){let t=r.useContext(Q).outlet;return r.useMemo(()=>t&&r.createElement(Ln.Provider,{value:e},t),[t,e])}function zn(){let{matches:e}=r.useContext(Q);return e[e.length-1]?.params??{}}function Bn(e,{relative:t}={}){let{matches:n}=r.useContext(Q),{pathname:i}=$(),a=JSON.stringify(ye(n));return r.useMemo(()=>be(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function Vn(e,t,n){h(An(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:i}=r.useContext(Z),{matches:a}=r.useContext(Q),o=a[a.length-1],s=o?o.params:{},c=o?o.pathname:`/`,l=o?o.pathnameBase:`/`,u=o&&o.route;{let e=u&&u.path||``;cr(c,!u||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=$(),f;if(t){let e=typeof t==`string`?x(t):t;h(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):P(e,{pathname:m});g(u||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),g(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Jn(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:U([l,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:U([l,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,n);return t&&v?r.createElement(Sn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},v):v}function Hn(){let e=rr(),t=Oe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=r.createElement(r.Fragment,null,r.createElement(`p`,null,`💿 Hey developer 👋`),r.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,r.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,r.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),r.createElement(r.Fragment,null,r.createElement(`h2`,null,`Unexpected Application Error!`),r.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?r.createElement(`pre`,{style:a},n):null,s)}var Un=r.createElement(Hn,null),Wn=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=On(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:r.createElement(Q.Provider,{value:this.props.routeContext},r.createElement(Cn.Provider,{value:e,children:this.props.component}));return this.context?r.createElement(Kn,{error:e},t):t}};Wn.contextType=_n;var Gn=new WeakMap;function Kn({children:e,error:t}){let{basename:n}=r.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Dn(t.digest);if(e){let i=Gn.get(t);if(i)throw i;let a=Ae(e.location,n),o=a.absoluteURL||a.to;if(Mt(o))throw Error(`Invalid redirect location`);if(ke&&!Gn.get(t))if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Gn.set(t,n),n}return r.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function qn({routeContext:e,match:t,children:n}){let i=r.useContext(hn);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(Q.Provider,{value:e},n)}function Jn(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);h(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let l=n?.onError,u=i&&l?(e,t)=>{l(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:W(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;i&&(d=o&&n.route.id?o[n.route.id]:void 0,p=n.route.errorElement||Un,s&&(c<0&&l===0?(cr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?r.createElement(n.route.Component,null):n.route.element?n.route.element:e,r.createElement(qn,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?r.createElement(Wn,{location:i.location,revalidation:i.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function Yn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xn(e){let t=r.useContext(hn);return h(t,Yn(e)),t}function Zn(e){let t=r.useContext(gn);return h(t,Yn(e)),t}function Qn(e){let t=r.useContext(Q);return h(t,Yn(e)),t}function $n(e){let t=Qn(e),n=t.matches[t.matches.length-1];return h(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function er(){return $n(`useRouteId`)}function tr(){let e=Zn(`useNavigation`);return r.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function nr(){let{matches:e,loaderData:t}=Zn(`useMatches`);return r.useMemo(()=>e.map(e=>ee(e,t)),[e,t])}function rr(){let e=r.useContext(Cn),t=Zn(`useRouteError`),n=$n(`useRouteError`);return e===void 0?t.errors?.[n]:e}var ir=0;function ar(e){let{router:t,basename:n}=Xn(`useBlocker`),i=Zn(`useBlocker`),[a,o]=r.useState(``),s=r.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:V(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:V(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return r.useEffect(()=>{let e=String(++ir);return o(e),()=>t.deleteBlocker(e)},[t]),r.useEffect(()=>{a!==``&&t.getBlocker(a,s)},[t,a,s]),a&&i.blockers.has(a)?i.blockers.get(a):qe}function or(){let{router:e}=Xn(`useNavigate`),t=$n(`useNavigate`),n=r.useRef(!1);return Pn(()=>{n.current=!0}),r.useCallback(async(r,i={})=>{g(n.current,Nn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var sr={};function cr(e,t,n){!t&&!sr[e]&&(sr[e]=!0,g(!1,n))}var lr={};function ur(e,t){!e&&!lr[t]&&(lr[t]=!0,console.warn(t))}var dr=r.useOptimistic,fr=()=>void 0;function pr(e){return dr?dr(e):[e,fr]}function mr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&g(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:r.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&g(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&g(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var hr=[`HydrateFallback`,`hydrateFallbackElement`],gr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function _r({router:e,flushSync:t,onError:n,useTransitions:i}){i=vn()||i;let[a,o]=r.useState(e.state),[s,c]=pr(a),[l,u]=r.useState(),[d,f]=r.useState({isTransitioning:!1}),[p,m]=r.useState(),[h,g]=r.useState(),[_,v]=r.useState(),y=r.useRef(new Map),b=r.useCallback((a,{deletedFetchers:s,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{l&&n&&Object.values(l).forEach(e=>n(e,{location:a.location,params:a.matches[0]?.params??{},pattern:W(a.matches)})),a.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),s.forEach(e=>y.current.delete(e)),ur(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ur(_==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!_||!b){t&&d?t(()=>o(a)):i===!1?o(a):r.startTransition(()=>{i===!0&&c(e=>vr(e,a)),o(a)});return}if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>o(a))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:a,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(a),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,i,c,n]);r.useLayoutEffect(()=>e.subscribe(b),[e,b]),r.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new gr)},[d]),r.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,a=e.window.document.startViewTransition(async()=>{i===!1?o(t):r.startTransition(()=>{i===!0&&c(e=>vr(e,t)),o(t)}),await n});a.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(a)}},[l,p,e.window,i,c]),r.useEffect(()=>{p&&l&&s.location.key===l.location.key&&p.resolve()},[p,h,s.location,l]),r.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[d.isTransitioning,_]);let x=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=r.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return r.createElement(r.Fragment,null,r.createElement(hn.Provider,{value:C},r.createElement(gn.Provider,{value:s},r.createElement(bn.Provider,{value:y.current},r.createElement(yn.Provider,{value:d},r.createElement(Cr,{basename:S,location:s.location,navigationType:s.historyAction,navigator:x,useTransitions:i},r.createElement(yr,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function vr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var yr=r.memo(br);function br({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Vn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function xr({to:e,replace:t,state:n,relative:i}){h(An(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=r.useContext(Z);g(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=r.useContext(Q),{pathname:s}=$(),c=Fn(),l=be(e,ye(o),s,i===`path`),u=JSON.stringify(l);return r.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:i})},[c,u,i,t,n]),null}function Sr(e){return Rn(e.context)}function Cr({basename:e=`/`,children:t=null,location:n,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){h(!An(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=r.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof n==`string`&&(n=x(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:_}=n,v=r.useMemo(()=>{let e=V(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:_},navigationType:i}},[c,u,d,f,p,m,i,_]);return g(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:r.createElement(Z.Provider,{value:l},r.createElement(Sn.Provider,{children:t,value:v}))}r.Component;var wr=`get`,Tr=`application/x-www-form-urlencoded`;function Er(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Dr(e){return Er(e)&&e.tagName.toLowerCase()===`button`}function Or(e){return Er(e)&&e.tagName.toLowerCase()===`form`}function kr(e){return Er(e)&&e.tagName.toLowerCase()===`input`}function Ar(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function jr(e,t){return e.button===0&&(!t||t===`_self`)&&!Ar(e)}function Mr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Nr(e,t){let n=Mr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Pr=null;function Fr(){if(Pr===null)try{new FormData(document.createElement(`form`),0),Pr=!1}catch{Pr=!0}return Pr}var Ir=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Lr(e){return e!=null&&!Ir.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tr}"`),null):e}function Rr(e,t){let n,r,i,a,o;if(Or(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||wr,i=Lr(e.getAttribute(`enctype`))||Tr,a=new FormData(e)}else if(Dr(e)||kr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?V(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||wr,i=Lr(e.getAttribute(`formenctype`))||Lr(o.getAttribute(`enctype`))||Tr,a=new FormData(o,e),!Fr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Er(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=wr,r=null,i=Tr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var zr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Br=/[&><\u2028\u2029]/g;function Vr(e){return e.replace(Br,e=>zr[e])}function Hr(e,t){if(e===!1||e==null)throw Error(t)}function Ur(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&V(i.pathname,t)===`/`?i.pathname=`${Se(t)}/_root.${r}`:i.pathname=`${Se(i.pathname)}.${r}`,i}async function Wr(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Gr(e){return e!=null&&typeof e.page==`string`}function Kr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function qr(e,t,n){return Qr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Wr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Kr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Jr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Yr(e,t,{includeHydrateFallback:n}={}){return Xr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Xr(e){return[...new Set(e)]}function Zr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Qr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Gr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Zr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function $r(){let e=r.useContext(hn);return Hr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ei(){let e=r.useContext(gn);return Hr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ti=r.createContext(void 0);ti.displayName=`FrameworkContext`;function ni(){let e=r.useContext(ti);return Hr(e,`You must render this element inside a <HydratedRouter> element`),e}function ri(e,t){let n=r.useContext(ti),[i,a]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=r.useRef(null);r.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e===`intent`?[o,p,{onFocus:ii(c,m),onBlur:ii(l,h),onMouseEnter:ii(u,m),onMouseLeave:ii(d,h),onTouchStart:ii(f,m)}]:[o,p,{}]:[!1,p,{}]}function ii(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ai({page:e,...t}){let n=vn(),{nonce:i}=ni(),{router:a}=$r(),o=r.useMemo(()=>P(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),n?r.createElement(si,{page:e,matches:o,...t}):r.createElement(ci,{page:e,matches:o,...t})):null}function oi(e){let{manifest:t,routeModules:n}=ni(),[i,a]=r.useState([]);return r.useEffect(()=>{let r=!1;return qr(e,t,n).then(e=>{r||a(e)}),()=>{r=!0}},[e,t,n]),i}function si({page:e,matches:t,...n}){let i=$(),{future:a}=ni(),{basename:o}=$r(),s=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Ur(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return r.createElement(r.Fragment,null,s.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ci({page:e,matches:t,...n}){let i=$(),{future:a,manifest:o,routeModules:s}=ni(),{basename:c}=$r(),{loaderData:l,matches:u}=ei(),d=r.useMemo(()=>Jr(e,t,u,o,i,`data`),[e,t,u,o,i]),f=r.useMemo(()=>Jr(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Ur(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=r.useMemo(()=>Yr(f,o),[f,o]),h=oi(f);return r.createElement(r.Fragment,null,p.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>r.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>r.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function li(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}r.Component;var ui=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ui&&(window.__reactRouterVersion=`7.18.1`)}catch{}function di(e,t){return nt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:m({window:t?.window}),hydrationData:t?.hydrationData||fi(),routes:e,mapRouteProperties:mr,hydrationRouteProperties:hr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function fi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:pi(e.errors)}),e}function pi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new De(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Ee.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function mi({basename:e,children:t,history:n,useTransitions:i}){let[a,o]=r.useState({action:n.action,location:n.location}),s=r.useCallback(e=>{i===!1?o(e):r.startTransition(()=>o(e))},[i]);return r.useLayoutEffect(()=>n.listen(s),[n,s]),r.createElement(Cr,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:n,useTransitions:i})}mi.displayName=`unstable_HistoryRouter`;var hi=r.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:c,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=r.useContext(Z),b=typeof d==`string`&&l.test(d),x=Ae(d,_);d=x.to;let S=kn(d,{relative:i}),C=$(),w=null;if(s){let e=be(s,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:U([_,e.pathname])),w=v.createHref(e)}let[T,E,D]=ri(n,h),O=Si(d,{replace:o,mask:s,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||a),j=r.createElement(`a`,{...h,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:li(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?r.createElement(r.Fragment,null,j,r.createElement(ai,{page:S})):j});hi.displayName=`Link`;var gi=r.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=Bn(o,{relative:l.relative}),f=$(),p=r.useContext(gn),{navigator:m,basename:h}=r.useContext(Z),g=p!=null&&Pi(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=V(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return r.createElement(hi,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});gi.displayName=`NavLink`;var _i=r.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:i,replace:a,state:o,method:s=wr,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=r.useContext(Z),v=Ei(),y=Di(c,{relative:d}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&l.test(c);return r.createElement(`form`,{ref:g,method:b,action:y,onSubmit:i?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,c=i?.getAttribute(`formmethod`)||s,l=()=>v(i||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?r.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});_i.displayName=`Form`;function vi({getKey:e,storageKey:t,...n}){let i=r.useContext(ti),{basename:a}=r.useContext(Z),o=$(),s=nr();ji({getKey:e,storageKey:t});let c=r.useMemo(()=>{if(!i||!e)return null;let t=Ai(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&i?.nonce&&(n.nonce=i.nonce),r.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Vr(JSON.stringify(t||Oi))}, ${Vr(JSON.stringify(c))})`}})}vi.displayName=`ScrollRestoration`;function yi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bi(e){let t=r.useContext(hn);return h(t,yi(e)),t}function xi(e){let t=r.useContext(gn);return h(t,yi(e)),t}function Si(e,{target:t,replace:n,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=Fn(),f=$(),p=Bn(e,{relative:s});return r.useCallback(m=>{if(jr(m,t)){m.preventDefault();let t=n===void 0?b(f)===b(p):n,h=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?r.startTransition(()=>h()):h()}},[f,d,p,n,i,a,t,e,o,s,c,l,u])}function Ci(e){g(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=r.useRef(Mr(e)),n=r.useRef(!1),i=$(),a=r.useMemo(()=>Nr(i.search,n.current?null:t.current),[i.search]),o=Fn();return[a,r.useCallback((e,t)=>{let r=Mr(typeof e==`function`?e(new URLSearchParams(a)):e);n.current=!0,o(`?`+r,t)},[o,a])]}var wi=0,Ti=()=>`__${String(++wi)}__`;function Ei(){let{router:e}=bi(`useSubmit`),{basename:t}=r.useContext(Z),n=er(),i=e.fetch,a=e.navigate;return r.useCallback(async(e,r={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Rr(e,t);r.navigate===!1?await i(r.fetcherKey||Ti(),n,r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync}):await a(r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,a,t,n])}function Di(e,{relative:t}={}){let{basename:n}=r.useContext(Z),i=r.useContext(Q);h(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...Bn(e||`.`,{relative:t})},s=$();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(o.pathname=o.pathname===`/`?n:U([n,o.pathname])),b(o)}var Oi=`react-router-scroll-positions`,ki={};function Ai(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:V(e.pathname,n)||e.pathname},t)),i??=e.key,i}function ji({getKey:e,storageKey:t}={}){let{router:n}=bi(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=xi(`useScrollRestoration`),{basename:o}=r.useContext(Z),s=$(),c=nr(),l=tr();r.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ni(r.useCallback(()=>{if(l.state===`idle`){let t=Ai(s,c,o,e);ki[t]=window.scrollY}try{sessionStorage.setItem(t||Oi,JSON.stringify(ki))}catch(e){g(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,o,s,c,t])),typeof document<`u`&&(r.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Oi);e&&(ki=JSON.parse(e))}catch{}},[t]),r.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(ki,()=>window.scrollY,e?(t,n)=>Ai(t,n,o,e):void 0);return()=>t&&t()},[n,o,e]),r.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{g(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[s,i,a]))}function Mi(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`beforeunload`,e,t),()=>{window.removeEventListener(`beforeunload`,e,t)}},[e,n])}function Ni(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Pi(e,{relative:t}={}){let n=r.useContext(yn);h(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=bi(`useViewTransitionState`),a=Bn(e,{relative:t});if(!n.isTransitioning)return!1;let o=V(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=V(n.nextLocation.pathname,i)||n.nextLocation.pathname;return z(a.pathname,s)!=null||z(a.pathname,o)!=null}export{_r as a,Mi as c,Mn as d,Fn as f,Ci as g,rr as h,Sr as i,ar as l,zn as m,gi as n,w as o,jn as p,xr as r,di as s,hi as t,$ as u};
|
|
4
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=$(),f;if(t){let e=typeof t==`string`?x(t):t;h(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):P(e,{pathname:m});g(u||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),g(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Jn(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:U([l,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:U([l,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,n);return t&&v?r.createElement(Sn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},v):v}function Hn(){let e=rr(),t=Oe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=r.createElement(r.Fragment,null,r.createElement(`p`,null,`💿 Hey developer 👋`),r.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,r.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,r.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),r.createElement(r.Fragment,null,r.createElement(`h2`,null,`Unexpected Application Error!`),r.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?r.createElement(`pre`,{style:a},n):null,s)}var Un=r.createElement(Hn,null),Wn=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=On(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:r.createElement(Q.Provider,{value:this.props.routeContext},r.createElement(Cn.Provider,{value:e,children:this.props.component}));return this.context?r.createElement(Kn,{error:e},t):t}};Wn.contextType=_n;var Gn=new WeakMap;function Kn({children:e,error:t}){let{basename:n}=r.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Dn(t.digest);if(e){let i=Gn.get(t);if(i)throw i;let a=Ae(e.location,n),o=a.absoluteURL||a.to;if(Mt(o))throw Error(`Invalid redirect location`);if(ke&&!Gn.get(t))if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Gn.set(t,n),n}return r.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function qn({routeContext:e,match:t,children:n}){let i=r.useContext(hn);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(Q.Provider,{value:e},n)}function Jn(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);h(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let l=n?.onError,u=i&&l?(e,t)=>{l(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:W(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;i&&(d=o&&n.route.id?o[n.route.id]:void 0,p=n.route.errorElement||Un,s&&(c<0&&l===0?(cr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?r.createElement(n.route.Component,null):n.route.element?n.route.element:e,r.createElement(qn,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?r.createElement(Wn,{location:i.location,revalidation:i.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function Yn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xn(e){let t=r.useContext(hn);return h(t,Yn(e)),t}function Zn(e){let t=r.useContext(gn);return h(t,Yn(e)),t}function Qn(e){let t=r.useContext(Q);return h(t,Yn(e)),t}function $n(e){let t=Qn(e),n=t.matches[t.matches.length-1];return h(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function er(){return $n(`useRouteId`)}function tr(){let e=Zn(`useNavigation`);return r.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function nr(){let{matches:e,loaderData:t}=Zn(`useMatches`);return r.useMemo(()=>e.map(e=>ee(e,t)),[e,t])}function rr(){let e=r.useContext(Cn),t=Zn(`useRouteError`),n=$n(`useRouteError`);return e===void 0?t.errors?.[n]:e}var ir=0;function ar(e){let{router:t,basename:n}=Xn(`useBlocker`),i=Zn(`useBlocker`),[a,o]=r.useState(``),s=r.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:V(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:V(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return r.useEffect(()=>{let e=String(++ir);return o(e),()=>t.deleteBlocker(e)},[t]),r.useEffect(()=>{a!==``&&t.getBlocker(a,s)},[t,a,s]),a&&i.blockers.has(a)?i.blockers.get(a):qe}function or(){let{router:e}=Xn(`useNavigate`),t=$n(`useNavigate`),n=r.useRef(!1);return Pn(()=>{n.current=!0}),r.useCallback(async(r,i={})=>{g(n.current,Nn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var sr={};function cr(e,t,n){!t&&!sr[e]&&(sr[e]=!0,g(!1,n))}var lr={};function ur(e,t){!e&&!lr[t]&&(lr[t]=!0,console.warn(t))}var dr=r.useOptimistic,fr=()=>void 0;function pr(e){return dr?dr(e):[e,fr]}function mr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&g(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:r.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&g(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&g(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var hr=[`HydrateFallback`,`hydrateFallbackElement`],gr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function _r({router:e,flushSync:t,onError:n,useTransitions:i}){i=vn()||i;let[a,o]=r.useState(e.state),[s,c]=pr(a),[l,u]=r.useState(),[d,f]=r.useState({isTransitioning:!1}),[p,m]=r.useState(),[h,g]=r.useState(),[_,v]=r.useState(),y=r.useRef(new Map),b=r.useCallback((a,{deletedFetchers:s,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{l&&n&&Object.values(l).forEach(e=>n(e,{location:a.location,params:a.matches[0]?.params??{},pattern:W(a.matches)})),a.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),s.forEach(e=>y.current.delete(e)),ur(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ur(_==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!_||!b){t&&d?t(()=>o(a)):i===!1?o(a):r.startTransition(()=>{i===!0&&c(e=>vr(e,a)),o(a)});return}if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>o(a))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:a,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(a),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,i,c,n]);r.useLayoutEffect(()=>e.subscribe(b),[e,b]),r.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new gr)},[d]),r.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,a=e.window.document.startViewTransition(async()=>{i===!1?o(t):r.startTransition(()=>{i===!0&&c(e=>vr(e,t)),o(t)}),await n});a.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(a)}},[l,p,e.window,i,c]),r.useEffect(()=>{p&&l&&s.location.key===l.location.key&&p.resolve()},[p,h,s.location,l]),r.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[d.isTransitioning,_]);let x=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=r.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return r.createElement(r.Fragment,null,r.createElement(hn.Provider,{value:C},r.createElement(gn.Provider,{value:s},r.createElement(bn.Provider,{value:y.current},r.createElement(yn.Provider,{value:d},r.createElement(Cr,{basename:S,location:s.location,navigationType:s.historyAction,navigator:x,useTransitions:i},r.createElement(yr,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function vr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var yr=r.memo(br);function br({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Vn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function xr({to:e,replace:t,state:n,relative:i}){h(An(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=r.useContext(Z);g(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=r.useContext(Q),{pathname:s}=$(),c=Fn(),l=be(e,ye(o),s,i===`path`),u=JSON.stringify(l);return r.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:i})},[c,u,i,t,n]),null}function Sr(e){return Rn(e.context)}function Cr({basename:e=`/`,children:t=null,location:n,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){h(!An(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=r.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof n==`string`&&(n=x(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:_}=n,v=r.useMemo(()=>{let e=V(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:_},navigationType:i}},[c,u,d,f,p,m,i,_]);return g(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:r.createElement(Z.Provider,{value:l},r.createElement(Sn.Provider,{children:t,value:v}))}r.Component;var wr=`get`,Tr=`application/x-www-form-urlencoded`;function Er(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Dr(e){return Er(e)&&e.tagName.toLowerCase()===`button`}function Or(e){return Er(e)&&e.tagName.toLowerCase()===`form`}function kr(e){return Er(e)&&e.tagName.toLowerCase()===`input`}function Ar(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function jr(e,t){return e.button===0&&(!t||t===`_self`)&&!Ar(e)}function Mr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Nr(e,t){let n=Mr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Pr=null;function Fr(){if(Pr===null)try{new FormData(document.createElement(`form`),0),Pr=!1}catch{Pr=!0}return Pr}var Ir=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Lr(e){return e!=null&&!Ir.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tr}"`),null):e}function Rr(e,t){let n,r,i,a,o;if(Or(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||wr,i=Lr(e.getAttribute(`enctype`))||Tr,a=new FormData(e)}else if(Dr(e)||kr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?V(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||wr,i=Lr(e.getAttribute(`formenctype`))||Lr(o.getAttribute(`enctype`))||Tr,a=new FormData(o,e),!Fr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Er(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=wr,r=null,i=Tr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var zr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Br=/[&><\u2028\u2029]/g;function Vr(e){return e.replace(Br,e=>zr[e])}function Hr(e,t){if(e===!1||e==null)throw Error(t)}function Ur(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&V(i.pathname,t)===`/`?i.pathname=`${Se(t)}/_root.${r}`:i.pathname=`${Se(i.pathname)}.${r}`,i}async function Wr(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Gr(e){return e!=null&&typeof e.page==`string`}function Kr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function qr(e,t,n){return Qr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Wr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Kr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Jr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Yr(e,t,{includeHydrateFallback:n}={}){return Xr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Xr(e){return[...new Set(e)]}function Zr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Qr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Gr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Zr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function $r(){let e=r.useContext(hn);return Hr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ei(){let e=r.useContext(gn);return Hr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ti=r.createContext(void 0);ti.displayName=`FrameworkContext`;function ni(){let e=r.useContext(ti);return Hr(e,`You must render this element inside a <HydratedRouter> element`),e}function ri(e,t){let n=r.useContext(ti),[i,a]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=r.useRef(null);r.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e===`intent`?[o,p,{onFocus:ii(c,m),onBlur:ii(l,h),onMouseEnter:ii(u,m),onMouseLeave:ii(d,h),onTouchStart:ii(f,m)}]:[o,p,{}]:[!1,p,{}]}function ii(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ai({page:e,...t}){let n=vn(),{nonce:i}=ni(),{router:a}=$r(),o=r.useMemo(()=>P(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),n?r.createElement(si,{page:e,matches:o,...t}):r.createElement(ci,{page:e,matches:o,...t})):null}function oi(e){let{manifest:t,routeModules:n}=ni(),[i,a]=r.useState([]);return r.useEffect(()=>{let r=!1;return qr(e,t,n).then(e=>{r||a(e)}),()=>{r=!0}},[e,t,n]),i}function si({page:e,matches:t,...n}){let i=$(),{future:a}=ni(),{basename:o}=$r(),s=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Ur(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return r.createElement(r.Fragment,null,s.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ci({page:e,matches:t,...n}){let i=$(),{future:a,manifest:o,routeModules:s}=ni(),{basename:c}=$r(),{loaderData:l,matches:u}=ei(),d=r.useMemo(()=>Jr(e,t,u,o,i,`data`),[e,t,u,o,i]),f=r.useMemo(()=>Jr(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Ur(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=r.useMemo(()=>Yr(f,o),[f,o]),h=oi(f);return r.createElement(r.Fragment,null,p.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>r.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>r.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function li(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}r.Component;var ui=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ui&&(window.__reactRouterVersion=`7.18.1`)}catch{}function di(e,t){return nt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:m({window:t?.window}),hydrationData:t?.hydrationData||fi(),routes:e,mapRouteProperties:mr,hydrationRouteProperties:hr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function fi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:pi(e.errors)}),e}function pi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new De(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Ee.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function mi({basename:e,children:t,history:n,useTransitions:i}){let[a,o]=r.useState({action:n.action,location:n.location}),s=r.useCallback(e=>{i===!1?o(e):r.startTransition(()=>o(e))},[i]);return r.useLayoutEffect(()=>n.listen(s),[n,s]),r.createElement(Cr,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:n,useTransitions:i})}mi.displayName=`unstable_HistoryRouter`;var hi=r.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:c,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=r.useContext(Z),b=typeof d==`string`&&l.test(d),x=Ae(d,_);d=x.to;let S=kn(d,{relative:i}),C=$(),w=null;if(s){let e=be(s,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:U([_,e.pathname])),w=v.createHref(e)}let[T,E,D]=ri(n,h),O=Si(d,{replace:o,mask:s,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||a),j=r.createElement(`a`,{...h,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:li(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?r.createElement(r.Fragment,null,j,r.createElement(ai,{page:S})):j});hi.displayName=`Link`;var gi=r.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=Bn(o,{relative:l.relative}),f=$(),p=r.useContext(gn),{navigator:m,basename:h}=r.useContext(Z),g=p!=null&&Pi(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=V(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return r.createElement(hi,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});gi.displayName=`NavLink`;var _i=r.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:i,replace:a,state:o,method:s=wr,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=r.useContext(Z),v=Ei(),y=Di(c,{relative:d}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&l.test(c);return r.createElement(`form`,{ref:g,method:b,action:y,onSubmit:i?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,c=i?.getAttribute(`formmethod`)||s,l=()=>v(i||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?r.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});_i.displayName=`Form`;function vi({getKey:e,storageKey:t,...n}){let i=r.useContext(ti),{basename:a}=r.useContext(Z),o=$(),s=nr();ji({getKey:e,storageKey:t});let c=r.useMemo(()=>{if(!i||!e)return null;let t=Ai(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&i?.nonce&&(n.nonce=i.nonce),r.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Vr(JSON.stringify(t||Oi))}, ${Vr(JSON.stringify(c))})`}})}vi.displayName=`ScrollRestoration`;function yi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bi(e){let t=r.useContext(hn);return h(t,yi(e)),t}function xi(e){let t=r.useContext(gn);return h(t,yi(e)),t}function Si(e,{target:t,replace:n,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=Fn(),f=$(),p=Bn(e,{relative:s});return r.useCallback(m=>{if(jr(m,t)){m.preventDefault();let t=n===void 0?b(f)===b(p):n,h=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?r.startTransition(()=>h()):h()}},[f,d,p,n,i,a,t,e,o,s,c,l,u])}function Ci(e){g(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=r.useRef(Mr(e)),n=r.useRef(!1),i=$(),a=r.useMemo(()=>Nr(i.search,n.current?null:t.current),[i.search]),o=Fn();return[a,r.useCallback((e,t)=>{let r=Mr(typeof e==`function`?e(new URLSearchParams(a)):e);n.current=!0,o(`?`+r,t)},[o,a])]}var wi=0,Ti=()=>`__${String(++wi)}__`;function Ei(){let{router:e}=bi(`useSubmit`),{basename:t}=r.useContext(Z),n=er(),i=e.fetch,a=e.navigate;return r.useCallback(async(e,r={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Rr(e,t);r.navigate===!1?await i(r.fetcherKey||Ti(),n,r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync}):await a(r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,a,t,n])}function Di(e,{relative:t}={}){let{basename:n}=r.useContext(Z),i=r.useContext(Q);h(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...Bn(e||`.`,{relative:t})},s=$();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(o.pathname=o.pathname===`/`?n:U([n,o.pathname])),b(o)}var Oi=`react-router-scroll-positions`,ki={};function Ai(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:V(e.pathname,n)||e.pathname},t)),i??=e.key,i}function ji({getKey:e,storageKey:t}={}){let{router:n}=bi(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=xi(`useScrollRestoration`),{basename:o}=r.useContext(Z),s=$(),c=nr(),l=tr();r.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ni(r.useCallback(()=>{if(l.state===`idle`){let t=Ai(s,c,o,e);ki[t]=window.scrollY}try{sessionStorage.setItem(t||Oi,JSON.stringify(ki))}catch(e){g(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,o,s,c,t])),typeof document<`u`&&(r.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Oi);e&&(ki=JSON.parse(e))}catch{}},[t]),r.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(ki,()=>window.scrollY,e?(t,n)=>Ai(t,n,o,e):void 0);return()=>t&&t()},[n,o,e]),r.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{g(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[s,i,a]))}function Mi(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`beforeunload`,e,t),()=>{window.removeEventListener(`beforeunload`,e,t)}},[e,n])}function Ni(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Pi(e,{relative:t}={}){let n=r.useContext(yn);h(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=bi(`useViewTransitionState`),a=Bn(e,{relative:t});if(!n.isTransitioning)return!1;let o=V(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=V(n.nextLocation.pathname,i)||n.nextLocation.pathname;return z(a.pathname,s)!=null||z(a.pathname,o)!=null}export{Ci as _,_r as a,z as c,$ as d,Mn as f,rr as g,zn as h,Sr as i,Mi as l,jn as m,gi as n,w as o,Fn as p,xr as r,di as s,hi as t,ar as u};
|