From c3fffa0739da7ca12a7109201f39270bdd27eb0f Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 17:03:28 +0800 Subject: [PATCH 1/6] release: prepare LoopX 1.0.0 Workspace milestone Signed-off-by: huangruiteng --- loopx/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loopx/__init__.py b/loopx/__init__.py index 650d48b698..f0b74ed19c 100644 --- a/loopx/__init__.py +++ b/loopx/__init__.py @@ -2,4 +2,4 @@ __all__ = ["__version__"] -__version__ = "0.5.4" +__version__ = "1.0.0" diff --git a/pyproject.toml b/pyproject.toml index 6a10774de6..ebf892f176 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "loopx" -version = "0.5.4" +version = "1.0.0" description = "A lightweight Loop Engineering control plane for long-running agent goals." readme = "README.md" requires-python = ">=3.11" From 4eebde5e23dc011a43d6950228cbc36bc9ea9647 Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 18:03:17 +0800 Subject: [PATCH 2/6] test(release): decouple license checks and dashboard fixtures from local state Signed-off-by: huangruiteng --- tests/test_dashboard_command.py | 4 ++++ tests/test_license_metadata.py | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_dashboard_command.py b/tests/test_dashboard_command.py index 7d438dec8d..7aa17bd685 100644 --- a/tests/test_dashboard_command.py +++ b/tests/test_dashboard_command.py @@ -982,6 +982,10 @@ def test_dashboard_command_in_installed_mode_resolves_packaged_web_bundle( tmp_path: Path, ) -> None: monkeypatch.setenv("LOOPX_RELEASE_ROOT", str(tmp_path)) + monkeypatch.setattr( + "loopx.dashboard_launcher._probe_existing_chat", + lambda *args, **kwargs: "unavailable", + ) served: list[dict[str, object]] = [] monkeypatch.setattr( diff --git a/tests/test_license_metadata.py b/tests/test_license_metadata.py index 0131b6a9c1..128f407303 100644 --- a/tests/test_license_metadata.py +++ b/tests/test_license_metadata.py @@ -31,8 +31,6 @@ def test_root_license_is_canonical_apache_2_with_historical_notices() -> None: def test_python_distributions_declare_apache_2() -> None: root_project = _project_metadata("pyproject.toml") - assert root_project["version"] == "0.5.4" - assert '__version__ = "0.5.4"' in (ROOT / "loopx/__init__.py").read_text() assert root_project["license"] == "Apache-2.0" assert set(root_project["license-files"]) == {"LICENSE", "NOTICE", "LICENSE-MIT"} From 84ca3426985468893a76a3b54c13eb0732eadaa4 Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 19:00:27 +0800 Subject: [PATCH 3/6] docs(release): align book and manual with 1.0.0 Signed-off-by: huangruiteng --- docs/book/chapters/00-reading-guide.md | 14 +++++++------- docs/book/en/chapters/00-reading-guide.md | 16 ++++++++-------- docs/book/en/index.md | 6 +++--- docs/book/index.md | 6 +++--- man/loopx.1 | 7 +++++-- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/docs/book/chapters/00-reading-guide.md b/docs/book/chapters/00-reading-guide.md index f5ceca0f84..0b19c81add 100644 --- a/docs/book/chapters/00-reading-guide.md +++ b/docs/book/chapters/00-reading-guide.md @@ -103,7 +103,7 @@ lifecycle 选择,不是所有贡献的默认终点。 ## 版本基线 -当前内容以 LoopX GitHub release `v0.5.4` 为发布锚点;本地命令示例已按 `loopx 0.5.4` 的 +当前内容以 LoopX GitHub release `v1.0.0` 为发布锚点;本地命令示例已按 `loopx 1.0.0` 的 公开 CLI 与协议表面复核。该版本要求 Python 3.11+ 与 Node.js 22.6+;后者运行由 LoopX 自动管理、 空闲后退出的 TypeScript Effect runtime,用户不需要手工维护 daemon。 @@ -129,7 +129,7 @@ node --version ### 如何理解当前 TypeScript 改造 -`v0.5.4` 不是“已经把 LoopX 全部重写成 TypeScript”。当前发布基线是: +`v1.0.0` 不是“已经把 LoopX 全部重写成 TypeScript”。当前发布基线是: - TypeScript 已拥有 Effect Program、Turn/Host Todo settlement、Todo completion、quota delivery/spend/void/monitor-poll、本地 task-lease lifecycle、Vision refresh、governed capability @@ -141,19 +141,19 @@ node --version - 当前 `main` 已进入 transaction-payoff phase:后续以完整 transaction cutover 和删除旧语义 为进展单位,不继续堆 leaf helper 与 bridge。 -发布态以 `v0.5.4` tag 和 release notes 为准;迁移阶段、下一批 cutover 与最终 CLI/App 收敛以 +发布态以 `v1.0.0` tag 和 release notes 为准;迁移阶段、下一批 cutover 与最终 CLI/App 收敛以 [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -的当前状态为准。`v0.5.4` 只交付了 Stage 3 的第一个 receipt-bound scheduler follow-up 切片;更广的 +的当前状态为准。`v1.0.0` 只交付了 Stage 3 的第一个 receipt-bound scheduler follow-up 切片;更广的 CLI/App convergence 与 Stage 4 distribution cleanup 仍是后续方向。 -### 从 `v0.4.4` 阅读基线升级到 `v0.5.4` +### 从 `v0.4.4` 阅读基线升级到 `v1.0.0` 如果你读过旧版 Dev Book,优先校准四个变化: -| 主题 | `v0.5.4` 已发布事实 | 深入入口 | +| 主题 | `v1.0.0` 已发布事实 | 深入入口 | | --- | --- | --- | | Control Plane | Turn/Host Todo settlement、quota commit、task-lease lifecycle、Vision refresh 与 scheduler heartbeat 等完整事务已迁入 typed TypeScript owner;Python facade 仍承担迁移期边界 | [迁移 RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) | -| Operator surface | Personal Workspace 已提供 Goal、Task、Chat 和 read-only status source 入口;界面不是新的事实源 | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v0.5.4/apps/presentation/dashboard/README.md) | +| Operator surface | Personal Workspace 已提供 Goal、Task、Chat 和 read-only status source 入口;界面不是新的事实源 | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v1.0.0/apps/presentation/dashboard/README.md) | | Host runtime | Codex、Claude Code、OpenCode、Pi、KunlunCode、DeepSeek Harness 与 custom runner 具有不同 activation/stop contract | [Runtime Connector Catalog](/loopx/docs/integrations/runtime-connector-catalog/) | | Capability / Provider | Capability 由 package-owned catalog entry、真实 command 和 durable validation 共同定义;Provider/Extension 不继承 Kernel authority | [Capability Catalog](/loopx/docs/capabilities/) | | Shared authority | file、NoKV 与 PostgreSQL provider 仍是 staged candidate;安装 Provider 不会改变默认本地 authority | [Shared Authority RFC](/loopx/docs/architecture/rfcs/shared-goal-authority-state-provider-v0/) | diff --git a/docs/book/en/chapters/00-reading-guide.md b/docs/book/en/chapters/00-reading-guide.md index 3a2af53c56..43038a6909 100644 --- a/docs/book/en/chapters/00-reading-guide.md +++ b/docs/book/en/chapters/00-reading-guide.md @@ -114,8 +114,8 @@ Do not bypass a newer permission or lifecycle check just to make an older exampl ## Version baseline -The current release anchor is LoopX GitHub release `v0.5.4`. Local command examples were checked against -the public `loopx 0.5.4` CLI and protocol surface. This release requires Python 3.11+ and Node.js 22.6+. +The current release anchor is LoopX GitHub release `v1.0.0`. Local command examples were checked against +the public `loopx 1.0.0` CLI and protocol surface. This release requires Python 3.11+ and Node.js 22.6+. LoopX starts and reuses its managed, idle-exiting TypeScript Effect runtime automatically; users do not operate that runtime as a manual daemon. @@ -143,7 +143,7 @@ different version identifiers imply. ### How to read the TypeScript migration -`v0.5.4` does not mean that all of LoopX has been rewritten in TypeScript. The current release baseline is: +`v1.0.0` does not mean that all of LoopX has been rewritten in TypeScript. The current release baseline is: - TypeScript owns the canonical semantics for migrated slices of the Effect Program, Turn and Host Todo settlement, Todo completion, quota delivery/spend/void/monitor-poll, the local task-lease lifecycle, @@ -155,20 +155,20 @@ different version identifiers imply. - current `main` is in the transaction-payoff phase: later progress is measured by complete transaction cutovers and deleted legacy semantics, not by accumulating leaf helpers and bridge calls. -Treat the `v0.5.4` tag and release notes as the shipped baseline. Use the current status of the +Treat the `v1.0.0` tag and release notes as the shipped baseline. Use the current status of the [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -for later cutovers and final CLI/App convergence. `v0.5.4` ships only the first receipt-bound scheduler +for later cutovers and final CLI/App convergence. `v1.0.0` ships only the first receipt-bound scheduler follow-up slice of Stage 3; broader CLI/App convergence and Stage 4 distribution cleanup remain future work. -### Updating your mental model from `v0.4.4` to `v0.5.4` +### Updating your mental model from `v0.4.4` to `v1.0.0` If you read an earlier edition of the Dev Book, recalibrate these four areas first: -| Area | Shipped in `v0.5.4` | Continue with | +| Area | Shipped in `v1.0.0` | Continue with | | --- | --- | --- | | Control Plane | Complete Turn/Host Todo settlement, quota commit, task-lease lifecycle, Vision refresh, and scheduler-heartbeat transactions have typed TypeScript owners; Python facades still carry migration-time boundaries | [Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) | -| Operator surface | Personal Workspace exposes Goal, Task, Chat, and read-only status-source entrypoints; the UI is not a new source of truth | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v0.5.4/apps/presentation/dashboard/README.md) | +| Operator surface | Personal Workspace exposes Goal, Task, Chat, and read-only status-source entrypoints; the UI is not a new source of truth | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v1.0.0/apps/presentation/dashboard/README.md) | | Host runtime | Codex, Claude Code, OpenCode, Pi, KunlunCode, DeepSeek Harness, and custom runners have distinct activation and stop contracts | [Runtime Connector Catalog](/loopx/docs/integrations/runtime-connector-catalog/) | | Capability and Provider | A Capability is defined by a package-owned catalog entry, a real command, and durable validation; a Provider or Extension does not inherit Kernel authority | [Capability Catalog](/loopx/docs/capabilities/) | | Shared authority | File, NoKV, and PostgreSQL providers remain staged candidates; installing a Provider does not change the default local authority | [Shared Authority RFC](/loopx/docs/architecture/rfcs/shared-goal-authority-state-provider-v0/) | diff --git a/docs/book/en/index.md b/docs/book/en/index.md index 2326c8e3e5..3d0201a19e 100644 --- a/docs/book/en/index.md +++ b/docs/book/en/index.md @@ -79,16 +79,16 @@ versioned or optional functionality, not the default shape of every contribution - Source format: Markdown - Site generator: MkDocs Material - Hosting: GitHub Pages -- LoopX release anchor: `v0.5.4` +- LoopX release anchor: `v1.0.0` - Runtime prerequisites: Python 3.11+ and Node.js 22.6+ The official public protocols remain authoritative for protocol facts. Commands that change across releases remain authoritative in the release you use, its current `--help`, and official documentation. This book owns the learning path and explanatory model, not another complete command reference. -In `v0.5.4`, key semantics for the Effect Program, Turn settlement, Todo completion, quota delivery +In `v1.0.0`, key semantics for the Effect Program, Turn settlement, Todo completion, quota delivery routing, workspace causality, and scheduler state sit behind typed TypeScript owners. During the migration, the Python CLI still owns transport, legacy projections, external Provider calls, and some durable writeback. These are not two independently evolving control planes. Treat the [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -on current `main` as the direction for later stages, not as shipped `v0.5.4` behavior. +on current `main` as the direction for later stages, not as shipped `v1.0.0` behavior. diff --git a/docs/book/index.md b/docs/book/index.md index f5de75a024..5f55139030 100644 --- a/docs/book/index.md +++ b/docs/book/index.md @@ -70,15 +70,15 @@ Extension 只是可独立版本化和交付的一种路径。 - 正文格式:Markdown; - 站点生成器:MkDocs Material; - 在线发布:GitHub Pages; -- LoopX 发布锚点:`v0.5.4`; +- LoopX 发布锚点:`v1.0.0`; - 运行时前提:Python 3.11+ 与 Node.js 22.6+。 协议解释以 LoopX 官方公开合同为事实源。易变化的命令仍以对应发布物、官方文档和当前 `--help` 为准;本书负责教学顺序与心智模型,不成为另一份完整命令参考。 -`v0.5.4` 已把 Effect Program、Turn settlement、Todo completion、quota delivery routing、 +`v1.0.0` 已把 Effect Program、Turn settlement、Todo completion、quota delivery routing、 workspace causality 与 scheduler state 等关键语义放到 typed TypeScript owner 后面。Python CLI 仍负责迁移期 transport、兼容投影、外部 Provider 调用和部分持久化写回;这不是两套可独立演进的 控制面。当前 `main` 的后续迁移阶段以 [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -为准,不应倒推为 `v0.5.4` 已发布行为。 +为准,不应倒推为 `v1.0.0` 已发布行为。 diff --git a/man/loopx.1 b/man/loopx.1 index 576cc70fdd..885ddafa4d 100644 --- a/man/loopx.1 +++ b/man/loopx.1 @@ -1,4 +1,4 @@ -.TH LOOPX 1 "" "LoopX 0.5.4" "User Commands" +.TH LOOPX 1 "" "LoopX 1.0.0" "User Commands" .SH NAME loopx \- control-plane helper for long-running agent work .SH SYNOPSIS @@ -87,6 +87,9 @@ Show todo lifecycle commands. \fBloopx task\-lease \-\-help\fR Acquire, renew, transfer, release, or inspect a hard per\-todo lease. .TP +\fBloopx coordination\-shadow \-\-help\fR +Inspect, bootstrap, or revision\-fenced rollback the default\-off Stage 2C file shadow. +.TP \fBloopx quota should\-run\fR Decide whether the next agent turn should run. .TP @@ -135,7 +138,7 @@ Generate a copy\-paste project connection prompt for an agent. Persist one stable host thread binding to an already registered LoopX agent. .TP \fBloopx resolve\-agent\-thread\fR -Read one exact host thread binding across the current project without mutating authority. +Read one exact host thread binding from an opaque id or copied Codex task deep link without mutating authority. .TP \fBloopx unbind\-agent\-thread\fR Remove one exact host thread binding without unregistering its agent or peer sessions. From b0754e50f2897338f2e3d30ca3cf454521052fe6 Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 19:02:05 +0800 Subject: [PATCH 4/6] docs(release): preserve historical migration milestone versions Signed-off-by: huangruiteng --- docs/book/chapters/00-reading-guide.md | 12 ++++++------ docs/book/en/chapters/00-reading-guide.md | 12 ++++++------ docs/book/en/index.md | 4 ++-- docs/book/index.md | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/book/chapters/00-reading-guide.md b/docs/book/chapters/00-reading-guide.md index 0b19c81add..85848dc3ad 100644 --- a/docs/book/chapters/00-reading-guide.md +++ b/docs/book/chapters/00-reading-guide.md @@ -129,7 +129,7 @@ node --version ### 如何理解当前 TypeScript 改造 -`v1.0.0` 不是“已经把 LoopX 全部重写成 TypeScript”。当前发布基线是: +`v0.5.4` 不是“已经把 LoopX 全部重写成 TypeScript”。当前发布基线是: - TypeScript 已拥有 Effect Program、Turn/Host Todo settlement、Todo completion、quota delivery/spend/void/monitor-poll、本地 task-lease lifecycle、Vision refresh、governed capability @@ -141,19 +141,19 @@ node --version - 当前 `main` 已进入 transaction-payoff phase:后续以完整 transaction cutover 和删除旧语义 为进展单位,不继续堆 leaf helper 与 bridge。 -发布态以 `v1.0.0` tag 和 release notes 为准;迁移阶段、下一批 cutover 与最终 CLI/App 收敛以 +发布态以 `v0.5.4` tag 和 release notes 为准;迁移阶段、下一批 cutover 与最终 CLI/App 收敛以 [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -的当前状态为准。`v1.0.0` 只交付了 Stage 3 的第一个 receipt-bound scheduler follow-up 切片;更广的 +的当前状态为准。`v0.5.4` 只交付了 Stage 3 的第一个 receipt-bound scheduler follow-up 切片;更广的 CLI/App convergence 与 Stage 4 distribution cleanup 仍是后续方向。 -### 从 `v0.4.4` 阅读基线升级到 `v1.0.0` +### 从 `v0.4.4` 阅读基线升级到 `v0.5.4` 如果你读过旧版 Dev Book,优先校准四个变化: -| 主题 | `v1.0.0` 已发布事实 | 深入入口 | +| 主题 | `v0.5.4` 已发布事实 | 深入入口 | | --- | --- | --- | | Control Plane | Turn/Host Todo settlement、quota commit、task-lease lifecycle、Vision refresh 与 scheduler heartbeat 等完整事务已迁入 typed TypeScript owner;Python facade 仍承担迁移期边界 | [迁移 RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) | -| Operator surface | Personal Workspace 已提供 Goal、Task、Chat 和 read-only status source 入口;界面不是新的事实源 | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v1.0.0/apps/presentation/dashboard/README.md) | +| Operator surface | Personal Workspace 已提供 Goal、Task、Chat 和 read-only status source 入口;界面不是新的事实源 | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v0.5.4/apps/presentation/dashboard/README.md) | | Host runtime | Codex、Claude Code、OpenCode、Pi、KunlunCode、DeepSeek Harness 与 custom runner 具有不同 activation/stop contract | [Runtime Connector Catalog](/loopx/docs/integrations/runtime-connector-catalog/) | | Capability / Provider | Capability 由 package-owned catalog entry、真实 command 和 durable validation 共同定义;Provider/Extension 不继承 Kernel authority | [Capability Catalog](/loopx/docs/capabilities/) | | Shared authority | file、NoKV 与 PostgreSQL provider 仍是 staged candidate;安装 Provider 不会改变默认本地 authority | [Shared Authority RFC](/loopx/docs/architecture/rfcs/shared-goal-authority-state-provider-v0/) | diff --git a/docs/book/en/chapters/00-reading-guide.md b/docs/book/en/chapters/00-reading-guide.md index 43038a6909..087a4b7153 100644 --- a/docs/book/en/chapters/00-reading-guide.md +++ b/docs/book/en/chapters/00-reading-guide.md @@ -143,7 +143,7 @@ different version identifiers imply. ### How to read the TypeScript migration -`v1.0.0` does not mean that all of LoopX has been rewritten in TypeScript. The current release baseline is: +`v0.5.4` does not mean that all of LoopX has been rewritten in TypeScript. The current release baseline is: - TypeScript owns the canonical semantics for migrated slices of the Effect Program, Turn and Host Todo settlement, Todo completion, quota delivery/spend/void/monitor-poll, the local task-lease lifecycle, @@ -155,20 +155,20 @@ different version identifiers imply. - current `main` is in the transaction-payoff phase: later progress is measured by complete transaction cutovers and deleted legacy semantics, not by accumulating leaf helpers and bridge calls. -Treat the `v1.0.0` tag and release notes as the shipped baseline. Use the current status of the +Treat the `v0.5.4` tag and release notes as the shipped baseline. Use the current status of the [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -for later cutovers and final CLI/App convergence. `v1.0.0` ships only the first receipt-bound scheduler +for later cutovers and final CLI/App convergence. `v0.5.4` ships only the first receipt-bound scheduler follow-up slice of Stage 3; broader CLI/App convergence and Stage 4 distribution cleanup remain future work. -### Updating your mental model from `v0.4.4` to `v1.0.0` +### Updating your mental model from `v0.4.4` to `v0.5.4` If you read an earlier edition of the Dev Book, recalibrate these four areas first: -| Area | Shipped in `v1.0.0` | Continue with | +| Area | Shipped in `v0.5.4` | Continue with | | --- | --- | --- | | Control Plane | Complete Turn/Host Todo settlement, quota commit, task-lease lifecycle, Vision refresh, and scheduler-heartbeat transactions have typed TypeScript owners; Python facades still carry migration-time boundaries | [Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) | -| Operator surface | Personal Workspace exposes Goal, Task, Chat, and read-only status-source entrypoints; the UI is not a new source of truth | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v1.0.0/apps/presentation/dashboard/README.md) | +| Operator surface | Personal Workspace exposes Goal, Task, Chat, and read-only status-source entrypoints; the UI is not a new source of truth | [Dashboard README](https://github.com/huangruiteng/loopx/blob/v0.5.4/apps/presentation/dashboard/README.md) | | Host runtime | Codex, Claude Code, OpenCode, Pi, KunlunCode, DeepSeek Harness, and custom runners have distinct activation and stop contracts | [Runtime Connector Catalog](/loopx/docs/integrations/runtime-connector-catalog/) | | Capability and Provider | A Capability is defined by a package-owned catalog entry, a real command, and durable validation; a Provider or Extension does not inherit Kernel authority | [Capability Catalog](/loopx/docs/capabilities/) | | Shared authority | File, NoKV, and PostgreSQL providers remain staged candidates; installing a Provider does not change the default local authority | [Shared Authority RFC](/loopx/docs/architecture/rfcs/shared-goal-authority-state-provider-v0/) | diff --git a/docs/book/en/index.md b/docs/book/en/index.md index 3d0201a19e..e82f985908 100644 --- a/docs/book/en/index.md +++ b/docs/book/en/index.md @@ -86,9 +86,9 @@ The official public protocols remain authoritative for protocol facts. Commands releases remain authoritative in the release you use, its current `--help`, and official documentation. This book owns the learning path and explanatory model, not another complete command reference. -In `v1.0.0`, key semantics for the Effect Program, Turn settlement, Todo completion, quota delivery +In `v0.5.4`, key semantics for the Effect Program, Turn settlement, Todo completion, quota delivery routing, workspace causality, and scheduler state sit behind typed TypeScript owners. During the migration, the Python CLI still owns transport, legacy projections, external Provider calls, and some durable writeback. These are not two independently evolving control planes. Treat the [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -on current `main` as the direction for later stages, not as shipped `v1.0.0` behavior. +on current `main` as the direction for later stages, not as shipped `v0.5.4` behavior. diff --git a/docs/book/index.md b/docs/book/index.md index 5f55139030..57253384eb 100644 --- a/docs/book/index.md +++ b/docs/book/index.md @@ -76,9 +76,9 @@ Extension 只是可独立版本化和交付的一种路径。 协议解释以 LoopX 官方公开合同为事实源。易变化的命令仍以对应发布物、官方文档和当前 `--help` 为准;本书负责教学顺序与心智模型,不成为另一份完整命令参考。 -`v1.0.0` 已把 Effect Program、Turn settlement、Todo completion、quota delivery routing、 +`v0.5.4` 已把 Effect Program、Turn settlement、Todo completion、quota delivery routing、 workspace causality 与 scheduler state 等关键语义放到 typed TypeScript owner 后面。Python CLI 仍负责迁移期 transport、兼容投影、外部 Provider 调用和部分持久化写回;这不是两套可独立演进的 控制面。当前 `main` 的后续迁移阶段以 [TypeScript Control-Plane Migration RFC](/loopx/docs/architecture/rfcs/typescript-control-plane-migration-v0/) -为准,不应倒推为 `v1.0.0` 已发布行为。 +为准,不应倒推为 `v0.5.4` 已发布行为。 From d22e53020d8f525a7efa16accc0b1efae7ee2389 Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 20:04:41 +0800 Subject: [PATCH 5/6] test(cli): follow extracted registration and writeback owners Signed-off-by: huangruiteng --- tests/test_cli_entrypoint.py | 2 +- tests/test_loopx_turn_journal_inspection.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_cli_entrypoint.py b/tests/test_cli_entrypoint.py index e3c941f207..65a6f50aba 100644 --- a/tests/test_cli_entrypoint.py +++ b/tests/test_cli_entrypoint.py @@ -203,7 +203,7 @@ def test_top_level_help_skips_full_cli_import() -> None: (["diagnose", "--help"], "loopx.cli_commands.status_registration", "loopx.cli_commands.status"), (["review-packet", "--help"], "loopx.cli_commands.status_registration", "loopx.cli_commands.status"), (["quota", "--help"], "loopx.cli_commands.quota_registration", "loopx.cli_commands.quota"), - (["todo", "--help"], "loopx.cli_commands.todo", "loopx.cli_commands.todo"), + (["todo", "--help"], "loopx.cli_commands.todo_registration", "loopx.cli_commands.todo"), ], ) def test_common_command_help_loads_only_its_owner( diff --git a/tests/test_loopx_turn_journal_inspection.py b/tests/test_loopx_turn_journal_inspection.py index fead34b384..65da1ef904 100644 --- a/tests/test_loopx_turn_journal_inspection.py +++ b/tests/test_loopx_turn_journal_inspection.py @@ -10,7 +10,7 @@ from loopx.cli import main as cli_main from loopx.cli_commands import turn as turn_command -from loopx.cli_commands import turn_rendering +from loopx.cli_commands import turn_rendering, turn_todo_writeback from loopx.control_plane.turn_driver import executor from loopx.control_plane.turn_driver import turn_journal_runtime @@ -302,10 +302,10 @@ def unexpected_call(*args: object, **kwargs: object) -> None: "run_loopx_turn_once", "spend_quota_slot", "refresh_state_run", - "complete_goal_todo", - "update_goal_todo", ): monkeypatch.setattr(turn_command, name, unexpected_call) + for name in ("complete_goal_todo", "update_goal_todo"): + monkeypatch.setattr(turn_todo_writeback, name, unexpected_call) monkeypatch.setattr(executor, "execute_turn_driver_settlement", unexpected_call) monkeypatch.setattr(executor, "_write_journal", unexpected_call) From 14c5f877f766ad8a420766ef84a08c7a31c20c94 Mon Sep 17 00:00:00 2001 From: huangruiteng Date: Sun, 6 Sep 2026 20:44:32 +0800 Subject: [PATCH 6/6] fix(desktop): match maintenance IPC origin and distinguish update failures Signed-off-by: huangruiteng --- .../loopx-control-plane/src-tauri/src/lib.rs | 31 ++++- .../src-tauri/src/maintenance.rs | 61 ++++++++- .../loopx-control-plane/static/boot.js | 12 +- .../personal-workspace/desktop-update.tsx | 30 +++- examples/desktop-update-browser-smoke.mjs | 27 +++- loopx/web/chat/assets/index-CyzsRtSq.js | 129 ++++++++++++++++++ loopx/web/chat/index.html | 2 +- 7 files changed, 276 insertions(+), 16 deletions(-) create mode 100644 loopx/web/chat/assets/index-CyzsRtSq.js diff --git a/apps/desktop/loopx-control-plane/src-tauri/src/lib.rs b/apps/desktop/loopx-control-plane/src-tauri/src/lib.rs index 1e2156ce84..f16d4a6ab5 100644 --- a/apps/desktop/loopx-control-plane/src-tauri/src/lib.rs +++ b/apps/desktop/loopx-control-plane/src-tauri/src/lib.rs @@ -15,6 +15,12 @@ use tauri_plugin_notification::NotificationExt; const APP_IDENTIFIER: &str = "io.loopx.control-plane"; +fn maintenance_origin(url: &Url) -> String { + // Custom-protocol IPC carries the HTTP Origin header (no /chat/ path). + // postMessage carries the page URL. Both must match the same exact origin. + url.origin().ascii_serialization() +} + fn show_main_window(app: &AppHandle) { if let Some(window) = app.get_webview_window("main") { let _ = window.show(); @@ -54,7 +60,7 @@ pub fn run() { let origin: Url = web_origin.parse()?; app.add_capability( CapabilityBuilder::new("desktop-loopx-chat") - .remote(origin.to_string()) + .remote(maintenance_origin(&origin)) .permission("allow-desktop-update") .permission("allow-desktop-update-status") .window("main"), @@ -148,6 +154,29 @@ pub fn run() { #[cfg(test)] mod tests { + #[test] + fn maintenance_acl_accepts_both_transports_only_on_the_app_origin() { + use tauri::utils::acl::RemoteUrlPattern; + let page: tauri::Url = "http://127.0.0.1:8767/chat/".parse().unwrap(); + let old: RemoteUrlPattern = page.to_string().parse().unwrap(); + assert!(!old.test(&"http://127.0.0.1:8767".parse().unwrap())); + let pattern: RemoteUrlPattern = super::maintenance_origin(&page).parse().unwrap(); + for allowed in [ + "http://127.0.0.1:8767", + "http://127.0.0.1:8767/chat/?goal=x", + ] { + assert!(pattern.test(&allowed.parse().unwrap()), "{allowed}"); + } + for denied in [ + "http://127.0.0.1:8766/chat/", + "http://localhost:8767/chat/", + "https://127.0.0.1:8767/chat/", + "https://example.com/chat/", + ] { + assert!(!pattern.test(&denied.parse().unwrap()), "{denied}"); + } + } + #[test] fn startup_surface_is_visible_and_names_automatic_recovery() { let html = include_str!("../../static/index.html"); diff --git a/apps/desktop/loopx-control-plane/src-tauri/src/maintenance.rs b/apps/desktop/loopx-control-plane/src-tauri/src/maintenance.rs index ca55140d7a..97fb593be2 100644 --- a/apps/desktop/loopx-control-plane/src-tauri/src/maintenance.rs +++ b/apps/desktop/loopx-control-plane/src-tauri/src/maintenance.rs @@ -90,6 +90,21 @@ fn endpoint(channel: &str) -> Result { _ => return Err("invalid_update_channel".into()), }.parse().unwrap()) } + +fn check_error(error: tauri_plugin_updater::Error) -> &'static str { + use tauri_plugin_updater::Error; + match error { + // The plugin discards non-success HTTP status codes, so this cannot + // distinguish an unpublished feed (404) from an unavailable server. + Error::ReleaseNotFound => "update_feed_unavailable", + Error::Serialization(_) => "update_feed_invalid", + Error::TargetNotFound(_) | Error::TargetsNotFound(_) => "update_platform_unavailable", + Error::Reqwest(error) if error.is_timeout() => "update_check_timeout", + Error::Reqwest(error) if error.is_decode() => "update_feed_invalid", + Error::Reqwest(_) => "update_network_failed", + _ => "update_check_failed", + } +} #[tauri::command] pub fn desktop_update_status(app: AppHandle, state: State<'_, Maintenance>) -> Value { json!({"state": state.snapshot.lock().unwrap().clone(), "app_version": app.package_info().version.to_string(), "runtime": bundled_runtime::identity(&app).ok(), "rollback_available": crate::update_backup::available(&app)}) @@ -160,7 +175,7 @@ async fn perform( .map_err(|_| "update_unavailable")? .check() .await - .map_err(|_| "update_check_failed")?; + .map_err(check_error)?; let details = json!({"channel":channel,"version":update.as_ref().map(|v| &v.version),"current_version":app.package_info().version.to_string()}); let phase = if update.is_some() { "available" @@ -276,6 +291,27 @@ pub fn start_services(app: &AppHandle) -> Result("invalid").unwrap_err(); + assert_eq!( + check_error(Error::Serialization(invalid)), + "update_feed_invalid" + ); + } + #[test] fn transaction_is_singleflight_and_released_on_unwind() { let state = Maintenance::default(); let guard = state.acquire().unwrap(); @@ -312,9 +348,14 @@ mod tests { fn service_failure_releases_recovery_and_later_success_is_ready() { let state = Maintenance::default(); state.publish("connecting", json!({})); - assert!(state.reconcile_services::<()>(|| Err("occupied port".into())).is_err()); + assert!(state + .reconcile_services::<()>(|| Err("occupied port".into())) + .is_err()); assert_eq!(state.snapshot.lock().unwrap()["phase"], "service_error"); - assert!(state.acquire().is_ok(), "recovery transaction must be available"); + assert!( + state.acquire().is_ok(), + "recovery transaction must be available" + ); assert_eq!(state.reconcile_services(|| Ok(())).unwrap(), Some(())); assert_eq!(state.snapshot.lock().unwrap()["phase"], "ready"); } @@ -323,9 +364,19 @@ mod tests { fn service_retry_cannot_race_maintenance_or_restart() { let state = Maintenance::default(); let guard = state.acquire().unwrap(); - assert_eq!(state.reconcile_services::<()>(|| panic!("must not start")).unwrap(), None); + assert_eq!( + state + .reconcile_services::<()>(|| panic!("must not start")) + .unwrap(), + None + ); drop(guard); state.publish("restart_required", json!({})); - assert_eq!(state.reconcile_services::<()>(|| panic!("must not start")).unwrap(), None); + assert_eq!( + state + .reconcile_services::<()>(|| panic!("must not start")) + .unwrap(), + None + ); } } diff --git a/apps/desktop/loopx-control-plane/static/boot.js b/apps/desktop/loopx-control-plane/static/boot.js index 69531b893f..adab3bf5a3 100644 --- a/apps/desktop/loopx-control-plane/static/boot.js +++ b/apps/desktop/loopx-control-plane/static/boot.js @@ -35,6 +35,14 @@ const labels = { ready: "更新完成,正在打开工作区。", error: "更新未完成。请重试检查,或修复当前版本。Goal 数据不会被删除。", }; +const errors = { + update_feed_unavailable: "此通道的更新源尚未就绪或暂时不可用。可稍后重新检查。", + update_feed_invalid: "更新源格式异常。请稍后重新检查。", + update_platform_unavailable: "此通道尚无适用于本机的更新包。", + update_check_timeout: "检查更新超时。请稍后重试。", + update_network_failed: "无法连接更新服务器。请检查网络后重试。", + update_download_or_signature_failed: "更新包下载或签名校验失败,尚未安装。请重新检查更新。", +}; function render(state) { if (!state?.phase) return; if (state.phase === "available" && state.details?.channel !== channel.value) state = {phase:"idle"}; @@ -45,13 +53,13 @@ function render(state) { channel.disabled = working || state.phase === "restart_required"; nextAction = state.phase === "available" ? "apply" : state.phase === "restart_required" ? "restart" : "check"; update.textContent = nextAction === "apply" ? "更新并准备重启 / Install update" : nextAction === "restart" ? "重启完成更新 / Restart" : "检查更新 / Check for updates"; - updateStatus.textContent = labels[state.phase] || ""; + updateStatus.textContent = state.phase === "error" && Object.hasOwn(errors, state.details?.code) ? errors[state.details.code] : labels[state.phase] || ""; } async function run(action) { if (working) return; render({phase: action === "check" ? "checking" : action === "repair" ? "installing_runtime" : "downloading"}); try { render(await window.__TAURI__.core.invoke("desktop_update", {action,channel:channel.value})); } - catch { render({phase:"error"}); } + catch (error) { render({phase:"error", details:{code: typeof error === "string" && Object.hasOwn(errors, error) ? error : "update_failed"}}); } } update.onclick = () => run(nextAction); repair.onclick = () => run("repair"); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/desktop-update.tsx b/apps/presentation/dashboard/src/features/personal-workspace/desktop-update.tsx index 30c9c6a13d..286bbc40e3 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/desktop-update.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/desktop-update.tsx @@ -7,6 +7,19 @@ type UpdateState = { phase: Phase; details?: { version?: string; channel?: strin type DesktopWindow = Window & { __TAURI__?: { core: { invoke: (command: string, args?: Record) => Promise } } }; const workingPhases: Phase[] = ["checking", "connecting", "downloading", "installing_app", "installing_runtime"]; +const updateErrors: Record = { + desktop_status_unavailable: ["无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。", "Cannot read the App update status. Restart the App; if this persists, reinstall the latest App."], + update_feed_unavailable: ["此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。", "This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version."], + update_feed_invalid: ["更新源格式异常。请稍后重新检查。", "The update feed is invalid. Check again later."], + update_platform_unavailable: ["此通道尚无适用于本机的更新包。", "This channel has no update package for this platform."], + update_check_timeout: ["检查更新超时。请稍后重试。", "The update check timed out. Try again later."], + update_network_failed: ["无法连接更新服务器。请检查网络后重试。", "Cannot reach the update server. Check your connection and retry."], + update_download_or_signature_failed: ["更新包下载或签名校验失败,尚未安装。请重新检查更新。", "Download or signature verification failed; the update was not installed. Check for updates again."], +}; +function failedUpdate(error: unknown, fallback = "update_failed"): UpdateState { + return { phase: "error", details: { code: typeof error === "string" && Object.hasOwn(updateErrors, error) ? error : fallback } }; +} + export function DesktopUpdate() { const { locale } = useWorkspaceI18n(); const zh = locale === "zh-CN"; @@ -39,9 +52,9 @@ export function DesktopUpdate() { const selected = value.state?.details?.channel ?? (value.app_version.includes("-main.") ? "main" : "stable"); setChannel(selected); if (!value.state?.phase) { - void invoke("desktop_update", { action: "check", channel: selected }).then((next) => { if (alive) setState(next); }).catch(() => { if (alive) setState({ phase: "error" }); }); + void invoke("desktop_update", { action: "check", channel: selected }).then((next) => { if (alive) setState(next); }).catch((error: unknown) => { if (alive) setState(failedUpdate(error)); }); } - }).catch(() => { if (alive) setState({ phase: "error" }); }); + }).catch(() => { if (alive) setState(failedUpdate(null, "desktop_status_unavailable")); }); return () => { alive = false; }; }, [invoke]); @@ -57,8 +70,15 @@ export function DesktopUpdate() { if (!invoke || busy.current) return; busy.current = true; setState({ phase: action === "check" ? "checking" : action === "repair" ? "installing_runtime" : "downloading" }); - try { setState(await invoke("desktop_update", { action, channel })); } - catch { setState({ phase: "error" }); } + try { + if (!version) { + const current = await invoke<{ app_version: string; rollback_available?: boolean }>("desktop_update_status"); + setVersion(current.app_version); + setRollbackAvailable(current.rollback_available === true); + } + setState(await invoke("desktop_update", { action, channel })); + } + catch (error: unknown) { setState(failedUpdate(error, version ? "update_failed" : "desktop_status_unavailable")); } finally { busy.current = false; } } const message: Record = { @@ -74,7 +94,7 @@ export function DesktopUpdate() { installing_runtime: zh ? "正在安装匹配的运行时,请稍候…" : "Installing the matching runtime…", restart_required: zh ? "重启后将自动完成运行时安装与服务连接。" : "Restart to finish runtime installation and reconnect services.", ready: zh ? "更新完成,服务已就绪。" : "Update completed; services are ready.", - error: zh ? "更新未完成。请检查网络后重试;启动失败可尝试修复当前版本。" : "Update incomplete. Check the connection and retry; repair this version if startup fails.", + error: updateErrors[state.details?.code ?? ""]?.[zh ? 0 : 1] ?? (zh ? "更新未完成。请重试;启动失败可尝试修复当前版本。" : "Update incomplete. Retry; repair this version if startup fails."), }; const label = working ? (zh ? "正在更新…" : "Updating…") : state.phase === "available" ? (zh ? "有可用更新" : "Update available") : state.phase === "restart_required" ? (zh ? "重启完成更新" : "Restart to finish") : state.phase === "error" ? (zh ? "更新需重试" : "Retry update") : (zh ? "更新 LoopX" : "Update LoopX"); return
diff --git a/examples/desktop-update-browser-smoke.mjs b/examples/desktop-update-browser-smoke.mjs index d33547e3aa..505d9e09ca 100644 --- a/examples/desktop-update-browser-smoke.mjs +++ b/examples/desktop-update-browser-smoke.mjs @@ -29,9 +29,15 @@ try { const calls = []; let nativeState = null; let failUpdate = false; + let checkFailure = null; + let statusFailure = false; await page.exposeFunction("nativeInvoke", async (command, args) => { - if (command === "desktop_update_status") return { state: nativeState, app_version: "0.5.4", rollback_available: true }; + if (command === "desktop_update_status") { + if (statusFailure) throw new Error("Command desktop_update_status not allowed by ACL"); + return { state: nativeState, app_version: "0.5.4", rollback_available: true }; + } calls.push({ command, args }); + if (checkFailure && args.action === "check") return { phase: "error", details: { code: checkFailure } }; if (failUpdate) throw new Error("private diagnostic must not be displayed"); await new Promise((done) => setTimeout(done, 150)); nativeState = { phase: args.action === "check" ? "available" : "restart_required", details: { version: "0.5.5", channel: args.channel } }; @@ -66,7 +72,7 @@ try { await page.reload(); await page.getByRole("button", { name: "有可用更新" }).click(); await page.getByRole("button", { name: "更新并准备重启", exact: true }).click(); - await page.getByText("更新未完成。请检查网络后重试;启动失败可尝试修复当前版本。").waitFor(); + await page.getByText("更新未完成。请重试;启动失败可尝试修复当前版本。").waitFor(); assert.ok(!(await page.locator("body").innerText()).includes("private diagnostic")); assert.equal(await page.getByRole("button", { name: "更新并准备重启", exact: true }).count(), 0); await page.setViewportSize({ width: 390, height: 844 }); @@ -75,6 +81,23 @@ try { assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)); await page.screenshot({ path: resolve(output, "update-mobile.png") }); + await page.setViewportSize({ width: 1280, height: 900 }); + statusFailure = true; + await page.reload(); + await page.getByRole("button", { name: "更新需重试" }).click(); + await page.getByText("无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。").waitFor(); + assert.ok(!(await page.locator("body").innerText()).includes("not allowed by ACL")); + statusFailure = false; + failUpdate = false; + checkFailure = "update_feed_unavailable"; + await page.getByRole("button", { name: "检查更新", exact: true }).click(); + await page.getByText("此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。").waitFor(); + await page.getByText("0.5.4 · 稳定版", { exact: true }).waitFor(); + assert.equal(await page.getByRole("button", { name: "更新并准备重启", exact: true }).count(), 0); + checkFailure = null; + await page.getByRole("button", { name: "检查更新", exact: true }).click(); + await page.getByRole("button", { name: "更新并准备重启", exact: true }).waitFor(); + const missing = await browser.newPage(); await missing.route("**/assets/*.js", (route) => route.abort()); await missing.goto(`${origin}/chat/`); diff --git a/loopx/web/chat/assets/index-CyzsRtSq.js b/loopx/web/chat/assets/index-CyzsRtSq.js new file mode 100644 index 0000000000..cc14b5153c --- /dev/null +++ b/loopx/web/chat/assets/index-CyzsRtSq.js @@ -0,0 +1,129 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=d()})),p=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=u(),n=f(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1oe||(e.current=ae[oe],ae[oe]=null,oe--)}function se(e,t){oe++,ae[oe]=e.current,e.current=t}var ce=P(null),le=P(null),ue=P(null),de=P(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(ce),se(ce,e)}function pe(){F(ce),F(le),F(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=Kd(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(F(ce),F(le)),de.current===e&&(F(de),np._currentValue=ie)}var I,ge;function _e(e){if(I===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);I=t&&t[1]||``,ge=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?_e(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e(`Lazy`);case 13:return e.child!==t&&t!==null?_e(`Suspense Fallback`):_e(`Suspense`);case 19:return _e(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return _e(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,L=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function R(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ve=256,z=262144,B=4194304;function He(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ue(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=B;return B<<=1,!(B&62914560)&&(B=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,"passive",{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.textContent,a=i.length;for(e=0;e=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=pn(),fn=dn=un=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pt(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=sn&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Pt(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=q(kr,`onSelect`),0>=o,i-=o,wi=1<<32-Le(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ni&&Ei(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ni&&Ei(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ni&&Ei(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ni&&Ei(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ea(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=di(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ui(o.type,o.key,o.props,null,e.mode,c),Na(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ea(o),b(e,r,o,c)}if(re(o))return h(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ma(o),c);if(o.$$typeof===C)return b(e,r,ta(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=fi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=b(e,t,n,r);return Aa=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=Fa(!0),La=Fa(!1),Ra=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ba(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ua(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Wa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ga=!1;function Ka(){if(Ga){var e=fa;if(e!==null)throw e}}function qa(e,t,n,r){Ga=!1;var i=e.updateQueue;Ra=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Gl&f)===f:(r&f)===f){f!==0&&f===da&&(Ga=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ra=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),$l|=o,e.lanes=o,e.memoizedState=d}}function H(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=M.T,s={};M.T=s,Fs(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ha(c,r),xu(e)):Ps(e,t,r,xu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},xu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,ie,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},xu())}function Os(){return ea(np)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=xu();e=Va(n);var r=Ha(t,e,n);r!==null&&(Cu(r,t,n),Ua(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=xu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ei(e,t,n,r),n!==null&&(Cu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,xu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return $r(e,t,i,0),Ul===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return Cu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=ei(e,n,r,2),t!==null&&Cu(t,e,2)}function Is(e){var t=e.alternate;return e===uo||t!==null&&t===uo}function Ls(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var zs={readContext:ea,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};zs.useEffectEvent=xo;var Bs={readContext:ea,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){R(!0);try{e()}finally{R(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){R(!0);try{n(t)}finally{R(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,uo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,uo,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=uo,a=Ao();if(Ni){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ul===null)throw Error(i(349));Gl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Ul.identifierPrefix;if(Ni){var n=Ti,r=wi;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(zd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ue.current,Bi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ji,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Li(t,!0)}else e=Wd(e).createTextNode(r),e[it]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(oo(t),t):(oo(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(oo(t),t):(oo(t),null)}return oo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return pe(),e===null&&Od(t.stateNode.containerInfo),zc(t),null;case 10:return Ji(t.type),zc(t),null;case 19:if(F(so),r=t.memoizedState,r===null)return zc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Rc(r,!1);else{if(Ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=co(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return se(so,so.current&1|2),Ni&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>lu&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=co(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ni)return zc(t),null}else 2*De()-r.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=so.current,se(so,a?n&1|2:n&1),Ni&&Ei(t,r.treeForkCount),e);case 22:case 23:return oo(t),$a(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&F(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ji(oa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ji(oa),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(oo(t),t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(oo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(so),null;case 4:return pe(),null;case 10:return Ji(t.type),null;case 22:case 23:return oo(t),$a(),e!==null&&F(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ji(oa),null;case 25:return null;default:return null}}function Hc(e,t){switch(ki(t),t.tag){case 3:Ji(oa),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&oo(t);break;case 13:oo(t);break;case 19:F(so);break;case 10:Ji(t.type);break;case 22:case 23:oo(t),$a(),e!==null&&F(_a);break;case 24:Ji(oa)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){U(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){U(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){U(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){U(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){U(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){U(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){U(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){U(e,t,n)}else n.current=null}}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){U(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[at]=t}catch(t){U(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zd(t,r,n),t[it]=e,t[at]=n}catch(t){U(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Ud=dp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Y={focusedElem:e,selectionRange:n},dp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),zd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,M.T=null,n=_u,_u=null;var o=pu,s=hu;if(fu=0,mu=pu=null,hu=0,Hl&6)throw Error(i(331));var c=Hl;if(Hl|=4,Ll(o.current),kl(o,o.current,s,n),Hl=c,dd(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{N.p=a,M.T=r,Yu(e,t)}}function Qu(e,t,n){t=gi(n,t),t=$s(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(Je(e,2),ud(e))}function U(e,t,n){if(e.tag===3)Qu(e,e,n);else for(;t!==null;){if(t.tag===3){Qu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(du===null||!du.has(r))){e=gi(n,e),n=ec(2),r=Ha(t,n,2),r!==null&&(tc(n,r,t,e),Je(r,2),ud(r));break}}t=t.return}}function $u(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Xl=!0,i.add(n),e=ed.bind(null,e,t,n),t.then(e,e))}function ed(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ul===e&&(Gl&n)===n&&(Ql===4||Ql===3&&(Gl&62914560)===Gl&&300>De()-su?!(Hl&2)&&Au(e,0):tu|=n,ru===Gl&&(ru=0)),ud(e)}function W(e,t){t===0&&(t=Ke()),e=ti(e,t),e!==null&&(Je(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),W(e,n)}function nd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),W(e,n)}function rd(e,t){return Ce(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=Gl,a=Ue(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,gd(r,a))}r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&Yd()&&(e=ld);for(var t=De(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}fu!==0&&fu!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Vd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),zd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=gt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);_t(c),zd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=gt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),_t(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=gt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),_t(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=ue.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),o||Lf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pf(e){return`href="`+It(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),zd(t,`link`,n),_t(t),e.head.appendChild(t))}function Rf(e){return`[src="`+It(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),zd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,_t(a),a):(r=n,(a=vf.get(o))&&(r=h({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),zd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),zd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},v=new class extends _{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},y={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=y;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function x(e){setTimeout(e,0)}var S=typeof window>`u`||`Deno`in globalThis;function C(){}function w(e,t){return typeof e==`function`?e(t):e}function T(e){return typeof e==`number`&&e>=0&&e!==1/0}function E(e,t){return Math.max(e+(t||0)-Date.now(),0)}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!te(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>ie(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function re(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=N(e)&&N(t);if(!r&&!(ie(e)&&ie(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{b.setTimeout(t,e)})}function P(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:re(e,t)}function F(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ce=Symbol();function le(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ce?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ue(e,t){return typeof e==`function`?e(...t):!!e}function de(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var fe=(()=>{let e=()=>S;return{isServer(){return e()},setIsServer(t){e=t}}})();function pe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var me=x;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var I=he(),ge=new class extends _{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=pe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>v.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),u=()=>ve(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(fe.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fe.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{de(e,()=>t.signal,()=>n=!0)},u=le(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?se:F;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Te=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=L(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=L(this.options);e.data!==void 0&&(this.setState(De(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=P(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(C).catch(C):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ce||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>D(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!E(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=le(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ee(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...De(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function De(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function L(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Oe=class extends _{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=pe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ae(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return je(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return je(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!M(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Me(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||D(this.options.staleTime,this.#t)!==D(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Pe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(C)),t}#g(){this.#b();let e=D(this.options.staleTime,this.#t);if(fe.isServer()||this.#r.isStale||!T(e))return;let t=E(this.#r.dataUpdatedAt,e)+1;this.#d=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(fe.isServer()||O(this.options.enabled,this.#t)===!1||!T(this.#p)||this.#p===0)&&(this.#f=b.setInterval(()=>{(this.options.refetchIntervalInBackground||v.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(b.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(b.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ae(e,t),o=i&&Me(e,n,t,r);(a||o)&&(l={...l,...Ee(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=P(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=P(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ne(e,t),refetch:this.refetch,promise:this.#o,isEnabled:O(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=pe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!M(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){I.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ke(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function Ae(e,t){return ke(e,t)||e.state.data!==void 0&&je(e,t,t.refetchOnMount)}function je(e,t,n){if(O(t.enabled,e)!==!1&&D(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ne(e,t)}return!1}function Me(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ne(e,n)}function Ne(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(D(t.staleTime,e))}function Pe(e,t){return!M(e.getCurrentResult(),t)}var Fe=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ie(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),I.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ie(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var R=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Fe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Le(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){return this.getAll().filter(t=>ee(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};function Le(e){return e.options.scope?.id}var Re=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??A(r,t),a=this.get(i);return a||(a=new Te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>k(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>k(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ze=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Re,this.#t=e.mutationCache||new R,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(D(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return I.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=I.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(D(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(j(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(j(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=A(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ce&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Be=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ve=o(((e,t)=>{t.exports=Be()})),z=c(f(),1),B=Ve(),He=z.createContext(void 0),Ue=e=>{let t=z.useContext(He);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},We=({client:e,children:t})=>(z.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,B.jsx)(He.Provider,{value:e,children:t})),Ge=z.createContext(!1),Ke=()=>z.useContext(Ge);Ge.Provider;function qe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Je=z.createContext(qe()),Ye=()=>z.useContext(Je),Xe=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ue(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ze=e=>{z.useEffect(()=>{e.clearReset()},[e])},Qe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ue(n,[e.error,r])),$e=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},et=(e,t)=>e.isLoading&&e.isFetching&&!t,tt=(e,t)=>e?.suspense&&t.isPending,nt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rt(e,t,n){let r=Ke(),i=Ye(),a=Ue(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,$e(o),Xe(o,i,s),Ze(i);let l=!a.getQueryCache().get(o.queryHash),[u]=z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(z.useSyncExternalStore(z.useCallback(e=>{let t=f?u.subscribe(I.batchCalls(e)):C;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),z.useEffect(()=>{u.setOptions(o)},[o,u]),tt(o,d))throw nt(o,u,i);if(Qe({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!fe.isServer()&&et(d,r)&&(l?nt(o,u,i):s?.promise)?.catch(C).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function it(e,t){return rt(e,Oe,t)}var at=typeof window<`u`?z.useLayoutEffect:z.useEffect;function ot(e){let t=z.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function st(e,t,n={},r={}){z.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ct(e){let t=z.useRef(null);return z.useImperativeHandle(e,()=>t.current,[]),t}function lt(e){return e[e.length-1]}function ut(e){return typeof e==`function`}function dt(e,t){return ut(e)?e(t):e}var ft=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable;function mt(e){for(let t in e)if(ft.call(e,t))return!0;return!1}var ht=()=>Object.create(null),gt=(e,t)=>_t(e,t,ht);function _t(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=xt(e)&&xt(i);if(!a&&!(yt(e)&&yt(i)))return i;let o=a?e:vt(e);if(!o)return i;let s=a?i:vt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!St(e[o],t[o],n)))return!1;return i===a}return!1}function Ct(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function wt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Tt(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function Et(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Tt(t)}var Dt=[`http:`,`https:`,`mailto:`,`tel:`];function Ot(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function kt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Et(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Et(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function At(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function jt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Pt=4,Ft=5;function It(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Lt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=It(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Ht(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Ht(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Ht(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Vt(n.fullPath??n.from);e.kind=Ft,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Vt(n.fullPath??n.from);e.kind=Pt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Rt(e,t,r,s,i,a,o)}function zt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Bt(e){if(e.pathless)for(let t of e.pathless)Bt(t);if(e.static)for(let t of e.static.values())Bt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Bt(t);if(e.dynamic?.length){e.dynamic.sort(zt);for(let t of e.dynamic)Bt(t)}if(e.optional?.length){e.optional.sort(zt);for(let t of e.optional)Bt(t)}if(e.wildcard?.length){e.wildcard.sort(zt);for(let t of e.wildcard)Bt(t)}}function Vt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ht(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Ut(e,t){let n=Vt(`/`),r=new Uint16Array(6);for(let t of e)Rt(!1,r,t,1,n,0);Bt(n),t.masksTree=n,t.flatCache=Nt(1e3)}function Wt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Yt(e,t.masksTree);return t.flatCache.set(e,r),r}function Gt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Vt(`/`),Rt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Yt(r,o,n)}function Kt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Yt(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Zt(a.route)),t.matchCache.set(r,a),a}function qt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Jt(e,t=!1,n){let r=Vt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Rt(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Mt(),a[e.id]=e,s!==0&&e.path){let t=qt(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Bt(r),{processedTree:{segmentTree:r,singleCache:Nt(1e3),matchCache:Nt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Yt(e,t,n=!1){let r=e.split(`/`),i=$t(e,r,t,n);if(!i)return null;let[a]=Xt(e,r,i);return{route:i.node.route,rawParams:a}}function Xt(e,t,n){let r=Qt(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+en(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+en(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+en(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+en(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Pt)>(e.node.kind===Pt)||t.node.kind===Pt==(e.node.kind===Pt)&&t.depth>e.depth)))}function an(e){return on(e.filter(e=>e!==void 0).join(`/`))}function on(e){return e.replace(/\/{2,}/g,`/`)}function sn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function cn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function ln(e){return cn(sn(e))}function un(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function dn(e,t,n){return un(e,n)===un(t,n)}function fn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&<(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1&&(lt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=on(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function pn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function mn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>gn(e,n)).join(`/`):gn(r,n):r}function hn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s{t[0]===`?`&&(t=t.substring(1));let n=bn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function wn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=vn(e,r);return t?`?${t}`:``}}var Tn=`__root__`;function En(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Dn(e){return e instanceof Response&&!!e.options}var On=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},kn=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),An=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),jn=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Mn=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},Nn=(e,t,n)=>{if(!(!Dn(n)&&!_n(n)))throw Dn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Dn(n)?`redirected`:_n(n)?`notFound`:r.status===`pending`?`success`:r.status,context:jn(e,t.index),isFetching:!1,error:n})),_n(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Dn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Pn=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Fn=(e,t,n)=>{let r=jn(e,n);e.updateMatch(t,e=>({...e,context:r}))},In=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Nn(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,Nn(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Dn(n)&&!_n(n)&&(e.serialError??=n)},Ln=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!An(e,t)&&(n.options.loader||n.options.beforeLoad||Jn(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{On(e)},i);r._nonReactive.pendingTimeout=t}},Rn=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Ln(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Nn(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},zn=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Ct(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&In(e,n,o),s&&In(e,n,s),Ln(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Ct();let f={...jn(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=An(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Dn(r)||_n(r))&&(u(),In(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),wt(y))return u(),y.catch(t=>{In(e,n,t)}).then(v)}catch(t){u(),In(e,n,t)}v(y)},Bn=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>zn(e,n,t,i),s=()=>{if(Pn(e,n))return;let t=Rn(e,n,i);return wt(t)?t.then(o):o()};return a()},Vn=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Hn=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=jn(e,r),d=An(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Un=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{qn(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(Hn(e,t,n,r,i)),l=!!s&&wt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;Nn(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:jn(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:jn(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,_n(t)&&await i.options.notFoundComponent?.preload?.(),Nn(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,Nn(e,e.router.getMatch(n),t)}!Dn(o)&&!_n(o)&&await qn(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:jn(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),Nn(e,r,t)}},Wn=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(Hn(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await Un(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Dn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await Un(e,t,i,n,d):Fn(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Pn(e,i)){if(!e.router.getMatch(i))return e.matches[n];Fn(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=An(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&Nn(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Ct(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function Gn(e){let t=e,n=[];kn(t.router)&&On(t);let r;for(let e=0;e({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await qn(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await qn(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=Vn(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=On(t);if(wt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Kn(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function qn(e,t=Yn){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===Yn?(()=>{if(e._componentsPromise===void 0){let t=Kn(e,Yn);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Kn(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Jn(e){for(let t of Yn)if(e.options[t]?.preload)return!0;return!1}var Yn=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Xn(e){return{input:({url:t})=>{for(let n of e)t=Qn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=$n(e[n],t);return t}}}function Zn(e){let t=ln(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=an([`/`,t,e.pathname]),e)}}function Qn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function $n(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function er(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>tr(o,_.get())),x=r(()=>tr(s,v.get())),S=r(()=>tr(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Nt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:ee,setPending:A,setCached:j};ee(e.matches),a?.(k);function ee(e){nr(e,o,_,n,i)}function A(e){nr(e,s,v,n,i)}function j(e){nr(e,c,y,n,i)}return k}function tr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function nr(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}jt(n.get(),a)||n.set(a)})}var rr=`__TSR_index`,ir=`popstate`,ar=`beforeunload`;function or(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=ur(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[rr];i=sr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[rr];i=sr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[rr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function sr(e,t){t||={};let n=dr();return{...t,key:n,__TSR_key:n,[rr]:e}}function cr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>ur(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=dr();t.history.replaceState({[rr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=ur(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[rr]-l.state[rr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=or({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ar,S,{capture:!0}),t.removeEventListener(ir,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(ar,S,{capture:!0}),t.addEventListener(ir,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function lr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function ur(e,t){let n=lr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=dr();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[rr]:0,key:a,__TSR_key:a}}}function dr(){return(Math.random()+1).toString(36).substring(7)}function fr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var pr=new WeakMap,mr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=pn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:cr()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Nt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=er(_r(this.latestLocation),e),Lr(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=ln(o);t&&t!==`/`&&e.push(Zn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Xn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Jt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Ut(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:kt(e).path,external:!1,searchStr:o,search:gt(t?.search,i),hash:kt(r.slice(1)).path,state:_t(t?.state,a)}}let o=new URL(i,this.origin),s=Qn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:kt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:gt(t?.search,c),hash:kt(s.hash.slice(1)).path,state:_t(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>fn({base:e,to:t.includes(`//`)?on(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>yr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,dt(t.params,s)),d=this.routesByPath[cn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&mt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:kt(hn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,vr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=br({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=gt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?dt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?dt(t.state,n.state):{};v=_t(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=$n(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=At(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Wt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,dt(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=St(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=cn(this.latestLocation.href)===cn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Ct(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=ur(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Qn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Ot(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?pr.set(this.latestLocation,t):pr.delete(this.latestLocation);let n=this.latestLocation,r=fr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await Gn({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Dn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):_n(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(fr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Ot(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??3e5;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=qn,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await Gn({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Dn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});_n(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Gt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!St(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?St(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Sn,parseSearch:e.parseSearch??xn,protocolAllowlist:e.protocolAllowlist??Dt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Zt(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:cn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Sr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;nthis.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=lt(t),i={...e.search};for(let e of t)try{Object.assign(i,vr(e.options.validateSearch,i))}catch{}let a=lt(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{Cr(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},hr=class extends Error{},gr=class extends Error{};function _r(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function vr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new hr(`Async validation not supported`);if(n.issues)throw new hr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function yr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=cn(e),a,o=Kt(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function br({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return xr(n)(e,t,r??!1)}function xr(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...vr(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:dt(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Sr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Tn}function Cr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function wr(){try{return sessionStorage}catch{return}}var Tr=`tsr-scroll-restoration-v1_3`,Er=wr();function Dr(){try{return JSON.parse(Er?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Or(){try{Er?.setItem(Tr,JSON.stringify(kr))}catch{}}var kr=Dr(),Ar=`data-scroll-restoration-id`,jr=e=>e.state.__TSR_key||e.href;function Mr(e){let t=e.getAttribute(Ar);if(t)return`[${Ar}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Nr=!1,Pr=`window`;function Fr(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Ir(e){let t=[];for(let n of e){if(n===Pr)continue;let e=Fr(n);e&&t.push(e)}return t}function Lr(e,t){if((t??e.options.scrollRestoration)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,Nr=!1;let n=e.options.getScrollRestorationKey||jr,r=new Map,i=(e,t,n)=>{let i=r.get(e)||{};i.scrollX=t,i.scrollY=n,r.set(e,i)};history.scrollRestoration=`manual`;let a=t=>{if(!(Nr||!e.isScrollRestoring)){if(t.target===document)i(Pr,scrollX,scrollY);else{let e=t.target;i(e,e.scrollLeft,e.scrollTop)}}},o=t=>{if(!e.isScrollRestoring)return;let n=kr[t]||={};for(let[e,t]of r)e===Pr?n[Pr]=t:e.isConnected&&(n[Mr(e)]=t)};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(n(e.fromLocation)),r.clear()}),addEventListener(`pagehide`,()=>{o(n(e.stores.resolvedLocation.get()??e.stores.location.get())),Or()}),e.subscribe(`onRendered`,t=>{let i=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=e.resetNextScroll,s;if(r.clear(),o||(e.resetNextScroll=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let c=n(t.toLocation),l=t.fromLocation&&n(t.fromLocation);if(e.isScrollRestoring&&l&&l!==c){let e=kr[l];if(e){let t=kr[c];for(let n in e){if(n===Pr){if(o)continue}else{let e=Fr(n);if(!e||o&&a&&(s??=Ir(a),s.includes(e)))continue}t||=kr[c]={},t[n]??=e[n]}}}Nr=!0;try{let n=t.toLocation.hash,r=t.toLocation.state.__hashScrollIntoViewOptions??!0,l=!1;if(o){let o=pr.get(t.toLocation),u=n&&r&&(o===`PUSH`||o===`REPLACE`),d=e.isScrollRestoring?kr[c]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:n}=d[e];if(e===Pr){if(u)continue;scrollTo({top:n,left:t,behavior:i}),l=!0}else{let r=Fr(e);r&&(r.scrollLeft=t,r.scrollTop=n)}}if(!l&&!n){let e={top:0,left:0,behavior:i};if(scrollTo(e),a){s??=Ir(a);for(let t of s)t.scrollTo(e)}}}!l&&n&&r&&document.getElementById(n)?.scrollIntoView(r)}finally{Nr=!1}})}var Rr=`Error preloading route! ☝️`,zr=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Tn:this.parentRoute||Mt();let r=n?Tn:t?.path;r&&r!==`/`&&(r=sn(r));let i=t?.id||r,a=n?Tn:an([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=an([`/`,a]));let o=a===`__root__`?`/`:an([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=cn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>En({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Br=class extends zr{constructor(e){super(e)}};function Vr(e){let t=e.errorComponent??Ur;return(0,B.jsx)(Hr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?z.createElement(t,{error:n,reset:r}):e.children})}var Hr=class extends z.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Ur({error:e}){let[t,n]=z.useState(!1);return(0,B.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,B.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,B.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,B.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,B.jsx)(`div`,{children:(0,B.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,B.jsx)(`code`,{children:e.message}):null})}):null]})}function Wr({children:e,fallback:t=null}){return Gr()?(0,B.jsx)(z.Fragment,{children:e}):(0,B.jsx)(z.Fragment,{children:t})}function Gr(){return z.useSyncExternalStore(Kr,()=>!0,()=>!1)}function Kr(){return()=>{}}var qr=z.createContext(null);function Jr(e){return z.useContext(qr)}var Yr=z.createContext(void 0),Xr=z.createContext(void 0),Zr=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Zr||{});function Qr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function $r(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ei=[],ti=0,{link:ni,unlink:ri,propagate:ii,checkDirty:ai,shallowPropagate:oi}=Qr({update(e){return e._update()},notify(e){ei[ci++]=e,e.flags&=~Zr.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Zr.Mutable|Zr.Dirty,fi(e))}}),si=0,ci=0,li,ui=0;function di(e){try{++ui,e()}finally{--ui||pi()}}function fi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ri(n,e)}function pi(){if(!(ui>0)){for(;si{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=li,o=t?.compare??Object.is;if(n)li=i,++ti,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Zr.Mutable|Zr.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{li=a,n&&(i.flags&=~Zr.RecursedCheck),fi(i)}}};return n?(i.flags=Zr.Mutable|Zr.Dirty,i.get=function(){let e=i.flags;if(e&Zr.Dirty||e&Zr.Pending&&ai(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&oi(e)}}else e&Zr.Pending&&(i.flags=e&~Zr.Pending);return li!==void 0&&ni(i,li,ti),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ii(e),oi(e),pi())}},i}function hi(e){let t=()=>{let t=li;li=n,++ti,n.depsTail=void 0,n.flags=Zr.Watching|Zr.RecursedCheck;try{return e()}finally{li=t,n.flags&=~Zr.RecursedCheck,fi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Zr.Watching|Zr.RecursedCheck,notify(){let e=this.flags;e&Zr.Dirty||e&Zr.Pending&&ai(this.deps,this)?t():this.flags=Zr.Watching},stop(){this.flags=Zr.None,this.depsTail=void 0,fi(this)}};return t(),n}var gi=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),_i=o(((e,t)=>{t.exports=gi()})),vi=o((e=>{var t=f(),n=_i();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),yi=o(((e,t)=>{t.exports=vi()}))();function bi(e,t){return e===t}function xi(e,t,n=bi){let r=(0,z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,z.useCallback)(()=>e?.get(),[e]);return(0,yi.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Si={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function Ci(e){let t=Jr(),n=z.useContext(e.from?Xr:Yr),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=z.useRef(void 0);return xi(i??Si,n=>{if((e.shouldThrow??!0)&&!n&&Mt(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=_t(a.current,r);return a.current=e,e}return r})}function wi(e){return Ci({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ti(e){let{select:t,...n}=e;return Ci({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Ei(e){return Ci({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Di(e){return Ci({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Oi(e){let t=Jr();return z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ki(e){let t=Jr(),n=Oi(),r=z.useRef(null);return at(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Ai(e){return Ci({...e,select:t=>e.select?e.select(t.context):t.context})}var ji=m();function Mi(e,t){let n=Jr(),r=ct(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:ee,state:A,mask:j,reloadDocument:te,unsafeRelative:ne,from:re,_fromLocation:M,...N}=e,ie=Gr(),ae=z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),oe=xi(n.stores.location,e=>e,(e,t)=>e.href===t.href),P=z.useMemo(()=>{let e={_fromLocation:oe,...ae};return n.buildLocation(e)},[n,oe,ae]),F=P.maskedLocation?P.maskedLocation.publicHref:P.publicHref,se=P.maskedLocation?P.maskedLocation.external:P.external,ce=z.useMemo(()=>Vi(F,se,n.history,v),[v,se,F,n.history]),le=z.useMemo(()=>{if(ce?.external)return Ot(ce.href,n.protocolAllowlist)?void 0:ce.href;if(!Hi(s)&&typeof s==`string`&&s.indexOf(`:`)!==-1)try{return new URL(s),Ot(s,n.protocolAllowlist)?void 0:s}catch{}},[s,ce,n.protocolAllowlist]),ue=z.useMemo(()=>{if(le)return!1;if(o?.exact){if(!dn(oe.pathname,P.pathname,n.basepath))return!1}else{let e=un(oe.pathname,n.basepath),t=un(P.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!St(oe.search,P.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||ie&&oe.hash===P.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,oe,le,ie,P.hash,P.pathname,P.search,n.basepath]),de=ue?dt(i,{})??Pi:Ni,fe=ue?Ni:dt(a,{})??Ni,pe=[b,de.className,fe.className].filter(Boolean).join(` `),me=(y||de.style||fe.style)&&{...y,...de.style,...fe.style},[he,I]=z.useState(!1),ge=z.useRef(!1),_e=e.reloadDocument||le?!1:c??n.options.defaultPreload,ve=l??n.options.defaultPreloadDelay??0,ye=z.useCallback(()=>{n.preloadRoute({...ae,_builtLocation:P}).catch(e=>{console.warn(e),console.warn(Rr)})},[n,ae,P]);st(r,z.useCallback(e=>{e?.isIntersecting&&ye()},[ye]),zi,{disabled:!!v||_e!==`viewport`}),z.useEffect(()=>{ge.current||!v&&_e===`render`&&(ye(),ge.current=!0)},[v,ye,_e]);let be=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!Wi(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,ji.flushSync)(()=>{I(!0)});let t=n.subscribe(`onResolved`,()=>{t(),I(!1)});n.navigate({...ae,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(le)return{...N,ref:r,href:le,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let xe=e=>{if(v||_e!==`intent`)return;if(!ve){ye();return}let t=e.currentTarget;if(Ri.has(t))return;let n=setTimeout(()=>{Ri.delete(t),ye()},ve);Ri.set(t,n)},Se=e=>{v||_e!==`intent`||ye()},Ce=e=>{if(v||!_e||!ve)return;let t=e.currentTarget,n=Ri.get(t);n&&(clearTimeout(n),Ri.delete(t))};return{...N,...de,...fe,href:ce?.href,ref:r,onClick:Bi([x,be]),onBlur:Bi([S,Ce]),onFocus:Bi([C,xe]),onMouseEnter:Bi([w,xe]),onMouseLeave:Bi([T,Ce]),onTouchStart:Bi([E,Se]),disabled:!!v,target:_,...me&&{style:me},...pe&&{className:pe},...v&&Fi,...ue&&Ii,...ie&&he&&Li}}var Ni={},Pi={className:`active`},Fi={role:`link`,"aria-disabled":!0},Ii={"data-status":`active`,"aria-current":`page`},Li={"data-transitioning":`transitioning`},Ri=new WeakMap,zi={rootMargin:`100px`},Bi=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Vi(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Hi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ui=z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Mi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return z.createElement(`a`,t,o)}return z.createElement(n,a,o)});function Wi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Gi=class extends zr{constructor(e){super(e),this.useMatch=e=>Ci({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ai({...e,from:this.id}),this.useSearch=e=>Di({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ei({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ti({...e,from:this.id}),this.useLoaderData=e=>wi({...e,from:this.id}),this.useNavigate=()=>Oi({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,B.jsx)(Ui,{ref:t,from:this.fullPath,...e}))}};function Ki(e){return new Gi(e)}var qi=class extends Br{constructor(e){super(e),this.useMatch=e=>Ci({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ai({...e,from:this.id}),this.useSearch=e=>Di({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ei({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ti({...e,from:this.id}),this.useLoaderData=e=>wi({...e,from:this.id}),this.useNavigate=()=>Oi({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,B.jsx)(Ui,{ref:t,from:this.fullPath,...e}))}};function Ji(e){return new qi(e)}function Yi(e){let t=Jr(),n=`not-found-${xi(t.stores.location,e=>e.pathname)}-${xi(t.stores.status,e=>e)}`;return(0,B.jsx)(Vr,{getResetKey:()=>n,onCatch:(t,n)=>{if(_n(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(_n(t))return e.fallback?.(t);throw t},children:e.children})}function Xi(){return(0,B.jsx)(`p`,{children:`Not Found`})}function Zi(e){return(0,B.jsx)(B.Fragment,{children:e.children})}function Qi(e,t,n){return t.options.notFoundComponent?(0,B.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,B.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,B.jsx)(Xi,{})}var $i=z.memo(function({matchId:e}){let t=Jr(),n=t.stores.matchStores.get(e);n||Mt();let r=xi(t.stores.loadedAt,e=>e),i=xi(n,e=>e);return(0,B.jsx)(ea,{router:t,matchId:e,resetKey:r,matchState:z.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function ea({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,B.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?z.Suspense:Zi,f=s?Vr:Zi,p=l?Yi:Zi;return(0,B.jsxs)(i.isRoot?i.options.shellComponent??Zi:Zi,{children:[(0,B.jsx)(Yr.Provider,{value:t,children:(0,B.jsx)(d,{fallback:o,children:(0,B.jsx)(f,{getResetKey:()=>n,errorComponent:s||Ur,onCatch:(e,t)=>{if(_n(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,B.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return z.createElement(l,e)},children:u||r._displayPending?(0,B.jsx)(Wr,{fallback:o,children:(0,B.jsx)(na,{matchId:t})}):(0,B.jsx)(na,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ta,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function ta({resetKey:e}){let t=Jr(),n=z.useRef(void 0);return at(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...fr(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var na=z.memo(function({matchId:e}){let t=Jr(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Mt();let i=xi(r,e=>e),a=i.routeId,o=t.routesById[a],s=z.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=z.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,B.jsx)(e,{},s):(0,B.jsx)(ra,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Ct();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return _n(i.error)||Mt(),Qi(t,o,i.error);if(i.status===`redirected`)throw Dn(i.error)||Mt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ra=z.memo(function(){let e=Jr(),t=z.useContext(Yr),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=xi(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=xi(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,B.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||Mt(),Qi(e,a,void 0);if(!i)return null;let s=(0,B.jsx)($i,{matchId:i});return n===`__root__`?(0,B.jsx)(z.Suspense,{fallback:o,children:s}):s});function ia(){let e=Jr(),t=z.useRef({router:e,mounted:!1}),[n,r]=z.useState(!1),i=xi(e.stores.isLoading,e=>e),a=xi(e.stores.hasPending,e=>e),o=ot(i),s=i||n||a,c=ot(s),l=i||a,u=ot(l);return e.startTransition=e=>{r(!0),z.startTransition(()=>{e(),r(!1)})},z.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return cn(e.latestLocation.publicHref)!==cn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),at(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),at(()=>{o&&!i&&e.emit({type:`onLoad`,...fr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),at(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...fr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),at(()=>{if(c&&!s){let t=fr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),di(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function aa(){let e=Jr(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,B.jsx)(t,{}):null,r=(0,B.jsxs)(typeof document<`u`&&e.ssr?Zi:z.Suspense,{fallback:n,children:[(0,B.jsx)(ia,{}),(0,B.jsx)(oa,{})]});return e.options.InnerWrap?(0,B.jsx)(e.options.InnerWrap,{children:r}):r}function oa(){let e=Jr(),t=xi(e.stores.firstId,e=>e),n=xi(e.stores.loadedAt,e=>e),r=t?(0,B.jsx)($i,{matchId:t}):null;return(0,B.jsx)(Yr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,B.jsx)(Vr,{getResetKey:()=>n,errorComponent:Ur,onCatch:void 0,children:r})})}var sa=e=>({createMutableStore:mi,createReadonlyStore:mi,batch:di}),ca=e=>new la(e),la=class extends mr{constructor(e){super(e,sa)}};function ua({router:e,children:t,...n}){mt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,B.jsx)(qr.Provider,{value:e,children:t});return e.options.Wrap?(0,B.jsx)(e.options.Wrap,{children:r}):r}function da({router:e,...t}){return(0,B.jsx)(ua,{router:e,...t,children:(0,B.jsx)(aa,{})})}var fa=g(),pa=(0,z.createContext)(null),ma=`loopx-pw-locale`,ha={en:{"common.actions":`Actions`,"common.agent":`Agent`,"common.allMessages":`All messages`,"common.cancel":`Cancel`,"common.close":`Close`,"common.closeActionReceipt":`Close action receipt`,"common.confirm":`Confirm`,"common.export":`Export`,"common.failed":`Failed`,"common.goal":`Goal`,"common.loading":`Loading…`,"common.none":`None`,"common.off":`Off`,"common.on":`On`,"common.open":`Open`,"common.owner":`Owner`,"common.readOnly":`Read only`,"common.recently":`Just now`,"common.status":`Status`,"common.task":`Task`,"common.you":`You`,"common.waiting":`Waiting`,"composer.addImage":`Add image`,"composer.agentProgress":`Ask Agent for a progress report`,"composer.agentProgressPrompt":`Give me a progress report for this Goal: completed, running, blocked, and next steps.`,"composer.attachImageHint":`Choose, paste, or drag an image`,"composer.clarifyDefer":`Deferring a Todo requires a deterministic resume condition. Add todo_done:, pr_merged:[owner/repo]#, or capacity_available:.`,"composer.clarifySingleAction":`This message contains multiple operations that may change state. Describe one operation at a time so each confirmation preview can be reviewed separately.`,"composer.createGoal":`Create Goal`,"composer.createGoalDraft":`Goal draft`,"composer.createGoalDraftDescription":`Complete the draft and send it. LoopX will show a confirmation preview first.`,"composer.createGoalDraftLead":`Create a long-term Goal:`,"composer.createGoalTemplate":`Create a long-term Goal: +Objective: +Completion criteria: +Execution boundary (optional): +Related repository (optional): +Notification method (optional):`,"composer.createGoalHint":`Insert a Goal template to review before creation`,"composer.draft":`Draft`,"composer.globalProgress":`Summarize all Goal progress`,"composer.globalProgressPrompt":`Summarize the latest progress and blockers for all active Goals.`,"composer.globalTasks":`Ask about global priorities`,"composer.globalTasksPrompt":`Which Goals need me, and what should I handle first?`,"composer.goalMessageHint":`Your message is delivered to {agent} in this Goal session.`,"composer.goalRunningHint":`{agent} is running {count} tasks · your message enters this session as guidance without interrupting it`,"composer.goalPlaceholder":`Ask or guide {goal}…`,"composer.imageAnalysisPrompt":`Analyze these images in the context of the current Goal and tell me the next step.`,"composer.imageCountError":`You can add up to {count} images.`,"composer.imagePicker":`Image file picker`,"composer.imageReadError":`Could not read image {name}.`,"composer.imageReadGenericError":`Could not read the image.`,"composer.imageSizeError":`Each image must be {size} MB or smaller.`,"composer.imageTypeError":`PNG, JPEG, WebP, and GIF images are supported.`,"composer.imagesPending":`Images to send`,"composer.immediate":`Send now`,"composer.managerMessageHint":`Your message goes to the LoopX Manager across Goals for global questions or Goal creation.`,"composer.managerPlaceholder":`Ask the LoopX Manager, or describe a new Goal…`,"composer.monitor":`Configure scheduled check`,"composer.monitorGoalQuestion":`Which Goal should receive the scheduled check?`,"composer.monitorTemplate":`Add a scheduled check for the current Goal: +Check target: +Frequency (supports 30 minutes / 2 hours / daily): Every 2 hours +Stop condition: Goal completes`,"composer.monitorTemplateWithoutGoal":`Configure a scheduled check: +Goal: +Check target: +Frequency: Every 2 hours +Stop condition: Goal completes`,"composer.monitorHint":`Fill in what to check, frequency, and stop condition before creation`,"composer.heartbeatGoalQuestion":`Which Goal should receive the Heartbeat?`,"composer.heartbeatTemplate":`Set a Heartbeat for the current Goal: +Frequency: Daily +Stop condition: Goal completes +Notification: Only notify me when needed`,"composer.heartbeatTemplateWithoutGoal":`Set up a Heartbeat: +Goal: +Frequency: Daily +Stop condition: Goal completes +Notification: Only notify me when needed`,"composer.nextAction":`Ask what’s next`,"composer.nextActionPrompt":`What should I do next?`,"composer.prepareDraft":`Insert a draft and review before sending`,"composer.send":`Send`,"composer.sendMessage":`Send a message to LoopX`,"composer.sendMessageHint":`Send message`,"composer.sentImageAlt":`Remove image {name}`,"conversation.agentPending":`Working…`,"conversation.close":`Close conversation receipt`,"conversation.convertHint":`Turn the Agent’s latest reply into a Task draft`,"conversation.full":`View full conversation`,"conversation.receipt":`Conversation receipt`,"conversation.replying":`Replying`,"conversation.title":`Manager conversation`,"conversation.toTask":`Convert to Task`,"digest.away":`Runs since your previous visit`,"digest.completed":`new completions`,"digest.failed":`new failed/interrupted runs`,"digest.needsYou":`currently need confirmation`,"feedback.applying":`Running: {title}`,"feedback.cancelFailed":`Cancel failed: {error}`,"feedback.completed":`Completed: {title}`,"feedback.executionFailed":`Execution failed: {error}`,"feedback.gateRequired":`Your confirmation is required: {summary}`,"feedback.notCompleted":`Not completed: {status}`,"feedback.goalRefreshFailed":`The Goal opened, but its latest state could not be refreshed. Use Refresh to try again.`,"feedback.preparingPreview":`Preparing confirmation preview: {title}`,"feedback.previewFailed":`Could not prepare the confirmation preview: {error}`,"feedback.sendFailed":`Send failed: {error}`,"feedback.sendGenericError":`Could not send the message. Try again later.`,"feedback.stale":`State changed, so nothing was applied. Generate a new confirmation preview.`,"feedback.taskDraftCreated":`Created a Task draft from the reply. Edit and send it to review the confirmation preview.`,"goal.defaultTitle":`New personal Goal`,"goal.initialTodo":`Work toward the completion criteria: {criteria}`,"goal.objectiveBoundary":`Execution boundary: {boundary}`,"goal.objectiveCompletion":`Completion criteria: {criteria}`,"drawer.advancedDiagnostics":`Advanced diagnostics`,"drawer.agentWorking":`Agent is continuing; the record updates automatically.`,"drawer.analysis":`Analyzing`,"drawer.apply":`Confirm and apply`,"drawer.applying":`Applying…`,"drawer.attentionBlocking":`Blocking an Agent`,"drawer.attentionWaiting":`Waiting for your decision`,"drawer.autoNotify":`Human-gate auto notifications`,"drawer.branch":`Branch`,"drawer.closeDetail":`Close details and return to {context}`,"drawer.connected":`Connected`,"drawer.correctionDescription":`The message keeps the current Goal, Todo, and Agent Session context.`,"drawer.correctionLabel":`Guide {agent}`,"drawer.correctionPlaceholder":`For example: focus on permission risks first and do not commit yet…`,"drawer.correctionSend":`Send guidance`,"drawer.correctionTextarea":`Enter guidance for Goal {goal}, Agent {agent}, Run {run}`,"drawer.copyRepository":`Copy repository identity`,"drawer.copyRepositoryDone":`Repository identity copied`,"drawer.copyRepositoryError":`Copy failed. Check browser clipboard permission.`,"drawer.copyRepositorySuccess":`Copied. You can paste it into another tool.`,"drawer.cost":`Cost 24h / 7d`,"drawer.currentGoal":`Current Goal`,"drawer.decisionDefaultEvidence":`No additional public-safe evidence is attached. The next step will still show a Preview first.`,"drawer.decisionDefaultReason":`This decision affects the next step of the current Todo.`,"drawer.decisionDefer":`Decide later`,"drawer.decisionMore":`More decisions`,"drawer.decisionReject":`Reject`,"drawer.decisionReview":`Review impact and decide`,"drawer.dependencies":`Dependencies`,"drawer.detailsAndActions":`Details & actions`,"drawer.duration":`Duration 24h / 7d`,"drawer.evidence":`Evidence`,"drawer.executionHistory":`Execution history`,"drawer.executionRecord":`Run record`,"drawer.executionRecordAndResult":`Execution & result`,"drawer.explainDecision":`Explain this decision`,"drawer.gateApproveHint":`Run one command in the terminal to complete approval:`,"drawer.gateRejectHint":`Replace approve with reject at the end to decline. This notice disappears after the command runs.`,"drawer.gateRequiresHost":`Host confirmation required`,"drawer.gateRequiresHostDescription":`This page cannot approve this protected permission change. Nothing was written by your click.`,"drawer.goalAutoRun":`Automatic runs for this Goal`,"drawer.goalChanges":`Pending changes for this Goal`,"drawer.goalDetails":`Goal details`,"drawer.group":`Group`,"drawer.inspectorFull":`Switch to full screen`,"drawer.inspectorFullView":`Full-screen view`,"drawer.inspectorHalf":`Switch to half screen`,"drawer.inspectorHalfView":`Half-screen view`,"drawer.lastNotification":`Latest notification`,"drawer.larkConfigure":`Configure Lark connection`,"drawer.larkConnect":`Connect Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`Not configured`,"drawer.larkNotConfiguredDescription":`After setup, LoopX sends a Feishu notification when this Goal needs your confirmation.`,"drawer.managerChanges":`Pending Manager changes`,"drawer.moreActions":`More actions`,"drawer.moreRunActions":`More run actions`,"drawer.nextTransition":`Next transition`,"drawer.noExecutionHistory":`No execution history yet.`,"drawer.noRun":`Execution Session has not started`,"drawer.noRunDescription":`Run records will appear here after an Agent starts execution.`,"drawer.notAssigned":`Unassigned`,"drawer.notLinked":`Not linked`,"drawer.notSet":`Not set`,"drawer.outputDetails":`Output details`,"drawer.outputRecorded":`This output is recorded on the current Goal.`,"drawer.outputSafePreview":`Public-safe output preview`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`Outputs from this run`,"drawer.previewUnavailable":`No public-safe inline preview is available for this output.`,"drawer.priority":`Priority`,"drawer.progress":`Progress`,"drawer.proposalApplied":`Applied. LoopX state will refresh.`,"drawer.proposalApplyFailed":`Apply failed. No changes were written.`,"drawer.proposalApplyFailedHint":`Refresh the Goal state and regenerate. If it still fails, keep this page open and inspect advanced diagnostics.`,"drawer.proposalClose":`Close`,"drawer.proposalDefer":`Later`,"drawer.proposalDeferred":`Deferred. You can apply it later or regenerate it.`,"drawer.proposalEnterGoal":`Open new Goal`,"drawer.proposalExplainer":`After confirmation, LoopX applies this change and shows the write result. Closing or canceling changes nothing.`,"drawer.proposalRecheck":`Recheck against latest state`,"drawer.proposalRegenerate":`Retry with latest state`,"drawer.proposalRejected":`Rejected. This change will not be written.`,"drawer.proposalStale":`Source state changed. Recheck against the latest state.`,"drawer.proposalViewGoal":`View updated Goal`,"drawer.reassign":`Reassign to`,"drawer.reassignSummary":`Reassign: {task}`,"drawer.reason":`Reason`,"drawer.recoveryDescription":`Local history is preserved. Choose a recovery path.`,"drawer.recoveryFailed":`Upstream Session recovery failed`,"drawer.recoveryNewSession":`Start a new Session with context`,"drawer.recoveryRetry":`Retry recovery`,"drawer.repositoryRole":`Execution workspace`,"drawer.repository":`Repository`,"drawer.replyMode":`Reply mode`,"drawer.subagentApplied":`Applied and verified against the shared Goal state.`,"drawer.subagentAppliedRefreshFailed":`Applied and verified. The status view could not refresh; retry the page refresh later.`,"drawer.subagentApplying":`Applying and verifying shared-state readback…`,"drawer.subagentApplyFailed":`Could not apply the sub-agent setting.`,"drawer.subagentChildLimit":`Current limit`,"drawer.subagentConfirmDisable":`Confirm turning off sub-agent execution`,"drawer.subagentConfirmEnable":`Confirm turning on sub-agent execution`,"drawer.subagentCurrentBoundary":`Current task-domain restriction`,"drawer.subagentDescription":`Allows the runtime to create temporary child agents for independent tasks only after Todo, quota, capability, and write-scope gates pass. It does not force parallel work or grant durable authority.`,"drawer.subagentDisable":`Preview turning off sub-agent execution`,"drawer.subagentDisableSummary":`New child-agent execution will be disabled for this Goal. Existing Todo ownership and execution records stay unchanged.`,"drawer.subagentDomainInvalid":`The selected task-domain restriction is invalid.`,"drawer.subagentDomainTodoCount":`{count} matching open Todos`,"drawer.subagentDomains":`Task-domain restriction (optional)`,"drawer.subagentDomainsEmpty":`No open advancement Todo declares task_domain. Leave this empty to keep child execution unrestricted by task domain.`,"drawer.subagentDomainsHint":`Leave every option clear to apply no task-domain filter. Selecting domains admits only matching typed Todos; all other execution gates still apply.`,"drawer.subagentDomainsUnrestricted":`No task-domain restriction`,"drawer.subagentEnable":`Preview turning on sub-agent execution`,"drawer.subagentLabel":`Per-Goal execution boundary`,"drawer.subagentMaxChildren":`Maximum child agents`,"drawer.subagentNoChange":`The current Goal already matches this setting; nothing was written.`,"drawer.subagentPending":`Pending confirmation`,"drawer.subagentPreviewBoundary":`Preview boundary update`,"drawer.subagentPreviewFailed":`Could not create the sub-agent setting preview.`,"drawer.subagentPreviewing":`Checking the latest Goal state…`,"drawer.subagentPreviewReady":`Preview locked. Confirm to apply this Goal setting.`,"drawer.subagentPreviewSummary":`Allow up to {count} child agents. Task-domain restriction: {domains}.`,"drawer.subagentRemoteReadOnly":`This source is read only. Open the Goal on its host to change the setting.`,"drawer.subagentTitle":`Adaptive sub-agent execution`,"drawer.remoteDetailsDescription":`SSH sources expose public-safe status only and do not read connection settings from the source host.`,"drawer.remoteDetailsUnavailable":`Remote details are not projected`,"drawer.resumeNo":`No`,"drawer.resumeYes":`Yes`,"drawer.runDetails":`Execution Session`,"drawer.runInterrupt":`Interrupt this run`,"drawer.runLatest":`View latest execution`,"drawer.runNewSession":`Start new Session`,"drawer.runCloseSession":`Close Session`,"drawer.runRecordEmpty":`No run record yet. The Agent has not started this execution. Check waiting conditions or resume the Session under Details & actions.`,"drawer.runRecordProjected":`No step-by-step record is available. LoopX read {completed}/{total} projected steps{outputs}; inspect the Session under Details & actions.`,"drawer.runRecordProjectedOutputs":` and {count} outputs`,"drawer.runRoleAssistant":`Completed`,"drawer.runRoleSystem":`Needs review`,"drawer.runRoleUser":`Task received`,"drawer.runView":`Session views`,"drawer.scheduleAdd":`Add scheduled check`,"drawer.scheduleDefaultNotification":`Notify only when you are needed`,"drawer.scheduleDefaultStop":`Goal completes or owner stops it`,"drawer.scheduleDefaultTarget":`Wake according to this Goal’s LoopX schedule.`,"drawer.scheduleEdit":`Change to every 2 hours`,"drawer.scheduleLast":`Last run`,"drawer.scheduleLocalTimezone":`Local timezone`,"drawer.scheduleNext":`Next run`,"drawer.scheduleNeverRun":`Not run yet`,"drawer.scheduleNotification":`Notification`,"drawer.schedulePause":`Pause`,"drawer.schedulePending":`Waiting for schedule`,"drawer.scheduleResume":`Resume`,"drawer.scheduleRunNow":`Run now`,"drawer.scheduleStop":`Stop {kind}`,"drawer.scheduleStopCondition":`Stop condition`,"drawer.scheduleTimezone":`Timezone`,"drawer.sessionRecoverable":`Resumable`,"drawer.sessionStatus":`Session status`,"drawer.setupHeartbeat":`Set up Heartbeat`,"drawer.taskActions":`Pending Todo actions`,"drawer.taskAdvancement":`Advancement task`,"drawer.taskBlock":`Mark blocked`,"drawer.taskComplete":`Mark complete`,"drawer.taskCompletedNote":`This task is retained as a read-only record.`,"drawer.taskCompletedTitle":`Task completed`,"drawer.taskDefer":`Defer`,"drawer.taskDeferCondition":`Todo defer resume condition`,"drawer.taskDeferInvalid":`Unsupported condition format; use one of the three deterministic conditions below.`,"drawer.taskDeferPlaceholder":`For example, pr_merged:owner/repo#123`,"drawer.taskDeferReview":`Review defer`,"drawer.taskDeferSupported":`Supports todo_done, pr_merged, and capacity_available conditions.`,"drawer.taskDeferUntil":`Defer until`,"drawer.taskDetails":`Todo details`,"drawer.taskInfo":`Task information`,"drawer.taskManage":`Manage task`,"drawer.taskNextCompleted":`Create a follow-up task`,"drawer.taskNextOpen":`Advance or update status`,"drawer.taskOrdinary":`Task`,"drawer.taskStatusBlocked":`Blocked`,"drawer.taskStatusDeferred":`Deferred`,"drawer.resumeWhen":`Resume condition`,"drawer.taskNextDeferred":`Wait for the resume condition, then reassess`,"drawer.taskStatusCompleted":`Completed`,"drawer.taskStatusOpen":`Ready`,"drawer.taskSuccessor":`Create follow-up Todo`,"drawer.taskSuccessorNote":`Owner marked this blocked while waiting for more context.`,"drawer.taskSuccessorSummary":`Create follow-up Todo: {task}`,"drawer.taskSuccessorText":`Follow-up work for {task}`,"drawer.taskType":`Task type`,"drawer.topic":`Topic`,"drawer.trigger":`Trigger`,"drawer.titleAttention":`Needs you`,"drawer.titleOutput":`Output details`,"drawer.titleProposalApplied":`Execution result`,"drawer.titleProposalConfirm":`Confirm execution`,"drawer.titleSchedule":`Scheduled check`,"drawer.unconfigured":`Not configured`,"drawer.workspaceCandidates":`Available workspaces`,"files.emptySummary":`Public-safe output`,"files.empty":`No files, outputs, or verified reports yet.`,"files.loadingReports":`Loading verified milestone reports…`,"files.reportDelta":`+{added} added · {changed} changed`,"files.reportAdded":`added`,"files.reportChanged":`changed`,"files.reportGeneration":`Generation`,"files.reportLoadFailed":`Could not load verified reports`,"files.reportPublication":`Publication`,"files.title":`Files & Outputs`,"files.verifiedReport":`Verified milestone report`,"header.agentUnavailable":`Unavailable`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} work Agents`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`Capability settings`,"header.goalCapabilitiesDescription":`Manage overrides and inherited machine defaults.`,"header.goalDetails":`Goal details`,"header.goalDetailsDescription":`Review status, usage, repository, notifications, and sessions.`,"header.goalSettings":`Goal settings`,"header.goalSettingsDescription":`Open Goal details or capability settings`,"header.goalNavigation":`Goal navigation`,"header.goalView":`Goal view`,"header.live":`Live`,"header.manager":`LoopX Manager`,"header.managerDescription":`Your personal workspace across Goals`,"header.managerOverview":`Overview`,"header.managerView":`Manager view`,"header.openGoalNavigation":`Open Goal navigation`,"header.readOnlySourceDescription":`{source} is displayed read-only through an SSH tunnel`,"header.refresh":`Refresh status`,"header.refreshDone":`Updated just now`,"header.refreshFailed":`Refresh failed`,"header.refreshing":`Refreshing`,"header.selectAgent":`Select Agent`,"header.selectChatRuntime":`Select chat runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`Switch to brutal theme`,"header.themePaper":`Switch to default theme`,"home.blockingSummary":`{count} are blocking an Agent.`,"home.completedGoals":`Completed Goals`,"home.empty":`Nothing here`,"startup.goalLoading":`Loading status…`,"startup.goalError":`Could not load status`,"startup.progress":`{loaded} of {total} active Goals loaded`,"startup.partial":`Goal states are updating. Counts are incomplete.`,"startup.independent":`Other Goals remain available while this Goal loads.`,"startup.error.timeout":`The request timed out. Retry when the local service is ready.`,"startup.error.network":`The connection was interrupted. Retry to reconnect.`,"startup.error.service":`The local service is temporarily unavailable. Retry to continue.`,"startup.error.revision":`The Goal directory changed during loading. Refresh to synchronize.`,"startup.error.scope":`This Goal is no longer available in the selected source. Refresh the directory.`,"startup.error.invalid":`The status response could not be read. Refresh or check for a LoopX update.`,"startup.retry":`Retry`,"startup.retryFailed":`Retry failed Goals`,"startup.failedCount":`{count} Goals could not be loaded. Ready Goals remain available.`,"home.greeting":`Hi, I’m your LoopX Manager`,"home.history":`History`,"home.lane.needsYou":`Needs you`,"home.lane.needsYouDescription":`Waiting for your decision, authorization, or context`,"home.lane.observing":`Observing`,"home.lane.observingDescription":`Monitoring continuously and notifying you when something changes`,"home.lane.running":`Running`,"home.lane.runningDescription":`Agents are making progress and reporting back`,"home.lane.scheduled":`Scheduled`,"home.lane.scheduledDescription":`Queued until its time or prerequisite arrives`,"home.noActivity":`No activity yet`,"home.noFirstActivity":`Waiting for first activity`,"home.noCompletedGoals":`No completed Goals yet`,"home.preservedState":`State is preserved and can be resumed`,"home.stopped":`Stopped`,"home.systemHealth":`System health: {summary}`,"home.taskCount":`{count} Tasks`,"home.todayAt":`Today {time}`,"home.waitingCount":`You have {count} items to handle.`,"home.workspace":`Goal workspace`,"lark.allMessages":`All messages in this topic`,"lark.allTopicMessages":`All topic messages`,"lark.agentIngress":`Agent ingress`,"lark.appCreated":`App created`,"lark.appCreateFailed":`Creation failed`,"lark.appLoading":`Loading available Lark Apps…`,"lark.appPermissions":`This App can send connection messages, but lacks the bot permissions required to receive group mentions or reply automatically. Enable im:message.group_at_msg:readonly, im:message.send_as_bot, and the im.message.receive_v1 event, publish a new version, then refresh.`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`Auto reply unavailable`,"lark.autoReplyReady":`Auto reply ready`,"lark.bindGoal":`Bind to Goal`,"lark.cancel":`Cancel`,"lark.cardinality":`One Lark App · many Goals · one isolated route per Agent`,"lark.capture":`Capture`,"lark.captureAddressed":`Only messages that mention or reply to the App`,"lark.captureAll":`All messages in this Goal topic`,"lark.captureScope":`Capture scope`,"lark.captureScopeDescription":`Controls which Topic messages enter LoopX without expanding Agent permissions.`,"lark.closeConnection":`Close connection dialog`,"lark.closeCreate":`Close create dialog`,"lark.closeSettings":`Close Lark settings`,"lark.connect":`Connect`,"lark.connectAllAgents":`Connect every registered Agent`,"lark.connectAllAgentsAction":`Connect {count} Agents`,"lark.connectAllAgentsDescription":`Create {count} isolated routes in one guided action. Each Agent keeps its own connection identity and inbox.`,"lark.connectApp":`Connect Lark App`,"lark.connection":`Connection`,"lark.connections":`Connections`,"lark.configuration":`Lark configuration`,"lark.continueFeishu":`Continue in Feishu`,"lark.createAutomatically":`Create Goal topic automatically`,"lark.createAutomaticallyDescription":`A dedicated topic will be created for this Goal.`,"lark.description":`Manage reusable Lark Apps and connect group chats to Goals through dedicated topics.`,"lark.editConnection":`Edit Lark Connection`,"lark.goalConnections":`{count} Goal connections`,"lark.goalTopicConnections":`Lark Goal Topic connections`,"lark.groupChat":`Group chat`,"lark.groupEmpty":`This bot has not joined a group that can be connected. Add it to a Feishu group first, then return to refresh or search.`,"lark.groupLoading":`Reading groups joined by this bot…`,"lark.groupSearch":`Search groups joined by this bot`,"lark.historyPermission":`Group-history permission (separate capability)`,"lark.health.eventProcessed":`{events} events processed, {replies} replies sent.`,"lark.health.eventUnverified":`Event subscription needs verification`,"lark.health.eventUnverifiedDetail":`The long connection is running, but no message event has arrived. Enable im.message.receive_v1 and group mention permissions, publish a new version, then send a new @ mention.`,"lark.health.ignoredSelf":`The bot’s own message was ignored to prevent duplicate replies.`,"lark.health.invalidRouting":`Invalid routing configuration`,"lark.health.invalidRoutingDetail":`The connection was safely disabled. Select a processing mode again and save.`,"lark.health.lastStatus":`Latest event status: {status}`,"lark.health.listening":`Listening`,"lark.health.messageContextPermission":`Message permission required`,"lark.health.messageContextPermissionDetail":`A message event arrived, but group context could not be read. Publish and authorize group message read access for this App.`,"lark.health.notAddressed":`Latest message did not directly @ the bot`,"lark.health.notAddressedDetail":`Listening is healthy. This connection only responds to direct @ mentions or replies to the bot.`,"lark.health.notStarted":`Listener not started`,"lark.health.notStartedDetail":`Refresh the connection or restart LoopX, then try again.`,"lark.health.processingFailed":`Message processing failed`,"lark.health.processingFailedDetail":`The message event arrived, but Agent processing failed. Review local diagnostics and retry.`,"lark.health.queued":`Queued in the Agent inbox`,"lark.health.queuedDetail":`The message will be processed asynchronously by {agent} without starting a general Chat Session.`,"lark.health.retrying":`Retrying listener`,"lark.health.retryingDetail":`Event listening was interrupted and LoopX is retrying automatically.`,"lark.health.routeAmbiguous":`Message matches multiple Goals`,"lark.health.routeAmbiguousDetail":`The same bot and group have multiple full-group capture connections. Use a separate bot for each Agent or keep only one full-group connection.`,"lark.health.routeMismatch":`Message did not match this Goal Topic`,"lark.health.routeMismatchDetail":`The event came from another group or Topic. Reconnect this Goal to the correct group, then send a new @ mention.`,"lark.health.routeUnavailable":`Message cannot be routed to the Goal`,"lark.health.routeUnavailableDetail":`Connection data is incomplete. Reconnect this Goal, then send a new @ mention.`,"lark.health.starting":`Starting`,"lark.health.startingDetail":`LoopX is starting message event listening for this App.`,"lark.health.unavailable":`Auto reply unavailable`,"lark.health.waiting":`Waiting`,"lark.incomingMessages":`Incoming messages`,"lark.ingressAsync":`Async inbox`,"lark.ingressAsyncDescription":`Write to the Agent private inbox for a later explicit drain.`,"lark.ingressLegacy":`Legacy direct`,"lark.ingressLegacyDescription":`Compatibility mode for old connections; choose one of the three current ingress modes when saving.`,"lark.ingressQueue":`Queuing`,"lark.ingressQueueDescription":`Enter the same Agent Session's bounded FIFO queue and run after the current Turn.`,"lark.ingressSteering":`Steering`,"lark.ingressSteeringDescription":`Deliver to the active Turn and reject safely when no exact active Turn exists.`,"lark.loading":`Loading Lark configuration…`,"lark.management":`Lark management`,"lark.openEventSettings":`Open Feishu event settings`,"lark.mentions":`Mentions`,"lark.mentionsOnly":`Mentions only`,"lark.needsMessagePermissions":`Needs message permissions`,"lark.needsSetup":`Needs setup`,"lark.newApp":`New Lark App`,"lark.noAgentConfigured":`No Agent configured`,"lark.noConnections":`No matching connections.`,"lark.noProfiles":`No lark-cli App profiles are available yet.`,"lark.profileName":`Profile name`,"lark.profileValidation":`Profile can contain only letters, numbers, periods, underscores, and hyphens.`,"lark.processing":`Processing`,"lark.region":`Region`,"lark.registerAnother":`+ Register another Lark App — Create through Feishu`,"lark.reopenFeishu":`Reopen Feishu`,"lark.settingsConfigure":`Configure {goal}`,"lark.settingsDisconnect":`Disconnect {goal}`,"lark.replyMode":`Reply mode`,"lark.replyModeDescription":`Replies are limited to the source Topic to prevent cross-group or cross-Goal delivery.`,"lark.reusableApps":`{count} reusable Apps`,"lark.reusableWorkspaceApp":`Reusable workspace App`,"lark.saveConnection":`Save connection`,"lark.searchConnections":`Search Lark connections`,"lark.searchPlaceholder":`Search Apps, groups, Goals, or topics`,"lark.setupCopy":`LoopX opens the official Feishu creation page through lark-cli. App credentials stay in the system Keychain; LoopX stores only the profile reference.`,"lark.someoneMentions":`Someone mentions the Agent`,"lark.targetAgent":`Target Agent`,"lark.targetAgentDescription":`Choose a registered Agent in this Goal. This connection delivers to one Agent; it does not broadcast or grant permissions. Steering and Queuing require that Agent's exact active Session.`,"lark.agentUnavailable":`{agent} · no longer available`,"lark.selectRegisteredAgent":`Select an available registered Agent before connecting. The previous Agent will not be replaced automatically.`,"lark.topicPreview":`Topic preview`,"lark.topicReply":`Topic reply`,"lark.trigger":`Trigger`,"lark.waitingFeishu":`Waiting for Feishu`,"lark.waitingFeishuDescription":`Complete Feishu authorization in the new window. This page updates automatically when it is ready.`,"lark.waitingLink":`Generating the official Feishu creation link…`,"lark.error.appCreate":`Lark App creation failed`,"lark.error.appRequired":`Select a Lark App profile.`,"lark.error.bind":`Connection failed`,"lark.error.bindPreview":`Connection preview failed`,"lark.error.configuration":`Could not load Lark configuration`,"lark.error.groupLookup":`Could not read groups joined by this bot. Check the bot status and try again.`,"lark.error.groupLoad":`Could not load group chats`,"lark.error.invalidApp":`The Lark App profile is unavailable or has not completed authorization.`,"lark.error.messagePermissions":`This App lacks the bot permissions required for automatic replies. Enable im:message.group_at_msg:readonly and im:message:send_as_bot, publish a new version, then refresh.`,"lark.error.provider":`The Feishu API call failed without a verified receipt. Try again later.`,"lark.error.setupPoll":`Could not read creation status`,"lark.error.setupStart":`Could not start Lark App creation`,"lark.error.cliExecutable":`The configured lark-cli was found but cannot run. Check the installation or launch arguments.`,"lark.error.cliMissing":`lark-cli was not found. Install lark-cli and restart LoopX.`,"lark.error.cliStart":`lark-cli failed to start. Check the installation and restart LoopX.`,"lark.error.disconnect":`Disconnect failed`,"notifications.autoNotify":`Send automatically when your confirmation is required`,"notifications.bind":`Bind notification group`,"notifications.bindConfirm":`Bind “{goal}” to “{target}”. LoopX will verify that the bot is in the group and send a confirmation message.`,"notifications.bindFailed":`Binding failed`,"notifications.bound":`Bound`,"notifications.confirmBind":`Confirm binding`,"notifications.description":`Send Goal changes that need your confirmation to a Feishu group. Bindings and automatic delivery use the existing channel.`,"notifications.disabled":`Disabled`,"notifications.group":`Notification group: {target}`,"notifications.loadFailed":`Could not load notification groups`,"notifications.noTargets":`No notification groups are available. Group delivery uses a private bot identity; configure one from the terminal first:`,"notifications.notBound":`Not bound`,"notifications.recent":`Latest {time}`,"notifications.sentCount":`{count} sent`,"notifications.settings":`Goal notification bindings`,"notifications.setupFailed":`Could not update settings`,"notifications.title":`Feishu group notifications`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`Frequency`,"proposal.field.completionCriteria":`Completion criteria`,"proposal.field.executionBoundary":`Execution boundary`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`Initial tasks`,"proposal.field.objective":`Objective`,"proposal.field.operation":`Operation`,"proposal.field.permission":`Permission`,"proposal.field.reason":`Reason`,"proposal.field.stopCondition":`Stop condition`,"proposal.field.target":`Check target`,"proposal.field.timezone":`Timezone`,"proposal.field.title":`Title`,"proposal.field.workspace":`Execution workspace`,"proposal.gate.default":`Host confirmation required`,"proposal.impact.default":`After confirmation, the canonical LoopX service will write the state change.`,"proposal.impact.goalCreate":`After confirmation, LoopX will create the Goal and its initial Todo, then let the selected Agent start the first run.`,"proposal.impact.lifecycleDelete":`After confirmation, this stopped Goal is removed from the source and global registries. Project files, history state, and backups are preserved.`,"proposal.impact.lifecycleResume":`After confirmation, the Goal becomes eligible for automatic scheduling and returns to Active Goals. Actual execution still follows quota, Gate, and Todo constraints.`,"proposal.impact.lifecycleStop":`After confirmation, automatic progress stops and the Goal moves to the collapsed Stopped list. History, Todos, and evidence remain available for resuming.`,"proposal.impact.protected":`This action must be completed through the protected LoopX write service.`,"proposal.primary.apply":`Confirm and apply`,"proposal.primary.goalCreate":`Create Goal and start first run`,"proposal.primary.lifecycleDelete":`Delete Goal`,"proposal.primary.lifecycleResume":`Resume Goal`,"proposal.primary.lifecycleStop":`Stop Goal`,"proposal.primary.todoStart":`Create task and start execution`,"proposal.summary.goalCreate":`Create Goal: {title}`,"proposal.summary.heartbeat":`Set a Heartbeat for the current Goal`,"proposal.summary.lifecycleDelete":`Delete Goal: {title}`,"proposal.summary.lifecycleResume":`Resume Goal: {title}`,"proposal.summary.lifecycleStop":`Stop Goal: {title}`,"proposal.summary.monitor":`Create a scheduled check for the current Goal: {target}`,"proposal.workspace.current":`Current local workspace (no Repository bound)`,"proposal.workspace.named":`{workspace} (execution environment only; does not bind a repository)`,"proposal.workspaceGate.agentImpact":`Bind an Agent identity, then recheck the original action. No Goal has been written.`,"proposal.workspaceGate.agentTitle":`Bind an Agent first`,"proposal.workspaceGate.defaultSummary":`Select the Goal workspace.`,"proposal.workspaceGate.selectionImpact":`After selecting a workspace, LoopX will show the confirmation preview again. The selection itself does not write state.`,"proposal.workspaceGate.selectionTitle":`Select Goal workspace`,"runs.completed":`Completed`,"runs.failed":`Needs review`,"runs.interrupted":`Interrupted`,"runs.queued":`Scheduled`,"runs.ready":`Ready`,"runs.resumeFailed":`Recovery failed`,"runs.running":`Running`,"runs.unknown":`Unknown`,"runs.waiting":`Waiting`,"schedule.active":`Running`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`Scheduled & continuous task`,"schedule.paused":`Paused`,"schedule.summary":`Continuously checked under LoopX scheduling constraints`,"schedule.defaultTarget":`Check the current Goal for blockers, progress, and new outputs`,"schedule.unsupportedCalendar":`Scheduled checks do not currently support an exact weekday or time. Use a fixed interval such as “Every 30 minutes,” “Every 2 hours,” or “Daily.” The draft was preserved and no confirmation preview was created.`,"source.add":`Add source`,"source.addConfigured":`Add read-only source`,"source.addMethod":`Source setup method`,"source.addSsh":`Add SSH source`,"source.closeForm":`Close source form`,"source.configured":`Configured SSH`,"source.configuredCount":`Local SSH Hosts · {count}`,"source.configuredGroup":`Configured SSH Hosts · {count} (select to add)`,"source.connected":`Connected`,"source.connecting":`Connecting`,"source.controlPlane":`Control plane source`,"source.copy":`Copy`,"source.copyCommand":`Copy SSH tunnel command`,"source.copyError":`Could not copy the command. Copy it manually below.`,"source.copied":`Copied`,"source.description":`All explicit Hosts are loaded, including Include files. Wildcards are not listed. Run the command first; LoopX never reads SSH keys or configuration details.`,"source.host":`Local SSH Host`,"source.hostEmpty":`No explicit SSH Hosts are available in ~/.ssh/config.`,"source.hostLoadError":`Could not read local SSH Hosts.`,"source.hostPlaceholder":`Enter or search for a Host`,"source.invalid":`The SSH source settings are invalid.`,"source.loadingHosts":`Loading…`,"source.localInteractive":`Local interactive`,"source.localPort":`Local port`,"source.manual":`Manual URL`,"source.manualDescription":`Remote sources always remain read-only projections and never inherit local write permissions.`,"source.name":`Name`,"source.namePlaceholder":`Remote development machine`,"source.notAvailable":`Unavailable`,"source.readOnly":`SSH tunnel · read only`,"source.readOnlyNoticeDescription":`You can view Goals, Tasks, evidence, and run status. Writes, guidance, and Agent sessions remain on the source host.`,"source.readOnlyNoticeTitle":`Remote read-only projection`,"source.readOnlyWriteError":`Remote SSH tunnel sources are read-only projections and cannot perform control-plane writes.`,"source.refreshHosts":`Reload SSH Hosts`,"source.remove":`Remove source {source}`,"source.removeCurrent":`Remove current source`,"source.select":`Select control plane source`,"source.selectHost":`Select a configured SSH Host.`,"source.statusUrl":`Local forwarded URL`,"source.tunnelCommandPending":`Select a Host to generate the tunnel command`,"machine.absent":`Not configured`,"machine.action.create":`Create machine policy`,"machine.action.delete":`Remove machine policy`,"machine.action.unchanged":`No write required`,"machine.action.update":`Update machine policy`,"machine.applied":`Machine policy applied and read back successfully.`,"machine.applyError":`Machine policy could not be applied.`,"machine.applyPreview":`Apply reviewed preview`,"machine.changedNamespaces":`Changed namespaces`,"machine.capabilityCatalog":`Machine capability catalog`,"machine.capabilityEmpty":`No machine-configurable capabilities are registered.`,"machine.configured":`Configured`,"machine.confirmRollback":`Confirm rollback`,"machine.currentRevision":`Current revision`,"machine.currentValue":`Current machine value`,"machine.description":`Browse the same capability catalog as Goal settings. Configure supported machine defaults here; Goal-only capabilities are labeled explicitly.`,"capabilities.rawJson":`Advanced: raw JSON`,"machine.goalOnly":`This capability currently supports Goal configuration only. Open a Goal’s capability settings to configure it; no machine-wide default is applied.`,"machine.desiredRevision":`Desired revision`,"machine.editorUnavailable":`No editor is installed for this namespace`,"machine.editorUnavailableDescription":`The namespace remains visible in the registry. Install or upgrade its Dashboard editor before changing it.`,"machine.editorMode":`Editor mode`,"machine.liveDefault":`Live default; Goal override wins`,"machine.liveDefaultDescription":`Goals without an explicit periodic-report override read this machine policy on every plan. Changes and removal affect those existing Goals immediately; an explicit Goal override stays pinned.`,"machine.genericNamespaceDescription":`Edit this registered namespace as JSON. LoopX validates it with the capability-owned schema before previewing any write.`,"machine.jsonConfiguration":`Namespace configuration (JSON)`,"machine.jsonConfigurationHelp":`Only this namespace is updated. Other machine configuration is preserved, and Apply remains locked to the reviewed preview revision.`,"machine.jsonEditor":`JSON`,"machine.jsonInvalid":`Enter one valid JSON object before previewing changes.`,"machine.loadError":`Machine configuration could not be loaded.`,"machine.machinePolicy":`Machine policy`,"machine.namespaceCount":`Registered namespaces`,"machine.namespaces":`Configuration namespaces`,"machine.periodicReport":`Periodic reports`,"machine.periodicReportDescription":`Default report policy for every Goal without an explicit override. Goal scheduling and delivery consume the effective configuration.`,"machine.periodicReportActivation":`Enabled means automatic delivery at validated stage boundaries`,"machine.periodicReportActivationDescription":`This is not a weekly timer. When LoopX validates a Goal stage completion, an Agent prepares and freezes the report, then automatically delivers it through the configured Goal Channel. The enabled subscription is standing delivery authority; failures and route drift stop closed for repair.`,"machine.preview":`Review exact machine change`,"machine.previewChanges":`Preview changes`,"machine.previewError":`A machine-policy preview could not be created.`,"machine.previewLocked":`Apply is locked to this exact revision. If machine state changes, LoopX requires a new preview.`,"machine.previewRollback":`Preview rollback`,"machine.previewRemoval":`Preview removal`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`A capability-owned preset, such as weekly-progress.`,"machine.registry":`Typed registry`,"machine.requiredFields":`Enable requires a profile preset, Goal Channel route, and valid timezone.`,"machine.revision":`Machine revision`,"machine.revisionLockedReady":`All changes require a preview and apply only while that exact machine revision remains current.`,"machine.rollbackAvailable":`Rollback is available for the last apply`,"machine.rollbackDescription":`Preview the stored prior revision before restoring it.`,"machine.rollbackError":`The rollback could not be completed.`,"machine.rollbackPreviewDescription":`The prior revision is ready to restore. Confirm to apply this rollback.`,"machine.rolledBack":`The prior machine policy was restored and verified.`,"machine.removed":`Machine policy removed and the resulting configuration read back successfully.`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`Use a public route alias; credentials and provider identifiers never enter this form.`,"machine.timezone":`Timezone`,"machine.timezoneHelp":`Use an IANA timezone, for example Asia/Shanghai.`,"machine.title":`Machine configuration`,"machine.unchanged":`Machine policy already matches this preview; nothing was written.`,"machine.visualEditor":`Guided`,"capabilities.atomicOverride":`Goal override is atomic`,"capabilities.atomicOverrideDescription":`A complete Goal value wins over the machine default. LoopX never mixes individual fields across scopes.`,"capabilities.applyFailed":`Goal capability changes were not applied.`,"capabilities.applyPreview":`Apply preview`,"capabilities.catalog":`Goal capability catalog`,"capabilities.chooseGoal":`Choose a Goal before inspecting its capabilities.`,"capabilities.defaultValue":`Declared default`,"capabilities.description":`Inspect the capabilities available to this Goal and the exact scope of each setting.`,"capabilities.editorPrepared":`Typed editor contract available`,"capabilities.effectiveSource":`Effective source`,"capabilities.empty":`No capability descriptors are available for this Goal.`,"capabilities.fields":`Registered fields`,"capabilities.goalPolicy":`Goal capability policy`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`Current Goal value`,"capabilities.loadFailed":`Could not load Goal capabilities`,"capabilities.loading":`Loading Goal capabilities…`,"capabilities.machineOnly":`This capability is configured only at machine scope.`,"capabilities.machineValue":`Live machine default`,"capabilities.machineScope":`Machine`,"capabilities.previewOnly":`Inspection is live. Goal writes remain unavailable until the revision-locked preview and apply path is connected.`,"capabilities.preview":`Revision-locked preview`,"capabilities.previewChanges":`Preview changes`,"capabilities.restoreInheritance":`Restore machine-default inheritance`,"capabilities.previewFailed":`Could not preview Goal capability changes.`,"capabilities.previewLocked":`Apply will re-check this exact plan revision and reject stale changes.`,"capabilities.partialWrite":`Goal value saved; shared projection needs reconciliation`,"capabilities.partialWriteDescription":`The source Goal configuration was written and read back. Its shared runtime projection did not synchronize, so do not submit the change again.`,"capabilities.refreshSource":`Refresh source value`,"capabilities.readOnly":`Read-only capability`,"capabilities.revisionLockedReady":`Changes require a preview and are applied only when its exact revision is still current.`,"capabilities.retry":`Retry`,"capabilities.source.capability_default":`Capability default`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`Live machine default`,"capabilities.source.not_configured":`Not configured`,"capabilities.title":`Goal capabilities`,"settings.close":`Close settings`,"settings.appearance":`Appearance`,"settings.appearanceDescription":`Manage workspace display preferences in this browser.`,"settings.appearanceTabDescription":`Theme and display preferences`,"settings.capabilitiesTabDescription":`Capability overrides for this Goal`,"settings.back":`Back to workspace`,"settings.categories":`Settings categories`,"settings.description":`Manage workspace preferences and integrations.`,"settings.eyebrow":`Workspace preferences`,"settings.general":`General`,"settings.goalConnections":`Goal connections`,"settings.language":`Language`,"settings.languageDescription":`Choose the language used by the LoopX desktop workspace.`,"settings.languageEnglishDescription":`Use English for navigation, settings, and workspace controls.`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`Use Simplified Chinese for navigation, settings, and workspace controls.`,"settings.languageSimplifiedChinese":`Simplified Chinese`,"settings.languageStoredLocally":`This preference is stored only on this device.`,"settings.languageTabDescription":`Interface language for this device`,"settings.larkTabDescription":`Apps, group chats, and Goal Topic connections`,"settings.machineTabDescription":`Typed defaults shared by capabilities on this machine`,"settings.notifications":`Notifications`,"settings.open":`Settings`,"settings.themeDefault":`Paper`,"settings.themeDefaultDescription":`Calm and lightweight for long-running work.`,"settings.themeDescription":`Choose the workspace visual style. This preference is stored in the current browser.`,"settings.themeHighContrast":`High contrast`,"settings.themeHighContrastDescription":`Stronger borders and more prominent state blocks.`,"settings.themeLoopx":`LoopX standard`,"settings.themeLoopxDescription":`Precise monochrome surfaces, Geist type, and quiet hairline structure.`,"settings.title":`Settings`,"settings.workspaceDisplay":`Workspace display`,"settings.workspaceTheme":`Workspace theme`,"session.closeRecord":`Exit run record`,"session.details":`Session details`,"session.record":`Execution Session · Run record`,"session.recordDescription":`The timeline now shows messages and Turn records from this Session.`,"sidebar.createGoal":`Create Goal`,"sidebar.delete":`Delete`,"sidebar.deleteGoal":`Delete Goal`,"sidebar.manager":`LoopX Manager`,"sidebar.notifications":`Settings`,"sidebar.owner":`Personal workspace`,"sidebar.product":`Personal Agent workspace`,"sidebar.resume":`Resume`,"sidebar.resumeGoal":`Resume Goal`,"sidebar.stop":`Stop`,"tasks.historyLoading":`Loading history…`,"tasks.historyError":`History could not be loaded.`,"tasks.historyExpired":`History snapshot expired. Reload to continue.`,"tasks.historyRetry":`Reload`,"tasks.historyEnd":`End of completed history`,"tasks.historyMore":`Load more`,"tasks.historyLocalOnly":`Open this machine’s Dashboard to browse full history.`,"sidebar.sortGoals":`Reorder Goals`,"sidebar.dragGoal":`Drag to reorder, or use Reorder Goals`,"sidebar.moveUp":`Move {goal} up`,"sidebar.moveDown":`Move {goal} down`,"sidebar.goalMoved":`{goal} moved to position {position}`,"sidebar.orderNotSaved":`Order changed for this visit; browser storage is unavailable.`,"sidebar.stopGoal":`Stop Goal`,"sidebar.stopped":`Stopped`,"sidebar.stoppedLoading":`Loading stopped Goals`,"sidebar.stoppedLoadFailed":`Stopped Goals could not be loaded. Active Goals remain available.`,"sidebar.retryStopped":`Retry`,"state.completed":`Completed`,"state.needsRepair":`Needs repair`,"state.needsYou":`Needs you`,"state.quiet":`Quiet`,"state.running":`Running`,"state.stopped":`Stopped`,"state.waiting":`Waiting`,"tasks.blocked":`Blocked`,"tasks.agentLane":`Work Agent`,"tasks.agentLaneDescription":`Filter this Goal's projected work lanes`,"tasks.agentLaneFilter":`Filter by work Agent`,"tasks.allAgentLanes":`All Agents ({count})`,"tasks.chatAgentReplied":`Agent replied`,"tasks.chatPending":`Sent to Agent`,"tasks.chatPendingDescription":`Processing. Tasks update only after a task operation is confirmed.`,"tasks.chatRecent":`Recent conversation`,"tasks.chatUnchangedDescription":`This conversation did not directly change Tasks. Convert the reply to a Task draft and confirm it when execution is needed.`,"tasks.chatViewReply":`View reply`,"tasks.convertToTask":`Convert to Task`,"tasks.completed":`Completed`,"runs.discoveryPartial":`Some execution details are unavailable. Reconnecting; task summaries are not live execution status.`,"runs.discoveryOffline":`Execution service unavailable. Reconnecting; retained task summaries may be stale.`,"files.openConversation":`Go to conversation`,"files.exportSummary":`Export summary`,"tasks.viewDescription":`Decisions first, then work and recent completions`,"tasks.viewLabel":`Task view`,"tasks.listView":`List`,"tasks.boardView":`Board`,"tasks.completedSummary":`{count} tasks completed. Recent details are projected by the control plane when needed.`,"tasks.emptyCompleted":`No completed tasks yet.`,"tasks.emptyConfirm":`No tasks waiting for confirmation.`,"tasks.emptyRunning":`No queued or running tasks.`,"tasks.emptySchedules":`No scheduled tasks.`,"tasks.emptyGoal":`This Goal has no tasks yet. Describe the next step below and LoopX will show a confirmation preview first.`,"tasks.markComplete":`Mark complete: {name}`,"tasks.moreActions":`More actions: {name}`,"tasks.openExecution":`View execution: {name}`,"tasks.pending":`Pending`,"tasks.pendingAndRunning":`Queued / Running`,"tasks.scheduled":`Scheduled & continuous`,"tasks.sessionError":`Session issue`,"tasks.waiting":`Queued`,"tasks.waitingAge":`Waiting {age}`,"tasks.viewExecution":`View execution`,"tasks.viewResult":`View result`,"time.days":`{count} days`,"time.hours":`{count} hours`,"timeline.emptyGoal":`This Goal has no new activity`,"timeline.emptyGoalDescription":`Ask for progress or send new guidance.`,"timeline.emptyWorkspace":`Your workspace is quiet today`,"timeline.emptyWorkspaceDescription":`Describe a Goal to the LoopX Manager, or ask what deserves attention today.`,"timeline.gateHistory":`{count} historical Gates`,"timeline.pending":`Working…`,"timeline.runCompleted":`{run}: completed`,"timeline.review":`Review`,"timeline.reviewAndConfirm":`Review and confirm`,"timeline.waitingConfirmation":`Needs your confirmation`},"zh-CN":{"common.actions":`操作`,"common.agent":`Agent`,"common.allMessages":`所有消息`,"common.cancel":`取消`,"common.close":`关闭`,"common.closeActionReceipt":`关闭操作回执`,"common.confirm":`确认`,"common.export":`导出`,"common.failed":`失败`,"common.goal":`Goal`,"common.loading":`加载中…`,"common.none":`无`,"common.off":`关闭`,"common.on":`开启`,"common.open":`打开`,"common.owner":`Owner`,"common.readOnly":`只读`,"common.recently":`刚刚`,"common.status":`状态`,"common.task":`Task`,"common.you":`你`,"common.waiting":`等待中`,"composer.addImage":`添加图片`,"composer.agentProgress":`向 Agent 获取进度报告`,"composer.agentProgressPrompt":`请给我一份当前 Goal 的进度报告:已完成、执行中、阻塞和下一步。`,"composer.attachImageHint":`选择、粘贴或拖入图片`,"composer.clarifyDefer":`暂缓 Todo 需要可自动判断的恢复条件。请补充 todo_done:、pr_merged:[owner/repo]# 或 capacity_available:。`,"composer.clarifySingleAction":`这句话包含多个可能修改状态的操作。请一次描述一项操作,我会逐项展示确认预览。`,"composer.createGoal":`创建新 Goal`,"composer.createGoalDraft":`Goal 草稿`,"composer.createGoalDraftDescription":`补充内容后发送,LoopX 会先展示待确认操作。`,"composer.createGoalDraftLead":`我想创建一个长期 Goal:`,"composer.createGoalTemplate":`我想创建一个长期 Goal: +目标: +完成标准: +执行边界(可选): +关联仓库(可选): +通知方式(可选):`,"composer.createGoalHint":`填入 Goal 模板草稿,检查后再创建`,"composer.draft":`草稿`,"composer.globalProgress":`汇总所有 Goal 进展`,"composer.globalProgressPrompt":`请帮我汇总所有活跃 Goal 的最新进展与阻塞。`,"composer.globalTasks":`询问全局待办`,"composer.globalTasksPrompt":`有哪些 Goal 正在等我?我现在该优先处理什么?`,"composer.goalMessageHint":`你的消息由 {agent} 在本 Goal 的会话中接收`,"composer.goalRunningHint":`{agent} 正在执行 {count} 个任务 · 你的消息作为纠偏进入本会话,不会打断执行`,"composer.goalPlaceholder":`询问或纠偏 {goal}…`,"composer.imageAnalysisPrompt":`请结合这些图片分析当前 Goal,并告诉我下一步。`,"composer.imageCountError":`最多添加 {count} 张图片。`,"composer.imagePicker":`图片文件选择器`,"composer.imageReadError":`无法读取图片 {name}`,"composer.imageReadGenericError":`图片读取失败。`,"composer.imageSizeError":`单张图片不能超过 {size}MB。`,"composer.imageTypeError":`支持 PNG、JPEG、WebP 和 GIF 图片。`,"composer.imagesPending":`待发送图片`,"composer.immediate":`立即发送`,"composer.managerMessageHint":`你的消息由 LoopX 管家跨 Goal 接收,支持全局询问与创建 Goal`,"composer.managerPlaceholder":`问问 LoopX 管家,或描述一个新 Goal…`,"composer.monitor":`配置定时检查`,"composer.monitorGoalQuestion":`为哪个 Goal 添加定时检查?`,"composer.monitorTemplate":`为当前 Goal 添加定时检查: +检查内容: +频率(支持 30 分钟 / 2 小时 / 每天):每 2 小时 +停止条件:Goal 完成`,"composer.monitorTemplateWithoutGoal":`配置定时检查: +Goal: +检查内容: +频率:每 2 小时 +停止条件:Goal 完成`,"composer.monitorHint":`先填写检查内容、频率和停止条件,不会立即创建`,"composer.heartbeatGoalQuestion":`为哪个 Goal 设置 Heartbeat?`,"composer.heartbeatTemplate":`为当前 Goal 设置 Heartbeat: +频率:每天 +停止条件:Goal 完成 +通知:仅在需要我时`,"composer.heartbeatTemplateWithoutGoal":`设置 Heartbeat: +Goal: +频率:每天 +停止条件:Goal 完成 +通知:仅在需要我时`,"composer.nextAction":`询问下一步`,"composer.nextActionPrompt":`我现在该做什么?`,"composer.prepareDraft":`填入编辑框,确认后再发送`,"composer.send":`发送`,"composer.sendMessage":`向 LoopX 发送消息`,"composer.sendMessageHint":`发送消息`,"composer.sentImageAlt":`移除图片 {name}`,"conversation.agentPending":`正在整理…`,"conversation.close":`关闭对话回执`,"conversation.convertHint":`将 Agent 最新回复转为 Task 草稿`,"conversation.full":`查看完整对话`,"conversation.receipt":`对话回执`,"conversation.replying":`正在回复`,"conversation.title":`管家对话`,"conversation.toTask":`转为 Task`,"digest.away":`自上次访问以来的运行记录`,"digest.completed":`新增完成运行`,"digest.failed":`新增失败或中断`,"digest.needsYou":`当前待确认`,"feedback.applying":`正在执行:{title}`,"feedback.cancelFailed":`取消失败:{error}`,"feedback.completed":`已完成:{title}`,"feedback.executionFailed":`执行失败:{error}`,"feedback.gateRequired":`需要你确认:{summary}`,"feedback.notCompleted":`操作未完成:{status}`,"feedback.goalRefreshFailed":`已打开 Goal,但暂时无法刷新最新状态。请点击刷新重试。`,"feedback.preparingPreview":`正在准备确认预览:{title}`,"feedback.previewFailed":`无法准备确认预览:{error}`,"feedback.sendFailed":`发送失败:{error}`,"feedback.sendGenericError":`消息发送失败,请稍后重试。`,"feedback.stale":`状态已变化,操作未执行,请重新生成确认预览。`,"feedback.taskDraftCreated":`已根据回复生成 Task 草稿。编辑后发送,LoopX 会先展示确认预览。`,"goal.defaultTitle":`新的个人 Goal`,"goal.initialTodo":`按完成标准推进:{criteria}`,"goal.objectiveBoundary":`执行边界:{boundary}`,"goal.objectiveCompletion":`完成标准:{criteria}`,"drawer.advancedDiagnostics":`高级诊断`,"drawer.agentWorking":`Agent 正在继续执行,记录会自动更新。`,"drawer.analysis":`正在分析`,"drawer.apply":`确认并应用`,"drawer.applying":`正在应用…`,"drawer.attentionBlocking":`正在阻塞 Agent`,"drawer.attentionWaiting":`等待你的决定`,"drawer.autoNotify":`Human-gate 自动通知`,"drawer.branch":`分支`,"drawer.closeDetail":`关闭详情:返回{context}`,"drawer.connected":`已连接`,"drawer.correctionDescription":`消息会沿用当前 Goal、Todo 与 Agent Session 上下文。`,"drawer.correctionLabel":`与 {agent} 纠偏`,"drawer.correctionPlaceholder":`例如:先关注权限风险,暂时不要提交…`,"drawer.correctionSend":`发送纠偏`,"drawer.correctionTextarea":`输入纠偏信息:Goal {goal},Agent {agent},Run {run}`,"drawer.copyRepository":`复制仓库标识`,"drawer.copyRepositoryDone":`已复制仓库标识`,"drawer.copyRepositoryError":`复制失败,请检查浏览器剪贴板权限。`,"drawer.copyRepositorySuccess":`已复制,可粘贴到其他工具。`,"drawer.cost":`成本 24h / 7d`,"drawer.currentGoal":`当前 Goal`,"drawer.decisionDefaultEvidence":`当前状态没有附加公开安全证据;下一步仍会先展示 Preview。`,"drawer.decisionDefaultReason":`该决定会影响当前 Todo 的下一步执行。`,"drawer.decisionDefer":`稍后决定`,"drawer.decisionMore":`更多决定`,"drawer.decisionReject":`拒绝`,"drawer.decisionReview":`查看影响并决定`,"drawer.dependencies":`依赖`,"drawer.detailsAndActions":`详情与操作`,"drawer.duration":`运行时长 24h / 7d`,"drawer.evidence":`证据`,"drawer.executionHistory":`执行历史`,"drawer.executionRecord":`运行记录`,"drawer.executionRecordAndResult":`执行过程与结果`,"drawer.explainDecision":`解释此决定`,"drawer.gateApproveHint":`在终端执行一条命令即可完成审批:`,"drawer.gateRejectHint":`不同意就把末尾的 approve 换成 reject。执行后这条提醒会自动消失。`,"drawer.gateRequiresHost":`需要宿主确认`,"drawer.gateRequiresHostDescription":`页面无权直接批准这类权限变更,你的点击没有写入任何内容。`,"drawer.goalAutoRun":`当前 Goal 的自动运行`,"drawer.goalChanges":`当前 Goal 的待确认变更`,"drawer.goalDetails":`Goal 详情`,"drawer.group":`群聊`,"drawer.inspectorFull":`切换到全屏`,"drawer.inspectorFullView":`全屏查看`,"drawer.inspectorHalf":`切换到半屏`,"drawer.inspectorHalfView":`半屏查看`,"drawer.lastNotification":`最近通知`,"drawer.larkConfigure":`管理 Lark connection`,"drawer.larkConnect":`连接 Lark App`,"drawer.larkConnection":`Lark connection`,"drawer.larkNotConfigured":`未配置`,"drawer.larkNotConfiguredDescription":`配置后,当这个 Goal 出现需要你确认的变更时,会自动发飞书通知。`,"drawer.managerChanges":`管家待确认变更`,"drawer.moreActions":`更多操作`,"drawer.moreRunActions":`更多运行操作`,"drawer.nextTransition":`下一转换`,"drawer.noExecutionHistory":`暂无执行记录。`,"drawer.noRun":`尚未启动执行 Session`,"drawer.noRunDescription":`Agent 开始执行后,运行记录会稳定显示在这里。`,"drawer.notAssigned":`未分配`,"drawer.notLinked":`未关联`,"drawer.notSet":`未设置`,"drawer.outputDetails":`产出详情`,"drawer.outputRecorded":`该产出已记录到当前 Goal。`,"drawer.outputSafePreview":`公开安全产出预览`,"drawer.outputRun":`Run`,"drawer.outputTodo":`Todo`,"drawer.outputs":`本次运行产出`,"drawer.previewUnavailable":`此产出没有可用的公开安全内联预览。`,"drawer.priority":`优先级`,"drawer.progress":`进度`,"drawer.proposalApplied":`已应用,LoopX 状态将刷新。`,"drawer.proposalApplyFailed":`应用失败,没有写入任何变更。`,"drawer.proposalApplyFailedHint":`请刷新 Goal 状态后重新生成;若仍失败,可保留此页并查看高级诊断。`,"drawer.proposalClose":`关闭`,"drawer.proposalDefer":`稍后`,"drawer.proposalDeferred":`已暂缓,可稍后继续应用或重新生成。`,"drawer.proposalEnterGoal":`进入新 Goal`,"drawer.proposalExplainer":`确认后,LoopX 会执行这项变更并显示写入结果。关闭或取消不会修改任何状态。`,"drawer.proposalRecheck":`按最新状态重新检查`,"drawer.proposalRegenerate":`基于最新状态重试`,"drawer.proposalRejected":`已拒绝,这项变更不会写入。`,"drawer.proposalStale":`来源状态已变化,请按最新状态重新检查。`,"drawer.proposalViewGoal":`查看更新后的 Goal`,"drawer.reassign":`改派给`,"drawer.reassignSummary":`重新分配:{task}`,"drawer.reason":`原因`,"drawer.recoveryDescription":`本地历史已经保留,请选择恢复路径。`,"drawer.recoveryFailed":`上游 Session 恢复失败`,"drawer.recoveryNewSession":`携带上下文开始新 Session`,"drawer.recoveryRetry":`重试恢复`,"drawer.repositoryRole":`执行工作区`,"drawer.repository":`仓库`,"drawer.replyMode":`回复方式`,"drawer.subagentApplied":`已写入,并通过共享 Goal 状态读回校验。`,"drawer.subagentAppliedRefreshFailed":`已写入并通过共享 Goal 状态读回;状态投影刷新失败,可稍后手动刷新。`,"drawer.subagentApplying":`正在写入并校验共享状态读回…`,"drawer.subagentApplyFailed":`子代理设置写入失败。`,"drawer.subagentChildLimit":`当前上限`,"drawer.subagentConfirmDisable":`确认关闭子代理执行`,"drawer.subagentConfirmEnable":`确认开启子代理执行`,"drawer.subagentCurrentBoundary":`当前任务领域限制`,"drawer.subagentDescription":`仅在 Todo、配额、能力和写入范围门禁全部通过后,允许运行时为相互独立的任务临时创建子代理;不会强制并行,也不会授予持久权限。`,"drawer.subagentDisable":`预览关闭子代理执行`,"drawer.subagentDisableSummary":`这个 Goal 将不再创建新的子代理;现有 Todo 归属和执行记录不受影响。`,"drawer.subagentDomainInvalid":`所选任务领域限制无效。`,"drawer.subagentDomainTodoCount":`匹配 {count} 个开放 Todo`,"drawer.subagentDomains":`任务领域限制(可选)`,"drawer.subagentDomainsEmpty":`当前没有开放的 advancement Todo 声明 task_domain;保持为空即可不按任务领域限制子代理执行。`,"drawer.subagentDomainsHint":`全部不选表示不按任务领域过滤;选择后只放行匹配且已声明领域的 Todo,其他执行门禁始终生效。`,"drawer.subagentDomainsUnrestricted":`不限制任务领域`,"drawer.subagentEnable":`预览开启子代理执行`,"drawer.subagentLabel":`Per-Goal 执行边界`,"drawer.subagentMaxChildren":`最多子代理数`,"drawer.subagentNoChange":`当前 Goal 已是这个设置,没有写入任何内容。`,"drawer.subagentPending":`待确认`,"drawer.subagentPreviewBoundary":`预览边界调整`,"drawer.subagentPreviewFailed":`无法生成子代理设置预览。`,"drawer.subagentPreviewing":`正在核对最新 Goal 状态…`,"drawer.subagentPreviewReady":`预览已锁定,确认后才会写入这个 Goal。`,"drawer.subagentPreviewSummary":`最多允许创建 {count} 个子代理;任务领域限制:{domains}。`,"drawer.subagentRemoteReadOnly":`当前来源只读,请在 Goal 所在主机上修改。`,"drawer.subagentTitle":`自适应子代理执行`,"drawer.remoteDetailsDescription":`SSH 来源只展示公开安全状态,不读取来源主机上的连接配置。`,"drawer.remoteDetailsUnavailable":`远端详情未投影`,"drawer.resumeNo":`否`,"drawer.resumeYes":`是`,"drawer.runDetails":`执行 Session`,"drawer.runInterrupt":`中断本次运行`,"drawer.runLatest":`查看最近执行过程`,"drawer.runNewSession":`开始新 Session`,"drawer.runCloseSession":`关闭 Session`,"drawer.runRecordEmpty":`还没有运行记录。Agent 尚未开始这次执行;请在“详情与操作”查看等待条件或恢复 Session。`,"drawer.runRecordProjected":`当前没有可展示的逐步运行记录。LoopX 已读取到 {completed}/{total} 的投影进度{outputs};请在“详情与操作”检查 Session 状态。`,"drawer.runRecordProjectedOutputs":`和 {count} 项产出`,"drawer.runRoleAssistant":`已完成`,"drawer.runRoleSystem":`需检查`,"drawer.runRoleUser":`收到任务`,"drawer.runView":`Session 视图`,"drawer.scheduleAdd":`添加定时检查`,"drawer.scheduleDefaultNotification":`仅在需要你时通知`,"drawer.scheduleDefaultStop":`Goal 完成或 owner 停止`,"drawer.scheduleDefaultTarget":`由 LoopX 调度器按 Goal 配置唤醒。`,"drawer.scheduleEdit":`改为每 2 小时`,"drawer.scheduleLast":`上次执行`,"drawer.scheduleLocalTimezone":`本地时区`,"drawer.scheduleNext":`下次执行`,"drawer.scheduleNeverRun":`尚未执行`,"drawer.scheduleNotification":`通知`,"drawer.schedulePause":`暂停`,"drawer.schedulePending":`等待调度`,"drawer.scheduleResume":`恢复`,"drawer.scheduleRunNow":`立即运行`,"drawer.scheduleStop":`停止{kind}`,"drawer.scheduleStopCondition":`停止条件`,"drawer.scheduleTimezone":`时区`,"drawer.sessionRecoverable":`可恢复`,"drawer.sessionStatus":`会话状态`,"drawer.setupHeartbeat":`设置 Heartbeat`,"drawer.taskActions":`Todo 待确认操作`,"drawer.taskAdvancement":`推进任务`,"drawer.taskBlock":`标记阻塞`,"drawer.taskComplete":`标记完成`,"drawer.taskCompletedNote":`该任务保留为只读记录。`,"drawer.taskCompletedTitle":`任务已完成`,"drawer.taskDefer":`暂缓`,"drawer.taskDeferCondition":`Todo 暂缓恢复条件`,"drawer.taskDeferInvalid":`条件格式不受支持;请使用下列三种可判定条件。`,"drawer.taskDeferPlaceholder":`例如 pr_merged:owner/repo#123`,"drawer.taskDeferReview":`检查暂缓`,"drawer.taskDeferSupported":`支持 todo_done、pr_merged、capacity_available 条件。`,"drawer.taskDeferUntil":`暂缓至`,"drawer.taskDetails":`Todo 详情`,"drawer.taskInfo":`任务信息`,"drawer.taskManage":`管理任务`,"drawer.taskNextCompleted":`可创建后续任务`,"drawer.taskNextOpen":`推进或更新状态`,"drawer.taskOrdinary":`普通任务`,"drawer.taskStatusBlocked":`受阻`,"drawer.taskStatusDeferred":`已延期`,"drawer.resumeWhen":`恢复条件`,"drawer.taskNextDeferred":`等待恢复条件满足后重新评估`,"drawer.taskStatusCompleted":`已完成`,"drawer.taskStatusOpen":`待执行`,"drawer.taskSuccessor":`创建后续 Todo`,"drawer.taskSuccessorNote":`Owner 标记为阻塞,等待补充上下文。`,"drawer.taskSuccessorSummary":`创建后续 Todo:{task}`,"drawer.taskSuccessorText":`{task} 的后续工作`,"drawer.taskType":`任务类型`,"drawer.topic":`Topic`,"drawer.trigger":`触发方式`,"drawer.titleAttention":`需要你`,"drawer.titleOutput":`产出详情`,"drawer.titleProposalApplied":`执行结果`,"drawer.titleProposalConfirm":`确认执行`,"drawer.titleSchedule":`定时检查`,"drawer.unconfigured":`未配置`,"drawer.workspaceCandidates":`可选择的工作区`,"files.emptySummary":`公开安全产出`,"files.empty":`还没有文件、产出或已验证的阶段周报。`,"files.loadingReports":`正在加载已验证的阶段周报…`,"files.reportDelta":`+{added} 新增 · {changed} 变化`,"files.reportAdded":`新增`,"files.reportChanged":`变化`,"files.reportGeneration":`生成批次`,"files.reportLoadFailed":`无法加载已验证周报`,"files.reportPublication":`发布批次`,"files.title":`Files & Outputs`,"files.verifiedReport":`已验证阶段周报`,"header.agentUnavailable":`不可用`,"header.chatRuntime":`Chat`,"header.workAgentCount":`{count} 个工作 Agent`,"header.chat":`Chat`,"header.files":`Files`,"header.goalCapabilities":`能力配置`,"header.goalCapabilitiesDescription":`管理 Goal override 与继承的本机默认值。`,"header.goalDetails":`Goal 详情`,"header.goalDetailsDescription":`查看状态、用量、仓库、通知与 Session。`,"header.goalSettings":`Goal 设置`,"header.goalSettingsDescription":`打开 Goal 详情或能力配置`,"header.goalNavigation":`Goal 导航`,"header.goalView":`Goal 视图`,"header.live":`实时`,"header.manager":`LoopX 管家`,"header.managerDescription":`跨 Goal 的个人工作入口`,"header.managerOverview":`总览`,"header.managerView":`管家视图`,"header.openGoalNavigation":`打开 Goal 导航`,"header.readOnlySourceDescription":`{source} 通过 SSH 隧道只读展示`,"header.refresh":`刷新状态`,"header.refreshDone":`刚刚更新`,"header.refreshFailed":`刷新失败`,"header.refreshing":`刷新中`,"header.selectAgent":`选择 Agent`,"header.selectChatRuntime":`选择聊天 Runtime`,"header.tasks":`Tasks`,"header.themeBrutal":`切换到野兽主题`,"header.themePaper":`切换到默认主题`,"home.blockingSummary":`其中 {count} 项正在阻塞 Agent。`,"home.completedGoals":`已完成的 Goal`,"home.empty":`当前没有`,"startup.goalLoading":`正在加载状态…`,"startup.goalError":`状态加载失败`,"startup.progress":`已加载 {loaded} / {total} 个活跃 Goal`,"startup.partial":`Goal 状态正在逐个更新,当前统计尚不完整。`,"startup.independent":`此 Goal 的加载不会阻塞其他 Goal,你可以先查看已加载的内容。`,"startup.error.timeout":`读取超时,可在本地服务就绪后重试。`,"startup.error.network":`连接中断,请重试以重新连接。`,"startup.error.service":`本地服务暂时不可用,请重试继续加载。`,"startup.error.revision":`加载期间 Goal 目录发生变化,请刷新以同步。`,"startup.error.scope":`该 Goal 已不在当前来源中,请刷新目录。`,"startup.error.invalid":`无法解析状态响应,请刷新或检查 LoopX 更新。`,"startup.retry":`重试`,"startup.retryFailed":`重试失败的 Goal`,"startup.failedCount":`{count} 个 Goal 加载失败,已加载的 Goal 可继续使用。`,"home.greeting":`你好,我是 LoopX 管家`,"home.history":`历史`,"home.lane.needsYou":`需要你`,"home.lane.needsYouDescription":`等待你的决定、授权或补充信息`,"home.lane.observing":`观察中`,"home.lane.observingDescription":`持续监控,出现变化时再提醒你`,"home.lane.running":`执行中`,"home.lane.runningDescription":`Agent 正在推进并持续回传进展`,"home.lane.scheduled":`已安排`,"home.lane.scheduledDescription":`已经安排,等待时间或前置条件`,"home.noActivity":`尚无活动`,"home.noFirstActivity":`等待首次活动`,"home.noCompletedGoals":`还没有已完成的 Goal`,"home.preservedState":`保留状态,可随时恢复`,"home.stopped":`已停止`,"home.systemHealth":`系统健康:{summary}`,"home.taskCount":`{count} 个 Task`,"home.todayAt":`今天 {time}`,"home.waitingCount":`你有 {count} 项需要处理。`,"home.workspace":`Goal 工作区`,"lark.allMessages":`此 Topic 中的所有消息`,"lark.allTopicMessages":`所有 Topic 消息`,"lark.agentIngress":`Agent 入站方式`,"lark.appCreated":`App 已创建`,"lark.appCreateFailed":`创建失败`,"lark.appLoading":`正在加载可用的 Lark Apps…`,"lark.appPermissions":`该 App 能发送建联消息,但缺少接收群聊 @ 消息或自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly、im:message.send_as_bot 和事件 im.message.receive_v1,发布新版后刷新。`,"lark.appProfile":`Lark App`,"lark.apps":`Lark Apps`,"lark.autoReplyUnavailable":`自动回复暂不可用`,"lark.autoReplyReady":`自动回复可用`,"lark.bindGoal":`绑定到 Goal`,"lark.cancel":`取消`,"lark.cardinality":`一个 Lark App · 多个 Goal · 每个 Agent 一条隔离路由`,"lark.capture":`接收范围`,"lark.captureAddressed":`仅接收提及 App 或回复 App 的消息`,"lark.captureAll":`接收此 Goal Topic 中的所有消息`,"lark.captureScope":`接收范围`,"lark.captureScopeDescription":`决定哪些 Topic 消息会进入 LoopX;不会扩大 Agent 权限。`,"lark.closeConnection":`关闭连接弹窗`,"lark.closeCreate":`关闭创建弹窗`,"lark.closeSettings":`关闭 Lark 设置`,"lark.connect":`连接`,"lark.connectAllAgents":`连接全部已注册 Agent`,"lark.connectAllAgentsAction":`一键连接 {count} 个 Agent`,"lark.connectAllAgentsDescription":`一次引导创建 {count} 条隔离路由;每个 Agent 保留独立连接身份和收件箱。`,"lark.connectApp":`连接 Lark App`,"lark.connection":`连接`,"lark.connections":`连接`,"lark.configuration":`Lark 配置`,"lark.continueFeishu":`在飞书中继续`,"lark.createAutomatically":`自动创建 Goal Topic`,"lark.createAutomaticallyDescription":`将为这个 Goal 创建一个专属 Topic。`,"lark.description":`管理可复用的 Lark App,并用独立 Topic 将群聊连接到 Goal。`,"lark.editConnection":`编辑 Lark 连接`,"lark.goalConnections":`{count} 个 Goal 连接`,"lark.goalTopicConnections":`Lark Goal Topic 连接`,"lark.groupChat":`群聊`,"lark.groupEmpty":`该机器人尚未加入可连接的群。请先在飞书群设置中添加这个机器人,再回来刷新或搜索。`,"lark.groupLoading":`正在读取该机器人已加入的群…`,"lark.groupSearch":`搜索该机器人已加入的群`,"lark.historyPermission":`历史补读权限(独立能力)`,"lark.health.eventProcessed":`已处理 {events} 条事件,成功回复 {replies} 条。`,"lark.health.eventUnverified":`事件订阅待验证`,"lark.health.eventUnverifiedDetail":`长连接已启动,但尚未收到消息事件。请启用 im.message.receive_v1,开通群聊 @ 消息权限,发布新版后再发送一条新的 @ 消息。`,"lark.health.ignoredSelf":`已忽略机器人自身发送的消息,避免重复回复。`,"lark.health.invalidRouting":`路由配置无效`,"lark.health.invalidRoutingDetail":`连接已安全停用,请重新选择处理方式并保存。`,"lark.health.lastStatus":`最近事件状态:{status}`,"lark.health.listening":`监听中`,"lark.health.messageContextPermission":`消息权限不足`,"lark.health.messageContextPermissionDetail":`已收到消息事件,但无法读取群消息上下文。请发布并授权该 App 的群消息读取权限。`,"lark.health.notAddressed":`最近消息未直接 @ 机器人`,"lark.health.notAddressedDetail":`监听正常;当前连接只响应直接 @ 机器人或对机器人的回复。`,"lark.health.notStarted":`监听未启动`,"lark.health.notStartedDetail":`请刷新连接或重新启动 LoopX 后再试。`,"lark.health.processingFailed":`消息处理失败`,"lark.health.processingFailedDetail":`已收到消息事件,但 Agent 处理失败。请查看本地诊断后重试。`,"lark.health.queued":`已进入 Agent 收件箱`,"lark.health.queuedDetail":`消息由 {agent} 异步处理,不会启动通用 Chat Session。`,"lark.health.retrying":`监听重试中`,"lark.health.retryingDetail":`事件监听暂时中断,LoopX 正在自动重试。`,"lark.health.routeAmbiguous":`消息匹配多个 Goal`,"lark.health.routeAmbiguousDetail":`同一 Bot 和群聊存在多个完整群捕获连接。请让每个 Agent 使用独立 Bot,或只保留一个完整群连接。`,"lark.health.routeMismatch":`消息未匹配当前 Goal Topic`,"lark.health.routeMismatchDetail":`事件来自其他群聊或 Topic。请重新选择群聊并连接该 Goal,然后发送一条新的 @ 消息。`,"lark.health.routeUnavailable":`消息无法路由到 Goal`,"lark.health.routeUnavailableDetail":`当前连接信息不完整。请重新连接该 Goal 后再发送一条新的 @ 消息。`,"lark.health.starting":`正在启动`,"lark.health.startingDetail":`LoopX 正在启动该 App 的消息事件监听。`,"lark.health.unavailable":`自动回复不可用`,"lark.health.waiting":`等待处理`,"lark.incomingMessages":`接收消息`,"lark.ingressAsync":`异步收件箱`,"lark.ingressAsyncDescription":`写入 Agent 私有收件箱,等待后续显式处理。`,"lark.ingressLegacy":`旧版直连`,"lark.ingressLegacyDescription":`旧连接兼容模式;保存时请选择新的三种入站模式之一。`,"lark.ingressQueue":`排队`,"lark.ingressQueueDescription":`进入同一 Agent Session 的有界 FIFO 队列,当前 Turn 完成后处理。`,"lark.ingressSteering":`实时引导`,"lark.ingressSteeringDescription":`投到当前活跃 Turn;没有精确活跃 Turn 时安全拒绝。`,"lark.loading":`加载 Lark 配置…`,"lark.management":`Lark 管理`,"lark.openEventSettings":`查看飞书事件配置`,"lark.mentions":`提及机器人`,"lark.mentionsOnly":`仅提及消息`,"lark.needsMessagePermissions":`需要消息权限`,"lark.needsSetup":`需要设置`,"lark.newApp":`新建 Lark App`,"lark.noAgentConfigured":`未配置 Agent`,"lark.noConnections":`暂无匹配的连接。`,"lark.noProfiles":`还没有可用的 lark-cli App profile。`,"lark.profileName":`Profile 名称`,"lark.profileValidation":`Profile 只能包含字母、数字、点、下划线和连字符。`,"lark.processing":`处理方式`,"lark.region":`区域`,"lark.registerAnother":`+ 注册另一个 Lark App — 通过飞书创建`,"lark.reopenFeishu":`重新打开飞书`,"lark.settingsConfigure":`配置 {goal}`,"lark.settingsDisconnect":`解绑 {goal}`,"lark.replyMode":`回复方式`,"lark.replyModeDescription":`当前只支持在来源 Topic 内回复,避免跨群或跨 Goal 投递。`,"lark.reusableApps":`{count} 个可复用 App`,"lark.reusableWorkspaceApp":`可复用工作区 App`,"lark.saveConnection":`保存连接`,"lark.searchConnections":`搜索 Lark 连接`,"lark.searchPlaceholder":`搜索 App、群、Goal 或 Topic`,"lark.setupCopy":`LoopX 将通过 lark-cli 打开飞书官方创建页面。应用凭证保存在系统 Keychain,LoopX 只保留 profile 引用。`,"lark.someoneMentions":`有人提及 Agent`,"lark.targetAgent":`目标 Agent`,"lark.targetAgentDescription":`选择该 Goal 内已注册的 Agent。此连接只投递给一个 Agent,不广播、不授予新权限。实时引导与排队需要该 Agent 的精确活跃 Session。`,"lark.agentUnavailable":`{agent} · 已不可用`,"lark.selectRegisteredAgent":`请先选择可用的已注册 Agent;不会自动替换原先的接收者。`,"lark.topicPreview":`Topic 预览`,"lark.topicReply":`Topic 回复`,"lark.trigger":`触发方式`,"lark.waitingFeishu":`等待飞书完成创建`,"lark.waitingFeishuDescription":`请在新窗口中完成飞书授权,完成后会自动回到这里。`,"lark.waitingLink":`正在生成飞书官方创建链接…`,"lark.error.appCreate":`Lark App 创建失败`,"lark.error.appRequired":`请选择一个 Lark App profile。`,"lark.error.bind":`绑定失败`,"lark.error.bindPreview":`绑定预览失败`,"lark.error.configuration":`Lark 配置加载失败`,"lark.error.groupLookup":`无法读取该机器人已加入的群。请检查机器人状态后重试。`,"lark.error.groupLoad":`群聊加载失败`,"lark.error.invalidApp":`Lark App profile 不可用或尚未完成授权。`,"lark.error.messagePermissions":`该 App 缺少自动回复所需的机器人权限。请开启 im:message.group_at_msg:readonly 和 im:message:send_as_bot,发布新版后回来刷新重试。`,"lark.error.provider":`飞书 API 调用失败,且没有生成已验证回执。请稍后重试。`,"lark.error.setupPoll":`创建状态查询失败`,"lark.error.setupStart":`无法启动 Lark App 创建流程`,"lark.error.cliExecutable":`已找到配置的 lark-cli,但当前无法执行。请检查安装或启动参数。`,"lark.error.cliMissing":`未发现 lark-cli。请先安装 lark-cli,然后重新启动 LoopX。`,"lark.error.cliStart":`lark-cli 启动失败。请检查安装状态,然后重新启动 LoopX。`,"lark.error.disconnect":`解绑失败`,"notifications.autoNotify":`需要你确认时自动推送到群里`,"notifications.bind":`绑定到通知群`,"notifications.bindConfirm":`将把「{goal}」绑定到通知群「{target}」,绑定时会验证机器人在群内并发送一条确认消息。`,"notifications.bindFailed":`绑定失败`,"notifications.bound":`已绑定`,"notifications.confirmBind":`确认绑定`,"notifications.description":`把 Goal 里需要你确认的变更推送到飞书群。绑定和开关在这里完成,推送逻辑沿用现有通道。`,"notifications.disabled":`已停用`,"notifications.group":`通知群:{target}`,"notifications.loadFailed":`通知群列表加载失败`,"notifications.noTargets":`还没有可用的通知群。通知群涉及机器人私有身份,请先在终端配置一次:`,"notifications.notBound":`未绑定`,"notifications.recent":`最近 {time}`,"notifications.sentCount":`已发送 {count} 条`,"notifications.settings":`Goal 通知绑定`,"notifications.setupFailed":`设置失败`,"notifications.title":`飞书群通知`,"proposal.field.agentId":`Agent`,"proposal.field.cadence":`频率`,"proposal.field.completionCriteria":`完成标准`,"proposal.field.executionBoundary":`执行边界`,"proposal.field.goalId":`Goal ID`,"proposal.field.heartbeat":`Heartbeat`,"proposal.field.initialTodos":`首个任务`,"proposal.field.objective":`目标`,"proposal.field.operation":`操作`,"proposal.field.permission":`权限`,"proposal.field.reason":`原因`,"proposal.field.stopCondition":`停止条件`,"proposal.field.target":`检查内容`,"proposal.field.timezone":`时区`,"proposal.field.title":`标题`,"proposal.field.workspace":`执行工作区`,"proposal.gate.default":`需要宿主确认`,"proposal.impact.default":`确认后会调用规范 LoopX 服务写入状态。`,"proposal.impact.goalCreate":`确认后会创建 Goal 和首个 Todo,并让选定 Agent 开始首轮推进。`,"proposal.impact.lifecycleDelete":`确认后会从 source registry 和 global registry 移除这个已停止 Goal;项目文件、历史状态文件和备份不会被删除。`,"proposal.impact.lifecycleResume":`确认后会恢复 Goal 的自动调度资格并移回 Active Goals;实际执行仍受 quota、Gate 和 Todo 约束。`,"proposal.impact.lifecycleStop":`确认后会停止自动推进,并将 Goal 移入折叠的「已停止」列表;历史、Todo 和证据都会保留,可随时恢复。`,"proposal.impact.protected":`该操作需要通过受保护的 LoopX 写入服务完成。`,"proposal.primary.apply":`确认并应用`,"proposal.primary.goalCreate":`创建 Goal 并开始首轮`,"proposal.primary.lifecycleDelete":`删除 Goal`,"proposal.primary.lifecycleResume":`恢复 Goal`,"proposal.primary.lifecycleStop":`停止 Goal`,"proposal.primary.todoStart":`创建任务并开始执行`,"proposal.summary.goalCreate":`创建 Goal:{title}`,"proposal.summary.heartbeat":`为当前 Goal 设置 Heartbeat`,"proposal.summary.lifecycleDelete":`删除 Goal:{title}`,"proposal.summary.lifecycleResume":`恢复 Goal:{title}`,"proposal.summary.lifecycleStop":`停止 Goal:{title}`,"proposal.summary.monitor":`为当前 Goal 创建定时检查:{target}`,"proposal.workspace.current":`当前本地工作区(未绑定 Repository)`,"proposal.workspace.named":`{workspace}(仅提供执行环境,不会自动关联仓库)`,"proposal.workspaceGate.agentImpact":`先完成 Agent 身份绑定,再重新检查原操作;当前没有写入 Goal。`,"proposal.workspaceGate.agentTitle":`先绑定 Agent`,"proposal.workspaceGate.defaultSummary":`请选择 Goal 所属工作区。`,"proposal.workspaceGate.selectionImpact":`选择工作区后会重新展示待确认操作,选择本身不会写入状态。`,"proposal.workspaceGate.selectionTitle":`选择 Goal 工作区`,"runs.completed":`已完成`,"runs.failed":`需检查`,"runs.interrupted":`已中断`,"runs.queued":`已安排`,"runs.ready":`可继续`,"runs.resumeFailed":`恢复失败`,"runs.running":`执行中`,"runs.unknown":`状态未知`,"runs.waiting":`等待条件`,"schedule.active":`执行中`,"schedule.heartbeat":`Goal Heartbeat`,"schedule.monitor":`定时与持续任务`,"schedule.paused":`已暂停`,"schedule.summary":`按 LoopX 调度约束持续检查`,"schedule.defaultTarget":`检查当前 Goal 的阻塞、进度与新产出`,"schedule.unsupportedCalendar":`当前定时检查不支持精确到星期或时刻的日历计划。请改用固定间隔,例如“每 30 分钟”“每 2 小时”或“每天”;草稿已保留,没有生成待确认操作。`,"source.add":`添加来源`,"source.addConfigured":`添加只读来源`,"source.addMethod":`来源添加方式`,"source.addSsh":`添加 SSH 隧道来源`,"source.closeForm":`关闭来源表单`,"source.configured":`已配置 SSH`,"source.configuredCount":`本机 SSH Host · {count} 个`,"source.configuredGroup":`已配置 SSH Host · {count}(点击快速添加)`,"source.connected":`已连接`,"source.connecting":`连接中`,"source.controlPlane":`控制面来源`,"source.copy":`复制`,"source.copyCommand":`复制 SSH 隧道命令`,"source.copyError":`无法复制命令,请手动复制下方命令。`,"source.copied":`已复制`,"source.description":`已读取全部显式 Host(含 Include);通配规则不会作为具体来源。先运行命令,LoopX 不读取密钥或配置细节。`,"source.host":`本机 SSH Host`,"source.hostEmpty":`~/.ssh/config 中没有可直接选择的显式 Host。`,"source.hostLoadError":`无法读取本机 SSH Host。`,"source.hostPlaceholder":`输入或搜索 Host`,"source.invalid":`SSH 来源参数无效。`,"source.loadingHosts":`正在读取…`,"source.localInteractive":`本机交互`,"source.localPort":`本地端口`,"source.manual":`手动 URL`,"source.manualDescription":`远端来源始终按只读投影处理,不继承本机写权限。`,"source.name":`名称`,"source.namePlaceholder":`远程开发机`,"source.notAvailable":`不可用`,"source.readOnly":`SSH 隧道 · 只读`,"source.readOnlyNoticeDescription":`你可以查看 Goal、Task、证据与运行状态;写入、纠偏和 Agent 会话仍留在来源主机。`,"source.readOnlyNoticeTitle":`远端只读投影`,"source.readOnlyWriteError":`远端 SSH 隧道来源是只读投影,不能执行控制面写入。`,"source.refreshHosts":`重新读取 SSH Host`,"source.remove":`移除来源 {source}`,"source.removeCurrent":`移除当前来源`,"source.select":`选择控制面来源`,"source.selectHost":`请选择已配置的 SSH Host。`,"source.statusUrl":`本地转发 URL`,"source.tunnelCommandPending":`选择 Host 后生成隧道命令`,"machine.absent":`尚未配置`,"machine.action.create":`创建机器策略`,"machine.action.delete":`移除机器策略`,"machine.action.unchanged":`无需写入`,"machine.action.update":`更新机器策略`,"machine.applied":`机器策略已应用,并通过回读校验。`,"machine.applyError":`无法应用机器策略。`,"machine.applyPreview":`应用已审阅预览`,"machine.changedNamespaces":`变更的 Namespace`,"machine.capabilityCatalog":`机器能力目录`,"machine.capabilityEmpty":`当前没有注册可在机器作用域配置的能力。`,"machine.configured":`已配置`,"machine.confirmRollback":`确认回滚`,"machine.currentRevision":`当前 Revision`,"machine.currentValue":`当前机器值`,"machine.description":`与 Goal 设置共用能力目录。在这里管理受支持的机器默认值;仅支持 Goal 配置的能力会明确标注。`,"capabilities.rawJson":`高级:原始 JSON`,"machine.goalOnly":`此能力目前仅支持 Goal 级配置。请打开具体 Goal 的能力设置进行配置;这里不会设置机器级默认值。`,"machine.desiredRevision":`目标 Revision`,"machine.editorUnavailable":`当前版本未安装此 Namespace 的编辑器`,"machine.editorUnavailableDescription":`它仍会显示在 Registry 中;安装或升级对应的 Dashboard 编辑器后才能修改。`,"machine.editorMode":`编辑模式`,"machine.liveDefault":`实时默认值;Goal 显式覆盖优先`,"machine.liveDefaultDescription":`没有显式周期报告覆盖的 Goal 会在每次规划时读取当前机器策略。修改或移除策略会立即影响这些已有 Goal;显式 Goal 覆盖保持固定。`,"machine.genericNamespaceDescription":`使用 JSON 编辑这个已注册 Namespace。LoopX 会先按 capability 自己拥有的 schema 校验,再允许预览写入。`,"machine.jsonConfiguration":`Namespace 配置(JSON)`,"machine.jsonConfigurationHelp":`只更新当前 Namespace;其他机器配置会保留,Apply 仍锁定到已审阅的 Preview Revision。`,"machine.jsonEditor":`JSON`,"machine.jsonInvalid":`请先填写一个合法的 JSON object,再预览变更。`,"machine.loadError":`无法读取机器配置。`,"machine.machinePolicy":`机器策略`,"machine.namespaceCount":`已注册 Namespace`,"machine.namespaces":`配置 Namespace`,"machine.periodicReport":`周期报告`,"machine.periodicReportDescription":`为所有未显式覆盖的 Goal 提供默认报告策略;Goal 调度与发送消费解析后的有效配置。`,"machine.periodicReportActivation":`开启后将在已验证的阶段节点自动投递`,"machine.periodicReportActivationDescription":`这不是每周定时器。当 LoopX 验证 Goal 已完成一个阶段时,Agent 会生成并冻结报告,随后通过配置的 Goal Channel 自动发送。启用此订阅即授予持续投递权;发送失败或路由漂移会 fail closed 并进入修复。`,"machine.preview":`审阅机器配置变更`,"machine.previewChanges":`预览变更`,"machine.previewError":`无法生成机器策略预览。`,"machine.previewLocked":`应用操作锁定到当前 Revision;若机器状态变化,LoopX 会要求重新预览。`,"machine.previewRollback":`预览回滚`,"machine.previewRemoval":`预览移除`,"machine.profilePreset":`Profile preset`,"machine.profilePresetHelp":`由 capability 管理的 preset,例如 weekly-progress。`,"machine.registry":`Typed Registry`,"machine.requiredFields":`开启后必须填写 profile preset、Goal Channel route 与有效时区。`,"machine.revision":`机器 Revision`,"machine.revisionLockedReady":`所有变更必须先预览;只有对应的机器 Revision 仍然有效时才会应用。`,"machine.rollbackAvailable":`可回滚上一次应用`,"machine.rollbackDescription":`先预览已保存的前一 Revision,再决定是否恢复。`,"machine.rollbackError":`无法完成回滚。`,"machine.rollbackPreviewDescription":`前一 Revision 已准备恢复,请确认执行本次回滚。`,"machine.rolledBack":`已恢复前一版机器策略,并通过校验。`,"machine.removed":`机器策略已移除,并通过回读校验。`,"machine.routeRef":`Goal Channel route`,"machine.routeRefHelp":`只填写公开 route alias;凭据与 provider identifier 不会进入此表单。`,"machine.timezone":`时区`,"machine.timezoneHelp":`填写 IANA 时区,例如 Asia/Shanghai。`,"machine.title":`机器配置`,"machine.unchanged":`机器策略已与预览一致,本次没有写入。`,"machine.visualEditor":`引导式`,"capabilities.atomicOverride":`Goal override 按完整配置生效`,"capabilities.atomicOverrideDescription":`Goal 的完整配置优先于机器默认值;LoopX 不会在两个作用域之间逐字段拼接。`,"capabilities.applyFailed":`Goal 能力变更未写入。`,"capabilities.applyPreview":`应用此预览`,"capabilities.catalog":`Goal 能力目录`,"capabilities.chooseGoal":`请先选择一个 Goal,再查看它的能力配置。`,"capabilities.defaultValue":`声明的默认值`,"capabilities.description":`查看当前 Goal 可用的能力,以及每项配置的准确作用域。`,"capabilities.editorPrepared":`已注册 typed editor contract`,"capabilities.effectiveSource":`当前生效来源`,"capabilities.empty":`当前 Goal 没有可用的能力描述。`,"capabilities.fields":`已注册字段`,"capabilities.goalPolicy":`Goal 能力策略`,"capabilities.goalScope":`Goal`,"capabilities.goalValue":`当前 Goal 值`,"capabilities.loadFailed":`无法加载 Goal 能力`,"capabilities.loading":`正在加载 Goal 能力…`,"capabilities.machineOnly":`此能力只能在机器作用域配置。`,"capabilities.machineValue":`实时机器默认值`,"capabilities.machineScope":`机器`,"capabilities.previewOnly":`当前读取结果来自真实配置;在 revision-locked preview/apply 路径接通前,Dashboard 不会提供 Goal 写入控件。`,"capabilities.preview":`锁定 revision 的变更预览`,"capabilities.previewChanges":`预览变更`,"capabilities.restoreInheritance":`恢复继承机器默认值`,"capabilities.previewFailed":`无法预览 Goal 能力变更。`,"capabilities.previewLocked":`应用时会重新校验这一个 plan revision;过期变更将被拒绝。`,"capabilities.partialWrite":`Goal 值已保存;共享投影仍需修复`,"capabilities.partialWriteDescription":`源 Goal 配置已经写入并回读,但共享 runtime 投影尚未同步;请勿重复提交本次变更。`,"capabilities.refreshSource":`刷新源配置`,"capabilities.readOnly":`只读能力`,"capabilities.revisionLockedReady":`所有变更必须先预览;只有对应的精确 revision 仍然有效时才会写入。`,"capabilities.retry":`重试`,"capabilities.source.capability_default":`能力默认值`,"capabilities.source.goal_override":`Goal override`,"capabilities.source.machine_default":`实时机器默认值`,"capabilities.source.not_configured":`未配置`,"capabilities.title":`Goal 能力`,"settings.close":`关闭设置`,"settings.appearance":`外观`,"settings.appearanceDescription":`管理当前浏览器里的工作区显示偏好。`,"settings.appearanceTabDescription":`主题和显示偏好`,"settings.capabilitiesTabDescription":`当前 Goal 的能力覆盖配置`,"settings.back":`返回工作区`,"settings.categories":`设置分类`,"settings.description":`管理工作区偏好与集成。`,"settings.eyebrow":`工作区偏好`,"settings.general":`通用`,"settings.goalConnections":`Goal 连接`,"settings.language":`语言`,"settings.languageDescription":`选择 LoopX Desktop 工作区使用的界面语言。`,"settings.languageEnglishDescription":`使用英文显示导航、设置和工作区控件。`,"settings.languageEnglish":`English`,"settings.languageSimplifiedChineseDescription":`使用简体中文显示导航、设置和工作区控件。`,"settings.languageSimplifiedChinese":`简体中文`,"settings.languageStoredLocally":`此偏好仅保存在当前设备。`,"settings.languageTabDescription":`当前设备的界面语言`,"settings.larkTabDescription":`App、群聊和 Goal Topic 连接`,"settings.machineTabDescription":`本机各 Capability 共享的 typed defaults`,"settings.notifications":`通知`,"settings.open":`设置`,"settings.themeDefault":`纸张`,"settings.themeDefaultDescription":`安静、轻量,适合长期查看。`,"settings.themeDescription":`选择工作区的视觉风格。设置会保存在当前浏览器本地。`,"settings.themeHighContrast":`高对比`,"settings.themeHighContrastDescription":`更强边框和更醒目的状态块。`,"settings.themeLoopx":`LoopX 标准`,"settings.themeLoopxDescription":`精确的黑白界面、Geist 字体与安静的细线结构。`,"settings.title":`设置`,"settings.workspaceDisplay":`工作区显示`,"settings.workspaceTheme":`工作区主题`,"session.closeRecord":`退出运行记录`,"session.details":`Session 详情`,"session.record":`执行 Session · 运行记录`,"session.recordDescription":`当前时间线已切换到这次 Session 的消息与 Turn 记录。`,"sidebar.createGoal":`创建 Goal`,"sidebar.delete":`删除`,"sidebar.deleteGoal":`删除 Goal`,"sidebar.manager":`LoopX 管家`,"sidebar.notifications":`设置`,"sidebar.owner":`个人工作区`,"sidebar.product":`个人 Agent 工作区`,"sidebar.resume":`恢复`,"sidebar.resumeGoal":`恢复 Goal`,"sidebar.stop":`停止`,"tasks.historyLoading":`正在加载历史…`,"tasks.historyError":`历史加载失败,已显示的内容仍可查看。`,"tasks.historyExpired":`历史快照已过期,重新加载后可继续查看。`,"tasks.historyRetry":`重新加载`,"tasks.historyEnd":`已显示全部完成记录`,"tasks.historyMore":`加载更多`,"tasks.historyLocalOnly":`请打开这台机器的 Dashboard 查看完整历史。`,"sidebar.sortGoals":`调整 Goal 顺序`,"sidebar.dragGoal":`拖拽调整顺序,或使用列表排序按钮`,"sidebar.moveUp":`上移 {goal}`,"sidebar.moveDown":`下移 {goal}`,"sidebar.goalMoved":`{goal} 已移至第 {position} 位`,"sidebar.orderNotSaved":`顺序已在本次页面生效;浏览器存储不可用,无法保存。`,"sidebar.stopGoal":`停止 Goal`,"sidebar.stopped":`已停止`,"sidebar.stoppedLoading":`正在加载已停止 Goal`,"sidebar.stoppedLoadFailed":`已停止 Goal 加载失败,其他 Goal 仍可使用。`,"sidebar.retryStopped":`重试`,"state.completed":`已完成`,"state.needsRepair":`需修复`,"state.needsYou":`等你`,"state.quiet":`安静运行`,"state.running":`推进中`,"state.stopped":`已停止`,"state.waiting":`等待条件`,"tasks.blocked":`受阻`,"tasks.agentLane":`工作 Agent`,"tasks.agentLaneDescription":`筛选这个 Goal 下的工作泳道`,"tasks.agentLaneFilter":`按工作 Agent 筛选`,"tasks.allAgentLanes":`全部 Agent({count})`,"tasks.chatAgentReplied":`Agent 已回复`,"tasks.chatPending":`已发送给 Agent`,"tasks.chatPendingDescription":`正在处理;只有经过确认的任务操作才会更新 Tasks。`,"tasks.chatRecent":`最近对话`,"tasks.chatUnchangedDescription":`本次对话没有直接修改 Tasks。需要执行时,可先转成 Task 草稿并确认。`,"tasks.chatViewReply":`查看回复`,"tasks.convertToTask":`转为 Task`,"tasks.completed":`已完成`,"runs.discoveryPartial":`部分执行详情暂不可用,正在重连;任务摘要不代表实时执行状态。`,"runs.discoveryOffline":`执行服务暂不可用,正在重连;保留的任务摘要可能已过时。`,"files.openConversation":`前往会话`,"files.exportSummary":`导出摘要`,"tasks.viewDescription":`先处理待确认,再查看工作与完成记录`,"tasks.viewLabel":`任务视图`,"tasks.listView":`列表`,"tasks.boardView":`看板`,"tasks.completedSummary":`已完成 {count} 项,近期完成明细由控制面按需投影。`,"tasks.emptyCompleted":`还没有完成的任务。`,"tasks.emptyConfirm":`没有待确认的任务。`,"tasks.emptyRunning":`没有待执行或进行中的任务。`,"tasks.emptySchedules":`没有定时任务。`,"tasks.emptyGoal":`这个 Goal 还没有任务。用下面的输入框描述下一步,LoopX 会先展示待确认操作。`,"tasks.markComplete":`标记完成:{name}`,"tasks.moreActions":`更多操作:{name}`,"tasks.openExecution":`查看执行过程:{name}`,"tasks.pending":`待处理`,"tasks.pendingAndRunning":`待执行 / 进行中`,"tasks.scheduled":`定时与持续`,"tasks.sessionError":`Session 异常`,"tasks.waiting":`待执行`,"tasks.waitingAge":`已等待 {age}`,"tasks.viewExecution":`查看执行过程`,"tasks.viewResult":`查看结果`,"time.days":`{count} 天`,"time.hours":`{count} 小时`,"timeline.emptyGoal":`这个 Goal 还没有新动态`,"timeline.emptyGoalDescription":`你可以直接询问进度或下发新的纠偏信息。`,"timeline.emptyWorkspace":`今天的工作区很安静`,"timeline.emptyWorkspaceDescription":`向 LoopX 管家描述一个 Goal,或询问今天最值得关注的事情。`,"timeline.gateHistory":`{count} 项历史 Gate`,"timeline.pending":`正在整理…`,"timeline.runCompleted":`{run}:已完成`,"timeline.review":`查看处理方式`,"timeline.reviewAndConfirm":`查看并确认`,"timeline.waitingConfirmation":`待你确认`}};function ga(e,t){return t?Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e):e}function _a(){try{return window.localStorage.getItem(`loopx-pw-locale`)===`en`?`en`:`zh-CN`}catch{return`zh-CN`}}function va({children:e}){let[t,n]=(0,z.useState)(_a);function r(e){n(e);try{window.localStorage.setItem(ma,e)}catch{}}(0,z.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,z.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>ga(ha[t][e],n)}),[t]);return(0,B.jsx)(pa.Provider,{value:i,children:e})}function ya(){let e=(0,z.useContext)(pa);if(!e)throw Error(`useWorkspaceI18n must be used within WorkspaceI18nProvider`);return e}function ba(e,t){let n={安静运行:`state.quiet`,等你:`state.needsYou`,等待条件:`state.waiting`,推进中:`state.running`,需修复:`state.needsRepair`,已完成:`state.completed`,已停止:`state.stopped`}[e];return n?ha[t][n]:e}function xa(e,t){let n={busy:`runs.running`,completed:`runs.completed`,failed:`runs.failed`,queued:`runs.queued`,ready:`runs.ready`,resume_failed:`runs.resumeFailed`,running:`runs.running`,waiting:`runs.waiting`};return e?n[e]?t(n[e]):e:t(`runs.unknown`)}function Sa(e,t){if(!e)return null;let n=new Date(e).getTime();if(Number.isNaN(n))return null;let r=Date.now()-n;if(r<36e5)return null;let i=Math.floor(r/864e5);return i>=1?t(`time.days`,{count:i}):t(`time.hours`,{count:Math.floor(r/36e5)})}var Ca;function V(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var wa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ta=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ca=globalThis).__zod_globalConfig??(Ca.__zod_globalConfig={});var Ea=globalThis.__zod_globalConfig;function Da(e){return e&&Object.assign(Ea,e),Ea}function Oa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ka(e,t){return typeof t==`bigint`?t.toString():t}function Aa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ja(e){return e==null}function Ma(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Na(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function Va(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ha=Aa(()=>{if(Ea.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ua(e){if(Va(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Va(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Wa(e){return Ua(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ga=new Set([`string`,`number`,`symbol`]);function Ka(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function qa(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function H(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ja(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ya={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Xa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return qa(e,La(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ia(this,`shape`,e),e},checks:[]}))}function Za(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return qa(e,La(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ia(this,`shape`,r),r},checks:[]}))}function Qa(e,t){if(!Ua(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qa(e,La(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ia(this,`shape`,n),n}}))}function $a(e,t){if(!Ua(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return qa(e,La(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ia(this,`shape`,n),n}}))}function eo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return qa(e,La(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ia(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function to(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return qa(t,La(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ia(this,`shape`,i),i},checks:[]}))}function no(e,t,n){return qa(t,La(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ia(this,`shape`,i),i}}))}function ro(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function oo(e){return typeof e==`string`?e:e?.message}function so(e,t,n){let r=e.message?e.message:oo(e.inst?._zod.def?.error?.(e))??oo(t?.error?.(e))??oo(n.customError?.(e))??oo(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function co(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function lo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var uo=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ka,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fo=V(`$ZodError`,uo),po=V(`$ZodError`,uo,{Parent:Error});function mo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ho(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new wa;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>so(e,a,Da())));throw Ba(t,i?.callee),t}return o.value},_o=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>so(e,a,Da())));throw Ba(t,i?.callee),t}return o.value},vo=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new wa;return a.issues.length?{success:!1,error:new(e??fo)(a.issues.map(e=>so(e,i,Da())))}:{success:!0,data:a.value}},yo=vo(po),bo=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>so(e,i,Da())))}:{success:!0,data:a.value}},xo=bo(po),So=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return go(e)(t,n,i)},Co=e=>(t,n,r)=>go(e)(t,n,r),wo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _o(e)(t,n,i)},To=e=>async(t,n,r)=>_o(e)(t,n,r),Eo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vo(e)(t,n,i)},Do=e=>(t,n,r)=>vo(e)(t,n,r),Oo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bo(e)(t,n,i)},ko=e=>async(t,n,r)=>bo(e)(t,n,r),Ao=/^[cC][0-9a-z]{6,}$/,jo=/^[0-9a-z]+$/,Mo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,No=/^[0-9a-vA-V]{20}$/,Po=/^[A-Za-z0-9]{27}$/,Fo=/^[a-zA-Z0-9_-]{21}$/,Io=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Lo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ro=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,zo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Bo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Vo(){return new RegExp(Bo,`u`)}var Ho=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Uo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Go=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ko=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qo=/^[A-Za-z0-9_-]*$/,Jo=/^https?$/,Yo=/^\+[1-9]\d{6,14}$/,Xo=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Zo=RegExp(`^${Xo}$`);function Qo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $o(e){return RegExp(`^${Qo(e)}$`)}function es(e){let t=Qo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Xo}T(?:${r})$`)}var ts=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ns=/^-?\d+$/,rs=/^-?\d+(?:\.\d+)?$/,is=/^(?:true|false)$/i,as=/^null$/i,os=/^[^A-Z]*$/,ss=/^[^a-z]*$/,cs=V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ls={number:`number`,bigint:`bigint`,object:`date`},us=V(`$ZodCheckLessThan`,(e,t)=>{cs.init(e,t);let n=ls[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{cs.init(e,t);let n=ls[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fs=V(`$ZodCheckMultipleOf`,(e,t)=>{cs.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Na(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ps=V(`$ZodCheckNumberFormat`,(e,t)=>{cs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ya[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ns)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ms=V(`$ZodCheckMaxLength`,(e,t)=>{var n;cs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ja(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=co(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hs=V(`$ZodCheckMinLength`,(e,t)=>{var n;cs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ja(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=co(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gs=V(`$ZodCheckLengthEquals`,(e,t)=>{var n;cs.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ja(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=co(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),_s=V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;cs.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),vs=V(`$ZodCheckRegex`,(e,t)=>{_s.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ys=V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=os,_s.init(e,t)}),bs=V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ss,_s.init(e,t)}),xs=V(`$ZodCheckIncludes`,(e,t)=>{cs.init(e,t);let n=Ka(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ss=V(`$ZodCheckStartsWith`,(e,t)=>{cs.init(e,t);let n=RegExp(`^${Ka(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Cs=V(`$ZodCheckEndsWith`,(e,t)=>{cs.init(e,t);let n=RegExp(`.*${Ka(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ws=V(`$ZodCheckOverwrite`,(e,t)=>{cs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ts=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` +`))}},Es={major:4,minor:4,patch:3},Ds=V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Es;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ro(e),i;for(let a of t){if(a._zod.def.when){if(io(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new wa;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ro(e,t))});else{if(e.issues.length===t)continue;r||=ro(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ro(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new wa;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new wa;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Fa(e,`~standard`,()=>({validate:t=>{try{let n=yo(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Os=V(`$ZodString`,(e,t)=>{Ds.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ts(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),ks=V(`$ZodStringFormat`,(e,t)=>{_s.init(e,t),Os.init(e,t)}),As=V(`$ZodGUID`,(e,t)=>{t.pattern??=Lo,ks.init(e,t)}),js=V(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ro(e)}else t.pattern??=Ro();ks.init(e,t)}),Ms=V(`$ZodEmail`,(e,t)=>{t.pattern??=zo,ks.init(e,t)}),Ns=V(`$ZodURL`,(e,t)=>{ks.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Jo.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ps=V(`$ZodEmoji`,(e,t)=>{t.pattern??=Vo(),ks.init(e,t)}),Fs=V(`$ZodNanoID`,(e,t)=>{t.pattern??=Fo,ks.init(e,t)}),Is=V(`$ZodCUID`,(e,t)=>{t.pattern??=Ao,ks.init(e,t)}),Ls=V(`$ZodCUID2`,(e,t)=>{t.pattern??=jo,ks.init(e,t)}),Rs=V(`$ZodULID`,(e,t)=>{t.pattern??=Mo,ks.init(e,t)}),zs=V(`$ZodXID`,(e,t)=>{t.pattern??=No,ks.init(e,t)}),Bs=V(`$ZodKSUID`,(e,t)=>{t.pattern??=Po,ks.init(e,t)}),Vs=V(`$ZodISODateTime`,(e,t)=>{t.pattern??=es(t),ks.init(e,t)}),Hs=V(`$ZodISODate`,(e,t)=>{t.pattern??=Zo,ks.init(e,t)}),Us=V(`$ZodISOTime`,(e,t)=>{t.pattern??=$o(t),ks.init(e,t)}),Ws=V(`$ZodISODuration`,(e,t)=>{t.pattern??=Io,ks.init(e,t)}),Gs=V(`$ZodIPv4`,(e,t)=>{t.pattern??=Ho,ks.init(e,t),e._zod.bag.format=`ipv4`}),Ks=V(`$ZodIPv6`,(e,t)=>{t.pattern??=Uo,ks.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),qs=V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Wo,ks.init(e,t)}),Js=V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Go,ks.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ys(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Xs=V(`$ZodBase64`,(e,t)=>{t.pattern??=Ko,ks.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Ys(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Zs(e){if(!qo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ys(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Qs=V(`$ZodBase64URL`,(e,t)=>{t.pattern??=qo,ks.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Zs(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),$s=V(`$ZodE164`,(e,t)=>{t.pattern??=Yo,ks.init(e,t)});function ec(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var tc=V(`$ZodJWT`,(e,t)=>{ks.init(e,t),e._zod.check=n=>{ec(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),nc=V(`$ZodNumber`,(e,t)=>{Ds.init(e,t),e._zod.pattern=e._zod.bag.pattern??rs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),rc=V(`$ZodNumberFormat`,(e,t)=>{ps.init(e,t),nc.init(e,t)}),ic=V(`$ZodBoolean`,(e,t)=>{Ds.init(e,t),e._zod.pattern=is,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ac=V(`$ZodNull`,(e,t)=>{Ds.init(e,t),e._zod.pattern=as,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),oc=V(`$ZodUnknown`,(e,t)=>{Ds.init(e,t),e._zod.parse=e=>e}),sc=V(`$ZodNever`,(e,t)=>{Ds.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function cc(e,t,n){e.issues.length&&t.issues.push(...ao(n,e.issues)),t.value[n]=e.value}var lc=V(`$ZodArray`,(e,t)=>{Ds.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;ecc(t,n,e))):cc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function uc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ao(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function dc(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ja(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function fc(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>uc(e,n,i,t,u,d))):uc(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var pc=V(`$ZodObject`,(e,t)=>{if(Ds.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Aa(()=>dc(t));Fa(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Va,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>uc(n,t,e,s,r,i))):uc(a,t,e,s,r,i)}return i?fc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),mc=V(`$ZodObjectJIT`,(e,t)=>{pc.init(e,t);let n=e._zod.parse,r=Aa(()=>dc(t)),i=e=>{let t=new Ts([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Ra(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Ra(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(` + if (${n}.issues.length) { + if (${o} in input) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `):c?t.write(` + if (${n}.issues.length) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `):t.write(` + const ${n}_present = ${o} in input; + if (${n}.issues.length) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + if (!${n}_present && !${n}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${o}] + }); + } + + if (${n}_present) { + if (${n}.value === undefined) { + newResult[${o}] = undefined; + } else { + newResult[${o}] = ${n}.value; + } + } + + `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Va,s=!Ea.jitless,c=s&&Ha.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?fc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function hc(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ro(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>so(e,r,Da())))}),t)}var gc=V(`$ZodUnion`,(e,t)=>{Ds.init(e,t),Fa(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Fa(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Fa(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Fa(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ma(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>hc(t,r,e,i)):hc(o,r,e,i)}}),_c=V(`$ZodIntersection`,(e,t)=>{Ds.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>yc(e,t,n)):yc(e,i,a)}});function vc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ua(e)&&Ua(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=vc(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ro(e))return e;let o=vc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var bc=V(`$ZodTuple`,(e,t)=>{Ds.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=xc(n,`optin`),c=xc(n,`optout`);if(!t.rest){if(a.lengthn.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Sc(t,r,e))):Sc(a,r,e)}}return o.length?Promise.all(o).then(()=>Cc(l,r,n,a,c)):Cc(l,r,n,a,c)}});function xc(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Sc(e,t,n){e.issues.length&&t.issues.push(...ao(n,e.issues)),t.value[n]=e.value}function Cc(e,t,n,r,i){for(let a=0;a=i){t.value.length=a;break}t.issues.push(...ao(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var wc=V(`$ZodRecord`,(e,t)=>{Ds.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ua(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>so(e,r,Da())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...ao(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...ao(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&rs.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>so(e,r,Da())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...ao(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...ao(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Tc=V(`$ZodEnum`,(e,t)=>{Ds.init(e,t);let n=Oa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ga.has(typeof e)).map(e=>typeof e==`string`?Ka(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ec=V(`$ZodLiteral`,(e,t)=>{if(Ds.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Ka(e):e?Ka(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Dc=V(`$ZodTransform`,(e,t)=>{Ds.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ta(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new wa;return n.value=i,n.fallback=!0,n}});function Oc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var kc=V(`$ZodOptional`,(e,t)=>{Ds.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Fa(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Fa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ma(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Oc(e,r)):Oc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ac=V(`$ZodExactOptional`,(e,t)=>{kc.init(e,t),Fa(e._zod,`values`,()=>t.innerType._zod.values),Fa(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),jc=V(`$ZodNullable`,(e,t)=>{Ds.init(e,t),Fa(e._zod,`optin`,()=>t.innerType._zod.optin),Fa(e._zod,`optout`,()=>t.innerType._zod.optout),Fa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ma(e.source)}|null)$`):void 0}),Fa(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Mc=V(`$ZodDefault`,(e,t)=>{Ds.init(e,t),e._zod.optin=`optional`,Fa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Nc(e,t)):Nc(r,t)}});function Nc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Pc=V(`$ZodPrefault`,(e,t)=>{Ds.init(e,t),e._zod.optin=`optional`,Fa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Fc=V(`$ZodNonOptional`,(e,t)=>{Ds.init(e,t),Fa(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ic(t,e)):Ic(i,e)}});function Ic(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Lc=V(`$ZodCatch`,(e,t)=>{Ds.init(e,t),e._zod.optin=`optional`,Fa(e._zod,`optout`,()=>t.innerType._zod.optout),Fa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>so(e,n,Da()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>so(e,n,Da()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Rc=V(`$ZodPipe`,(e,t)=>{Ds.init(e,t),Fa(e._zod,`values`,()=>t.in._zod.values),Fa(e._zod,`optin`,()=>t.in._zod.optin),Fa(e._zod,`optout`,()=>t.out._zod.optout),Fa(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>zc(e,t.in,n)):zc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>zc(e,t.out,n)):zc(r,t.out,n)}});function zc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Bc=V(`$ZodReadonly`,(e,t)=>{Ds.init(e,t),Fa(e._zod,`propValues`,()=>t.innerType._zod.propValues),Fa(e._zod,`values`,()=>t.innerType._zod.values),Fa(e._zod,`optin`,()=>t.innerType?._zod?.optin),Fa(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Vc):Vc(r)}});function Vc(e){return e.value=Object.freeze(e.value),e}var Hc=V(`$ZodCustom`,(e,t)=>{cs.init(e,t),Ds.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Uc(t,n,r,e));Uc(i,n,r,e)}});function Uc(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(lo(e))}}var Wc,Gc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Kc(){return new Gc}(Wc=globalThis).__zod_globalRegistry??(Wc.__zod_globalRegistry=Kc());var qc=globalThis.__zod_globalRegistry;function Jc(e,t){return new e({type:`string`,...H(t)})}function Yc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...H(t)})}function Xc(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...H(t)})}function Zc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...H(t)})}function Qc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...H(t)})}function $c(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...H(t)})}function el(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...H(t)})}function tl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...H(t)})}function nl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...H(t)})}function rl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...H(t)})}function il(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...H(t)})}function al(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...H(t)})}function ol(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...H(t)})}function sl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...H(t)})}function cl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...H(t)})}function ll(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...H(t)})}function ul(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...H(t)})}function dl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...H(t)})}function fl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...H(t)})}function pl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...H(t)})}function ml(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...H(t)})}function hl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...H(t)})}function gl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...H(t)})}function _l(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...H(t)})}function vl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...H(t)})}function yl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...H(t)})}function bl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...H(t)})}function xl(e,t){return new e({type:`number`,checks:[],...H(t)})}function Sl(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...H(t)})}function Cl(e,t){return new e({type:`boolean`,...H(t)})}function wl(e,t){return new e({type:`null`,...H(t)})}function Tl(e){return new e({type:`unknown`})}function El(e,t){return new e({type:`never`,...H(t)})}function Dl(e,t){return new us({check:`less_than`,...H(t),value:e,inclusive:!1})}function Ol(e,t){return new us({check:`less_than`,...H(t),value:e,inclusive:!0})}function kl(e,t){return new ds({check:`greater_than`,...H(t),value:e,inclusive:!1})}function Al(e,t){return new ds({check:`greater_than`,...H(t),value:e,inclusive:!0})}function jl(e,t){return new fs({check:`multiple_of`,...H(t),value:e})}function Ml(e,t){return new ms({check:`max_length`,...H(t),maximum:e})}function Nl(e,t){return new hs({check:`min_length`,...H(t),minimum:e})}function Pl(e,t){return new gs({check:`length_equals`,...H(t),length:e})}function Fl(e,t){return new vs({check:`string_format`,format:`regex`,...H(t),pattern:e})}function Il(e){return new ys({check:`string_format`,format:`lowercase`,...H(e)})}function Ll(e){return new bs({check:`string_format`,format:`uppercase`,...H(e)})}function Rl(e,t){return new xs({check:`string_format`,format:`includes`,...H(t),includes:e})}function zl(e,t){return new Ss({check:`string_format`,format:`starts_with`,...H(t),prefix:e})}function Bl(e,t){return new Cs({check:`string_format`,format:`ends_with`,...H(t),suffix:e})}function Vl(e){return new ws({check:`overwrite`,tx:e})}function Hl(e){return Vl(t=>t.normalize(e))}function Ul(){return Vl(e=>e.trim())}function Wl(){return Vl(e=>e.toLowerCase())}function Gl(){return Vl(e=>e.toUpperCase())}function Kl(){return Vl(e=>za(e))}function ql(e,t,n){return new e({type:`array`,element:t,...H(n)})}function Jl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...H(n)})}function Yl(e,t){let n=Xl(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(lo(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(lo(r))}},e(t.value,t)),t);return n}function Xl(e,t){let n=new cs({check:`custom`,...H(t)});return n._zod.check=e,n}function Zl(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??qc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ql(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ql(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&tu(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function $l(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function eu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ru(t,`input`,e.processors),output:ru(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function tu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return tu(r.element,n);if(r.type===`set`)return tu(r.valueType,n);if(r.type===`lazy`)return tu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return tu(r.innerType,n);if(r.type===`intersection`)return tu(r.left,n)||tu(r.right,n);if(r.type===`record`||r.type===`map`)return tu(r.keyType,n)||tu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:tu(r.in,n)||tu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(tu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(tu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(tu(e,n))return!0;return!!(r.rest&&tu(r.rest,n))}return!1}var nu=(e,t={})=>n=>{let r=Zl({...n,processors:t});return Ql(e,r),$l(r,e),eu(r,e)},ru=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Zl({...i??{},target:a,io:t,processors:n});return Ql(e,o),$l(o,e),eu(o,e)},iu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},au=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=iu[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ou=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},su=(e,t,n,r)=>{n.type=`boolean`},cu=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},lu=(e,t,n,r)=>{n.not={}},uu=(e,t,n,r)=>{let i=e._zod.def,a=Oa(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},du=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},fu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},pu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},mu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ql(a.element,t,{...r,path:[...r.path,`items`]})},hu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ql(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ql(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},gu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ql(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},_u=(e,t,n,r)=>{let i=e._zod.def,a=Ql(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ql(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},vu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ql(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ql(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},yu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ql(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ql(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ql(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},bu=(e,t,n,r)=>{let i=e._zod.def,a=Ql(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},xu=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Su=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Cu=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},wu=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Tu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ql(o,t,r);let s=t.seen.get(e);s.ref=o},Eu=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Du=(e,t,n,r)=>{let i=e._zod.def;Ql(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ou=V(`ZodISODateTime`,(e,t)=>{Vs.init(e,t),td.init(e,t)});function ku(e){return _l(Ou,e)}var Au=V(`ZodISODate`,(e,t)=>{Hs.init(e,t),td.init(e,t)});function ju(e){return vl(Au,e)}var Mu=V(`ZodISOTime`,(e,t)=>{Us.init(e,t),td.init(e,t)});function Nu(e){return yl(Mu,e)}var Pu=V(`ZodISODuration`,(e,t)=>{Ws.init(e,t),td.init(e,t)});function Fu(e){return bl(Pu,e)}var Iu=(e,t)=>{fo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ho(e,t)},flatten:{value:t=>mo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ka,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ka,2)}},isEmpty:{get(){return e.issues.length===0}}})},Lu=V(`ZodError`,Iu),Ru=V(`ZodError`,Iu,{Parent:Error}),zu=go(Ru),Bu=_o(Ru),Vu=vo(Ru),Hu=bo(Ru),Uu=So(Ru),Wu=Co(Ru),Gu=wo(Ru),Ku=To(Ru),qu=Eo(Ru),Ju=Do(Ru),Yu=Oo(Ru),Xu=ko(Ru),Zu=new WeakMap;function Qu(e,t,n){let r=Object.getPrototypeOf(e),i=Zu.get(r);if(i||(i=new Set,Zu.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var U=V(`ZodType`,(e,t)=>(Ds.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ru(e,`input`),output:ru(e,`output`)}}),e.toJSONSchema=nu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>zu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Vu(e,t,n),e.parseAsync=async(t,n)=>Bu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Hu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Uu(e,t,n),e.decode=(t,n)=>Wu(e,t,n),e.encodeAsync=async(t,n)=>Gu(e,t,n),e.decodeAsync=async(t,n)=>Ku(e,t,n),e.safeEncode=(t,n)=>qu(e,t,n),e.safeDecode=(t,n)=>Ju(e,t,n),e.safeEncodeAsync=async(t,n)=>Yu(e,t,n),e.safeDecodeAsync=async(t,n)=>Xu(e,t,n),Qu(e,`ZodType`,{check(...e){let t=this.def;return this.clone(La(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return qa(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ff(e,t))},superRefine(e,t){return this.check(pf(e,t))},overwrite(e){return this.check(Vl(e))},optional(){return qd(this)},exactOptional(){return Yd(this)},nullable(){return Zd(this)},nullish(){return qd(Zd(this))},nonoptional(e){return rf(this,e)},array(){return q(this)},or(e){return Pd([this,e])},and(e){return Id(this,e)},transform(e){return cf(this,Gd(e))},default(e){return $d(this,e)},prefault(e){return tf(this,e)},catch(e){return of(this,e)},pipe(e){return cf(this,e)},readonly(){return uf(this)},describe(e){let t=this.clone();return qc.add(t,{description:e}),t},meta(...e){if(e.length===0)return qc.get(this);let t=this.clone();return qc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return qc.get(e)?.description},configurable:!0}),e)),$u=V(`_ZodString`,(e,t)=>{Os.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>au(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qu(e,`_ZodString`,{regex(...e){return this.check(Fl(...e))},includes(...e){return this.check(Rl(...e))},startsWith(...e){return this.check(zl(...e))},endsWith(...e){return this.check(Bl(...e))},min(...e){return this.check(Nl(...e))},max(...e){return this.check(Ml(...e))},length(...e){return this.check(Pl(...e))},nonempty(...e){return this.check(Nl(1,...e))},lowercase(e){return this.check(Il(e))},uppercase(e){return this.check(Ll(e))},trim(){return this.check(Ul())},normalize(...e){return this.check(Hl(...e))},toLowerCase(){return this.check(Wl())},toUpperCase(){return this.check(Gl())},slugify(){return this.check(Kl())}})}),ed=V(`ZodString`,(e,t)=>{Os.init(e,t),$u.init(e,t),e.email=t=>e.check(Yc(nd,t)),e.url=t=>e.check(tl(ad,t)),e.jwt=t=>e.check(gl(bd,t)),e.emoji=t=>e.check(nl(od,t)),e.guid=t=>e.check(Xc(rd,t)),e.uuid=t=>e.check(Zc(id,t)),e.uuidv4=t=>e.check(Qc(id,t)),e.uuidv6=t=>e.check($c(id,t)),e.uuidv7=t=>e.check(el(id,t)),e.nanoid=t=>e.check(rl(sd,t)),e.guid=t=>e.check(Xc(rd,t)),e.cuid=t=>e.check(il(cd,t)),e.cuid2=t=>e.check(al(ld,t)),e.ulid=t=>e.check(ol(ud,t)),e.base64=t=>e.check(pl(_d,t)),e.base64url=t=>e.check(ml(vd,t)),e.xid=t=>e.check(sl(dd,t)),e.ksuid=t=>e.check(cl(fd,t)),e.ipv4=t=>e.check(ll(pd,t)),e.ipv6=t=>e.check(ul(md,t)),e.cidrv4=t=>e.check(dl(hd,t)),e.cidrv6=t=>e.check(fl(gd,t)),e.e164=t=>e.check(hl(yd,t)),e.datetime=t=>e.check(ku(t)),e.date=t=>e.check(ju(t)),e.time=t=>e.check(Nu(t)),e.duration=t=>e.check(Fu(t))});function W(e){return Jc(ed,e)}var td=V(`ZodStringFormat`,(e,t)=>{ks.init(e,t),$u.init(e,t)}),nd=V(`ZodEmail`,(e,t)=>{Ms.init(e,t),td.init(e,t)}),rd=V(`ZodGUID`,(e,t)=>{As.init(e,t),td.init(e,t)}),id=V(`ZodUUID`,(e,t)=>{js.init(e,t),td.init(e,t)}),ad=V(`ZodURL`,(e,t)=>{Ns.init(e,t),td.init(e,t)}),od=V(`ZodEmoji`,(e,t)=>{Ps.init(e,t),td.init(e,t)}),sd=V(`ZodNanoID`,(e,t)=>{Fs.init(e,t),td.init(e,t)}),cd=V(`ZodCUID`,(e,t)=>{Is.init(e,t),td.init(e,t)}),ld=V(`ZodCUID2`,(e,t)=>{Ls.init(e,t),td.init(e,t)}),ud=V(`ZodULID`,(e,t)=>{Rs.init(e,t),td.init(e,t)}),dd=V(`ZodXID`,(e,t)=>{zs.init(e,t),td.init(e,t)}),fd=V(`ZodKSUID`,(e,t)=>{Bs.init(e,t),td.init(e,t)}),pd=V(`ZodIPv4`,(e,t)=>{Gs.init(e,t),td.init(e,t)}),md=V(`ZodIPv6`,(e,t)=>{Ks.init(e,t),td.init(e,t)}),hd=V(`ZodCIDRv4`,(e,t)=>{qs.init(e,t),td.init(e,t)}),gd=V(`ZodCIDRv6`,(e,t)=>{Js.init(e,t),td.init(e,t)}),_d=V(`ZodBase64`,(e,t)=>{Xs.init(e,t),td.init(e,t)}),vd=V(`ZodBase64URL`,(e,t)=>{Qs.init(e,t),td.init(e,t)}),yd=V(`ZodE164`,(e,t)=>{$s.init(e,t),td.init(e,t)}),bd=V(`ZodJWT`,(e,t)=>{tc.init(e,t),td.init(e,t)}),xd=V(`ZodNumber`,(e,t)=>{nc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ou(e,t,n,r),Qu(e,`ZodNumber`,{gt(e,t){return this.check(kl(e,t))},gte(e,t){return this.check(Al(e,t))},min(e,t){return this.check(Al(e,t))},lt(e,t){return this.check(Dl(e,t))},lte(e,t){return this.check(Ol(e,t))},max(e,t){return this.check(Ol(e,t))},int(e){return this.check(Cd(e))},safe(e){return this.check(Cd(e))},positive(e){return this.check(kl(0,e))},nonnegative(e){return this.check(Al(0,e))},negative(e){return this.check(Dl(0,e))},nonpositive(e){return this.check(Ol(0,e))},multipleOf(e,t){return this.check(jl(e,t))},step(e,t){return this.check(jl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function G(e){return xl(xd,e)}var Sd=V(`ZodNumberFormat`,(e,t)=>{rc.init(e,t),xd.init(e,t)});function Cd(e){return Sl(Sd,e)}var wd=V(`ZodBoolean`,(e,t)=>{ic.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>su(e,t,n,r)});function K(e){return Cl(wd,e)}var Td=V(`ZodNull`,(e,t)=>{ac.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cu(e,t,n,r)});function Ed(e){return wl(Td,e)}var Dd=V(`ZodUnknown`,(e,t)=>{oc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Od(){return Tl(Dd)}var kd=V(`ZodNever`,(e,t)=>{sc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lu(e,t,n,r)});function Ad(e){return El(kd,e)}var jd=V(`ZodArray`,(e,t)=>{lc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r),e.element=t.element,Qu(e,`ZodArray`,{min(e,t){return this.check(Nl(e,t))},nonempty(e){return this.check(Nl(1,e))},max(e,t){return this.check(Ml(e,t))},length(e,t){return this.check(Pl(e,t))},unwrap(){return this.element}})});function q(e,t){return ql(jd,e,t)}var Md=V(`ZodObject`,(e,t)=>{mc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r),Fa(e,`shape`,()=>t.shape),Qu(e,`ZodObject`,{keyof(){return Hd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Od()})},loose(){return this.clone({...this._zod.def,catchall:Od()})},strict(){return this.clone({...this._zod.def,catchall:Ad()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Qa(this,e)},safeExtend(e){return $a(this,e)},merge(e){return eo(this,e)},pick(e){return Xa(this,e)},omit(e){return Za(this,e)},partial(...e){return to(Kd,this,e[0])},required(...e){return no(nf,this,e[0])}})});function J(e,t){return new Md({type:`object`,shape:e??{},...H(t)})}var Nd=V(`ZodUnion`,(e,t)=>{gc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gu(e,t,n,r),e.options=t.options});function Pd(e,t){return new Nd({type:`union`,options:e,...H(t)})}var Fd=V(`ZodIntersection`,(e,t)=>{_c.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(e,t,n,r)});function Id(e,t){return new Fd({type:`intersection`,left:e,right:t})}var Ld=V(`ZodTuple`,(e,t)=>{bc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Rd(e,t,n){let r=t instanceof Ds;return new Ld({type:`tuple`,items:e,rest:r?t:null,...H(r?n:t)})}var zd=V(`ZodRecord`,(e,t)=>{wc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Bd(e,t,n){return!t||!t._zod?new zd({type:`record`,keyType:W(),valueType:e,...H(t)}):new zd({type:`record`,keyType:e,valueType:t,...H(n)})}var Vd=V(`ZodEnum`,(e,t)=>{Tc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uu(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Vd({...t,checks:[],...H(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Vd({...t,checks:[],...H(r),entries:i})}});function Hd(e,t){return new Vd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var Ud=V(`ZodLiteral`,(e,t)=>{Ec.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>du(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Ud({type:`literal`,values:Array.isArray(e)?e:[e],...H(t)})}var Wd=V(`ZodTransform`,(e,t)=>{Dc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ta(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(lo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(lo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Gd(e){return new Wd({type:`transform`,transform:e})}var Kd=V(`ZodOptional`,(e,t)=>{kc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qd(e){return new Kd({type:`optional`,innerType:e})}var Jd=V(`ZodExactOptional`,(e,t)=>{Ac.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yd(e){return new Jd({type:`optional`,innerType:e})}var Xd=V(`ZodNullable`,(e,t)=>{jc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zd(e){return new Xd({type:`nullable`,innerType:e})}var Qd=V(`ZodDefault`,(e,t)=>{Mc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Su(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $d(e,t){return new Qd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wa(t)}})}var ef=V(`ZodPrefault`,(e,t)=>{Pc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tf(e,t){return new ef({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wa(t)}})}var nf=V(`ZodNonOptional`,(e,t)=>{Fc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rf(e,t){return new nf({type:`nonoptional`,innerType:e,...H(t)})}var af=V(`ZodCatch`,(e,t)=>{Lc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function of(e,t){return new af({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var sf=V(`ZodPipe`,(e,t)=>{Rc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.in=t.in,e.out=t.out});function cf(e,t){return new sf({type:`pipe`,in:e,out:t})}var lf=V(`ZodReadonly`,(e,t)=>{Bc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uf(e){return new lf({type:`readonly`,innerType:e})}var df=V(`ZodCustom`,(e,t)=>{Hc.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fu(e,t,n,r)});function ff(e,t={}){return Jl(df,e,t)}function pf(e,t){return Yl(e,t)}var mf={ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,goal_count:1,run_count:8440,status_contract:{schema_version:2,minimum_dashboard_schema_version:2,producer:`loopx status`,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`},usage_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471166+00:00`,sample_run_count:20,proxy_note:`run-history proxy; excludes token counts and raw thread logs`,totals:{runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9},goals:[{goal_id:`loopx-meta`,runs_24h:20,runs_7d:20,quota_spend_slots_24h:11,quota_spend_slots_7d:11,automation_run_count_24h:11,automation_run_count_7d:11,progress_signal_run_count_24h:9,progress_signal_run_count_7d:9,project_share_24h:1}]},event_ledger_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.360662+00:00`,sample_run_count:20,proxy_note:`append-only run-history projection; compact event-class counts only`,event_classes:[`accounting`,`decision`,`evidence`,`state`,`work`],totals:{events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9}},goals:[{goal_id:`loopx-meta`,events_24h:20,events_7d:20,by_class_24h:{accounting:11,decision:0,evidence:0,state:0,work:9},by_class_7d:{accounting:11,decision:0,evidence:0,state:0,work:9},latest_event_class:`accounting`,latest_event_at:`2026-07-06T14:37:32+08:00`}]},promotion_readiness_summary:{available:!0,source:`run_history_full_scan`,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.408527+00:00`,sample_run_count:0,proxy_note:`canary promotion-readiness projection from append-only run history; exact evidence stays in run artifacts`},promotion_gate:{ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,runtime_root:`$HOME/.codex/loopx`,gate:`promotion_readiness`,gate_state:`ready`,can_promote:!0,should_warn:!1,non_blocking:!0,recommended_action:`promotion readiness is fresh`,readiness:{available:!0,goal_id:`loopx-meta`,generated_at:`2026-07-05T20:02:02+08:00`,classification:`canary_promotion_readiness_smoke_group`,delivery_batch_scale:`multi_surface`,delivery_outcome:`primary_goal_outcome`,recommended_action:`Canary promotion-readiness smoke passed; promotion may proceed after doctor/status reports fresh evidence.`,json_exists:!0,markdown_exists:!0,runtime_root:`$HOME/.codex/loopx`,freshness_window_hours:24,freshness_status:`fresh`,is_fresh:!0,requires_readiness_run:!1,age_seconds:67624,age_hours:18.78,freshness_reference_time:`2026-07-06T06:49:06.471087+00:00`}},decision_freshness_summary:{available:!0,source:`run_history`,generated_at:`2026-07-06T06:49:06.471133+00:00`,sample_run_count:20,window_days:7,proxy_note:`checkpointed decision freshness projection; rebase old decisions at the decision point before reuse`,summary:{decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0},items:[]},todo_index:JSON.parse(`{"schema_version":"todo_index_v0","source":"live_loopx_status_public_slice","total_count":12,"current_projected_count":12,"rollout_event_count":94,"item_limit":12,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}`),agent_management_projection:{schema_version:`agent_management_projection_v0`,mode:`read_only`,goal_id:`loopx-meta`,generated_at:`2026-07-06T06:49:06Z`,style_hint:null,truth_contract:{todo_is_runtime_work_item:!0,projection_is_writable:!1,introduces_task_runtime:!1,write_api:!1},source_summary:{registered_agent_count:4,projected_agent_count:4,todo_source:`live_loopx_status_public_slice`,public_safe_export:!0},agents:[{agent_id:`codex-main-control`,agent_model:`peer_v1`,profile_role:`release-validation`,state:`blocked`,next_action:`Continue projected todo todo_2bf560b48a0c.`,last_activity_at:`2026-06-29T00:49:36+08:00`,evidence_refs:[`todo:todo_e72afc24f04a:evidence`],goal_ids:[`loopx-meta`],stale_claim_hint:{state:`activity_missing`,claimed_by:`codex-main-control`,reason:`claimed open todo has no projected activity timestamp`,recommended_operator_action:`inspect evidence before considering reassignment`},current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_2bf560b48a0c`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0`,title:`Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harn…`,task_class:`blocker`,action_kind:`legacy_open_pr_rename_blocker`,claimed_by:`codex-main-control`}},{agent_id:`codex-product-capability`,agent_model:`peer_v1`,profile_role:`product-validation`,state:`monitoring`,next_action:`Continue projected todo todo_ded745761822.`,last_activity_at:`2026-07-06T06:29:53Z`,evidence_refs:[`todo:todo_ded745761822:evidence`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_ded745761822`,goal_id:`loopx-meta`,role:`agent`,status:`open`,priority:`P0-LOCAL`,title:`Public-safe redacted live LoopX text; inspect local status for the full row.`,task_class:`continuous_monitor`,action_kind:`Public-safe redacted live LoopX text; inspect local status for the full row.`,claimed_by:`codex-product-capability`,updated_at:`2026-07-04T20:22:45+08:00`}},{agent_id:`codex-side-bypass`,agent_model:`peer_v1`,profile_role:`implementation-validation`,state:`waiting`,next_action:`Inspect status projection before taking work.`,last_activity_at:`2026-07-06T06:32:16Z`,evidence_refs:[`rollout_event:todo_complete:todo_22c946938115`],goal_ids:[`loopx-meta`]},{agent_id:`codex-value-explorer`,agent_model:`peer_v1`,profile_role:`value-exploration`,state:`monitoring`,next_action:`Continue projected todo todo_584f55f8f3b4.`,last_activity_at:`2026-07-06T09:39:59+08:00`,evidence_refs:[`rollout_event:todo_update:todo_584f55f8f3b4`],goal_ids:[`loopx-meta`],current_todo:{schema_version:`todo_row_v0`,todo_id:`todo_584f55f8f3b4`,goal_id:`loopx-meta`,role:`agent`,status:`open`,title:`todo add recorded for todo_584f55f8f3b4`}}]},contract:{ok:!0,summary:{errors:0,warnings:1,checks:6},errors:[],warnings:["loopx-meta: duplicate index rows raw=8444 unique=8440 unexpected=3 artifact_identity_collisions=2 artifact_collision_rows=3 reward_overlays=1; inspect with `loopx history --goal-id loopx-meta inspect-index-duplicates`; artifact identity collisions need review…"],checks:[`registry goals checked: 12`,`registry boundary: shared_local_registry push_allowed=False tracked=False ignored=False`,`user-gate scopes checked: 6 open multi-agent gates`,`runtime root resolved: $HOME/.codex/loopx`,`run-history goals=28 runs=10210`,`public boundary scan clean: 1218 files`]},global_registry:{available:!0,ok:!0,registry:`$HOME/.codex/loopx/registry.global.json`,current_registry:`$HOME/.codex/loopx/registry.global.json`,current_registry_is_global:!0,global_goal_count:12,current_goal_count:12,source_registry_count:7,summary:{high:0,action:8,info:0,checks:2,findings:8},findings:[{kind:`source_registry_missing`,severity:`action`,message:"`cc-test` source registry is missing",recommended_action:"reconnect `cc-test` from its project or archive it if the project is obsolete",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-test` active state file is missing",recommended_action:"repair `cc-test` state_file or reconnect the project",goal_id:`cc-test`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp` source registry is missing",recommended_action:"reconnect `cc-tmp` from its project or archive it if the project is obsolete",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp` active state file is missing",recommended_action:"repair `cc-tmp` state_file or reconnect the project",goal_id:`cc-tmp`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` source registry is missing",recommended_action:"reconnect `cc-tmp-xdrchpuaul` from its project or archive it if the project is obsolete",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`cc-tmp-xdrchpuaul` active state file is missing",recommended_action:"repair `cc-tmp-xdrchpuaul` state_file or reconnect the project",goal_id:`cc-tmp-xdrchpuaul`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`source_registry_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` source registry is missing",recommended_action:"reconnect `loopx-auto-research-e2e-probe-20260628-2225-goal` from its project or archive it if the project is obsolete",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`},{kind:`state_file_missing`,severity:`action`,message:"`loopx-auto-research-e2e-probe-20260628-2225-goal` active state file is missing",recommended_action:"repair `loopx-auto-research-e2e-probe-20260628-2225-goal` state_file or reconnect the project",goal_id:`loopx-auto-research-e2e-probe-20260628-2225-goal`,path:`Public-safe redacted live LoopX text; inspect local status for the full row.`}],checks:[`global registry goals checked: 12`,`global source registries checked: 7`]},attention_queue:JSON.parse(`{"available":true,"item_count":1,"needs_user_or_controller":0,"needs_controller":0,"needs_codex":1,"watching_external_evidence":0,"items":[{"goal_id":"loopx-meta","status":"skillsbench_codex_cli_goal_tail4_keepalive_relaunched","lifecycle_phase":"adapter_inspected","lifecycle_flags":["adapter_inspected"],"waiting_on":"codex","severity":"action","recommended_action":"Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…","source":"latest_run","quota":{"compute":1.0,"window_hours":24,"slot_minutes":1,"allowed_slots":1440,"spent_slots":97,"state":"eligible","reason":"1 compute quota; eligible for the next automatic agent turn"},"agent_todos":{"source_section":"Agent Todo","total_count":12,"open_count":12,"done_count":0,"items":[{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo update recorded for todo_1596c3a678bb","schema_version":"todo_index_item_v0","todo_id":"todo_1596c3a678bb","role":"agent","status":"open","title":"todo update recorded for todo_1596c3a678bb","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:33:32Z","latest_event_status":"open","event_count":7,"event_kinds":["todo_update"]},{"goal_id":"loopx-meta","index":24,"done":false,"text":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","schema_version":"todo_index_item_v0","todo_id":"todo_15bc0926a494","role":"agent","status":"open","priority":"P0-REVENUE MONITOR","title":"Monitor ArcticDB #3179 LoopX comment https://github.com/man-group/ArcticDB/issues/3179#issuecomment-4797835630 for metadata-only maintainer reply signal; do not read private material or reply again without owner approva…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"github_public_reply_metadata_monitor","claimed_by":"codex-value-explorer","evidence":"autonomous replan: bounded current value-explorer monitor lane with explicit expires_at.","note":"Set bounded watch expiry for metadata-only public reply monitor; no catch-up after expiry.","updated_at":"2026-07-05T06:27:15+08:00"},{"goal_id":"loopx-meta","index":17,"done":false,"text":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","schema_version":"todo_index_item_v0","todo_id":"todo_2bf560b48a0c","role":"agent","status":"open","priority":"P0","title":"Block direct merge of legacy PR #199 until it is rebased/rewritten onto LoopX: rename goal_harness paths/imports and goal-harness CLI strings to loopx, rerun launch-artifact-handle smoke, and verify it does not reintrod…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"legacy_open_pr_rename_blocker","claimed_by":"codex-main-control"},{"goal_id":"loopx-meta","index":23,"done":false,"text":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","schema_version":"todo_index_item_v0","todo_id":"todo_3ed1c4a69164","role":"agent","status":"open","priority":"P0","title":"Fix or bypass local SkillsBench Docker verifier reward collection before using local fallback for canonical base/test comparison; organize-messy-files base on merged #668 reached final verifier but produced empty verifi…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"blocker","action_kind":"skillsbench_local_verifier_reward_collection","claimed_by":"codex-main-control","required_capabilities":["benchmark_runner"]},{"goal_id":"loopx-meta","index":32,"done":false,"text":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","schema_version":"todo_index_item_v0","todo_id":"todo_44907a5f355d","role":"agent","status":"blocked","priority":"P0","title":"Rerun SkillsBench raw vs loopx-goal-start-product-mode on citation-check and powerlifting with PR #779 merged; inspect compact public counters for soft_verify_exception_continued, probe_operation_count, task-facing solv…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_raw_new_rerun","claimed_by":"codex-main-control","evidence":"Public-safe redacted live LoopX text; inspect local status for the full row.","note":"Do not spend a full citation-check loopx rerun yet: #865 fixed scored output paths and #874 added bootstrap preflight attribution, but citation-check itself still preflights as apt+verifier bootstrap risk on ECS.","updated_at":"2026-06-29T00:49:36+08:00"},{"goal_id":"loopx-meta","index":39,"done":false,"text":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","schema_version":"todo_index_item_v0","todo_id":"todo_4762c790e583","role":"agent","status":"blocked","priority":"P0","title":"Run the next SkillsBench loopx-goal-start-product-mode reverse-channel case on latest main (no local Docker), prioritizing a currently bad or uncertain case, then update the public case ledger and true LoopX issue analy…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"skillsbench_goal_start_remote_rerun","claimed_by":"codex-main-control","evidence":"A prior benchmark adapter change was validated before the legacy surface was archived. Current research uses the RFC-linked benchmark workspace and toolkit boundary smokes.","note":"2026-06-29: fixed host-local ACP idle/no-output root cause in PR #894. ACP protocol tool_call_count=0 is now distinguished from reverse-channel task-facing bridge activity; repeated codex_exec_bridge_idle_timeout withou…","updated_at":"2026-06-29T19:40:32+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_584f55f8f3b4","schema_version":"todo_index_item_v0","todo_id":"todo_584f55f8f3b4","role":"agent","status":"open","title":"todo add recorded for todo_584f55f8f3b4","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_update","latest_event_at":"2026-07-06T06:48:49Z","latest_event_status":"open","event_count":3,"event_kinds":["todo_add","todo_update"]},{"goal_id":"loopx-meta","index":40,"done":false,"text":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","schema_version":"todo_index_item_v0","todo_id":"todo_62debf065fec","role":"agent","status":"blocked","priority":"P0 MONITOR","title":"Monitor r10 SkillsBench 30-case codex-app-server-goal-baseline batch, summarize completed compact results into the common case ledger, and stop/repair if setup/bootstrap creates new non-solver blockers.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","action_kind":"monitor_skillsbench_batch","claimed_by":"codex-main-control","evidence":"Observed 2026-06-30T02:52+08: active-state target_key=skillsbench-goal-baseline-30case-20260629T1826Z-r10; local ps/tmux/recent artifact search found no r10 batch process or compact artifact; no raw task/log/trajectory …","updated_at":"2026-06-30T02:54:54+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_93bc6439c521","schema_version":"todo_index_item_v0","todo_id":"todo_93bc6439c521","role":"agent","status":"open","title":"todo add recorded for todo_93bc6439c521","source":"rollout_event_log","agent_id":"codex-main-control","latest_event_kind":"todo_claim","latest_event_at":"2026-07-06T06:32:52Z","latest_event_status":"open","event_count":2,"event_kinds":["todo_add","todo_claim"]},{"goal_id":"loopx-meta","index":27,"done":false,"text":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","schema_version":"todo_index_item_v0","todo_id":"todo_aad7e9716927","role":"agent","status":"blocked","priority":"P0","title":"Run the SkillsBench two-arm comparison after the goal-start route is countable: raw Codex vs new loopx-goal-start-product-mode, reporting task_score/control_score/time and compact public-safe LoopX todo rollout evidence.","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"advancement_task","action_kind":"run_goal_start_product_mode_matrix","claimed_by":"codex-main-control","evidence":"driver.status shows DONE raw then RUN loopx-goal-start with no running driver; raw benchmark_run.compact first_blocker=skillsbench_codex_acp_provider_zero_activity; source guard requires --host-local-acp-launch for Loop…","note":"Remote run group skillsbench-raw-new-goal-start-20260627T0420Z produced a material closeout for citation-check raw only; raw compact attribution is skillsbench_codex_acp_provider_zero_activity with official score missin…","updated_at":"2026-06-27T13:05:47+08:00"},{"goal_id":"loopx-meta","index":21,"done":false,"text":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","schema_version":"todo_index_item_v0","todo_id":"todo_aec1873c7f28","role":"agent","status":"open","priority":"P0 MONITOR","title":"Observe remote official SkillsBench powerlifting-coef-calc base/test runtime-layer mountfix pair skillsbench-powerlifting-coef-calc-remote-canonical-runtime-mountfix-pair-20260623T022028Z: use compact/public artifacts o…","archive_state":"active","source_section":"Agent Todo","source":"attention_queue","task_class":"continuous_monitor","claimed_by":"codex-main-control","note":"2026-06-23 projection fix: this is monitor context for the powerlifting run, not an advancement next action; current executable path is SkillsBench build cache/prewarm repair.","updated_at":"2026-06-23T10:37:43+08:00"},{"goal_id":"loopx-meta","index":0,"done":false,"text":"todo add recorded for todo_c02cb7d19607","schema_version":"todo_index_item_v0","todo_id":"todo_c02cb7d19607","role":"agent","status":"open","title":"todo add recorded for todo_c02cb7d19607","source":"rollout_event_log","agent_id":"codex-value-explorer","latest_event_kind":"todo_add","latest_event_at":"2026-07-06T03:47:54Z","latest_event_status":"open","event_count":1,"event_kinds":["todo_add"]}]}}]}`),run_history:{available:!0,goal_count:1,run_count:5,goals:[{id:`loopx-meta`,domain:`loopx-platform`,status:`active-read-only`,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`],registry_member:!0,legacy_runtime_goal:!1,adapter_kind:`harness_self_improvement`,adapter_status:`connected-read-only`,index_exists:!0,raw_index_records:8444,unique_runs:8440,quota:{compute:1,window_hours:24,slot_minutes:1,allowed_slots:1440,spent_slots:97,state:`waiting`,reason:`no active Codex-ready work is currently selected`},latest_runs:[{generated_at:`2026-07-06T14:37:32+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-value-explorer`,recommended_action:`审阅 PR #1524 的 Agent Management 面板视觉方向:workspace hint 与 stale claim hint 是否符合预期;确认后允许 codex-value-explorer 自合并。`,health_check:`quota safe-bypass operator gate; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:55+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-main-control`,recommended_action:`[P1] Repair SkillsBench post-run debug gate consistency for countable codex-cli-goal official-zero runs: when attempt_accounting is countable and case_closeout_complete=true, do not project first_blocker=loopx_closeout_…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:54+08:00`,goal_id:`loopx-meta`,classification:`skillsbench_codex_cli_goal_tail4_keepalive_relaunched`,agent_id:`codex-main-control`,progress_scope:`goal`,delivery_batch_scale:`single_surface`,delivery_outcome:`outcome_progress`,recommended_action:`Monitor run_group skillsbench-codex-cli-goal-xhigh-tail4-keepalive-20260706T143132CST using public compact/public artifacts only; once benchmark_run.compact.json lands for each case, classify launcher/case/solver/verifi…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 10`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:33:34+08:00`,goal_id:`loopx-meta`,classification:`quota_slot_spent`,agent_id:`codex-side-bypass`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`quota should-run eligible; quota slot spend event public-safe`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]},{generated_at:`2026-07-06T14:32:57+08:00`,goal_id:`loopx-meta`,classification:`auto_research_successor_link_fix_merged`,agent_id:`codex-side-bypass`,progress_scope:`agent_lane`,delivery_batch_scale:`implementation`,delivery_outcome:`outcome_progress`,recommended_action:`[P0] Rerun real KNN visible auto-research after the successor-link fix and verify evaluator completion projects a second-round hypothesis/frontier or explicit completion gate without manual intervention; keep evidence p…`,health_check:`state_file 1/1; registry_goal 1/1; authority_sources 0`,json_exists:!0,markdown_exists:!0,lifecycle_phase:`adapter_inspected`,lifecycle_flags:[`adapter_inspected`]}]}]}},hf=Pd([W(),G(),K(),Ed()]),gf=Bd(W(),hf),_f=J({todo_id:W().optional(),priority:W().optional(),status:W(),title:W(),claimed_by:W().optional(),task_class:W().optional(),action_kind:W().optional()}),vf=J({gate_id:W(),kind:W(),status:W(),blocks:q(W()).optional()}),yf=J({todo_id:W().optional(),owner_agent:W().optional(),status:W().optional(),lease_until:W().optional(),write_scope:q(W()).optional()}),bf=J({generated_at:W().optional(),classification:W().optional(),summary:W().optional()}),xf=J({kind:W().optional().default(`warning`),message:Pd([W(),q(W())]).optional().default(`compact source warning`)}).passthrough(),Sf=J({schema_version:Y(`goal_channel_projection_v0`),mode:Y(`read_only`),goal_id:W(),display_name:W(),generated_at:W().optional().nullable(),latest_status:W(),waiting_on:W(),next_action:W(),source_refs:Bd(W(),hf),decision_frame:J({user_action_required:K(),agent_action_required:K(),quiet_noop_allowed:K()}),quota:gf,user_todos:q(_f).default([]),agent_todos:q(_f).default([]),open_gates:q(vf).default([]),active_leases:q(yf).default([]),artifacts:q(gf).default([]),recent_events:q(bf).default([]),source_warnings:q(xf).default([]),truth_contract:J({event_ledger_is_source_of_truth:K(),projection_is_writable:K(),recompute_rule:W(),write_authority:W()})}),Cf={schema_version:`goal_channel_projection_v0`,mode:`read_only`,goal_id:`demo-goal-channel`,display_name:`Demo Goal Channel`,generated_at:`2026-06-20T08:04:00Z`,latest_status:`safe_side_path_running`,waiting_on:`capability`,next_action:`Keep the leased delivery claim visible, wait on the missing capability, repair workspace drift, then write a durable outcome.`,source_refs:{status_generated_at:`2026-06-20T08:01:00Z`,active_state_updated_at:`2026-06-20T08:00:00Z`,latest_run_generated_at:`2026-06-20T08:02:00Z`,review_packet_generated_at:`2026-06-20T08:03:00Z`,event_ledger_source:`run_history`,latest_delivery_outcome:`outcome_progress`},decision_frame:{user_action_required:!0,agent_action_required:!0,quiet_noop_allowed:!1},quota:{allowed_slots:`10`,cadence_class:`active_work`,latest_evidence_ref:`run:validated_progress_fixture`,no_spend_for_cadence_change:!0,override_policy:`fresh quota guard required`,pause_policy:`control-plane policy only`,reason:`synthetic fixture has quota`,scheduler_reset_token:`fixture-reset-token`,scheduler_rrule:`FREQ=MINUTELY;INTERVAL=3`,spend_policy:`spend after validated writeback`,spent_slots:`2`,state:`eligible`},user_todos:[{todo_id:`todo_user_decision`,priority:`P0`,status:`open`,task_class:`user_gate`,action_kind:`approve_route`,title:`Decide whether the gated delivery route may continue.`}],agent_todos:[{todo_id:`todo_primary_route`,priority:`P0`,status:`open`,claimed_by:`codex-main-control`,task_class:`advancement_task`,action_kind:`delivery`,title:`Keep the primary delivery route visible while it waits.`},{todo_id:`todo_capability_wait`,priority:`P0`,status:`waiting`,claimed_by:`codex-capability`,task_class:`advancement_task`,action_kind:`capability_wait`,title:`Wait for the missing worker_bridge capability before resuming delivery.`},{todo_id:`todo_workspace_repair`,priority:`P1`,status:`open`,claimed_by:`codex-workspace`,task_class:`advancement_task`,action_kind:`workspace_repair`,title:`Repair the stale writable worktree before the next bounded write.`},{todo_id:`todo_side_fixture`,priority:`P2`,status:`open`,claimed_by:`codex-side-bypass`,task_class:`advancement_task`,action_kind:`frontstage_render`,title:`Render the productization frontstage fixture.`}],open_gates:[{gate_id:`interaction_contract_user_channel`,kind:`user_channel`,status:`action_required`,blocks:[`todo_user_decision`]},{gate_id:`capability_gate_worker_bridge`,kind:`capability_wait`,status:`waiting`,blocks:[`todo_capability_wait`,`todo_primary_route`]}],active_leases:[{owner_agent:`codex-main-control`,status:`hard_lease`,todo_id:`todo_primary_route`,lease_until:`2026-06-20T09:00:00Z`,write_scope:[`apps/presentation/dashboard/src/views/frontstage-page.tsx`]},{owner_agent:`codex-capability`,status:`soft_claim`,todo_id:`todo_capability_wait`,lease_until:`2026-06-20T08:30:00Z`,write_scope:[`docs/product/roadmaps/frontstage-channel-lease-roadmap.md`]},{owner_agent:`codex-workspace`,status:`soft_claim`,todo_id:`todo_workspace_repair`,lease_until:`2026-06-20T08:20:00Z`,write_scope:[`worktree`]},{owner_agent:`codex-side-bypass`,status:`soft_claim`,todo_id:`todo_side_fixture`}],artifacts:[{kind:`doc`,label:`frontstage roadmap`,path:`docs/product/roadmaps/frontstage-channel-lease-roadmap.md`},{kind:`local_state`,label:`omitted private control-plane source`}],recent_events:[{generated_at:`2026-06-20T08:03:00Z`,classification:`delivery_outcome`,summary:`latest delivery_outcome=outcome_progress stays visible without browser write authority`},{generated_at:`2026-06-20T08:02:00Z`,classification:`validated_progress`,summary:`frontstage fixture rendered from compact projection`},{generated_at:`2026-06-20T08:01:00Z`,classification:`capability_wait`,summary:`worker_bridge missing; capability-wait blocks primary delivery`},{generated_at:`2026-06-20T07:55:00Z`,classification:`workspace_repair`,summary:`writable worktree marked stale; repair before the next scoped write`},{generated_at:`2026-06-20T07:50:00Z`,classification:`operator_gate_recorded`,summary:`human decision stayed explicit`}],source_warnings:[{kind:`raw_or_private_material_omitted`,message:`raw/private-looking fields were omitted; inspect compact source references instead of copying raw material into the frontstage channel projection`}],truth_contract:{event_ledger_is_source_of_truth:!0,projection_is_writable:!1,recompute_rule:`refresh from LoopX status/quota/run history; do not edit the channel projection as project truth`,write_authority:`none`}},wf={outcome_progress:`success`,primary_goal_outcome:`success`,outcome_gap:`danger`,delivery_failed:`danger`,delivery_blocked:`danger`,surface_only:`neutral`,unknown:`neutral`,not_configured:`neutral`},Tf=new Set([`outcome_progress`,`primary_goal_outcome`,`outcome_gap`,`delivery_failed`,`delivery_blocked`]),Ef={workspace_repair:`warning`,capability_wait:`warning`,capability_repair:`warning`},Df={validated_progress:`success`,delivery_outcome:`info`,operator_gate_recorded:`info`,capability_wait:`warning`,workspace_repair:`warning`,outcome_progress:`success`,primary_goal_outcome:`success`,outcome_gap:`danger`,delivery_failed:`danger`,delivery_blocked:`danger`},Of={hard_lease:`success`,active:`success`,soft_claim:`info`,claimed:`info`,expired:`neutral`,released:`neutral`};function kf(e){return(e??``).trim().toLowerCase()}function Af(e){return Ef[kf(e)]??`neutral`}function jf(e){return Df[kf(e)]??`neutral`}function Mf(e){return Of[kf(e)]??`neutral`}function Nf(e){let t=e.source_refs.latest_delivery_outcome,n=t!=null,r=kf(n?String(t):void 0),i=e.recent_events.find(e=>{let t=kf(e.classification);return t===`delivery_outcome`||Tf.has(t)}),a=n?r:kf(i?.classification)||void 0,o=a?wf[a]??`neutral`:`neutral`,s=e.active_leases.find(e=>!!e.lease_until)??e.active_leases[0],c=e.agent_todos.find(e=>{let t=kf(e.action_kind);return t===`capability_wait`||t===`capability_repair`}),l=e.open_gates.find(e=>kf(e.kind)===`capability_wait`),u=kf(e.waiting_on)===`capability`,d=e.agent_todos.find(e=>kf(e.action_kind)===`workspace_repair`),f=e.recent_events.find(e=>kf(e.classification)===`workspace_repair`);return[{label:`outcome`,value:n?String(t):i?.classification??`not projected`,helper:i?.summary??`Delivery outcome stays in the compact event ledger, not in browser writes.`,tone:o},{label:`lease`,value:s?`${s.status??`claim`} · ${s.lease_until??`no expiry`}`:`no active lease`,helper:s?.write_scope?.length?`scope: ${s.write_scope.join(`, `)}`:s?.todo_id?`todo: ${s.todo_id}`:`Claim owners stay visible without granting browser write authority.`,tone:s?Mf(s.status):`neutral`},{label:`capability-wait`,value:l?.status??c?.status??(u?e.waiting_on:`clear`),helper:c?.title??l?.gate_id??`Missing capabilities stay explicit as wait/repair state.`,tone:l||c||u?`warning`:`success`},{label:`workspace-repair`,value:d?.action_kind??f?.classification??`clear`,helper:d?.title??f?.summary??`Workspace repair stays a projected agent lane, not a browser mutation.`,tone:d||f?`warning`:`success`}]}var Pf=J({compute:G().optional().default(1),window_hours:G().optional().default(24),slot_minutes:G().optional().default(1),allowed_slots:G().optional().nullable(),spent_slots:G().optional().default(0),state:W().optional().nullable(),next_eligible_at:W().optional().nullable(),reason:W().optional().nullable(),blocked_action_scope:W().optional().nullable(),focus_wait:K().optional().nullable(),handoff_outcome_floor_block:K().optional().nullable(),safe_bypass_allowed:K().optional().default(!1),safe_bypass_kind:W().optional().nullable(),safe_bypass_policy:W().optional().nullable(),post_handoff_outcome_gap_streak:G().optional().nullable(),outcome_gap_threshold:G().optional().nullable(),must_advance:q(W()).optional().default([]),avoid:q(W()).optional().default([])}).transform(e=>{let t=Math.max(1,e.slot_minutes),n=Math.round(e.window_hours*60*e.compute/t);return{...e,slot_minutes:t,allowed_slots:e.allowed_slots??n}}),Ff=J({self_repair:J({enabled:K().optional().default(!1),allow_health_blocker_repair:K().optional().default(!1),allow_waiting_projection_repair:K().optional().default(!1)}).optional().nullable()}).passthrough(),If=J({mode:W().optional().default(`default`),orchestration_mode:W().optional().nullable(),spawn_allowed:K().optional().default(!1),allowed:K().optional().nullable(),max_children:G().optional().default(0),allowed_domains:q(W()).optional().default([])}).passthrough(),Lf=J({label:W().optional().nullable(),path:W(),anchor:W().optional().nullable(),exists:K().optional().default(!1),resolved_path:W().optional().nullable()}),Rf=J({index:G(),done:K(),text:W(),schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),resume_when:W().optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),archive_state:W().optional().nullable(),source_section:W().optional().nullable(),task_class:W().optional().nullable(),task_domain:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_capabilities:q(W()).optional(),note:W().optional().nullable(),evidence:W().optional().nullable(),updated_at:W().optional().nullable(),review_materials:q(Lf).optional().default([])}).passthrough(),zf=J({source_section:W().optional().nullable(),total_count:G().optional().default(0),open_count:G().optional().default(0),done_count:G().optional().default(0),advancement_done_count:G().optional(),items:q(Rf).optional().default([]),deferred_items:q(Rf).optional()}),Bf=Rf.extend({goal_id:W(),source:W().optional().nullable(),event_count:G().optional().default(0),event_kinds:q(W()).optional().default([]),latest_event_kind:W().optional().nullable(),latest_event_at:W().optional().nullable(),latest_event_status:W().optional().nullable(),agent_id:W().optional().nullable()}).passthrough(),Vf=J({schema_version:W().optional().nullable(),source:W().optional().nullable(),total_count:G().optional().default(0),current_projected_count:G().optional().default(0),rollout_event_count:G().optional().default(0),item_limit:G().optional().nullable(),items:q(Bf).optional().default([])}),Hf=J({kind:W().optional().nullable(),label:W().optional().nullable(),path_safe:K().optional().default(!1),branch:W().optional().nullable(),write_scope:q(W()).optional().default([])}).passthrough(),Uf=J({state:W().optional().nullable(),claimed_by:W().optional().nullable(),last_activity_at:W().optional().nullable(),threshold_hours:G().optional().nullable(),reason:W().optional().nullable(),recommended_operator_action:W().optional().nullable()}).passthrough(),Wf=J({schema_version:W().optional().nullable(),todo_id:W().optional().nullable(),goal_id:W().optional().nullable(),role:W().optional().nullable(),status:W().optional().nullable(),priority:W().optional().nullable(),title:W().optional().nullable(),task_class:W().optional().nullable(),action_kind:W().optional().nullable(),claimed_by:W().optional().nullable(),required_write_scopes:q(W()).optional().default([]),workspace_ref:Hf.optional().nullable()}).passthrough(),Gf=J({schema_version:W().optional().nullable(),from_agent:W().optional().nullable(),to_agent:W().optional().nullable(),intent:W().optional().nullable(),summary:W().optional().nullable(),blocker:W().optional().nullable(),suggested_next_action:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),updated_at:W().optional().nullable()}).passthrough(),Kf=J({agent_id:W(),role:W().optional().nullable(),state:W().optional().nullable(),current_todo:Wf.optional().nullable(),next_action:W().optional().nullable(),last_activity_at:W().optional().nullable(),evidence_refs:q(W()).optional().default([]),handoff_refs:q(W()).optional().default([]),handoff_note:Gf.optional().nullable(),workspace_ref:Hf.optional().nullable(),stale_claim_hint:Uf.optional().nullable(),blocked_on:Wf.optional().nullable(),goal_ids:q(W()).optional().default([])}).passthrough(),qf=J({schema_version:W().optional().nullable(),mode:W().optional().nullable(),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),style_hint:J({preferred:W().optional().nullable(),license_boundary:W().optional().nullable()}).optional().nullable(),truth_contract:J({todo_is_runtime_work_item:K().optional().default(!0),projection_is_writable:K().optional().default(!1),introduces_task_runtime:K().optional().default(!1),write_api:K().optional().default(!1)}).optional().nullable(),source_summary:J({registered_agent_count:G().optional().default(0),projected_agent_count:G().optional().default(0),todo_source:W().optional().nullable()}).optional().nullable(),agents:q(Kf).optional().default([])}).passthrough(),Jf=J({goal_id:W(),configured:K().optional().default(!1),enabled:K().optional().default(!1),human_gate_auto_notify_enabled:K().optional().default(!1),target_ref:W().optional().nullable(),receipt_count:G().optional().default(0),last_notified_at:W().optional().nullable()}).passthrough(),Yf=J({schema_version:W().optional().nullable(),generated_at:W().optional().nullable(),goals:q(Jf).optional().default([])}).passthrough(),Xf=J({source_section:W().optional().nullable(),open:G().optional().default(0),done:G().optional().default(0),total:G().optional().default(0),advancement_done_count:G().optional(),next:W().optional().nullable(),next_index:G().optional().nullable(),items:q(Rf).optional().default([]),recent_completed_advancement_items:q(Rf).optional().default([])}),Zf=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),severity:W().optional().nullable(),index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),Qf=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q(Zf).optional().default([])}),$f=J({goal_id:W(),status:W().optional().nullable(),waiting_on:W().optional().nullable(),quota_state:W().optional().nullable(),priority:W().optional().nullable(),todo_index:G().optional().nullable(),text:W(),source:W().optional().nullable()}),ep=J({source:W().optional().nullable(),open_count:G().optional().default(0),items:q($f).optional().default([])}),tp=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),summary:W().optional().nullable()}),np=J({kind:W().optional().nullable(),source:W().optional().nullable(),severity:W().optional().nullable(),requires_refresh_state:K().optional().default(!1),reason:W().optional().nullable(),active_state_updated_at:W().optional().nullable(),latest_run_generated_at:W().optional().nullable(),latest_run_state_updated_at:W().optional().nullable(),latest_run_classification:W().optional().nullable(),recommended_action:W().optional().nullable()}),rp=J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),health_check:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}),ip=J({project_asset_backed:K().optional(),same_source_should_run:K().optional(),codex_ready:K().optional(),handoff_has_next_action:K().optional(),handoff_has_stop_condition:K().optional(),handoff_sanitized_surface:K().optional()}).catchall(K()),ap=J({ready:K().optional().default(!1),codex_ready:K().optional().default(!1),source:W().optional().nullable(),quota_state:W().optional().nullable(),checks:ip.optional().default({}),handoff_status:W().optional().nullable(),handoff_ready_at:W().optional().nullable(),handoff_ready_classification:W().optional().nullable(),post_handoff_run_seen:K().optional().default(!1),post_handoff_latest_run:rp.optional().nullable(),post_handoff_recent_runs:q(rp).optional().default([]),post_handoff_small_scale_streak:G().int().nonnegative().optional().default(0),post_handoff_outcome_gap_streak:G().int().nonnegative().optional().default(0),next_probe:W().optional().nullable()}),op=J({schema_version:W().optional().nullable(),kind:W().optional().nullable(),missing_roles:q(W()).optional().default([]),source:W().optional().nullable(),recommended_action:W().optional().nullable()}),sp=J({owner:W(),gate:W(),next_action:W(),stop_condition:W(),user_todos:Xf.optional().nullable(),agent_todos:Xf.optional().nullable(),quota:Pf.optional().nullable(),control_plane:Ff.optional().nullable(),orchestration:If.optional().nullable(),latest_validation:tp.optional().nullable(),stale_latest_run_warning:np.optional().nullable(),todo_projection_gap:op.optional().nullable()}),cp=J({goal_id:W(),activation_state:Hd([`active`,`stopped`]).optional().default(`active`),status:W(),waiting_on:W(),severity:W(),recommended_action:W(),project_asset:sp.optional().nullable(),handoff_readiness:ap.optional().nullable(),source:W().optional(),operator_question:W().optional().nullable(),agent_command:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),controller_stage:W().optional().nullable(),missing_gates:q(W()).optional().default([]),next_handoff_condition:W().optional().nullable(),quota:Pf.optional().nullable(),control_plane:Ff.optional().nullable(),user_todos:zf.optional().nullable(),agent_todos:zf.optional().nullable(),stale_latest_run_warning:np.optional().nullable(),dependency_blockers:Qf.optional().nullable(),todo_state_file:W().optional().nullable(),goal_channel_projection:Sf.optional().nullable()}),lp=J({recorded_at:W().optional().nullable(),decision:W().optional().nullable(),reward:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable()}),up=J({recorded_at:W().optional().nullable(),gate:W().optional().nullable(),decision:W().optional().nullable(),operator_question:W().optional().nullable(),reason_summary:W().optional().nullable(),follow_up:W().optional().nullable(),agent_command:W().optional().nullable()}),dp=J({version:W().optional().nullable(),goal_id:W().optional().nullable(),run_id:W().optional().nullable(),gate_id:W().optional().nullable(),created_state_ref:W().optional().nullable(),created_policy_version:W().optional().nullable(),interrupt_payload:J({question:W().optional().nullable(),choices:q(W()).optional().default([])}).optional().nullable(),allowed_decisions:q(W()).optional().default([]),operator_decision:W().optional().nullable(),latest_state_ref:W().optional().nullable(),freshness_check:W().optional().nullable(),precondition_check:W().optional().nullable(),migration_or_rebase_result:W().optional().nullable(),resulting_action:W().optional().nullable(),validation_after_resume:W().optional().nullable()}),fp=J({id:W().optional().nullable(),ok:K().optional().nullable(),review:W().optional().nullable()}),pp=J({classification:W().optional().nullable(),read_only_observer_ready:K().optional().nullable(),decision_advisor_ready:K().optional().nullable(),write_controller_ready:K().optional().nullable(),missing_gates:q(W()).optional().default([]),review_judgment:W().optional().nullable(),next_handoff_condition:W().optional().nullable(),gates:q(fp).optional().default([])}),mp=J({declared:K().optional().default(!1),required:K().optional().default(!1),path:W().optional().nullable(),path_exists:K().optional().nullable(),read_status:W().optional().nullable(),default_entry_count:G().optional().default(0),default_entries_checked:G().optional().default(0),default_entries_present:G().optional().default(0),topic_authority_count:G().optional().default(0),project_material_count:G().optional().default(0),project_material_repository_count:G().optional().default(0),project_material_owner_review_required_count:G().optional().default(0),project_material_stale_count:G().optional().default(0),project_material_current_authority_count:G().optional().default(0),deprecated_source_count:G().optional().default(0),conflict_risk:W().optional().nullable()}),hp=J({adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_source_count:G().optional().nullable(),authority_registry_declared:K().optional().nullable(),authority_registry_path_exists:K().optional().nullable(),authority_registry_default_entry_count:G().optional().nullable(),authority_registry_default_entries_present:G().optional().nullable(),topic_authority_count:G().optional().nullable(),project_material_count:G().optional().nullable(),project_material_repository_count:G().optional().nullable(),project_material_owner_review_required_count:G().optional().nullable(),project_material_stale_count:G().optional().nullable(),project_material_current_authority_count:G().optional().nullable(),authority_registry_conflict_risk:W().optional().nullable(),guard_count:G().optional().nullable(),sections_found:G().optional().nullable(),sections_checked:G().optional().nullable(),files_present:G().optional().nullable(),files_checked:G().optional().nullable()}),gp=J({generated_at:W(),goal_id:W(),classification:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),recommended_action:W().optional().nullable(),health_check:W().optional().nullable(),active_task_count:G().optional().nullable(),active_priorities:Bd(W(),Od()).optional().nullable(),cache_check:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),human_reward:lp.optional().nullable(),operator_gate:up.optional().nullable(),operator_gate_resume_contract:dp.optional().nullable(),controller_readiness:pp.optional().nullable(),project_map:hp.optional().nullable()}),_p=J({id:W(),activation_state:Hd([`active`,`stopped`]).optional().default(`active`),display_name:W().optional().nullable(),domain:W().optional().nullable(),status:W().optional().nullable(),lifecycle_phase:W().optional().nullable(),lifecycle_flags:q(W()).optional().default([]),registry_member:K().optional().default(!1),legacy_runtime_goal:K().optional().default(!1),adapter_kind:W().optional().nullable(),adapter_status:W().optional().nullable(),authority_registry:mp.optional().nullable(),quota:Pf.optional().nullable(),control_plane:Ff.optional().nullable(),spawn_policy:If.optional().nullable(),orchestration:If.optional().nullable(),coordination:J({agent_model:W().optional().nullable(),registered_agents:q(W()).optional().default([])}).optional().nullable(),index_exists:K().optional().default(!1),raw_index_records:G().optional().default(0),unique_runs:G().optional().default(0),latest_runs:q(gp).optional().default([])}),vp=J({available:K(),goal_count:G().optional().default(0),run_count:G().optional().default(0),goals:q(_p).optional().default([]),recent_runs:q(gp).optional().default([])}),yp=J({kind:W(),severity:W(),message:W(),recommended_action:W(),goal_id:W().optional().nullable(),path:W().optional().nullable(),goal_ids:q(W()).optional().default([])}),bp=J({available:K(),ok:K(),registry:W(),current_registry:W().optional().nullable(),current_registry_is_global:K().optional().default(!1),global_goal_count:G().optional().default(0),current_goal_count:G().optional().default(0),source_registry_count:G().optional().default(0),summary:J({high:G().optional().default(0),action:G().optional().default(0),info:G().optional().default(0),checks:G().optional().default(0),findings:G().optional().default(0)}),findings:q(yp).optional().default([]),checks:q(W()).optional().default([])}),xp=J({runs_24h:G().optional().default(0),runs_7d:G().optional().default(0),quota_spend_slots_24h:G().optional().default(0),quota_spend_slots_7d:G().optional().default(0),automation_run_count_24h:G().optional().default(0),automation_run_count_7d:G().optional().default(0),progress_signal_run_count_24h:G().optional().default(0),progress_signal_run_count_7d:G().optional().default(0),input_tokens_24h:G().optional().default(0),input_tokens_7d:G().optional().default(0),output_tokens_24h:G().optional().default(0),output_tokens_7d:G().optional().default(0),cache_tokens_24h:G().optional().default(0),cache_tokens_7d:G().optional().default(0),cost_usd_24h:G().optional().default(0),cost_usd_7d:G().optional().default(0),duration_ms_24h:G().optional().default(0),duration_ms_7d:G().optional().default(0)}),Sp=xp.extend({goal_id:W(),project_share_24h:G().optional().default(0)}),Cp=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),totals:xp.optional().default({runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0,input_tokens_24h:0,input_tokens_7d:0,output_tokens_24h:0,output_tokens_7d:0,cache_tokens_24h:0,cache_tokens_7d:0,cost_usd_24h:0,cost_usd_7d:0,duration_ms_24h:0,duration_ms_7d:0}),goals:q(Sp).optional().default([])}).optional().nullable(),wp=J({accounting:G().optional().default(0),decision:G().optional().default(0),evidence:G().optional().default(0),state:G().optional().default(0),work:G().optional().default(0)}),Tp={accounting:0,decision:0,evidence:0,state:0,work:0},Ep=J({events_24h:G().optional().default(0),events_7d:G().optional().default(0),by_class_24h:wp.optional().default(Tp),by_class_7d:wp.optional().default(Tp)}),Dp=Ep.extend({goal_id:W(),latest_event_class:W().optional().nullable(),latest_event_at:W().optional().nullable()}),Op={events_24h:0,events_7d:0,by_class_24h:Tp,by_class_7d:Tp},kp=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),event_classes:q(W()).optional().default([`accounting`,`decision`,`evidence`,`state`,`work`]),totals:Ep.optional().default(Op),goals:q(Dp).optional().default([])}).optional().nullable(),Ap=J({available:K().optional().default(!1),source:W().optional().default(`run_history`),goal_id:W().optional().nullable(),generated_at:W().optional().nullable(),classification:W().optional().nullable(),delivery_batch_scale:W().optional().nullable(),delivery_outcome:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().default(!1),markdown_exists:K().optional().default(!1),freshness_window_hours:G().optional().default(24),freshness_status:W().optional().nullable(),is_fresh:K().optional().default(!1),requires_readiness_run:K().optional().default(!0),age_seconds:G().optional().nullable(),age_hours:G().optional().nullable(),freshness_reference_time:W().optional().nullable(),sample_run_count:G().optional().default(0),proxy_note:W().optional().nullable(),reason:W().optional().nullable()}).optional().nullable(),jp=J({ok:K().optional().default(!0),registry:W().optional().nullable(),runtime_root:W().optional().nullable(),gate:W().optional().default(`promotion_readiness`),gate_state:W().optional().default(`warning`),can_promote:K().optional().default(!1),should_warn:K().optional().default(!0),non_blocking:K().optional().default(!0),recommended_action:W().optional().nullable(),warning_message:W().optional().nullable(),readiness:Ap.default(null)}).optional().nullable(),Mp=J({decision_count:G().optional().default(0),stale_count:G().optional().default(0),rebase_required_count:G().optional().default(0),fresh_count:G().optional().default(0)}),Np=J({goal_id:W(),decision_kind:W().optional().nullable(),decision_at:W().optional().nullable(),classification:W().optional().nullable(),age_days:G().optional().nullable(),stale_by_age:K().optional().default(!1),newer_event_count_7d:G().optional().default(0),newer_event_classes_7d:wp.optional().default(Tp),freshness_state:W().optional().nullable(),requires_decision_point_rebase:K().optional().default(!1),reason:W().optional().nullable()}),Pp=J({available:K().optional().default(!0),source:W().optional().default(`run_history`),generated_at:W().optional().nullable(),sample_run_count:G().optional().default(0),window_days:G().optional().default(7),proxy_note:W().optional().nullable(),summary:Mp.optional().default({decision_count:0,stale_count:0,rebase_required_count:0,fresh_count:0}),items:q(Np).optional().default([])}).optional().nullable(),Fp=J({schema_version:G().optional().default(0),minimum_dashboard_schema_version:G().optional().default(2),producer:W().optional().nullable(),reload_hint:W().optional().nullable()}).optional().default({schema_version:0,minimum_dashboard_schema_version:2,producer:null,reload_hint:`scripts/macos-dashboard-launchagent.sh restart`}),Ip=J({schema_version:Y(`loopx_goal_projection_scope_v0`),scope:Hd([`all`,`active`,`stopped`]),complete:K(),projected_goal_count:G().int().nonnegative(),registry_goal_count:G().int().nonnegative(),registry_revision:W().optional().nullable()}),Lp=J({source:W().optional().default(`serve-status`),status_url:W().optional().nullable(),health_url:W().optional().nullable(),review_material_url:W().optional().nullable(),presentation_surfaces_url:W().optional().nullable(),presentation_detail_url:W().optional().nullable(),periodic_report_index_url:W().optional().nullable(),periodic_report_detail_url:W().optional().nullable(),ssh_hosts_url:W().optional().nullable(),reward_dry_run_url:W().optional().nullable(),reward_append_url:W().optional().nullable(),reward_write_enabled:K().optional().default(!1),configure_goal_dry_run_url:W().optional().nullable(),configure_goal_apply_url:W().optional().nullable(),control_plane_write_enabled:K().optional().default(!1)}).optional().nullable(),Rp=J({extension_id:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),extension_revision:W().min(1),payload_sha256:W().regex(/^[0-9a-f]{64}$/)}).strict(),zp=J({extension_id:W().min(1),extension_revision:W().min(1),surface_id:W().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),surface_kind:W().regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/),title:W().min(1),view_schema:W().regex(/^[a-z][a-z0-9_]*_v\d+$/),visibility:Hd([`public-safe`,`owner-only`]),goal_id:W().min(1).nullable(),generated_at:W().min(1).nullable(),review_due_at:W().min(1).nullable(),diagnostic:W().min(1).nullable(),empty_state_title:W().min(1),empty_state_detail:W().min(1)}),Bp=Pd([zp.extend({state:Hd([`ready`,`review_due`]),goal_id:W().min(1),generated_at:W().min(1),detail_ref:Rp}).strict(),zp.extend({state:Y(`empty`),detail_ref:Ad().optional()}).strict(),zp.extend({state:Y(`invalid`),diagnostic:W().min(1),detail_ref:Ad().optional()}).strict()]),Vp=J({schema_version:Y(`extension_presentation_surfaces_v0`),count:G().int().nonnegative(),ready_count:G().int().nonnegative(),review_due_count:G().int().nonnegative(),empty_count:G().int().nonnegative(),invalid_count:G().int().nonnegative(),items:q(Bp)}).strict(),Hp={schema_version:`extension_presentation_surfaces_v0`,count:0,ready_count:0,review_due_count:0,empty_count:0,invalid_count:0,items:[]};J({ok:Y(!0),presentation_surfaces:Vp}).strict();var Up=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/)}).strict(),Wp=J({goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),detail_ref:Up}).strict(),Gp=J({schema_version:Y(`periodic_report_workspace_index_v0`),count:G().int().nonnegative(),items:q(Wp)}),Kp=Gp.extend({returned_count:G().int().nonnegative(),total_count:G().int().nonnegative(),limit:G().int().nonnegative(),offset:G().int().nonnegative(),truncated:K()}).strict(),qp=Gp.strict().transform(e=>({...e,returned_count:e.count,total_count:e.count,limit:e.count,offset:0,truncated:!1})),Jp=J({ok:Y(!0),periodic_reports:Pd([Kp,qp])}).strict(),Yp=J({schema_version:Y(`periodic_report_workspace_projection_v0`),goal_id:W().min(1),agent_id:W().min(1),generation_id:W().min(1),generated_at:W().min(1),title:W().min(1),summary:W().min(1),content_sha256:W().regex(/^sha256:[0-9a-f]{64}$/),period_window:J({start_at:W().min(1),end_at:W().min(1)}).strict(),interaction:J({attention_kind:Y(`progress`),interaction:Y(`inform`),delivery:Y(`surface`),form:Y(`milestone_report`),writable:Y(!1)}).strict(),delta:J({added_count:G().int().nonnegative(),changed_count:G().int().nonnegative(),item_count:G().int().positive(),items:q(J({fact_id:W().min(1),source_ref:W().min(1),title:W().min(1),summary:W().min(1),status:W().min(1),content_kind:W().min(1),change_kind:Hd([`added`,`changed`]),previous_status:W().min(1).optional()}).strict())}).strict(),publication:J({publication_id:W().min(1),delivered_at:W().min(1),predecessor_publication_id:W().min(1).nullable().optional(),cursor_id:W().min(1)}).strict(),truth_contract:J({published_cursor_is_source_of_truth:Y(!0),generation_receipt_is_delivery_receipt:Y(!1),projection_is_writable:Y(!1),browser_write_api:Y(!1)}).strict()}).strict(),Xp=J({ok:Y(!0),projection:Yp}).strict(),Zp=J({ok:K(),registry:W(),runtime_root:W(),goal_count:G(),run_count:G(),status_contract:Fp,goal_projection:Ip.optional().nullable().default(null),local_dashboard_api:Lp,contract:J({ok:K(),summary:J({errors:G(),warnings:G(),checks:G()}),errors:q(W()),warnings:q(W()),checks:q(W()).optional().default([])}),global_registry:bp.optional().default({available:!1,ok:!0,registry:``,current_registry:null,current_registry_is_global:!1,global_goal_count:0,current_goal_count:0,source_registry_count:0,summary:{high:0,action:0,info:0,checks:0,findings:0},findings:[],checks:[]}),attention_queue:J({available:K(),item_count:G(),needs_user_or_controller:G(),needs_controller:G().optional().default(0),needs_codex:G(),watching_external_evidence:G(),autonomous_backlog_candidates:ep.optional().nullable(),items:q(cp)}),run_history:vp.optional().default({available:!1,goal_count:0,run_count:0,goals:[],recent_runs:[]}),event_ledger_summary:kp.default(null),promotion_readiness_summary:Ap.default(null),promotion_gate:jp.default(null),decision_freshness_summary:Pp.default(null),usage_summary:Cp.default(null),todo_index:Vf.optional().nullable().default(null),agent_management_projection:qf.optional().nullable().default(null),goal_channel_notification_projection:Yf.optional().nullable().default(null),presentation_surfaces:Vp.optional().default(Hp)});J({ok:K(),dry_run:K().optional().default(!0),appended:K().optional().default(!1),goal_id:W().optional().nullable(),raw_index_records_before:G().optional().nullable(),preview_id:W().optional().nullable(),selected_run:J({generated_at:W().optional().nullable(),classification:W().optional().nullable(),recommended_action:W().optional().nullable(),json_exists:K().optional().nullable(),markdown_exists:K().optional().nullable()}).optional().nullable(),human_reward:lp.optional().nullable(),active_state_summary:W().optional().nullable(),project_agent_visibility:J({source_of_truth:W().optional().nullable(),history_command:W().optional().nullable(),active_state_role:W().optional().nullable(),review_packet_role:W().optional().nullable()}).optional().nullable(),error:W().optional().nullable()});function Qp(e,t,n){let r=e.run_history.goals.map(e=>e.id===t&&e.activation_state!==n?{...e,activation_state:n}:e),i=e.attention_queue.items.map(e=>e.goal_id===t&&e.activation_state!==n?{...e,activation_state:n}:e),a=r.some((t,n)=>t!==e.run_history.goals[n]),o=i.some((t,n)=>t!==e.attention_queue.items[n]);return!a&&!o?e:{...e,attention_queue:o?{...e.attention_queue,items:i}:e.attention_queue,run_history:a?{...e.run_history,goals:r}:e.run_history}}function $p(e,t){let n=e.run_history.goals.filter(e=>e.id!==t),r=e.attention_queue.items.filter(e=>e.goal_id!==t);return n.length===e.run_history.goals.length&&r.length===e.attention_queue.items.length?e:{...e,attention_queue:{...e.attention_queue,items:r},run_history:{...e.run_history,goals:n}}}function em(e){return Zp.parse(e)}function tm(e){return e instanceof Lu?e.issues.map(e=>`${e.path.join(`.`)||`root`}: ${e.message}`).join(`; `):e instanceof Error?e.message:String(e)}var nm=em(mf),rm=J({ok:Y(!0),schema_version:Y(`loopx_workspace_directory_v1`),registry_revision:W(),goals:q(J({id:W(),display_name:W(),activation_state:Hd([`active`,`stopped`]),registry_member:Y(!0)}))});function im(e,t,n){let r=new URL(e,n);r.searchParams.delete(`goal_activation`),r.searchParams.delete(`goal_id`),r.searchParams.delete(`view`);for(let[e,n]of Object.entries(t))r.searchParams.set(e,n);return r.toString()}async function am(e,t){let n=await fetch(im(e,{view:`workspace-directory`},t),{cache:`no-store`,signal:AbortSignal.timeout(5e3)});if(!n.ok)return null;let r=rm.safeParse(await n.json());return r.success?r.data:null}function om(e){return em({ok:!0,registry:``,runtime_root:``,goal_count:e.goals.length,run_count:0,local_dashboard_api:{},contract:{ok:!0,summary:{errors:0,warnings:0,checks:0},errors:[],warnings:[]},attention_queue:{available:!1,item_count:0,needs_user_or_controller:0,needs_codex:0,watching_external_evidence:0,items:[]},run_history:{available:!1,goal_count:e.goals.length,run_count:0,goals:e.goals,recent_runs:[]}})}async function sm(e,t,n,r,i,a,o){let s=[...n.goals],c=new Map;async function l(){for(;s.length&&i()&&!o?.aborted;){let l=s.findIndex(e=>e.id===a()),u=l>=0?l:s.findIndex(e=>e.activation_state===`active`);if(u<0)return;let d=s.splice(u,1)[0],f=(c.get(d.id)??0)+1;c.set(d.id,f);let p=new AbortController,m=!1,h=()=>p.abort();o?.addEventListener(`abort`,h,{once:!0});let g=setTimeout(()=>{m=!0,p.abort()},3e4),_=null;try{let a=await fetch(im(e,{goal_id:d.id},t),{cache:`no-store`,signal:p.signal});if(!a.ok)_=a.status===409?`revision`:a.status>=500?`service`:`scope`;else{let e=await a.json();if(e.workspace_registry_revision!==n.registry_revision)_=`revision`;else{let t=em(e);!t.run_history.goals.some(e=>e.id===d.id)||t.run_history.goals.some(e=>e.id!==d.id)?_=`scope`:i()&&!o?.aborted&&r(d.id,t,null)}}}catch(e){_=m?`timeout`:e instanceof TypeError?`network`:`invalid`}finally{clearTimeout(g),o?.removeEventListener(`abort`,h)}if(!i()||o?.aborted)return;_&&[`timeout`,`network`,`service`].includes(_)&&f<3?(await new Promise(e=>setTimeout(e,f*1e3)),s.push(d)):_&&r(d.id,null,_)}}await Promise.all([l(),l()])}var cm=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),lm=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),um=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),dm=e=>{let t=um(e);return t.charAt(0).toUpperCase()+t.slice(1)},fm={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},pm=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},mm=(0,z.createContext)({}),hm=()=>(0,z.useContext)(mm),gm=(0,z.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=hm()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,z.createElement)(`svg`,{ref:c,...fm,width:t??l??fm.width,height:t??l??fm.height,stroke:e??f,strokeWidth:m,className:cm(`lucide`,p,i),...!a&&!pm(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),X=(e,t)=>{let n=(0,z.forwardRef)(({className:n,...r},i)=>(0,z.createElement)(gm,{ref:i,iconNode:t,className:cm(`lucide-${lm(dm(e))}`,`lucide-${e}`,n),...r}));return n.displayName=dm(e),n},_m=X(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),vm=X(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ym=X(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),bm=X(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),xm=X(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Sm=X(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Cm=X(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),wm=X(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Tm=X(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Em=X(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Dm=X(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Om=X(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),km=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Am=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),jm=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Mm=X(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Nm=X(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Pm=X(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Fm=X(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Im=X(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Lm=X(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Rm=X(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),zm=X(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Bm=X(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Vm=X(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Hm=X(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Um=X(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Wm=X(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Gm=X(`file-check-corner`,[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`,key:`g5mvt7`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14 20 2 2 4-4`,key:`15kota`}]]),Km=X(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qm=X(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Jm=X(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),Ym=X(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Xm=X(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Zm=X(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Qm=X(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),$m=X(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),eh=X(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),th=X(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),nh=X(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),rh=X(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ih=X(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),ah=X(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),oh=X(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),sh=X(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),ch=X(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),lh=X(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),uh=X(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),dh=X(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),fh=X(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),ph=X(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),mh=X(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),hh=X(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),gh=X(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),_h=X(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),vh=X(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),yh=X(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),bh=X(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),xh=X(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Sh=X(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ch=X(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),wh=X(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Th=X(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Eh=X(`test-tube-diagonal`,[[`path`,{d:`M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3`,key:`1ub6xw`}],[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`M12 16H4`,key:`1cjfip`}]]),Dh=X(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Oh=X(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),kh=X(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Ah=X(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),jh=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Mh(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||e.startsWith(`//`)}function Nh(e){return[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}function Ph(e,t,n){let r=e.trim();if(!r)return{error:`status URL is empty`};let i;try{i=new URL(r,t)}catch{return{error:`status URL is invalid`}}let a=!Mh(r),o=Nh(i.hostname);return!a&&!o?{error:`${n} must be relative or loopback`}:{source:{isLoopback:o,isRelative:a,url:r}}}function Fh(e,t){return Ph(e,t,`statusUrl`)}function Ih(e,t){let n=Ph(e,t,`Ops statusUrl`);return n.error?{error:`${n.error}; use showcase mode for public links.`}:n}async function Lh(e){let t=await fetch(e,{cache:`no-store`});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return em(await t.json())}function Rh(e,t,n){let r=new URL(e,n);return r.searchParams.set(`goal_activation`,t),r.toString()}function zh(e,t){if(!t.isLoopback)return null;let n=e.status_contract.schema_version??0;return n>=2?null:{reloadHint:e.status_contract.reload_hint||`scripts/macos-dashboard-launchagent.sh restart`,schemaVersion:n}}function Bh(e,t){if(!t||!e.isLoopback)return null;try{let n=new URL(e.url,window.location.href),r=new URL(t,n.origin);return Nh(r.hostname)?r.toString():null}catch{return null}}function Vh(e,t){return{detailUrl:Bh(t,e.local_dashboard_api?.periodic_report_detail_url),indexUrl:Bh(t,e.local_dashboard_api?.periodic_report_index_url)}}async function Hh(e,t){let n=new URL(e);n.searchParams.set(`goal_id`,t),n.searchParams.set(`limit`,`100`),n.searchParams.set(`offset`,`0`);let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published reports`);return Jp.parse(await r.json()).periodic_reports}async function Uh(e,t){let n=new URL(e);Object.entries(t).forEach(([e,t])=>n.searchParams.set(e,t));let r=await fetch(n,{cache:`no-store`});if(!r.ok)throw Error(`HTTP ${r.status} while loading published report detail`);return Xp.parse(await r.json()).projection}function Wh(e,t){let n=e.local_dashboard_api,r=Bh(t,n?.reward_dry_run_url),i=Bh(t,n?.reward_append_url),a=Bh(t,n?.configure_goal_dry_run_url),o=Bh(t,n?.configure_goal_apply_url),s=!!(n?.reward_write_enabled&&i),c=!!(n?.control_plane_write_enabled&&o);return{controlPlaneApplyUrl:o,controlPlaneDryRunUrl:a,controlPlaneWriteEnabled:c,loopbackOnly:t.isLoopback,readOnlyDefault:!s&&!c,rewardAppendUrl:i,rewardDryRunUrl:r,rewardWriteEnabled:s,source:n?.source??`not advertised`}}function Gh(e,t,n){let r=e.find(e=>e.agentId===t&&e.available)??e.find(e=>e.agentId===n&&e.available)??e.find(e=>e.available);if(!r)throw Error(`Chat requires at least one available route`);return r}function Kh(e){return!!(e&&typeof e==`object`&&e.session_invalidated===!0)}var qh=``.replace(/\/+$/,``);function Jh(e){return!qh||/^https?:\/\//.test(e)?e:new URL(e,`${qh}/`).toString()}var Yh=J({todo_id:W().nullable(),role:W().nullable(),status:W(),priority:W().nullable(),text:W(),action_kind:W().nullable(),task_class:W().nullable(),claimed_by:W().nullable(),evidence:W().nullable()}),Xh=J({goal_id:W(),title:W(),objective:W(),status:W(),waiting_on:W().nullable(),severity:W().nullable(),gate:W(),next_action:W(),top_todo:Yh.nullable(),todos:q(Yh),evidence:q(W()),quota:J({state:W().nullable(),spent_slots:G().nullable(),allowed_slots:G().nullable(),reason:W().nullable()})});J({ok:K(),schema_version:Y(`loopx_chat_status_v0`),selected_goal_id:W().nullable(),goal_count:G(),goals:q(Xh)});var Zh=J({ok:Y(!0),schema_version:Hd([`loopx_chat_capabilities_v0`,`loopx_chat_capabilities_v1`]),agent_backend:W(),sandbox:W(),approval_policy:W(),todo_write:W(),goal_subagent_configuration:W().optional(),goal_id:W().nullable(),streaming:K().optional(),resume:K().optional(),interrupt:K().optional(),typed_actions:K().optional(),action_kinds:q(W()).optional(),adapters:q(J({agent_id:W(),display_name:W(),adapter_kind:W(),available:K(),streaming:K(),resume:K(),interrupt:K(),location:W().optional(),source:W().optional(),tool_calls:K().optional(),trust_scope:W().optional()})).optional(),lark_cli:J({available:K(),source:W(),version:W().nullable(),error_code:W().nullable()}).optional()}),Qh=J({kind:Y(`todo`),text:W(),priority:Hd([`P0`,`P1`,`P2`]),rationale:W()}),$h=J({operation:Hd([`merge`,`release`,`deploy`,`delete`,`payment`]),target:W().min(1).max(160),summary:W().max(300)}),eg=J({schema_version:Y(`loopx_chat_agent_response_v0`),message:W(),proposals:q(Qh),protected_action:$h.nullable().optional().default(null),gate:J({kind:W(),summary:W(),next_action:W()}).nullable()}),tg=J({closed:Y(!0),ok:Y(!0),session_id:W().min(1)});J({dry_run:Y(!0),ok:Y(!0),preview_id:W().min(1),todo:J({goal_id:W().min(1),text:W(),todo_id:W().optional()})});var ng=J({schema_version:Y(`loopx_chat_todo_receipt_v0`),receipt_id:W().min(1),preview_id:W().min(1),goal_id:W().min(1),todo_id:W().min(1),status:Y(`applied`),outcome:Hd([`todo_added`,`todo_already_exists`]),already_exists:K(),preview_revision:W().nullable()});J({applied:Y(!0),ok:Y(!0),receipt:ng,todo:J({text:W(),todo_id:W()})});var rg=J({mode:W(),spawn_allowed:K(),max_children:G().int().nonnegative(),allowed_domains:q(W()).optional().default([])}).passthrough(),ig=J({ok:Y(!0),dry_run:K(),execute:K(),written:K(),changed:K(),goal_id:W().min(1),changed_fields:q(W()),before:J({orchestration:rg}).passthrough(),after:J({orchestration:rg}).passthrough(),preview_id:W().min(1),feature_summary:J({multi_subagent:Hd([`off`,`enabled`])}).passthrough(),global_sync:J({required:K(),executed:K(),readback:J({status:W(),verified:K()}).passthrough()}).passthrough()}),ag=J({id:W().min(1),outcome:Hd([`approved`,`rejected`,`cancelled`]),projectionVerified:K().nullable(),proposal:Qh,receipt:ng.nullable()}).superRefine((e,t)=>{e.outcome===`approved`&&!e.receipt&&t.addIssue({code:`custom`,message:`approved decision history requires a Todo receipt`,path:[`receipt`]}),e.outcome!==`approved`&&e.receipt&&t.addIssue({code:`custom`,message:`zero-write decision history must not include a Todo receipt`,path:[`receipt`]})});J({schema_version:Y(`loopx_chat_decision_history_v0`),goal_id:W().min(1),decisions:q(ag).max(24)});var og=class extends Error{payload;constructor(e,t){super(e),this.payload=t}},sg=Hd([`goal.create`,`goal.update`,`goal.lifecycle`,`todo.create`,`todo.update`,`agent.bind`,`heartbeat.bind`,`monitor.create`,`monitor.update`,`gate.resolve`,`run.correct`]),cg=J({schema_version:Y(`loopx_chat_action_proposal_v1`),proposal_id:W().min(1),action_kind:sg,summary:W().min(1),normalized_parameters:Bd(W(),Od()),context:Bd(W(),Od()),expected_state_fingerprint:W().min(1),permission_classification:W().min(1),validation_evidence:q(Od()),available_transitions:q(Hd([`apply`,`cancel`,`regenerate`,`reject`,`defer`])),status:Hd([`preview_ready`,`applying`,`gated`,`failed`,`rejected`,`deferred`,`cancelled`,`stale`,`applied`]),receipt:Bd(W(),Od()).nullable(),stale:Bd(W(),Od()).nullable(),gate:Bd(W(),Od()).nullable().optional(),error:Bd(W(),Od()).nullable().optional(),checkpoint:Bd(W(),Od()).nullable().optional(),regenerated_from:W().nullable().optional(),created_at:W(),updated_at:W()}),lg=J({ok:Y(!0),proposal:cg});async function ug(e){let t=await gg(`/api/actions/preview`,{method:`POST`,body:JSON.stringify({action_kind:e.actionKind,context:e.context,idempotency_key:e.idempotencyKey,normalized_parameters:e.normalizedParameters,summary:e.summary})});return lg.parse(t).proposal}var dg=J({ok:Y(!0),schema_version:Y(`loopx_chat_action_list_v1`),proposals:q(cg)});async function fg(e={}){let t=new URLSearchParams;e.contextKind&&t.set(`context_kind`,e.contextKind),e.goalId&&t.set(`goal_id`,e.goalId);let n=t.size>0?`?${t.toString()}`:``;return dg.parse(await gg(`/api/actions${n}`)).proposals}async function pg(e){let t=await gg(`/api/actions/${encodeURIComponent(e)}/apply`,{method:`POST`,body:`{}`});return J({ok:Y(!0),proposal:cg,turn:Bd(W(),Od()).nullable().optional()}).parse(t)}async function mg(e){return lg.parse(await gg(`/api/actions/${encodeURIComponent(e)}/cancel`,{method:`POST`,body:`{}`})).proposal}async function hg(e,t){return lg.parse(await gg(`/api/actions/${encodeURIComponent(e)}/${t}`,{method:`POST`,body:`{}`})).proposal}async function gg(e,t){let n;try{n=await fetch(Jh(e),{cache:`no-store`,...t,headers:{"Content-Type":`application/json`,...t?.headers}})}catch{throw new og(`无法连接 LoopX Chat 服务。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`,{error_code:`chat_api_unavailable`})}let r=await n.text(),i=null;if(r.trim())try{i=JSON.parse(r)}catch{i=null}let a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};if(!n.ok){let e=(a.proposal&&typeof a.proposal==`object`?a.proposal:null)?.status===`stale`?`来源状态已变化,请重新生成预览。`:null,t=n.status>=500?`LoopX Chat 服务暂时不可用(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务已启动且来自同一版本。`:`LoopX Chat 请求失败(HTTP ${n.status})。`;throw new og(e??String(a.error||t),Object.keys(a).length?a:{error_code:`chat_api_unavailable`,http_status:n.status})}if(i===null)throw new og(`LoopX Chat 服务返回了无法识别的响应(HTTP ${n.status})。请确认 Dashboard 与 Chat 服务来自同一版本。`,{error_code:`invalid_chat_api_response`,http_status:n.status});return i}async function _g(){return Zh.parse(await gg(`/api/chat/capabilities`))}async function vg(e){return gg(`/api/chat/projection-messages`,{method:`POST`,body:JSON.stringify({answer:e.answer,context_kind:e.contextKind,goal_id:e.goalId,question:e.question})})}async function yg(e,t=`codex`,n=`resume_latest`,r=`goal`){return gg(`/api/chat/sessions`,{method:`POST`,body:JSON.stringify({goal_id:e,agent_id:t,mode:n,context_kind:r})})}async function bg(e){return gg(`/api/chat/sessions/${e}`)}async function xg(e){let t=new URLSearchParams;return e.agentId&&t.set(`agent_id`,e.agentId),e.channelId&&t.set(`channel_id`,e.channelId),e.goalId&&t.set(`goal_id`,e.goalId),gg(`/api/chat/sessions?${t.toString()}`)}function Sg(e){let t=new Map;for(let n of e)for(let e of n.messages)t.set(e.message_id,e);return[...t.values()].sort((e,t)=>e.created_at.localeCompare(t.created_at)||e.message_id.localeCompare(t.message_id))}async function Cg(e){let t=await xg(e),n=await Promise.all(t.sessions.map(e=>bg(e.session_id)));return{messages:Sg(n),sessions:t.sessions,snapshots:n}}async function wg(e,t,n,r=[]){return gg(`/api/chat/sessions/${e}/turns`,{method:`POST`,body:JSON.stringify({message:t,client_turn_id:n,...r.length?{attachments:r.map(e=>({data_url:e.dataUrl,id:e.id,mime_type:e.mimeType,name:e.name,size:e.size}))}:{}})})}function Tg(e){let t=e.split(` +`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(` +`);if(!t)return null;try{let e=JSON.parse(t);return!e.kind||!e.payload||typeof e.payload!=`object`?null:{event_id:String(e.event_id??``),sequence:Number(e.sequence??0),kind:String(e.kind),created_at:String(e.created_at??``),payload:e.payload}}catch{return null}}async function Eg(e,t,n){let r=``,i=0,a=!1;for(;!a&&i<4;){let o=typeof window>`u`?`http://127.0.0.1`:window.location.origin,s=new URL(Jh(e),o);r&&s.searchParams.set(`after`,r);try{let e=await fetch(s,{cache:`no-store`,headers:{Accept:`text/event-stream`},signal:n});if(!e.ok||!e.body)throw new og(`SSE HTTP ${e.status}`,{status:e.status});let o=e.body.getReader(),c=new TextDecoder,l=``;for(;;){let{done:e,value:n}=await o.read();l+=c.decode(n,{stream:!e}).replaceAll(`\r +`,` +`);let i=l.indexOf(` + +`);for(;i>=0;){let e=l.slice(0,i);l=l.slice(i+2);let n=Tg(e);n&&(n.event_id&&(r=n.event_id),t(n),a=[`turn.completed`,`turn.interrupted`,`turn.failed`].includes(n.kind)),i=l.indexOf(` + +`)}if(e||a)break}i=a?i:i+1}catch(e){if(n?.aborted||(i+=1,i>=4))throw e;await new Promise(e=>globalThis.setTimeout(e,250*2**(i-1)))}}if(!a)throw new og(`Agent 事件流连接已断开。`,{reconnect_attempts:i})}async function Dg(e,t){return gg(`/api/chat/sessions/${e}/turns/${t}/interrupt`,{method:`POST`,body:`{}`})}async function Og(e,t,n={}){let r=await wg(e,t,n.clientTurnId??crypto.randomUUID(),n.attachments);return n.onPhase?.(`turn.accepted`,r.turn_id),kg(e,r.turn_id,r.events_url,n)}async function kg(e,t,n,r={}){let i=null,a={failure:null,interrupted:null};try{await Eg(n,e=>{r.onPhase?.(e.kind,t),(e.kind===`answer.delta`||e.kind===`assistant.delta`)&&r.onDelta?.(String(e.payload.text??``)),e.kind===`agent.phase`&&r.onActivity?.(String(e.payload.label??`Agent 正在处理`)),e.kind===`turn.completed`&&(i=e.payload.response),e.kind===`turn.failed`&&(a.failure=e.payload),e.kind===`turn.interrupted`&&(a.interrupted=e.payload)},r.signal)}catch(i){throw i instanceof og&&!r.signal?.aborted?new og(i.message,{...i.payload,events_url:n,reconnectable:!0,session_id:e,turn_id:t}):i}if(a.failure)throw new og(String(a.failure.message||`Agent 回合失败。`),a.failure);if(a.interrupted)throw new og(`Agent 回合已中断。`,{...a.interrupted,error_code:`turn_interrupted`,session_id:e,turn_id:t});return{response:eg.parse(i),sessionId:e,turnId:t}}async function Ag(e,t,n={}){return kg(e,t,`/api/chat/sessions/${e}/turns/${t}/events`,n)}async function jg(e){let t=tg.parse(await gg(`/api/chat/sessions/${e}`,{keepalive:!0,method:`DELETE`}));if(t.session_id!==e)throw new og(`Agent 会话关闭回执与本次请求不一致。`,{session_id:t.session_id});return t}async function Mg(e){return gg(`/api/chat/sessions/${e}/resume`,{method:`POST`,body:`{}`})}function Ng(e){return{goal_id:e.goalId,enabled:e.enabled,...e.enabled?{max_children:e.maxChildren,allowed_domains:e.allowedDomains}:{}}}function Pg(e,t){let n=e.after.orchestration,r=[...new Set(t.allowedDomains)],i=e.feature_summary.multi_subagent===`enabled`;if(!(e.goal_id===t.goalId&&i===t.enabled&&(t.enabled?n.max_children===t.maxChildren&&JSON.stringify(n.allowed_domains)===JSON.stringify(r):n.spawn_allowed===!1&&n.max_children===0)))throw new og(`Goal 子代理配置回执与本次请求不一致,界面已停止更新。`,{after:e.after,goal_id:e.goal_id});return e}async function Fg(e){let t=ig.parse(await gg(`/api/chat/goal-subagents/dry-run`,{method:`POST`,body:JSON.stringify(Ng(e))}));if(!t.dry_run||t.execute||t.written)throw new og(`Goal 子代理预览返回了非预览回执,已停止进入确认状态。`,{result:t});return Pg(t,e)}async function Ig(e,t){let n=ig.parse(await gg(`/api/chat/goal-subagents/apply`,{method:`POST`,body:JSON.stringify({...Ng(e),preview_id:t})}));if(n.preview_id!==t||n.dry_run||!n.execute)throw new og(`Goal 子代理写入回执与本次确认不一致,界面已停止更新。`,{result:n});if(n.changed&&(!n.written||!n.global_sync.executed||!n.global_sync.readback.verified))throw new og(`Goal 子代理设置未通过共享状态读回验证。`,{result:n});return Pg(n,e)}var Lg=J({ok:Y(!0),targets:q(J({enabled:K(),provider:W(),target_name:W()}))});async function Rg(){return Lg.parse(await gg(`/api/chat/goal-channel/targets`)).targets}var zg=J({ok:K(),blocker:W().optional(),public_summary:W().optional(),status:W().optional()});async function Bg(e){return zg.parse(await gg(`/api/chat/goal-channel/setup`,{method:`POST`,body:JSON.stringify({execute:e.execute,goal_id:e.goalId,target:e.target})}))}async function Vg(e){return zg.parse(await gg(`/api/chat/goal-channel/configure`,{method:`POST`,body:JSON.stringify({auto_notify_human_gates:e.autoNotify,goal_id:e.goalId})}))}J({schema_version:Y(`periodic_report_machine_defaults_v0`),enabled:K(),inheritance:Y(`live_machine_default`),profile_preset:W().optional(),route_ref:W().optional(),timezone:W()});var Hg=J({schema_version:Y(`loopx_machine_configuration_v0`),namespaces:Bd(W(),Bd(W(),Od()))}),Ug=J({namespace:W(),title:W(),description:W(),schema_versions:q(W()).min(1),configuration_template:Bd(W(),Od()),template_status:Hd([`ready`,`schema_only`])}),Wg=J({schema_version:Y(`machine_configuration_catalog_v0`),namespaces:q(Ug)}),Gg=J({key:W(),label:W(),description:W(),input_kind:Hd([`boolean`,`number`,`select`,`string_list`,`text`]),required:K(),minimum:G().int().optional(),maximum:G().int().optional(),options:q(W()).optional()}),Kg=J({schema_version:Y(`capability_configuration_editor_v0`),editable:K(),supported_scopes:q(Hd([`goal`,`machine`])),writable_scopes:q(Hd([`goal`,`machine`])),fields:q(Gg),read_only_reason:W().optional()}),qg=J({schema_version:Y(`capability_configuration_catalog_v0`),capabilities:q(J({capability_id:W(),display_name:W(),description:W(),available_scopes:q(Hd([`goal`,`machine`])),machine_namespace:W().optional(),goal_feature_id:W().optional(),effective_value_policy:Y(`goal_override_over_live_machine_default`).optional(),availability:W().optional(),default:Bd(W(),Od()).optional(),current:Bd(W(),Od()).optional(),machine_current:Bd(W(),Od()).optional(),effective_configuration:J({schema_version:Y(`capability_configuration_resolution_v0`),capability_id:W(),source:Hd([`goal_override`,`machine_default`,`capability_default`,`not_configured`]),configuration:Bd(W(),Od()).nullable(),inherited:K(),goal_override_present:K(),machine_default_present:K(),effective_revision:W()}).optional(),documentation:Bd(W(),Od()).optional(),configuration_editor:Kg}))}),Jg=J({ok:Y(!0),schema_version:Y(`goal_configuration_inspection_v0`),status:Y(`configured`),goal_id:W(),revision:W(),available_capabilities:q(W()),capability_catalog:qg}),Yg=J({ok:Y(!0),goal_id:W(),capability_id:W(),changed_fields:q(W()),goal_configuration:Bd(W(),Od()).nullable(),capability_catalog:qg}),Xg=Yg.extend({schema_version:Y(`goal_configuration_update_plan_v0`),status:Y(`preview`),action:Hd([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),base_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative()}),Zg=Pd([Yg.extend({schema_version:Y(`goal_configuration_transaction_v0`),status:Hd([`applied`,`unchanged`]),plan_revision:W(),applied_revision:W(),readback_verified:Y(!0)}),J({ok:Y(!1),schema_version:Y(`goal_configuration_transaction_v0`),status:Y(`partial_write`),goal_id:W(),capability_id:W(),plan_revision:W(),applied_revision:W().nullable(),source_written:Y(!0),shared_sync_pending:Y(!0),readback_verified:K(),changed_fields:q(W()),goal_configuration:Bd(W(),Od()).nullable(),capability_catalog:qg,error:W(),recommended_action:W()})]),Qg=J({ok:Y(!0),available_namespaces:q(W()),namespace_catalog:Wg.optional().default({schema_version:`machine_configuration_catalog_v0`,namespaces:[]}),capability_catalog:qg,changed_namespaces:q(W()).optional().default([]),machine_configuration:Hg.nullable().optional()}),$g=Qg.extend({schema_version:Y(`machine_configuration_inspection_v0`),status:Hd([`configured`,`absent`]),revision:W()}),e_=Qg.extend({schema_version:Y(`machine_configuration_update_plan_v0`),status:Y(`preview`),action:Hd([`create`,`update`,`delete`,`unchanged`]),current_revision:W(),desired_revision:W(),plan_revision:W(),writes_required:G().int().nonnegative(),machine_configuration:Hg.nullable()}),t_=Qg.extend({schema_version:Y(`machine_configuration_transaction_v0`),status:Hd([`applied`,`unchanged`]),plan_revision:W(),transaction_id:W().nullable(),readback_verified:Y(!0),rollback_available:K(),applied_revision:W().optional(),prior_revision:W().optional()}),n_=Qg.extend({schema_version:Y(`machine_configuration_rollback_plan_v0`),status:Y(`preview`),action:Hd([`delete`,`restore`,`unchanged`,`blocked`]),reason:W(),transaction_id:W(),plan_revision:W(),rollback_allowed:K(),writes_required:G().int().nonnegative()}),r_=Qg.extend({schema_version:Y(`machine_configuration_rollback_receipt_v0`),status:Hd([`rolled_back`,`unchanged`]),transaction_id:W(),plan_revision:W(),rollback_id:W().nullable(),readback_verified:Y(!0)});async function i_(){return $g.parse(await gg(`/api/chat/machine-configuration`))}async function a_(e){let t=new URLSearchParams({goal_id:e});return Jg.parse(await gg(`/api/chat/goal-configuration?${t.toString()}`))}async function o_(e,t,n){return Xg.parse(await gg(`/api/chat/goal-configuration/preview`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n})}))}async function s_(e,t,n,r){return Zg.parse(await gg(`/api/chat/goal-configuration/apply`,{method:`POST`,body:JSON.stringify({goal_id:e,capability_id:t,configuration:n,expected_plan_revision:r})}))}async function c_(e,t){return e_.parse(await gg(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,namespace_configuration:t})}))}async function l_(e,t,n){return t_.parse(await gg(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:n,namespace:e,namespace_configuration:t})}))}async function u_(e){return e_.parse(await gg(`/api/chat/machine-configuration/preview`,{method:`POST`,body:JSON.stringify({namespace:e,operation:`remove`})}))}async function d_(e,t){return t_.parse(await gg(`/api/chat/machine-configuration/apply`,{method:`POST`,body:JSON.stringify({expected_plan_revision:t,namespace:e,operation:`remove`})}))}async function f_(e){return n_.parse(await gg(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!1,transaction_id:e})}))}async function p_(e,t){return r_.parse(await gg(`/api/chat/machine-configuration/rollback`,{method:`POST`,body:JSON.stringify({execute:!0,expected_plan_revision:t,transaction_id:e})}))}var m_=J({ok:Y(!0),goals:q(J({goal_id:W(),repository:J({branch:W(),identity:W(),label:W(),read_only:Y(!0)})}))});async function h_(){return m_.parse(await gg(`/api/chat/goals/contexts`)).goals}var g_=J({ok:Y(!0),apps:q(J({active:K(),app_ref:W(),brand:W(),health_error_code:W().nullable().default(null),label:W(),ready:K(),reply_ready:K().default(!1)}))});async function __(){return g_.parse(await gg(`/api/chat/lark/apps`)).apps}var v_=J({ok:Y(!0),app_ref:W(),error:W().nullable(),setup_id:W(),status:Hd([`starting`,`waiting_for_feishu`,`ready`,`failed`,`cancelled`]),verification_url:W().url().nullable()});async function y_(e){return v_.parse(await gg(`/api/chat/lark/app-setups`,{method:`POST`,body:JSON.stringify({app_ref:e.appRef,brand:e.brand})}))}async function b_(e){return v_.parse(await gg(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`))}async function x_(e){return v_.parse(await gg(`/api/chat/lark/app-setups/${encodeURIComponent(e)}`,{method:`DELETE`}))}var S_=[`invalid_event`,`binding_unavailable`,`chat_mismatch`,`topic_mismatch`,`route_ambiguous`,`self_message`,`invalid_routing_state`,`not_addressed`],C_=J({ok:Y(!0),chats:q(J({chat_id:W(),chat_name:W()}))});async function w_(e,t){let n=new URLSearchParams({app_ref:e});return t&&n.set(`query`,t),C_.parse(await gg(`/api/chat/lark/chats?${n.toString()}`)).chats}var T_=J({ok:Y(!0),connections:q(J({agent_id:W().nullable().default(null),connection_id:W(),app_label:W(),app_ref:W(),capture_scope:Hd([`addressed_only`,`configured_chat_all`]).default(`addressed_only`),chat_name:W(),enabled:K(),goal_id:W(),goal_title:W(),health_error_code:W().nullable().default(null),history_permission_guidance:J({action:Y(`enable_application_scopes_and_publish`),api_document_url:W().url(),capability:Y(`group_history_pagination`),identity:Y(`bot`),required_scopes:Rd([Y(`im:message.group_msg`),Y(`im:message.group_msg.include_bot:read`)]),schema_version:Y(`lark_bot_group_history_permission_guidance_v0`)}).nullable().default(null),incoming_mode:Hd([`mentions`,`all`]),ingress_mode:Hd([`live_steering`,`session_queue`,`async_inbox`,`direct_session`]).default(`async_inbox`),event_count:G().int().nonnegative().default(0),last_event_reason:Hd(S_).nullable().default(null).catch(null),last_event_status:W().nullable().default(null),listener_error_code:W().nullable().default(null),listener_status:Hd([`starting`,`listening`,`retrying`,`stopped`]).nullable().default(null),replied_count:G().int().nonnegative().default(0),reply_ready:K().default(!1),reply_mode:Y(`topic_reply`),session_bound:K().default(!1),target_ref:W(),topic_name:W(),topic_setup_required:K()}))});async function E_(){return T_.parse(await gg(`/api/chat/lark/connections`)).connections}async function D_(e){return zg.parse(await gg(`/api/chat/lark/connections`,{method:`POST`,body:JSON.stringify({...e.agentId?{agent_id:e.agentId}:{},app_ref:e.appRef,capture_scope:e.captureScope,chat_id:e.chatId,chat_name:e.chatName,execute:e.execute,goal_id:e.goalId,incoming_mode:e.incomingMode,ingress_mode:e.ingressMode,reply_mode:e.replyMode})}))}async function O_(e,t){let n=new URLSearchParams({goal_id:e,connection_id:t});return zg.parse(await gg(`/api/chat/lark/connections?${n.toString()}`,{method:`DELETE`}))}function k_(e){return{loadedUrl:null,projectionRevision:0,requestedUrl:e,selectionRevision:0,requestGeneration:0}}function A_(e,t){return e.selectionRevision+=1,e.requestedUrl=t,e.selectionRevision}function j_(e,t,n){if(n.background)return e.requestedUrl!==null||e.loadedUrl!==t?null:(e.requestGeneration+=1,{background:!0,projectionRevision:e.projectionRevision,selectionRevision:e.selectionRevision,url:t,generation:e.requestGeneration});let r=n.selectionRevision??e.selectionRevision+1;return n.selectionRevision!==void 0&&e.selectionRevision!==r?null:(e.selectionRevision=r,e.projectionRevision+=1,e.requestedUrl=t,e.requestGeneration+=1,{background:!1,projectionRevision:e.projectionRevision,selectionRevision:r,url:t,generation:e.requestGeneration})}function M_(e,t){return t.generation===e.requestGeneration&&e.projectionRevision===t.projectionRevision&&e.selectionRevision===t.selectionRevision}function N_(e,t){return M_(e,t)&&(!t.background||e.requestedUrl===null&&e.loadedUrl===t.url)}function P_(e,t,n){return t.get(e)===n}function F_(e,t,n,r){return e.filter(e=>P_(r(e),n,t))}function I_(e,t,n){let r=new Set,i=[];for(let a of[...e,...t]){let e=n(a);e==null||r.has(e)||(r.add(e),i.push(a))}return i}var L_=[`runs_24h`,`runs_7d`,`quota_spend_slots_24h`,`quota_spend_slots_7d`,`automation_run_count_24h`,`automation_run_count_7d`,`progress_signal_run_count_24h`,`progress_signal_run_count_7d`,`input_tokens_24h`,`input_tokens_7d`,`output_tokens_24h`,`output_tokens_7d`,`cache_tokens_24h`,`cache_tokens_7d`,`cost_usd_24h`,`cost_usd_7d`,`duration_ms_24h`,`duration_ms_7d`],R_=[`accounting`,`decision`,`evidence`,`state`,`work`],z_={accounting:0,decision:0,evidence:0,state:0,work:0},B_={runs_24h:0,runs_7d:0,quota_spend_slots_24h:0,quota_spend_slots_7d:0,automation_run_count_24h:0,automation_run_count_7d:0,progress_signal_run_count_24h:0,progress_signal_run_count_7d:0,input_tokens_24h:0,input_tokens_7d:0,output_tokens_24h:0,output_tokens_7d:0,cache_tokens_24h:0,cache_tokens_7d:0,cost_usd_24h:0,cost_usd_7d:0,duration_ms_24h:0,duration_ms_7d:0};function V_(e,t){let n={...e};for(let r of L_)n[r]=(Number(e[r])||0)+(Number(t[r])||0);return n}function H_(e,t){return!e.length||t<=0?e:e.map(e=>({...e,project_share_24h:Math.round((Number(e.runs_24h)||0)/t*1e3)/1e3}))}function U_(e,t){let n={...e};for(let r of R_)n[r]=(e[r]??0)+(t[r]??0);return n}function W_(e){let t={events_24h:0,events_7d:0,by_class_24h:{...z_},by_class_7d:{...z_}};for(let n of e)t.events_24h+=n.events_24h,t.events_7d+=n.events_7d,t.by_class_24h=U_(t.by_class_24h,n.by_class_24h),t.by_class_7d=U_(t.by_class_7d,n.by_class_7d);return t}function G_(e,t,n){if(!e&&!t)return null;let r=F_(e?.goals??[],`active`,n,e=>e.goal_id),i=F_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=I_(r,i,e=>e.goal_id),o=W_(r),s=W_(i),c={events_24h:o.events_24h+s.events_24h,events_7d:o.events_7d+s.events_7d,by_class_24h:U_(o.by_class_24h,s.by_class_24h),by_class_7d:U_(o.by_class_7d,s.by_class_7d)};return{...e??t,goals:a,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:c}}function K_(e,t,n){if(!e&&!t)return null;let r=I_([...F_(e?.items??[],`active`,n,e=>e.goal_id),...F_(t?.items??[],`stopped`,n,e=>e.goal_id)],[],e=>`${e.goal_id}:${e.decision_kind??``}:${e.decision_at??``}`),i={decision_count:(e?.summary.decision_count??0)+(t?.summary.decision_count??0),stale_count:r.filter(e=>e.stale_by_age).length,rebase_required_count:(e?.summary.rebase_required_count??0)+(t?.summary.rebase_required_count??0),fresh_count:(e?.summary.fresh_count??0)+(t?.summary.fresh_count??0)};return{...e??t,items:r,sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),summary:i}}function q_(e,t){return I_([...e,...t].sort((e,t)=>t.generated_at.localeCompare(e.generated_at)),[],e=>`${e.goal_id}:${e.generated_at}:${e.classification??``}`)}function J_(e,t,n){let r=I_(F_(e.items,`active`,n,e=>e.goal_id),F_(t.items,`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e,item_count:r.length,items:r,needs_controller:r.filter(e=>e.waiting_on===`controller`).length,needs_codex:r.filter(e=>e.waiting_on===`codex`).length,needs_user_or_controller:r.filter(e=>[`user_or_controller`,`controller`].includes(e.waiting_on)).length,watching_external_evidence:r.filter(e=>e.waiting_on===`external_evidence`).length}}function Y_(e){let t=e.todo_id?.trim()||``;return t?`${e.goal_id}:${t}`:`${e.goal_id}:synthetic:${e.role??``}:${e.index??``}:${e.text??``}`}function X_(e){let t={...B_};for(let n of e)for(let e of L_)t[e]+=Number(n[e])||0;return t}function Z_(e,t,n){if(!e&&!t)return null;let r=F_(e?.items??[],`active`,n,e=>e.goal_id),i=F_(t?.items??[],`stopped`,n,e=>e.goal_id),a=I_(r,i,Y_);return{...e??t,current_projected_count:r.length+i.length,items:a,rollout_event_count:a.reduce((e,t)=>e+(t.event_count??0),0),total_count:a.length}}function Q_(e,t,n){if(!e&&!t)return null;let r=F_(e?.goals??[],`active`,n,e=>e.goal_id),i=F_(t?.goals??[],`stopped`,n,e=>e.goal_id),a=I_(r,i,e=>e.goal_id),o=V_(X_(r),X_(i));return{...e??t,goals:H_(a,Number(o.runs_24h)||0),sample_run_count:(e?.sample_run_count??0)+(t?.sample_run_count??0),totals:o}}function $_(e,t,n){if(!e&&!t)return null;let r=(e?.agents??[]).filter(e=>e.goal_ids.some(e=>P_(e,n,`active`))||(e.current_todo?.goal_id?P_(e.current_todo.goal_id,n,`active`):!1)),i=(t?.agents??[]).filter(e=>e.goal_ids.some(e=>P_(e,n,`stopped`))||(e.current_todo?.goal_id?P_(e.current_todo.goal_id,n,`stopped`):!1)),a=I_(r,i,e=>e.agent_id).map(e=>{let t=i.find(t=>t.agent_id===e.agent_id);return t?{...e,goal_ids:Array.from(new Set([...e.goal_ids??[],...t.goal_ids]))}:e});return{...e??t,agents:a,source_summary:(e??t)?.source_summary?{...(e??t).source_summary,projected_agent_count:a.length,registered_agent_count:new Set(a.map(e=>e.agent_id)).size}:(e??t)?.source_summary}}function ev(e,t,n){if(!e&&!t)return null;let r=I_(F_(e?.goals??[],`active`,n,e=>e.goal_id),F_(t?.goals??[],`stopped`,n,e=>e.goal_id),e=>e.goal_id);return{...e??t,goals:r}}function tv(e,t){let n=t.goal_projection?.scope;if(n!==`active`&&n!==`stopped`)return t;let r=n,i=t.run_history.goals,a=e.run_history.goals,o=I_(r===`active`?i:a.filter(e=>e.activation_state!==`stopped`),r===`stopped`?i:a.filter(e=>e.activation_state===`stopped`),e=>e.id),s=new Map(o.map(e=>[e.id,e.activation_state])),c=r===`active`?t:e,l=r===`stopped`?t:e,u=e.goal_projection?.registry_revision??null,d=t.goal_projection?.registry_revision??null,f=u===null||d===null||u===d;return{...e,agent_management_projection:$_(c.agent_management_projection,l.agent_management_projection,s),attention_queue:J_(c.attention_queue,l.attention_queue,s),decision_freshness_summary:K_(c.decision_freshness_summary,l.decision_freshness_summary,s),event_ledger_summary:G_(c.event_ledger_summary,l.event_ledger_summary,s),goal_channel_notification_projection:ev(c.goal_channel_notification_projection,l.goal_channel_notification_projection,s),goal_projection:{schema_version:`loopx_goal_projection_scope_v0`,...t.goal_projection,complete:f,projected_goal_count:o.length,registry_goal_count:t.goal_projection?.registry_goal_count??0,scope:`all`},run_history:{...e.run_history,goal_count:o.length,goals:o,recent_runs:q_(c.run_history.recent_runs,l.run_history.recent_runs),run_count:c.run_history.run_count+l.run_history.run_count},todo_index:Z_(c.todo_index,l.todo_index,s),usage_summary:Q_(c.usage_summary,l.usage_summary,s)}}function nv(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,av=rv,ov=(e,t)=>n=>{if(t?.variants==null)return av(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=iv(t)||iv(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return av(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},sv=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),lv=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),uv=`-`,dv=[],fv=`arbitrary..`,pv=e=>{let t=gv(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return hv(e);let n=e.split(uv);return mv(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?sv(i,t):t:i||dv}return n[e]||dv}}},mv=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=mv(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(uv):e.slice(t).join(uv),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?fv+r:void 0})(),gv=e=>{let{theme:t,classGroups:n}=e;return _v(n,t)},_v=(e,t)=>{let n=lv();for(let r in e){let i=e[r];vv(i,n,r,t)}return n},vv=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){bv(e,t,n);return}if(typeof e==`function`){xv(e,t,n,r);return}Sv(e,t,n,r)},bv=(e,t,n)=>{let r=e===``?t:Cv(t,e);r.classGroupId=n},xv=(e,t,n,r)=>{if(wv(e)){vv(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(cv(n,e))},Sv=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(uv),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,Tv=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ev=`!`,Dv=`:`,Ov=[],kv=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Av=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return kv(t,l,c,u)};if(t){let e=t+Dv,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):kv(Ov,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},jv=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Mv=e=>({cache:Tv(e.cacheSize),parseClassName:Av(e),sortModifiers:jv(e),postfixLookupClassGroupIds:Nv(e),...pv(e)}),Nv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Pv),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ev:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},Iv=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Mv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Fv(e,n);return i(e,a),a};return a=o,(...e)=>a(Iv(...e))},zv=[],Bv=e=>{let t=t=>t[e]||zv;return t.isThemeGetter=!0,t},Vv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Uv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Kv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yv=e=>Uv.test(e),Xv=e=>!!e&&!Number.isNaN(Number(e)),Zv=e=>!!e&&Number.isInteger(Number(e)),Qv=e=>e.endsWith(`%`)&&Xv(e.slice(0,-1)),$v=e=>Wv.test(e),ey=()=>!0,ty=e=>Gv.test(e)&&!Kv.test(e),ny=()=>!1,ry=e=>qv.test(e),iy=e=>Jv.test(e),ay=e=>!Z(e)&&!Q(e),oy=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),sy=e=>Sy(e,Ey,ny),Z=e=>Vv.test(e),cy=e=>Sy(e,Dy,ty),ly=e=>Sy(e,Oy,Xv),uy=e=>Sy(e,Ay,ey),dy=e=>Sy(e,ky,ny),fy=e=>Sy(e,wy,ny),py=e=>Sy(e,Ty,iy),my=e=>Sy(e,jy,ry),Q=e=>Hv.test(e),hy=e=>Cy(e,Dy),gy=e=>Cy(e,ky),_y=e=>Cy(e,wy),vy=e=>Cy(e,Ey),yy=e=>Cy(e,Ty),by=e=>Cy(e,jy,!0),xy=e=>Cy(e,Ay,!0),Sy=(e,t,n)=>{let r=Vv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Cy=(e,t,n=!1)=>{let r=Hv.exec(e);return r?r[1]?t(r[1]):n:!1},wy=e=>e===`position`||e===`percentage`,Ty=e=>e===`image`||e===`url`,Ey=e=>e===`length`||e===`size`||e===`bg-size`,Dy=e=>e===`length`,Oy=e=>e===`number`,ky=e=>e===`family-name`,Ay=e=>e===`number`||e===`weight`,jy=e=>e===`shadow`,My=Rv(()=>{let e=Bv(`color`),t=Bv(`font`),n=Bv(`text`),r=Bv(`font-weight`),i=Bv(`tracking`),a=Bv(`leading`),o=Bv(`breakpoint`),s=Bv(`container`),c=Bv(`spacing`),l=Bv(`radius`),u=Bv(`shadow`),d=Bv(`inset-shadow`),f=Bv(`text-shadow`),p=Bv(`drop-shadow`),m=Bv(`blur`),h=Bv(`perspective`),g=Bv(`aspect`),_=Bv(`ease`),v=Bv(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Q,Z],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Q,Z,c],T=()=>[Yv,`full`,`auto`,...w()],E=()=>[Zv,`none`,`subgrid`,Q,Z],D=()=>[`auto`,{span:[`full`,Zv,Q,Z]},Zv,Q,Z],O=()=>[Zv,`auto`,Q,Z],k=()=>[`auto`,`min`,`max`,`fr`,Q,Z],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],te=()=>[Yv,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ne=()=>[Yv,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],re=()=>[Yv,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[e,Q,Z],N=()=>[...b(),_y,fy,{position:[Q,Z]}],ie=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ae=()=>[`auto`,`cover`,`contain`,vy,sy,{size:[Q,Z]}],oe=()=>[Qv,hy,cy],P=()=>[``,`none`,`full`,l,Q,Z],F=()=>[``,Xv,hy,cy],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[Xv,Qv,_y,fy],ue=()=>[``,`none`,m,Q,Z],de=()=>[`none`,Xv,Q,Z],fe=()=>[`none`,Xv,Q,Z],pe=()=>[Xv,Q,Z],me=()=>[Yv,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$v],breakpoint:[$v],color:[ey],container:[$v],"drop-shadow":[$v],ease:[`in`,`out`,`in-out`],font:[ay],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$v],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$v],shadow:[$v],spacing:[`px`,Xv],text:[$v],"text-shadow":[$v],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Yv,Z,Q,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Q,Z]}],"container-named":[oy],columns:[{columns:[Xv,Z,Q,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Zv,`auto`,Q,Z]}],basis:[{basis:[Yv,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xv,Yv,`auto`,`initial`,`none`,Z]}],grow:[{grow:[``,Xv,Q,Z]}],shrink:[{shrink:[``,Xv,Q,Z]}],order:[{order:[Zv,`first`,`last`,`none`,Q,Z]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:te()}],"inline-size":[{inline:[`auto`,...ne()]}],"min-inline-size":[{"min-inline":[`auto`,...ne()]}],"max-inline-size":[{"max-inline":[`none`,...ne()]}],"block-size":[{block:[`auto`,...re()]}],"min-block-size":[{"min-block":[`auto`,...re()]}],"max-block-size":[{"max-block":[`none`,...re()]}],w:[{w:[s,`screen`,...te()]}],"min-w":[{"min-w":[s,`screen`,`none`,...te()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...te()]}],h:[{h:[`screen`,`lh`,...te()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...te()]}],"max-h":[{"max-h":[`screen`,`lh`,...te()]}],"font-size":[{text:[`base`,n,hy,cy]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,xy,uy]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qv,Z]}],"font-family":[{font:[gy,dy,t]}],"font-features":[{"font-features":[Z]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Q,Z]}],"line-clamp":[{"line-clamp":[Xv,`none`,Q,ly]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Q,Z]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Q,Z]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xv,`from-font`,`auto`,Q,cy]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Xv,`auto`,Q,Z]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Zv,Q,Z]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Q,Z]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Q,Z]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zv,Q,Z],radial:[``,Q,Z],conic:[Zv,Q,Z]},yy,py]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xv,Q,Z]}],"outline-w":[{outline:[``,Xv,hy,cy]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,u,by,my]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,by,my]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Xv,cy]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,by,my]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Xv,Q,Z]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Xv]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Q,Z]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Xv]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Q,Z]}],filter:[{filter:[``,`none`,Q,Z]}],blur:[{blur:ue()}],brightness:[{brightness:[Xv,Q,Z]}],contrast:[{contrast:[Xv,Q,Z]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,by,my]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,Xv,Q,Z]}],"hue-rotate":[{"hue-rotate":[Xv,Q,Z]}],invert:[{invert:[``,Xv,Q,Z]}],saturate:[{saturate:[Xv,Q,Z]}],sepia:[{sepia:[``,Xv,Q,Z]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Q,Z]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Xv,Q,Z]}],"backdrop-contrast":[{"backdrop-contrast":[Xv,Q,Z]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xv,Q,Z]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xv,Q,Z]}],"backdrop-invert":[{"backdrop-invert":[``,Xv,Q,Z]}],"backdrop-opacity":[{"backdrop-opacity":[Xv,Q,Z]}],"backdrop-saturate":[{"backdrop-saturate":[Xv,Q,Z]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xv,Q,Z]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Q,Z]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xv,`initial`,Q,Z]}],ease:[{ease:[`linear`,`initial`,_,Q,Z]}],delay:[{delay:[Xv,Q,Z]}],animate:[{animate:[`none`,v,Q,Z]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Q,Z]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Q,Z,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],zoom:[{zoom:[Zv,Q,Z]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Q,Z]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Q,Z]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[Xv,hy,cy,ly]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Ny(...e){return My(rv(e))}var Py=ov(`inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-zinc-500`,{variants:{variant:{primary:`border-slate-900 bg-slate-950 text-white hover:bg-slate-800 dark:border-zinc-100 dark:bg-zinc-50 dark:text-zinc-950 dark:hover:bg-zinc-200`,secondary:`border-slate-200 bg-white text-slate-900 hover:bg-slate-50 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:bg-zinc-900`,ghost:`border-transparent bg-transparent text-slate-700 hover:bg-slate-100 dark:text-zinc-300 dark:hover:bg-zinc-900`},size:{sm:`h-8 px-2 text-xs`,md:`h-9 px-3 text-sm`,icon:`h-9 w-9 px-0`}},defaultVariants:{variant:`secondary`,size:`md`}});function Fy({className:e,variant:t,size:n,...r}){return(0,B.jsx)(`button`,{className:Ny(Py({variant:t,size:n}),e),type:`button`,...r})}function Iy({className:e,...t}){return(0,B.jsx)(`section`,{className:Ny(`rounded-lg border border-slate-200/80 bg-white/95 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.04)] dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50`,e),...t})}function Ly({className:e,...t}){return(0,B.jsx)(`div`,{className:Ny(`p-4 pt-0`,e),...t})}function Ry(e){return{blockingTodoCount:e.blockingTodoCount,goalNotifications:e.goalNotifications,goals:e.goals,openUserTodoCount:e.openUserTodoCount,systemHealth:e.systemHealth,userTodos:e.userTodos,workers:e.workers}}function zy(e,t){return e.goals.find(e=>e.goalId===t)?.title??t}function By(e){return e.activationState===`stopped`||e.state===`已停止`?`stopped`:e.state===`已完成`?`history`:e.needsYou||e.state===`等你`?`needs_you`:e.state===`推进中`||e.state===`需修复`?`running`:e.state===`安静运行`?`observing`:`scheduled`}function Vy(e){let t=e??0;return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Hy(e){return`$${(e??0).toFixed(2)}`}function Uy(e){let t=e??0;return t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${Math.round(t/1e3)}s`:`${t}ms`}function Wy(e){return!!(e&&e.tokens24h+e.tokens7d+e.costUsd24h+e.costUsd7d+e.durationMs24h+e.durationMs7d>0)}function Gy(e){return Wy(e)?`7d ${Vy(e.tokens7d)} tokens · ${Hy(e.costUsd7d)}`:null}function Ky({ariaLabel:e,className:t,icon:n,onChange:r,options:i,prefixLabel:a,value:o}){let s=(0,z.useId)(),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(new Map),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(o),h=i.find(e=>e.value===o)??i[0],g=i.filter(e=>!e.disabled);(0,z.useEffect)(()=>{if(!d)return;let e=e=>{c.current?.contains(e.target)||f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[d]),(0,z.useEffect)(()=>{d&&u.current.get(p)?.focus()},[p,d]);function _(e){m(e)}function v(e=`selected`){let t=e===`last`?g.at(-1):g[0],n=e===`selected`&&h&&!h.disabled?h:t;n&&(f(!0),_(n.value))}function y({restoreFocus:e=!1}={}){f(!1),e&&l.current?.focus()}function b(e){e.disabled||(r(e.value),y({restoreFocus:!0}))}function x(e){if(!g.length)return;let t=g.findIndex(e=>e.value===p),n=t<0?0:(t+e+g.length)%g.length;_(g[n].value)}function S(e){e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),v(`selected`)):e.key===`ArrowUp`&&(e.preventDefault(),v(`last`))}function C(e,t){if(e.key===`ArrowDown`)e.preventDefault(),x(1);else if(e.key===`ArrowUp`)e.preventDefault(),x(-1);else if(e.key===`Home`)e.preventDefault(),g[0]&&_(g[0].value);else if(e.key===`End`){e.preventDefault();let t=g.at(-1);t&&_(t.value)}else e.key===`Enter`||e.key===` `?(e.preventDefault(),b(t)):e.key===`Escape`?(e.preventDefault(),y({restoreFocus:!0})):e.key===`Tab`&&y()}let w;return(0,B.jsxs)(`div`,{className:`personal-select${t?` ${t}`:``}`,ref:c,children:[(0,B.jsxs)(`button`,{"aria-controls":s,"aria-expanded":d,"aria-haspopup":`listbox`,"aria-label":e,className:`personal-select-trigger`,"data-value":o,onClick:()=>d?y():v(),onKeyDown:S,ref:l,role:`combobox`,type:`button`,children:[n?(0,B.jsx)(`span`,{className:`personal-select-icon`,children:n}):null,(0,B.jsxs)(`span`,{className:`personal-select-value`,children:[a?(0,B.jsx)(`small`,{children:a}):null,(0,B.jsx)(`span`,{children:h?.label??o})]}),(0,B.jsx)(Am,{"aria-hidden":!0,className:d?`is-open`:void 0,size:14})]}),d?(0,B.jsx)(`div`,{"aria-label":e,className:`personal-select-listbox`,id:s,role:`listbox`,children:i.map(e=>{let t=e.group&&e.group!==w;return w=e.group,(0,B.jsxs)(`div`,{className:`personal-select-option-wrap`,children:[t?(0,B.jsx)(`div`,{className:`personal-select-group-label`,children:e.group}):null,(0,B.jsxs)(`button`,{"aria-disabled":e.disabled||void 0,"aria-selected":e.value===o,className:`personal-select-option`,disabled:e.disabled,id:`${s}-${e.value.replace(/[^a-z0-9_-]/gi,`-`)}`,onClick:()=>b(e),onFocus:()=>m(e.value),onKeyDown:t=>C(t,e),ref:t=>{t?u.current.set(e.value,t):u.current.delete(e.value)},role:`option`,tabIndex:e.value===p?0:-1,type:`button`,children:[(0,B.jsx)(`span`,{children:e.label}),e.value===o?(0,B.jsx)(km,{"aria-hidden":!0,size:15}):null]})]},e.value)})}):null]})}function qy({agents:e,managerChatOpen:t,mobileNavigationOpen:n,onOpenGoalCapabilities:r,onOpenGoalDetail:i,onOpenManagerChat:a,onRefresh:o,onOpenNavigation:s,onSelectGoalTab:c,onSelectAgent:l,onReturnManagerHome:u,refreshState:d,readOnlySourceLabel:f,selectedAgentId:p,selectedGoal:m,selectedGoalTab:h}){let{locale:g,t:_}=ya(),[v,y]=(0,z.useState)(!1),b=(0,z.useRef)(null),x=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!v)return;function e(e){x.current?.contains(e.target)||y(!1)}function t(e){e.key===`Escape`&&(y(!1),b.current?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[v]),(0,z.useEffect)(()=>y(!1),[m?.goalId]);function S(e){y(!1),e?.()}return(0,B.jsxs)(`header`,{className:`personal-channel-header`,children:[(0,B.jsx)(`button`,{"aria-expanded":n??!1,"aria-label":_(`header.openGoalNavigation`),className:`personal-icon-button personal-mobile-menu`,onClick:s,type:`button`,children:(0,B.jsx)(nh,{size:18})}),(0,B.jsxs)(`div`,{className:`personal-channel-title`,children:[(0,B.jsx)(`h1`,{children:m?.title??_(`header.manager`)}),(0,B.jsx)(`p`,{children:m?m.loadState?_(m.loadState===`error`?`startup.goalError`:`startup.goalLoading`):`${m.agentLaneCount&&m.agentLaneCount>1?_(`header.workAgentCount`,{count:m.agentLaneCount}):m.agentLabel??m.agentId} · ${m.loadState?_(m.loadState===`error`?`startup.goalError`:`startup.goalLoading`):ba(m.state,g)}${Gy(m.usage)?` · ${Gy(m.usage)}`:``} · ${m.nextSentence}`:_(`header.managerDescription`)})]}),m?(0,B.jsxs)(`nav`,{"aria-label":_(`header.goalView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":h===`chat`?`page`:void 0,onClick:()=>c(`chat`),type:`button`,children:_(`header.chat`)}),(0,B.jsx)(`button`,{"aria-current":h===`tasks`?`page`:void 0,onClick:()=>c(`tasks`),type:`button`,children:_(`header.tasks`)}),(0,B.jsx)(`button`,{"aria-current":h===`files`?`page`:void 0,onClick:()=>c(`files`),type:`button`,children:_(`header.files`)})]}):(0,B.jsxs)(`nav`,{"aria-label":_(`header.managerView`),className:`personal-goal-tabs`,children:[(0,B.jsx)(`button`,{"aria-current":t?void 0:`page`,onClick:u,type:`button`,children:_(`header.managerOverview`)}),(0,B.jsx)(`button`,{"aria-current":t?`page`:void 0,onClick:a,type:`button`,children:_(`header.chat`)})]}),(0,B.jsxs)(`div`,{className:`personal-channel-actions`,children:[m&&i&&r?(0,B.jsxs)(`div`,{className:`personal-goal-tools`,ref:x,children:[(0,B.jsxs)(`button`,{"aria-expanded":v,"aria-haspopup":`menu`,"aria-label":_(`header.goalSettingsDescription`),className:`personal-goal-tools-trigger`,onClick:()=>y(e=>!e),ref:b,title:_(`header.goalSettingsDescription`),type:`button`,children:[(0,B.jsx)(Sh,{"aria-hidden":!0,size:16}),(0,B.jsx)(`span`,{children:_(`header.goalSettings`)}),(0,B.jsx)(Am,{"aria-hidden":!0,size:13})]}),v?(0,B.jsxs)(`fieldset`,{"aria-label":_(`header.goalSettings`),className:`personal-goal-tools-menu`,children:[(0,B.jsxs)(`button`,{onClick:()=>S(i),type:`button`,children:[(0,B.jsx)(Ym,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:_(`header.goalDetails`)}),(0,B.jsx)(`small`,{children:_(`header.goalDetailsDescription`)})]})]}),(0,B.jsxs)(`button`,{onClick:()=>S(r),type:`button`,children:[(0,B.jsx)(Sh,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:_(`header.goalCapabilities`)}),(0,B.jsx)(`small`,{children:_(`header.goalCapabilitiesDescription`)})]})]})]}):null]}):null,f?(0,B.jsxs)(`span`,{className:`personal-read-only-source`,title:_(`header.readOnlySourceDescription`,{source:f}),children:[(0,B.jsx)(Um,{size:15}),f,(0,B.jsx)(`small`,{children:_(`common.readOnly`)})]}):(0,B.jsx)(Ky,{ariaLabel:_(`header.selectChatRuntime`),className:`personal-agent-select`,icon:(0,B.jsx)(Tm,{size:16}),onChange:l,options:e.map(e=>({disabled:!e.available,label:`${e.label}${e.available?``:` · ${_(`header.agentUnavailable`)}`}`,value:e.agentId})),prefixLabel:_(`header.chatRuntime`),value:p}),(0,B.jsxs)(`span`,{className:`personal-live-indicator`,children:[(0,B.jsx)(`i`,{}),_(`header.live`)]}),o?(0,B.jsxs)(`span`,{className:`personal-refresh-control is-${d??`idle`}`,children:[d===`loading`?(0,B.jsx)(`small`,{children:_(`header.refreshing`)}):d===`done`?(0,B.jsx)(`small`,{children:_(`header.refreshDone`)}):d===`error`?(0,B.jsx)(`small`,{children:_(`header.refreshFailed`)}):null,(0,B.jsx)(`button`,{"aria-label":_(d===`loading`?`header.refreshing`:`header.refresh`),className:`personal-icon-button`,disabled:d===`loading`,onClick:o,type:`button`,children:(0,B.jsx)(ph,{className:d===`loading`?`is-spinning`:void 0,size:17})})]}):null]})]})}function Jy({attention:e,onSelect:t}){let{t:n}=ya(),r=Sa(e.updatedAt,n);return(0,B.jsxs)(`button`,{className:`personal-timeline-row personal-attention-row`,"data-testid":`personal-browse-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-attention`,children:(0,B.jsx)(Nm,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[e.goalTitle??e.goalId,` · `,n(`home.lane.needsYou`),r?` · ${n(`tasks.waitingAge`,{age:r})}`:``]}),(0,B.jsx)(`strong`,{children:e.text})]}),(0,B.jsx)(`span`,{className:`personal-priority-dot is-${e.priority??(e.blocking?`high`:`medium`)}`}),(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?n(`tasks.blocked`):n(`tasks.pending`)}),(0,B.jsx)(jm,{size:17})]})}var Yy=/(`[^`\n]+`)|(\*\*[^*\n]+(\*[^*\n]*)?\*\*)|(\[[^\]\n]{1,120}\]\(https?:\/\/[^)\s]+\))/g;function Xy(e,t){let n=[],r=0,i=0;for(let a of e.matchAll(Yy)){let o=a.index??0;o>r&&n.push(e.slice(r,o));let s=a[0],c=`${t}-i${i++}`;if(s.startsWith("`"))n.push((0,B.jsx)(`code`,{className:`personal-md-code`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`))n.push((0,B.jsx)(`strong`,{children:s.slice(2,-2)},c));else{let e=s.indexOf(`](`),t=s.slice(1,e),r=s.slice(e+2,-1);n.push((0,B.jsx)(`a`,{className:`personal-md-link`,href:r,rel:`noreferrer`,target:`_blank`,children:t},c))}r=o+s.length}return r{r.length>0&&(n.push({type:`paragraph`,lines:r}),r=[])},a=0;for(;a{let n=`b${t}`;if(e.type===`code`)return(0,B.jsx)(`pre`,{className:`personal-md-pre`,children:(0,B.jsx)(`code`,{children:e.text})},n);if(e.type===`heading`)return(0,B.jsx)(`p`,{className:`personal-md-heading is-h${e.level}`,children:Xy(e.text,n)},n);if(e.type===`list`){let t=e.items.map((e,t)=>(0,B.jsx)(`li`,{children:Xy(e,`${n}-${t}`)},`${n}-${t}`));return e.ordered?(0,B.jsx)(`ol`,{className:`personal-md-list`,children:t},n):(0,B.jsx)(`ul`,{className:`personal-md-list`,children:t},n)}return(0,B.jsx)(`p`,{children:e.lines.map((e,t)=>(0,B.jsxs)(z.Fragment,{children:[t>0?(0,B.jsx)(`br`,{}):null,Xy(e,`${n}-${t}`)]},`${n}-${t}`))},n)})})}function tb({onSelect:e,output:t}){let{t:n}=ya(),r=t.kind===`report`?Km:Gm;return(0,B.jsxs)(`button`,{className:`personal-timeline-row personal-output-row`,"data-output-kind":t.kind,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-output`,children:(0,B.jsx)(r,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsxs)(`small`,{children:[t.goalTitle??t.goalId,` · `,t.agentLabel??`LoopX`]}),(0,B.jsx)(`strong`,{children:t.title}),t.summary?(0,B.jsx)(`span`,{children:t.summary}):null,t.report?(0,B.jsxs)(`small`,{children:[n(`files.reportDelta`,{added:t.report.addedCount,changed:t.report.changedCount}),` · `,n(`files.verifiedReport`)]}):null]}),t.createdAt?(0,B.jsx)(`time`,{children:t.createdAt}):null,(0,B.jsx)(jm,{size:17})]})}var nb={completed:`runs.completed`,failed:`runs.failed`,interrupted:`runs.interrupted`,queued:`runs.queued`,running:`runs.running`,waiting:`runs.waiting`};function rb({onSelect:e,run:t}){let{t:n}=ya(),r=t.totalSteps>0?Math.min(100,t.completedSteps/t.totalSteps*100):0;return(0,B.jsxs)(`button`,{"aria-label":`${n(`tasks.viewExecution`)}:${t.title}`,className:`personal-timeline-row personal-run-row`,"data-testid":`personal-browse-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-row-icon is-run`,children:(0,B.jsx)(Tm,{size:18})}),(0,B.jsxs)(`span`,{className:`personal-run-identity`,children:[(0,B.jsx)(`small`,{children:t.goalTitle}),(0,B.jsx)(`strong`,{children:t.agentLabel})]}),(0,B.jsxs)(`span`,{className:`personal-row-copy`,children:[(0,B.jsx)(`strong`,{children:t.title}),(0,B.jsx)(`small`,{children:t.latestActivity})]}),(0,B.jsxs)(`span`,{className:`personal-run-progress`,"aria-label":`${t.completedSteps}/${t.totalSteps}`,children:[(0,B.jsxs)(`small`,{children:[t.completedSteps,`/`,t.totalSteps]}),(0,B.jsx)(`i`,{children:(0,B.jsx)(`b`,{style:{width:`${r}%`}})})]}),(0,B.jsxs)(`span`,{className:`personal-row-status is-${t.status}`,children:[t.status===`running`?(0,B.jsx)(eh,{className:`personal-spin`,size:14}):null,n(nb[t.status])]}),t.sessionId?(0,B.jsx)(`span`,{className:`personal-run-open-label`,children:n(`tasks.viewExecution`)}):null,(0,B.jsx)(jm,{size:17})]})}function ib({onSelect:e,schedule:t}){let{t:n}=ya(),r=t.scheduleKind===`heartbeat`;return(0,B.jsxs)(`button`,{"aria-label":`${r?`Heartbeat`:n(`tasks.scheduled`)}:${t.label};${t.status??`active`}`,className:`personal-schedule-row`,onClick:e,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-schedule-icon`,children:r?(0,B.jsx)(fh,{size:17}):(0,B.jsx)(Dm,{size:17})}),(0,B.jsxs)(`span`,{className:`personal-schedule-copy`,children:[(0,B.jsx)(`small`,{children:n(r?`schedule.heartbeat`:`schedule.monitor`)}),(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`p`,{children:t.schedule??n(`schedule.summary`)})]}),(0,B.jsx)(`span`,{className:`personal-schedule-status is-${t.status??`active`}`,children:t.status===`paused`?n(`schedule.paused`):n(`schedule.active`)}),(0,B.jsx)(jm,{size:16})]})}function ab({items:e,onSelect:t,selectedGoal:n}){let{t:r}=ya();if(e.length===0)return(0,B.jsxs)(`div`,{className:`personal-timeline-empty`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Ch,{size:20})}),(0,B.jsx)(`strong`,{children:r(n?`timeline.emptyGoal`:`timeline.emptyWorkspace`)}),(0,B.jsx)(`p`,{children:r(n?`timeline.emptyGoalDescription`:`timeline.emptyWorkspaceDescription`)})]});let i=[...e].reverse().find(e=>e.kind===`message`&&e.message.role!==`user`||e.kind===`proposal`&&[`applied`,`stale`,`error`,`gated`].includes(e.proposal.status)||e.kind===`run`&&e.run.status===`completed`),a=i?.kind===`message`?`${i.message.agentLabel??r(`header.manager`)}:${i.message.pending?r(`timeline.pending`):i.message.text}`:i?.kind===`proposal`?`${i.proposal.title}:${i.proposal.status}`:i?.kind===`run`?r(`timeline.runCompleted`,{run:i.run.title}):``,o=e.filter(e=>e.kind===`proposal`&&e.proposal.status===`gated`),s=e.filter(e=>e.kind!==`proposal`),c=e.filter(e=>e.kind===`proposal`&&e.proposal.status!==`gated`);function l(e){return e.kind===`attention`?(0,B.jsx)(Jy,{attention:e.attention,onSelect:()=>t({item:e.attention,kind:`attention`})},e.id):e.kind===`run`?(0,B.jsx)(rb,{onSelect:()=>t({item:e.run,kind:`run`}),run:e.run},e.id):e.kind===`output`?(0,B.jsx)(tb,{onSelect:()=>t({item:e.output,kind:`output`}),output:e.output},e.id):e.kind===`schedule`?(0,B.jsx)(ib,{onSelect:()=>t({item:e.schedule,kind:`schedule`}),schedule:e.schedule},e.id):e.kind===`proposal`?(0,B.jsxs)(`button`,{className:`personal-proposal-row is-${e.proposal.status}`,onClick:()=>t({item:e.proposal,kind:`proposal`}),type:`button`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Ch,{size:17})}),(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`small`,{children:[e.proposal.actionKind,` · `,e.proposal.status]}),(0,B.jsx)(`strong`,{children:e.proposal.title}),(0,B.jsx)(`p`,{children:e.proposal.impact})]}),(0,B.jsx)(`b`,{children:e.proposal.status===`gated`?r(`timeline.review`):e.proposal.primaryLabel??r(`timeline.reviewAndConfirm`)})]},e.id):(0,B.jsxs)(`article`,{className:`personal-message is-${e.message.role}`,children:[e.message.role===`user`?null:(0,B.jsx)(`span`,{className:`personal-message-avatar`,children:(0,B.jsx)(Tm,{size:17})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.message.role===`user`?r(`common.you`):e.message.agentLabel??r(`header.manager`)}),e.message.time?(0,B.jsx)(`time`,{children:e.message.time}):null]}),e.message.attachments?.length?(0,B.jsx)(`div`,{className:`personal-message-images`,children:e.message.attachments.map(e=>(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl},e.id))}):null,e.message.role===`user`?(0,B.jsx)(`p`,{children:e.message.text}):(0,B.jsx)(eb,{text:e.message.text}),e.message.pending?(0,B.jsx)(`span`,{className:`personal-message-pending`,children:r(`timeline.pending`)}):null]})]},e.id)}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,className:`personal-live-region`,role:`status`,children:a}),(0,B.jsxs)(`div`,{className:`personal-channel-timeline`,children:[s.map(l),o.length?(0,B.jsxs)(`details`,{className:`personal-gated-summary`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Ch,{size:16})}),(0,B.jsx)(`strong`,{children:r(`timeline.waitingConfirmation`)}),(0,B.jsx)(`small`,{children:r(`timeline.gateHistory`,{count:o.length})})]}),(0,B.jsx)(`div`,{children:o.map(l)})]}):null,c.map(l)]})]})}function ob(e){return e.replace(/\s+/gu,` `).trim()}function sb(e,t){let n=RegExp(`(?:不要|不需要|无需|禁止|别|暂不|do not\\b|don't\\b|without\\b).{0,10}(?:${t.source})`,`iu`),r=RegExp(`(?:${t.source}).{0,10}(?:不要|不需要|无需|禁止|关闭)`,`iu`),i=RegExp(`disable\\b.{0,10}(?:${t.source})|(?:turn|switch|set)\\b.{0,10}(?:${t.source}).{0,10}\\boff\\b|(?:${t.source})\\s+(?:is\\s+)?disabled\\b`,`iu`);return n.test(e)||r.test(e)||i.test(e)}function cb(e){return/(我现在该做什么|下一步|哪些\s*Goal\s*在等我|需要我|谁在等我|Agent\s*在做什么|当前进度|总结(?:今天)?进展)/iu.test(e)}function lb(e){let t=/(怎么|如何|为什么|给.*建议|分析一下|解释|只读)/u.test(e),n=/(解决一下|修复一下|处理一下|执行一下|改一下|跑(?:一下)?测试|rebase|push|提交|推送)/iu.test(e);return!t&&n&&/(帮我|请|给我|直接|现在|开始|bytedcli|codebase|git|rebase|push|提交|推送)/iu.test(e)}function ub(e){return ob(e).toLowerCase().match(/(?:^|[\s,,;;:((:]|到|至)(?todo_done:todo_[a-z0-9_-]{3,64}|pr_merged:(?:(?:[a-z0-9_.-]{1,80})\/(?:[a-z0-9_.-]{1,100}))?#[1-9][0-9]{0,8}|capacity_available:[a-z][a-z0-9_:-]{0,63})(?=$|[\s,,。;;))])/iu)?.groups?.condition??null}function db(e,t){let n=ob(e),r=[],i=t.agents.find(e=>{let t=n.toLowerCase();return t.includes(e.agentId.toLowerCase())||t.includes(e.label.toLowerCase())}),a=t.todos.find(e=>n.includes(e.todoId)||n.includes(e.text)),o=/(刚刚|已经|已)(?:经)?\s*(新增|创建|添加)(?:的)?\s*(todo|待办|任务)/iu.test(n),s=!!t.goalId&&!sb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n);if(!t.goalId&&!sb(n,/goal|目标/iu)&&/(创建|新建|设置|create|start|set up).{0,24}(goal|目标)/iu.test(n)&&r.push({actionKind:`goal.create`,confidence:.97,normalizedParameters:{heartbeat_enabled:!sb(n,/heartbeat|心跳/iu)&&/(heartbeat|心跳|每天推进|持续推进|daily progress)/iu.test(n)}}),t.goalId&&s&&r.push({actionKind:`heartbeat.bind`,confidence:.96,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&!s&&!sb(n,/定时|监控|监测|持续观察|scheduled check|monitor/iu)&&/(定时|监控|监测|每.{0,8}(分钟|小时|天)|持续观察|scheduled check|monitor|every.{0,12}(minute|hour|day)|daily)/iu.test(n)&&r.push({actionKind:`monitor.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&i&&!sb(n,/绑定|负责|接管|管理/iu)&&/((让|交给).{0,20}(管理|负责|接管).{0,8}(goal|目标)|(绑定).{0,12}(goal|目标)|(goal|目标).{0,12}(交给|绑定|负责|接管))/iu.test(n)&&r.push({actionKind:`agent.bind`,confidence:.96,normalizedParameters:{agent_id:i.agentId,goal_id:t.goalId}}),t.goalId&&!o&&!sb(n,RegExp(`todo|待办|任务`,`iu`))&&/(创建|新建|新增|添加|加一个|记一个).{0,16}(todo|待办|任务)|(todo|待办|任务).{0,12}(创建|新建|新增|添加)|(?:create|add)(?:\s+(?:a|an|new))?\s+(?:todo|task)|(?:todo|task).{0,12}(?:create|add)/iu.test(n)&&r.push({actionKind:`todo.create`,confidence:.94,normalizedParameters:{goal_id:t.goalId}}),t.goalId&&lb(n)&&r.push({actionKind:`todo.create`,confidence:.9,normalizedParameters:{goal_id:t.goalId,start_execution:!0}}),t.goalId&&a){let e=!sb(n,/完成|做完|关闭/u)&&/完成|做完|关闭/u.test(n)?`complete`:!sb(n,/阻塞|卡住/u)&&/阻塞|卡住/u.test(n)?`block`:!sb(n,/暂缓|稍后|推迟/u)&&/暂缓|稍后|推迟/u.test(n)?`defer`:i&&!sb(n,/交给|分配给|改派/u)&&/交给|分配给|改派/u.test(n)?`reassign`:null;if(e){let i=e===`defer`?ub(n):null;if(e===`defer`&&!i)return{actionKind:`todo.update`,confidence:.97,missingFields:[`resume_when`],normalizedParameters:{goal_id:t.goalId,operation:e,todo_id:a.todoId},route:`clarify`};r.push({actionKind:`todo.update`,confidence:.97,normalizedParameters:{goal_id:t.goalId,operation:e,...i?{resume_when:i}:{},todo_id:a.todoId}})}}let c=[...new Map(r.map(e=>[e.actionKind,e])).values()];return c.length>1?{actionKind:null,confidence:.4,missingFields:[`single_intent`],normalizedParameters:{},route:`clarify`}:c.length===1?{...c[0],missingFields:[],route:`typed_action`}:!t.goalId&&cb(n)?{actionKind:null,confidence:.98,missingFields:[],normalizedParameters:{},route:`projection`}:{actionKind:null,confidence:.75,missingFields:[],normalizedParameters:{},route:`agent_chat`}}var fb=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`input:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`),pb=[{key:`drawer.taskBlock`,operation:`block`},{key:`drawer.taskSuccessor`,operation:`successor_create`}],mb=[{key:`drawer.decisionReject`,resolution:`reject`},{key:`drawer.decisionDefer`,resolution:`defer`}],hb=Array.from({length:32},(e,t)=>t+1),gb=/^[a-z][a-z0-9_.-]{0,63}$/u;function _b(e){let t=String(e??``).trim().toLowerCase();return gb.test(t)?t:null}function vb(e,t){return e.enabled===t.enabled&&e.maxChildren===t.maxChildren&&[...e.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)===[...t.allowedDomains].sort((e,t)=>e.localeCompare(t)).join(`\0`)}function yb({agents:e,callbacks:t,goalNotifications:n=[],goals:r=[],inspectorExpanded:i=!1,larkConnections:a=[],onClose:o,onToggleInspectorSize:s,readOnly:c=!1,runs:l=[],selection:u}){let{locale:d,t:f}=ya(),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(`idle`),[y,b]=(0,z.useState)(`record`),[x,S]=(0,z.useState)([]),[C,w]=(0,z.useState)(null),[T,E]=(0,z.useState)(2),[D,O]=(0,z.useState)(`idle`),[k,ee]=(0,z.useState)(null),[A,j]=(0,z.useState)(null),te=(0,z.useRef)(null),ne=(0,z.useRef)(null),[re,M]=(0,z.useState)(e.find(e=>e.available)?.agentId??`codex`),[N,ie]=(0,z.useState)(``),ae=(0,z.useRef)(null),oe=(0,z.useRef)(null),P=(0,z.useRef)(null),F=(0,z.useRef)(null),se=u.kind===`run`?`run:${u.item.runId}`:u.kind===`proposal`?`proposal:${u.item.previewId}`:u.kind===`todo`?`todo:${u.item.todoId}`:u.kind===`attention`?`attention:${u.item.todoId}`:u.kind===`output`?`output:${u.item.outputId}`:u.kind===`schedule`?`schedule:${u.item.scheduleId}`:`goal:${u.item.goalId}`;(0,z.useEffect)(()=>{v(`idle`),g(!1),b(`record`),ie(``);let e=u.kind===`goal`?u.item.subagentExecution:void 0;S(e?.allowedDomains??[]),E(e?.maxChildren?Math.min(e.maxChildren,32):2),w(null),O(`idle`),ee(null),j(null),te.current=e??null,ne.current=null},[se]);let ce=u.kind===`goal`?u.item.subagentExecution:void 0;(0,z.useEffect)(()=>{let e=te.current,t=ce?!e||!vb(e,ce):e!==null;if(te.current=ce??null,!A){t&&ce&&(S(ce.allowedDomains),E(ce.maxChildren||2),w(null),O(`idle`),ee(null));return}let n=ne.current;(!ce||vb(A,ce)||n&&!vb(n,ce))&&(ce&&(S(ce.allowedDomains),E(ce.maxChildren||2)),ne.current=null,j(null))},[ce,A]),(0,z.useEffect)(()=>{let e=document.activeElement;e instanceof HTMLElement&&!oe.current?.contains(e)&&(P.current=e);let t=window.requestAnimationFrame(()=>F.current?.focus());return()=>window.cancelAnimationFrame(t)},[se]);let le=(0,z.useCallback)(()=>{let e=P.current;o(),window.requestAnimationFrame(()=>e?.focus())},[o]);(0,z.useEffect)(()=>{function e(e){if(e.key===`Escape`){e.preventDefault(),le();return}if(e.key===`Tab`&&u.kind!==`todo`){let t=Array.from(oe.current?.querySelectorAll(fb)??[]).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[le,u.kind]);let ue=u.kind===`attention`?f(`drawer.titleAttention`):u.kind===`todo`?f(`drawer.taskDetails`):u.kind===`run`?f(`drawer.runDetails`):u.kind===`output`?f(`drawer.titleOutput`):u.kind===`proposal`?f(u.item.status===`applied`?`drawer.titleProposalApplied`:`drawer.titleProposalConfirm`):u.kind===`schedule`?u.item.scheduleKind===`heartbeat`?`Heartbeat`:f(`drawer.titleSchedule`):f(`drawer.goalDetails`),de=u.kind===`proposal`?u.item.goalId??`manager`:u.item.goalId,fe=u.kind===`attention`?u.item.goalTitle??f(`drawer.currentGoal`):u.kind===`todo`||u.kind===`run`?u.item.goalTitle:u.kind===`output`?u.item.goalTitle??f(`drawer.currentGoal`):u.kind===`goal`?u.item.title:u.kind===`schedule`?f(`drawer.goalAutoRun`):u.item.goalId?f(`drawer.goalChanges`):f(`drawer.managerChanges`),pe=u.kind===`goal`?l.find(e=>e.goalId===u.item.goalId&&!!e.sessionId)??l.find(e=>e.goalId===u.item.goalId):null,me=u.kind===`run`&&(u.item.completedSteps>0||!!u.item.latestActivity||!!u.item.outputs?.length),he=u.kind===`attention`?Sa(u.item.updatedAt,f):null,I=ub(N);async function ge(){u.kind!==`run`||!p.trim()||(await t.onCorrectRun?.(u.item,p.trim()),m(``))}async function _e(e,n,r,i){if(n===`successor_create`){await t.onPreviewAction?.({actionKind:`todo.create`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-successor-${e.todoId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,text:f(`drawer.taskSuccessorText`,{task:e.text})},summary:f(`drawer.taskSuccessorSummary`,{task:e.text})});return}await t.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-${n}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:e.claimedBy??re,goal_id:e.goalId,operation:n,...n===`block`?{note:f(`drawer.taskSuccessorNote`)}:{},...n===`defer`&&i?{resume_when:i}:{},todo_id:e.todoId},summary:`${r}:${e.text}`})}async function ve(e,n,r){await t.onPreviewAction?.({actionKind:`gate.resolve`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-decision-${e.todoId}-${n}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,decision:n,todo_id:e.todoId},summary:`${r}:${e.text}`})}let ye=u.kind===`goal`?A??u.item.subagentExecution??{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0}:{allowedDomains:[],domainCandidates:[],enabled:!1,maxChildren:0},be=D===`previewing`||D===`applying`,xe=(()=>{if(u.kind!==`goal`)return[];let e=new Map;for(let t of ye.allowedDomains){let n=_b(t);n&&e.set(n,{matchingTodoCount:0,value:n})}if(ye.domainCandidates)for(let t of ye.domainCandidates){let n=_b(t.domain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+t.matchingTodoCount,value:n})}else for(let t of u.item.agentTodos){if(t.done||t.taskClass!==`advancement_task`)continue;let n=_b(t.taskDomain);if(!n)continue;let r=e.get(n);e.set(n,{matchingTodoCount:(r?.matchingTodoCount??0)+1,value:n})}return[...e.values()]})();function Se(){S(ye.allowedDomains),E(ye.maxChildren||2),w(null),O(`idle`),ee(null)}function Ce(){let e=[...new Set(x.map(e=>_b(e)))];return e.every(e=>!!e)?e:null}function we(e,t){S(n=>t?[...n,e].filter((e,t,n)=>n.indexOf(e)===t):n.filter(t=>t!==e)),ee(null),O(`idle`),w(null)}async function Te(e){if(u.kind!==`goal`||!t.onPreviewGoalSubagentConfiguration)return;let n=e?Ce():[];if(e&&!n){O(`error`),w(f(`drawer.subagentDomainInvalid`)),ee(null);return}let r={allowedDomains:n??[],enabled:e,goalId:u.item.goalId,maxChildren:e?T:0};O(`previewing`),w(f(`drawer.subagentPreviewing`)),ee(null);try{let e=await t.onPreviewGoalSubagentConfiguration(r);if(!e.changed){ne.current=ce??null,j({...e.configuration,domainCandidates:ye.domainCandidates}),S(e.configuration.allowedDomains),E(e.configuration.maxChildren||2),O(`success`),w(f(`drawer.subagentNoChange`));return}ee({...r,changed:e.changed,previewId:e.previewId}),O(`ready`),w(f(`drawer.subagentPreviewReady`))}catch(e){O(`error`),w(e instanceof Error?e.message:f(`drawer.subagentPreviewFailed`))}}async function Ee(){if(!(!k||!t.onApplyGoalSubagentConfiguration)){O(`applying`),w(f(`drawer.subagentApplying`));try{let e=await t.onApplyGoalSubagentConfiguration({allowedDomains:k.allowedDomains,enabled:k.enabled,goalId:k.goalId,maxChildren:k.maxChildren,previewId:k.previewId});ne.current=ce??null,j({...e,domainCandidates:ye.domainCandidates}),S(e.allowedDomains),E(e.maxChildren||2),O(`success`),w(f(`drawer.subagentApplied`)),ee(null);try{await t.onRefresh?.()}catch{O(`warning`),w(f(`drawer.subagentAppliedRefreshFailed`))}}catch(e){O(`error`),w(e instanceof Error?e.message:f(`drawer.subagentApplyFailed`))}}}return(0,B.jsxs)(`div`,{"aria-labelledby":`personal-drawer-title`,"aria-modal":u.kind===`todo`?void 0:`true`,className:`personal-context-drawer`,"data-context-kind":u.kind,ref:oe,role:`dialog`,children:[(0,B.jsxs)(`header`,{className:`personal-drawer-header${u.kind===`todo`?` is-task-inspector`:``}`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{id:`personal-drawer-title`,ref:F,tabIndex:-1,children:ue}),(0,B.jsx)(`p`,{children:fe})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-header-actions`,children:[u.kind===`todo`&&s?(0,B.jsx)(`button`,{"aria-label":f(i?`drawer.inspectorHalf`:`drawer.inspectorFull`),className:`personal-icon-button personal-inspector-size`,onClick:s,title:f(i?`drawer.inspectorHalfView`:`drawer.inspectorFullView`),type:`button`,children:i?(0,B.jsx)(ah,{size:17}):(0,B.jsx)(th,{size:17})}):null,(0,B.jsxs)(`button`,{"aria-label":f(`drawer.closeDetail`,{context:fe}),className:`personal-icon-button personal-drawer-close`,onClick:le,ref:ae,type:`button`,children:[(0,B.jsx)(ym,{className:`personal-mobile-back`,size:18}),(0,B.jsx)(jh,{className:`personal-desktop-close`,size:18})]})]})]}),(0,B.jsxs)(`div`,{className:`personal-drawer-body`,children:[u.kind===`attention`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card is-attention`,children:[(0,B.jsx)(`small`,{children:u.item.blocking?f(`drawer.attentionBlocking`):f(`drawer.attentionWaiting`)}),(0,B.jsx)(`h3`,{children:u.item.text}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:u.item.goalTitle??u.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:u.item.priority??`medium`})]}),he?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`common.waiting`)}),(0,B.jsx)(`dd`,{children:f(`tasks.waitingAge`,{age:he})})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.reason`)}),(0,B.jsx)(`dd`,{children:u.item.explanation??f(`drawer.decisionDefaultReason`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.evidence`)}),(0,B.jsx)(`dd`,{children:u.item.evidence??f(`drawer.decisionDefaultEvidence`)})]})]})]}),c?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void ve(u.item,`approve`,f(`common.confirm`)),type:`button`,children:[(0,B.jsx)(km,{size:17}),f(`drawer.decisionReview`)]}),(0,B.jsxs)(`details`,{className:`personal-compact-menu`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Vm,{size:17}),f(`drawer.decisionMore`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>void t.onExplainDecision?.(u.item),type:`button`,children:[(0,B.jsx)(rh,{size:16}),f(`drawer.explainDecision`)]}),mb.map(e=>(0,B.jsx)(`button`,{onClick:()=>void ve(u.item,e.resolution,f(e.key)),type:`button`,children:f(e.key)},e.resolution))]})]})]})]}):null,u.kind===`todo`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-task-inspector-summary`,children:[(0,B.jsxs)(`div`,{className:`personal-task-inspector-status`,children:[(0,B.jsxs)(`span`,{className:u.item.done?`is-done`:u.item.status===`blocked`?`is-blocked`:`is-open`,children:[(0,B.jsx)(`i`,{}),u.item.done?f(`drawer.taskStatusCompleted`):u.item.status===`deferred`?f(`drawer.taskStatusDeferred`):u.item.status===`blocked`?f(`drawer.taskStatusBlocked`):f(`drawer.taskStatusOpen`)]}),u.item.priority?(0,B.jsx)(`span`,{children:u.item.priority}):null,(0,B.jsx)(`span`,{children:u.item.taskClass===`advancement_task`?f(`drawer.taskAdvancement`):u.item.taskClass??f(`drawer.taskOrdinary`)})]}),(0,B.jsx)(`h3`,{children:u.item.text})]}),(0,B.jsxs)(`section`,{"aria-label":f(`drawer.taskInfo`),className:`personal-task-inspector-fields`,children:[(0,B.jsx)(`h4`,{children:f(`drawer.taskInfo`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:u.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`common.owner`)}),(0,B.jsx)(`dd`,{children:u.item.ownerLabel??u.item.claimedBy??f(`drawer.notAssigned`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`common.status`)}),(0,B.jsx)(`dd`,{children:u.item.done?f(`drawer.taskStatusCompleted`):u.item.status===`deferred`?f(`drawer.taskStatusDeferred`):u.item.status===`blocked`?f(`drawer.taskStatusBlocked`):f(`drawer.taskStatusOpen`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.priority`)}),(0,B.jsx)(`dd`,{children:u.item.priority??f(`drawer.notSet`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.dependencies`)}),(0,B.jsx)(`dd`,{children:u.item.dependencies?.join(` · `)||f(`common.none`)})]}),u.item.status===`deferred`?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.resumeWhen`)}),(0,B.jsx)(`dd`,{children:u.item.resumeWhen||f(`drawer.notSet`)})]}):null,(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.nextTransition`)}),(0,B.jsx)(`dd`,{children:u.item.nextTransition??(u.item.done?f(`drawer.taskNextCompleted`):u.item.status===`deferred`?f(`drawer.taskNextDeferred`):f(`drawer.taskNextOpen`))})]})]})]}),!c&&!u.item.done?(0,B.jsxs)(`div`,{className:`personal-task-inspector-actions`,"aria-label":f(`drawer.taskActions`),children:[(0,B.jsxs)(`details`,{className:`personal-task-management`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Vm,{size:16}),f(`drawer.taskManage`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:f(`drawer.reassign`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select`,children:[f(`drawer.reassign`),(0,B.jsx)(`select`,{"aria-label":f(`drawer.reassign`),onChange:e=>M(e.target.value),value:re,children:e.filter(e=>e.available).map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onPreviewAction?.({actionKind:`todo.update`,context:{goal_id:u.item.goalId,kind:`todo`,todo_id:u.item.todoId},idempotencyKey:`workspace-todo-${u.item.todoId}-reassign-${re}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:re,goal_id:u.item.goalId,operation:`reassign`,todo_id:u.item.todoId},summary:f(`drawer.reassignSummary`,{task:u.item.text})}),type:`button`,children:f(`timeline.review`)})]}),(0,B.jsx)(`strong`,{children:f(`drawer.taskDeferUntil`)}),(0,B.jsxs)(`label`,{className:`personal-inline-agent-select personal-inline-resume-when`,children:[f(`drawer.taskDeferUntil`),(0,B.jsx)(`input`,{"aria-label":f(`drawer.taskDeferCondition`),"aria-invalid":!!N.trim()&&!I,onChange:e=>ie(e.target.value),placeholder:f(`drawer.taskDeferPlaceholder`),value:N}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:!I,onClick:()=>void _e(u.item,`defer`,f(`drawer.taskDefer`),I??void 0),type:`button`,children:f(`drawer.taskDeferReview`)}),(0,B.jsx)(`small`,{children:N.trim()&&!I?f(`drawer.taskDeferInvalid`):f(`drawer.taskDeferSupported`)})]}),(0,B.jsx)(`div`,{className:`personal-task-management-secondary`,children:pb.map(e=>(0,B.jsx)(`button`,{onClick:()=>void _e(u.item,e.operation,f(e.key)),type:`button`,children:f(e.key)},e.operation))})]})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void _e(u.item,`complete`,f(`drawer.taskComplete`)),type:`button`,children:[(0,B.jsx)(km,{size:17}),f(`drawer.taskComplete`)]})]}):null,u.item.done?(0,B.jsxs)(`div`,{className:`personal-task-completed-note`,children:[(0,B.jsx)(km,{size:16}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:f(`drawer.taskCompletedTitle`)}),(0,B.jsx)(`small`,{children:f(`drawer.taskCompletedNote`)})]})]}):null]}):null,u.kind===`goal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:ba(u.item.state,d)}),(0,B.jsx)(`h3`,{children:u.item.title}),(0,B.jsx)(`p`,{children:u.item.agentSentence}),Wy(u.item.usage)?(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Tokens 24h / 7d`}),(0,B.jsxs)(`dd`,{children:[Vy(u.item.usage.tokens24h),` / `,Vy(u.item.usage.tokens7d)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.cost`)}),(0,B.jsxs)(`dd`,{children:[Hy(u.item.usage.costUsd24h),` / `,Hy(u.item.usage.costUsd7d)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.duration`)}),(0,B.jsxs)(`dd`,{children:[Uy(u.item.usage.durationMs24h),` / `,Uy(u.item.usage.durationMs7d)]})]})]}):null]}),(()=>{let e=n.find(e=>e.goalId===u.item.goalId),r=a.find(e=>e.goal_id===u.item.goalId);return(0,B.jsxs)(B.Fragment,{children:[u.item.repository?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-repository`,children:[(0,B.jsxs)(`div`,{className:`personal-detail-card-title`,children:[(0,B.jsx)(`small`,{children:f(`drawer.repository`)}),(0,B.jsx)(`em`,{children:f(`common.readOnly`)})]}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(qm,{size:16}),u.item.repository.label]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.branch`)}),(0,B.jsx)(`dd`,{children:u.item.repository.branch||`detached`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Role`}),(0,B.jsx)(`dd`,{children:f(`drawer.repositoryRole`)})]})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>{let e=navigator.clipboard?.writeText(u.item.repository?.identity??``);if(!e){v(`error`);return}e.then(()=>v(`copied`)).catch(()=>v(`error`))},type:`button`,children:[(0,B.jsx)(Rm,{size:15}),f(_===`copied`?`drawer.copyRepositoryDone`:`drawer.copyRepository`)]}),_===`error`?(0,B.jsx)(`p`,{className:`personal-copy-feedback is-error`,role:`status`,children:f(`drawer.copyRepositoryError`)}):_===`copied`?(0,B.jsx)(`p`,{className:`personal-copy-feedback`,role:`status`,children:f(`drawer.copyRepositorySuccess`)}):null]}):null,c?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:f(`drawer.larkConnection`)}),(0,B.jsx)(`h3`,{children:f(`drawer.remoteDetailsUnavailable`)}),(0,B.jsx)(`p`,{children:f(`drawer.remoteDetailsDescription`)})]}):(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-notification`,children:[(0,B.jsx)(`small`,{children:f(`drawer.larkConnection`)}),r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{children:[r.app_label,(0,B.jsx)(`span`,{className:`personal-connection-status`,children:f(`drawer.connected`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.group`)}),(0,B.jsx)(`dd`,{children:r.chat_name})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.topic`)}),(0,B.jsxs)(`dd`,{children:[`# `,r.topic_name]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.trigger`)}),(0,B.jsx)(`dd`,{children:r.incoming_mode===`mentions`?f(`lark.someoneMentions`):f(`lark.allMessages`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.replyMode`)}),(0,B.jsx)(`dd`,{children:f(`lark.topicReply`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.autoNotify`)}),(0,B.jsx)(`dd`,{children:e?.humanGateAutoNotifyEnabled?f(`common.on`):f(`common.off`)})]}),e?.lastNotifiedAt?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.lastNotification`)}),(0,B.jsx)(`dd`,{children:e.lastNotifiedAt})]}):null]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:f(`drawer.larkNotConfigured`)}),(0,B.jsx)(`p`,{children:f(`drawer.larkNotConfiguredDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>t.onOpenNotificationSettings?.(u.item.goalId),type:`button`,children:[(0,B.jsx)(wm,{size:16}),f(r?`drawer.larkConfigure`:`drawer.larkConnect`)]})]})]})})(),(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-session`,children:[(0,B.jsx)(`small`,{children:f(`drawer.runDetails`)}),pe?.sessionId?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:xa(pe.sessionStatus??pe.status,f)}),(0,B.jsx)(`p`,{children:pe.title}),t.onOpenRunSession?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void t.onOpenRunSession?.(pe),type:`button`,children:[(0,B.jsx)(uh,{size:16}),f(`drawer.runLatest`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{children:f(`drawer.noRun`)}),(0,B.jsx)(`p`,{children:f(`drawer.noRunDescription`)})]})]}),c?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>t.onRequestScheduleConfig?.(`heartbeat`,u.item.goalId),type:`button`,children:[(0,B.jsx)(fh,{size:16}),f(`drawer.setupHeartbeat`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>t.onRequestScheduleConfig?.(`monitor`,u.item.goalId),type:`button`,children:[(0,B.jsx)(Dm,{size:16}),f(`drawer.scheduleAdd`)]})]}),u.item.subagentExecution?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-goal-subagents`,children:[(0,B.jsxs)(`div`,{className:`personal-subagent-heading`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:f(`drawer.subagentLabel`)}),(0,B.jsxs)(`h3`,{children:[(0,B.jsx)(Tm,{size:16}),f(`drawer.subagentTitle`)]})]}),(0,B.jsxs)(`button`,{"aria-checked":ye.enabled,"aria-label":f(k&&D===`ready`?`drawer.subagentPending`:ye.enabled?`drawer.subagentDisable`:`drawer.subagentEnable`),className:`personal-subagent-switch`,"data-pending":k&&D===`ready`?`true`:void 0,disabled:c||be||!!k||!t.onPreviewGoalSubagentConfiguration,onClick:()=>void Te(!ye.enabled),role:`switch`,type:`button`,children:[(0,B.jsx)(`span`,{}),f(k&&D===`ready`?`drawer.subagentPending`:ye.enabled?`common.on`:`common.off`)]})]}),(0,B.jsx)(`p`,{children:f(`drawer.subagentDescription`)}),k&&D===`ready`?(0,B.jsxs)(`div`,{className:`personal-subagent-preview`,children:[(0,B.jsx)(`strong`,{children:f(k.enabled?`drawer.subagentConfirmEnable`:`drawer.subagentConfirmDisable`)}),(0,B.jsx)(`p`,{children:k.enabled?f(`drawer.subagentPreviewSummary`,{count:k.maxChildren,domains:k.allowedDomains.join(` · `)||f(`drawer.subagentDomainsUnrestricted`)}):f(`drawer.subagentDisableSummary`)}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{className:`personal-primary-action`,onClick:()=>void Ee(),type:`button`,children:f(`common.confirm`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:Se,type:`button`,children:f(`common.cancel`)})]})]}):null,C?(0,B.jsxs)(`p`,{className:`personal-subagent-feedback is-${D}`,role:`status`,children:[D===`previewing`||D===`applying`?(0,B.jsx)(mh,{className:`personal-spin`,size:13}):null,C]}):null,(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.subagentCurrentBoundary`)}),(0,B.jsx)(`dd`,{children:ye.allowedDomains.join(` · `)||f(`drawer.subagentDomainsUnrestricted`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.subagentChildLimit`)}),(0,B.jsx)(`dd`,{children:ye.maxChildren||0})]})]}),c?(0,B.jsx)(`p`,{className:`personal-subagent-read-only`,children:f(`drawer.subagentRemoteReadOnly`)}):(0,B.jsxs)(`div`,{className:`personal-subagent-fields`,children:[(0,B.jsxs)(`fieldset`,{className:`personal-subagent-domain-picker`,disabled:be,children:[(0,B.jsx)(`legend`,{children:f(`drawer.subagentDomains`)}),xe.length>0?(0,B.jsx)(`div`,{className:`personal-subagent-domain-options`,children:xe.map(e=>{let t=x.includes(e.value);return(0,B.jsxs)(`label`,{className:`personal-subagent-domain-option${t?` is-selected`:``}`,children:[(0,B.jsx)(`input`,{"aria-label":e.value,checked:t,onChange:t=>we(e.value,t.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.value}),(0,B.jsx)(`small`,{children:f(`drawer.subagentDomainTodoCount`,{count:e.matchingTodoCount})})]})]},e.value)})}):(0,B.jsx)(`p`,{className:`personal-subagent-domain-empty`,children:f(`drawer.subagentDomainsEmpty`)}),(0,B.jsx)(`small`,{children:f(`drawer.subagentDomainsHint`)})]}),(0,B.jsxs)(`label`,{className:`personal-subagent-limit-field`,children:[(0,B.jsx)(`span`,{children:f(`drawer.subagentMaxChildren`)}),(0,B.jsx)(`select`,{"aria-label":f(`drawer.subagentMaxChildren`),disabled:be,onChange:e=>{E(Number(e.target.value)),ee(null),O(`idle`),w(null)},value:T,children:hb.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),ye.enabled?(0,B.jsx)(`button`,{className:`personal-secondary-action`,disabled:be,onClick:()=>void Te(!0),type:`button`,children:f(`drawer.subagentPreviewBoundary`)}):null]})]}):null]}):null,u.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{"aria-label":f(`drawer.runView`),className:`personal-run-drawer-tabs`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":y===`record`,onClick:()=>b(`record`),role:`tab`,type:`button`,children:f(`drawer.executionRecordAndResult`)}),(0,B.jsx)(`button`,{"aria-selected":y===`details`,onClick:()=>b(`details`),role:`tab`,type:`button`,children:f(`drawer.detailsAndActions`)})]}),y===`record`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card personal-session-summary`,children:[(0,B.jsxs)(`small`,{children:[u.item.agentLabel,` · `,xa(u.item.sessionStatus??u.item.status,f)]}),(0,B.jsx)(`h3`,{children:u.item.title}),(0,B.jsx)(`p`,{children:u.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:u.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[u.item.completedSteps,`/`,u.item.totalSteps]})]})]})]}),(0,B.jsxs)(`section`,{"aria-label":f(`drawer.executionRecord`),className:`personal-session-message-record`,children:[(0,B.jsx)(`h3`,{children:f(`drawer.executionRecord`)}),u.item.sessionMessages?.length?(0,B.jsx)(`ol`,{children:u.item.sessionMessages.map(e=>(0,B.jsxs)(`li`,{className:`is-${e.role}`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:e.role===`user`?f(`drawer.runRoleUser`):e.role===`assistant`?f(`drawer.runRoleAssistant`):f(`drawer.runRoleSystem`)}),e.createdAt?(0,B.jsx)(`time`,{children:new Date(e.createdAt).toLocaleTimeString(d,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}):null]}),(0,B.jsx)(`p`,{children:e.text})]})]},e.messageId))}):(0,B.jsx)(`p`,{className:`personal-session-empty`,children:me?f(`drawer.runRecordProjected`,{completed:u.item.completedSteps,outputs:u.item.outputs?.length?f(`drawer.runRecordProjectedOutputs`,{count:u.item.outputs.length}):``,total:u.item.totalSteps}):f(`drawer.runRecordEmpty`)}),u.item.status===`running`?(0,B.jsxs)(`div`,{className:`personal-session-active-step`,children:[(0,B.jsx)(`i`,{}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:f(`drawer.analysis`)}),(0,B.jsx)(`small`,{children:f(`drawer.agentWorking`)})]})]}):null]}),u.item.outputs?.length?(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-run-outputs-title`,children:[(0,B.jsx)(`h3`,{id:`personal-run-outputs-title`,children:f(`drawer.outputs`)}),(0,B.jsx)(`ol`,{children:u.item.outputs.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{children:e.createdAt??e.kind??f(`files.emptySummary`)})]})},e.outputId))})]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[u.item.agentLabel,` · `,xa(u.item.status,f)]}),(0,B.jsx)(`h3`,{children:u.item.title}),(0,B.jsx)(`p`,{children:u.item.latestActivity}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:u.item.goalTitle})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.progress`)}),(0,B.jsxs)(`dd`,{children:[u.item.completedSteps,`/`,u.item.totalSteps]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.sessionStatus`)}),(0,B.jsx)(`dd`,{children:xa(u.item.sessionStatus??u.item.status,f)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.sessionRecoverable`)}),(0,B.jsx)(`dd`,{children:u.item.resumable===!1?f(`drawer.resumeNo`):f(`drawer.resumeYes`)})]})]})]}),u.item.sessionStatus===`resume_failed`&&!c?(0,B.jsxs)(`section`,{className:`personal-recovery-panel`,"aria-label":f(`drawer.recoveryFailed`),children:[(0,B.jsx)(`strong`,{children:f(`drawer.recoveryFailed`)}),(0,B.jsx)(`p`,{children:f(`drawer.recoveryDescription`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void t.onRetryResumeRun?.(u.item),type:`button`,children:[(0,B.jsx)(mh,{size:16}),f(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onStartNewRunSession?.(u.item),type:`button`,children:[(0,B.jsx)(uh,{size:16}),f(`drawer.recoveryNewSession`)]})]}):null,c?null:(0,B.jsxs)(`section`,{className:`personal-correction-panel`,children:[(0,B.jsx)(`header`,{children:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Tm,{size:16}),f(`drawer.correctionLabel`,{agent:u.item.agentLabel})]})}),(0,B.jsx)(`p`,{children:f(`drawer.correctionDescription`)}),(0,B.jsxs)(`div`,{className:`personal-correction-composer`,children:[(0,B.jsx)(`textarea`,{"aria-label":f(`drawer.correctionTextarea`,{agent:u.item.agentLabel,goal:u.item.goalTitle,run:u.item.title}),onChange:e=>m(e.target.value),placeholder:f(`drawer.correctionPlaceholder`),rows:3,value:p}),(0,B.jsx)(`button`,{"aria-label":f(`drawer.correctionSend`),disabled:!p.trim(),onClick:()=>void ge(),type:`button`,children:(0,B.jsx)(_h,{size:16})})]})]}),c?null:(0,B.jsxs)(`details`,{className:`personal-compact-menu personal-run-more`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Vm,{size:17}),f(`drawer.moreRunActions`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{disabled:!u.item.canInterrupt,onClick:()=>void t.onInterruptRun?.(u.item),type:`button`,children:[(0,B.jsx)(lh,{size:16}),f(`drawer.runInterrupt`)]}),(0,B.jsxs)(`button`,{disabled:u.item.resumable===!1,onClick:()=>void t.onRetryResumeRun?.(u.item),type:`button`,children:[(0,B.jsx)(mh,{size:16}),f(`drawer.recoveryRetry`)]}),(0,B.jsxs)(`button`,{onClick:()=>void t.onStartNewRunSession?.(u.item),type:`button`,children:[(0,B.jsx)(uh,{size:16}),f(`drawer.runNewSession`)]}),(0,B.jsxs)(`button`,{onClick:()=>void t.onCloseRunSession?.(u.item),type:`button`,children:[(0,B.jsx)(wh,{size:16}),f(`drawer.runCloseSession`)]})]})]})]})]}):null,u.kind===`output`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsx)(`small`,{children:u.item.kind??`output`}),(0,B.jsx)(`h3`,{children:u.item.title}),(0,B.jsx)(`p`,{children:u.item.summary??f(`drawer.outputRecorded`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Goal`}),(0,B.jsx)(`dd`,{children:u.item.goalTitle??u.item.goalId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.outputTodo`)}),(0,B.jsx)(`dd`,{children:u.item.todoId??f(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.outputRun`)}),(0,B.jsx)(`dd`,{children:u.item.runId??f(`drawer.notLinked`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:u.item.agentLabel??u.item.agentId??`LoopX`})]})]})]}),u.item.report?(0,B.jsxs)(`section`,{className:`personal-report-detail`,"data-testid":`personal-periodic-report-detail`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`strong`,{children:[`+`,u.item.report.addedCount]}),f(`files.reportAdded`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:u.item.report.changedCount}),f(`files.reportChanged`)]})]}),(0,B.jsxs)(`p`,{children:[u.item.report.periodStartAt,` → `,u.item.report.periodEndAt]}),(0,B.jsx)(`ol`,{children:u.item.report.items.map(e=>(0,B.jsxs)(`li`,{"data-change-kind":e.changeKind,children:[(0,B.jsxs)(`small`,{children:[e.changeKind,` · `,e.status]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.summary})]},e.sourceRef))}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`span`,{children:[f(`files.reportPublication`),`: `,u.item.report.publicationId]}),(0,B.jsxs)(`span`,{children:[f(`files.reportGeneration`),`: `,u.item.report.generationId]})]})]}):null,u.item.safePreview?(0,B.jsx)(`pre`,{"aria-label":f(`drawer.outputSafePreview`),className:`personal-safe-preview`,children:u.item.safePreview}):(0,B.jsx)(`p`,{className:`personal-preview-unavailable`,children:f(`drawer.previewUnavailable`)}),(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:!t.onOpenOutput,onClick:()=>{t.onOpenOutput?.(u.item),o()},type:`button`,children:[(0,B.jsx)(Hm,{size:16}),f(`files.openConversation`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!t.onExportOutput,onClick:()=>void t.onExportOutput?.(u.item),type:`button`,children:[(0,B.jsx)(Bm,{size:16}),f(`files.exportSummary`)]})]})]}):null,u.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-proposal-card`,children:[(0,B.jsxs)(`small`,{children:[u.item.actionKind,` · `,u.item.status]}),(0,B.jsx)(`h3`,{children:u.item.title}),(0,B.jsx)(`p`,{children:u.item.impact}),u.item.status===`ready`?(0,B.jsx)(`p`,{className:`personal-proposal-explainer`,children:f(`drawer.proposalExplainer`)}):null,(0,B.jsx)(`dl`,{children:u.item.fields.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},e.key))})]}),u.item.status===`applied`?(0,B.jsxs)(`p`,{className:`personal-proposal-state is-applied`,children:[(0,B.jsx)(km,{size:16}),f(`drawer.proposalApplied`)]}):null,u.item.status===`applied`&&u.item.goalId?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>{let e=u.item.goalId;o(),t.onOpenGoal?.(e)},type:`button`,children:[(0,B.jsx)(Hm,{size:16}),u.item.actionKind===`goal.create`?f(`drawer.proposalEnterGoal`):f(`drawer.proposalViewGoal`)]}):null,u.item.status===`stale`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-stale`,children:f(`drawer.proposalStale`)}):null,u.item.status===`error`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-error`,children:[(0,B.jsx)(`span`,{children:f(`drawer.proposalApplyFailed`)}),u.item.errorMessage?(0,B.jsx)(`small`,{children:u.item.errorMessage}):null,(0,B.jsx)(`small`,{children:f(`drawer.proposalApplyFailedHint`)})]}):null,u.item.status===`rejected`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-error`,children:f(`drawer.proposalRejected`)}):null,u.item.status===`deferred`?(0,B.jsx)(`p`,{className:`personal-proposal-state is-gated`,children:f(`drawer.proposalDeferred`)}):null,u.item.status===`gated`?(0,B.jsxs)(`div`,{className:`personal-proposal-state is-gated`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:f(`drawer.gateRequiresHost`)}),f(`drawer.gateRequiresHostDescription`)]}),u.item.gate?.nextAction?(0,B.jsx)(`small`,{children:u.item.gate.nextAction}):null]}):null,u.item.status===`gated`&&u.item.actionKind===`gate.resolve`?(()=>{let e=e=>u.item.fields.find(t=>t.key===e)?.value,t=e(`goal_id`),n=e(`todo_id`);return!t||!n?null:(0,B.jsxs)(`section`,{className:`personal-detail-card personal-gate-cli-hint`,children:[(0,B.jsx)(`small`,{children:f(`drawer.gateApproveHint`)}),(0,B.jsxs)(`code`,{children:[`loopx todo complete --goal-id `,t,` --todo-id `,n,` --decision-outcome approve`]}),(0,B.jsx)(`small`,{children:f(`drawer.gateRejectHint`)})]})})():null,!c&&u.item.workspaceCandidates?.length?(0,B.jsx)(`div`,{className:`personal-workspace-candidates`,"aria-label":f(`drawer.workspaceCandidates`),children:u.item.workspaceCandidates.map(e=>(0,B.jsxs)(`button`,{onClick:()=>void t.onSelectWorkspaceCandidate?.(u.item,e.workspaceRef),type:`button`,children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.workspaceRef})]},e.workspaceRef))}):null,!c&&u.item.status===`error`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void t.onTransitionProposal?.(u.item,`regenerate`),type:`button`,children:[(0,B.jsx)(mh,{size:17}),f(`drawer.proposalRegenerate`)]}):!c&&u.item.status!==`gated`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:![`ready`,`deferred`].includes(u.item.status),onClick:()=>void t.onApplyProposal?.(u.item),type:`button`,children:[(0,B.jsx)(km,{size:17}),u.item.status===`applying`?f(`drawer.applying`):u.item.primaryLabel??f(`drawer.apply`)]}):null,!c&&[`stale`,`gated`,`rejected`].includes(u.item.status)?(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onTransitionProposal?.(u.item,`regenerate`),type:`button`,children:[(0,B.jsx)(mh,{size:16}),f(`drawer.proposalRecheck`)]}):null,!c&&[`ready`,`gated`].includes(u.item.status)?(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onTransitionProposal?.(u.item,`defer`),type:`button`,children:f(`drawer.proposalDefer`)}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onTransitionProposal?.(u.item,`reject`),type:`button`,children:f(`drawer.decisionReject`)})]}):null,[`applied`,`applying`].includes(u.item.status)?null:(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:o,type:`button`,children:f(`drawer.proposalClose`)})]}):null,u.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{className:`personal-detail-card`,children:[(0,B.jsxs)(`small`,{children:[u.item.scheduleKind===`heartbeat`?`Goal Heartbeat`:`continuous_monitor`,` · `,u.item.status??`active`]}),(0,B.jsx)(`h3`,{children:u.item.label}),(0,B.jsx)(`p`,{children:u.item.target??u.item.schedule??f(`drawer.scheduleDefaultTarget`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.scheduleTimezone`)}),(0,B.jsx)(`dd`,{children:u.item.timezone??f(`drawer.scheduleLocalTimezone`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.scheduleNext`)}),(0,B.jsx)(`dd`,{children:u.item.nextRunAt??f(`drawer.schedulePending`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.scheduleLast`)}),(0,B.jsx)(`dd`,{children:u.item.previousRunAt??f(`drawer.scheduleNeverRun`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.scheduleNotification`)}),(0,B.jsx)(`dd`,{children:u.item.notificationRule??f(`drawer.scheduleDefaultNotification`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:f(`drawer.scheduleStopCondition`)}),(0,B.jsx)(`dd`,{children:u.item.stopCondition??f(`drawer.scheduleDefaultStop`)})]})]})]}),!c&&u.item.scheduleKind===`monitor`?(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:()=>void t.onUpdateSchedule?.(u.item,`run_now`),type:`button`,children:[(0,B.jsx)(uh,{size:16}),f(`drawer.scheduleRunNow`)]}):null,c?null:(0,B.jsxs)(`div`,{className:`personal-drawer-action-grid`,children:[(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onUpdateSchedule?.(u.item,u.item.status===`paused`?`resume`:`pause`),type:`button`,children:[u.item.status===`paused`?(0,B.jsx)(uh,{size:16}):(0,B.jsx)(lh,{size:16}),u.item.status===`paused`?f(`drawer.scheduleResume`):f(`drawer.schedulePause`)]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,onClick:()=>void t.onUpdateSchedule?.(u.item,`edit`),type:`button`,children:[(0,B.jsx)(Dm,{size:16}),f(`drawer.scheduleEdit`)]})]}),c?null:(0,B.jsxs)(`button`,{className:`personal-danger-action`,onClick:()=>void t.onUpdateSchedule?.(u.item,`stop`),type:`button`,children:[(0,B.jsx)(wh,{size:16}),f(`drawer.scheduleStop`,{kind:u.item.scheduleKind===`heartbeat`?` Heartbeat`:f(`drawer.titleSchedule`)})]}),(0,B.jsxs)(`section`,{className:`personal-execution-history`,"aria-labelledby":`personal-execution-history-title`,children:[(0,B.jsx)(`h3`,{id:`personal-execution-history-title`,children:f(`drawer.executionHistory`)}),u.item.executionHistory?.length?(0,B.jsx)(`ol`,{children:u.item.executionHistory.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.timestamp})]}),(0,B.jsx)(`em`,{className:`is-${e.status}`,children:e.status})]},`${e.timestamp}:${e.runId??t}`))}):(0,B.jsx)(`p`,{children:f(`drawer.noExecutionHistory`)})]})]}):null,u.kind===`run`||u.kind===`proposal`||u.kind===`schedule`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{"aria-expanded":h,className:`personal-diagnostics-trigger`,onClick:()=>g(e=>!e),type:`button`,children:[(0,B.jsx)(`span`,{children:f(`drawer.advancedDiagnostics`)}),(0,B.jsx)(Am,{className:h?`is-open`:``,size:16})]}),h?(0,B.jsxs)(`div`,{className:`personal-diagnostics`,children:[(0,B.jsxs)(`code`,{children:[`goal_id: `,de]}),(0,B.jsxs)(`code`,{children:[`kind: `,u.kind]}),u.kind===`run`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`session_id: `,u.item.sessionId??f(`drawer.notLinked`)]}),(0,B.jsxs)(`code`,{children:[`turn_id: `,u.item.turnId??f(`common.none`)]}),(0,B.jsxs)(`code`,{children:[`adapter: `,u.item.agentId]}),(0,B.jsxs)(`code`,{children:[`status: `,u.item.sessionStatus??u.item.status]})]}):u.kind===`proposal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`action: `,u.item.actionKind]}),(0,B.jsxs)(`code`,{children:[`status: `,u.item.status]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`code`,{children:[`schedule_id: `,u.item.scheduleId]}),(0,B.jsxs)(`code`,{children:[`status: `,u.item.status??`active`]})]})]}):null]}):null]})]})}var bb=[`checking`,`connecting`,`downloading`,`installing_app`,`installing_runtime`],xb={desktop_status_unavailable:[`无法读取 App 更新状态。请重启 App 后再试;若仍失败,请重新安装最新 App。`,`Cannot read the App update status. Restart the App; if this persists, reinstall the latest App.`],update_feed_unavailable:[`此通道的更新源尚未就绪或暂时不可用。可稍后重新检查,当前版本仍可继续使用。`,`This channel's update feed is not ready or temporarily unavailable. Check again later; you can keep using this version.`],update_feed_invalid:[`更新源格式异常。请稍后重新检查。`,`The update feed is invalid. Check again later.`],update_platform_unavailable:[`此通道尚无适用于本机的更新包。`,`This channel has no update package for this platform.`],update_check_timeout:[`检查更新超时。请稍后重试。`,`The update check timed out. Try again later.`],update_network_failed:[`无法连接更新服务器。请检查网络后重试。`,`Cannot reach the update server. Check your connection and retry.`],update_download_or_signature_failed:[`更新包下载或签名校验失败,尚未安装。请重新检查更新。`,`Download or signature verification failed; the update was not installed. Check for updates again.`]};function Sb(e,t=`update_failed`){return{phase:`error`,details:{code:typeof e==`string`&&Object.hasOwn(xb,e)?e:t}}}function Cb(){let{locale:e}=ya(),t=e===`zh-CN`,[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(`stable`),[s,c]=(0,z.useState)({phase:`idle`}),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),p=(0,z.useRef)(!1),m=window.__TAURI__?.core.invoke,h=bb.includes(s.phase);(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>r(e.matches(`:popover-open`));return e.addEventListener(`toggle`,t),()=>e.removeEventListener(`toggle`,t)},[]),(0,z.useEffect)(()=>{if(!m)return;let e=!0;return m(`desktop_update_status`).then(t=>{if(!e)return;u(t.app_version),f(t.rollback_available===!0),t.state?.phase&&c(t.state);let n=t.state?.details?.channel??(t.app_version.includes(`-main.`)?`main`:`stable`);o(n),t.state?.phase||m(`desktop_update`,{action:`check`,channel:n}).then(t=>{e&&c(t)}).catch(t=>{e&&c(Sb(t))})}).catch(()=>{e&&c(Sb(null,`desktop_status_unavailable`))}),()=>{e=!1}},[m]),(0,z.useEffect)(()=>{if(!m||!h)return;let e=window.setInterval(()=>{m(`desktop_update_status`).then(e=>{e.state?.phase&&c(e.state)}).catch(()=>{})},1e3);return()=>window.clearInterval(e)},[m,h]);async function g(e){if(!(!m||p.current)){p.current=!0,c({phase:e===`check`?`checking`:e===`repair`?`installing_runtime`:`downloading`});try{if(!l){let e=await m(`desktop_update_status`);u(e.app_version),f(e.rollback_available===!0)}c(await m(`desktop_update`,{action:e,channel:a}))}catch(e){c(Sb(e,l?`update_failed`:`desktop_status_unavailable`))}finally{p.current=!1}}}let _={service_error:t?`运行时已安装,但服务尚未连接。可重试更新、修复或恢复上版。`:`Runtime installed, but services are unavailable. Retry updates, repair, or restore the previous version.`,idle:t?`App 会检查可用更新,不会自动安装。`:`Updates are checked automatically, never installed without confirmation.`,runtime_required:t?`请完成匹配组件安装,或检查 App 更新。`:`Install matching components or check for an App update.`,connecting:t?`正在连接更新后的服务…`:`Connecting to updated services…`,checking:t?`正在检查更新…`:`Checking for updates…`,available:t?`新版本已就绪,一次更新 App 与匹配的运行时。`:`Update the App and its matching runtime together.`,up_to_date:t?`当前通道暂无更新。`:`No newer update on this channel.`,downloading:t?`正在下载并校验签名…`:`Downloading and verifying signature…`,installing_app:t?`正在安装 App,请保持窗口打开。`:`Installing the App. Keep this window open.`,installing_runtime:t?`正在安装匹配的运行时,请稍候…`:`Installing the matching runtime…`,restart_required:t?`重启后将自动完成运行时安装与服务连接。`:`Restart to finish runtime installation and reconnect services.`,ready:t?`更新完成,服务已就绪。`:`Update completed; services are ready.`,error:xb[s.details?.code??``]?.[+!t]??(t?`更新未完成。请重试;启动失败可尝试修复当前版本。`:`Update incomplete. Retry; repair this version if startup fails.`)},v=h?t?`正在更新…`:`Updating…`:s.phase===`available`?t?`有可用更新`:`Update available`:s.phase===`restart_required`?t?`重启完成更新`:`Restart to finish`:s.phase===`error`?t?`更新需重试`:`Retry update`:t?`更新 LoopX`:`Update LoopX`;return(0,B.jsxs)(`div`,{className:`personal-desktop-update`,children:[(0,B.jsxs)(`button`,{className:`personal-update-trigger`,type:`button`,"aria-expanded":n,"aria-controls":`desktop-update-panel`,onClick:e=>{i.current?.style.setProperty(`bottom`,`${window.innerHeight-e.currentTarget.getBoundingClientRect().top+8}px`),i.current?.togglePopover()},children:[(0,B.jsx)(Bm,{size:16,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:v}),(0,B.jsx)(Mm,{size:14,"aria-hidden":`true`})]}),(0,B.jsxs)(`section`,{ref:i,popover:`auto`,id:`desktop-update-panel`,className:`personal-update-panel`,"aria-label":t?`LoopX 更新`:`LoopX updates`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t?`LoopX 更新`:`LoopX updates`}),(0,B.jsx)(`button`,{type:`button`,"aria-label":t?`关闭更新面板`:`Close updates`,onClick:()=>i.current?.hidePopover(),children:(0,B.jsx)(jh,{size:16,"aria-hidden":`true`})})]}),(0,B.jsxs)(`small`,{children:[l,` · `,a===`main`?t?`main 预览版`:`main preview`:t?`稳定版`:`Stable`]}),s.details?.version?(0,B.jsxs)(`p`,{children:[t?`目标版本:`:`Target: `,s.details.version]}):null,(0,B.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[h?(0,B.jsx)(ph,{className:`is-spinning`,size:14,"aria-hidden":`true`}):null,_[s.phase]]}),s.phase===`downloading`&&s.details?.total?(0,B.jsx)(`progress`,{"aria-label":t?`下载进度`:`Download progress`,max:s.details.total,value:s.details.received??0}):null,m?(0,B.jsx)(`div`,{className:`personal-update-actions`,children:s.phase===`restart_required`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`restart`),children:t?`重启完成更新`:`Restart to finish`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void g(`check`),children:t?`检查更新`:`Check for updates`}),s.phase===`available`?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void g(`apply`),children:t?`更新并准备重启`:`Install update`}):null]})}):(0,B.jsx)(`p`,{children:t?`请在 LoopX App 中更新;浏览器自身无需安装包。`:`Update from the LoopX App; the browser needs no installer.`}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`高级选项`:`Advanced options`}),(0,B.jsxs)(`label`,{children:[t?`更新通道`:`Update channel`,(0,B.jsxs)(`select`,{disabled:h||s.phase===`restart_required`,value:a,onChange:e=>{o(e.target.value),c({phase:`idle`})},children:[(0,B.jsx)(`option`,{value:`stable`,children:t?`稳定版(推荐)`:`Stable (recommended)`}),(0,B.jsx)(`option`,{value:`main`,children:t?`main 预览版`:`main preview`})]})]}),(0,B.jsx)(`p`,{children:t?`App 与匹配的 CLI 一起更新,服务可能短暂断开。不删除 Goal 数据。`:`Updates the App and matching CLI. Services may briefly disconnect. Goal data is not deleted.`}),m?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:t?`启动失败时,可重装当前 App 随附的运行时。`:`If startup fails, reinstall this App's bundled runtime.`}),(0,B.jsx)(`button`,{disabled:h||s.phase===`restart_required`,type:`button`,onClick:()=>void g(`repair`),children:t?`修复当前版本`:`Repair this version`})]}):null,m&&d?(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:t?`恢复上个版本`:`Restore previous version`}),(0,B.jsx)(`p`,{children:t?`将恢复已保留的 App 和它的运行时,需要重启。`:`Restore the retained App and its runtime, then restart.`}),(0,B.jsx)(`button`,{disabled:h,type:`button`,onClick:()=>void g(`rollback`),children:t?`确认恢复上版`:`Restore previous version`})]}):null]})]})]})}var wb=e=>`loopx-sidebar-goal-order-v1:${encodeURIComponent(e)}`;function Tb(e){try{let t=JSON.parse(e??`null`);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?[...new Set(t)]:[]}catch{return[]}}function Eb(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.goalId)??1/0)-(n.get(t.goalId)??1/0))}function Db(e,t,n,r,i){if(n===r||!t.includes(n)||!t.includes(r))return e;let a=[...new Set([...e,...t])].filter(e=>e!==n);return a.splice(a.indexOf(r)+Number(i),0,n),a}function Ob(e,t){let n=wb(t),[r,i]=(0,z.useState)(()=>{try{return Tb(localStorage.getItem(n))}catch{return[]}}),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),d=(0,z.useRef)(null),f=(0,z.useRef)(!1),p=Eb(e,r),m=p.map(e=>e.goalId);function h(t,a,s){let l=Db(r,m,t,a,s);if(l===r)return;i(l);let u=Eb(e,l),d=u.findIndex(e=>e.goalId===t),f=u[d];f&&c({title:f.title,position:d+1});try{localStorage.setItem(n,JSON.stringify(l)),o(!1)}catch{o(!0)}}function g(){d.current=null,u(null)}return{sorted:p,target:l,saveFailed:a,lastMoved:s,move:h,moveBy(e,t){let n=p[m.indexOf(e)+t];n&&h(e,n.goalId,t===1)},pointerProps:e=>({onPointerDown(t){f.current=!1,t.pointerType===`mouse`&&t.button===0&&(d.current={id:e,x:t.clientX,y:t.clientY,dragging:!1},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove(e){let t=d.current;if(!t||!t.dragging&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6)return;t.dragging=!0,f.current=!0;let n=document.elementFromPoint(e.clientX,e.clientY)?.closest(`[data-reorder-goal]`),r=e.currentTarget.closest(`.personal-goal-list`),i=n?.dataset.reorderGoal;if(!n||!i||!r?.contains(n)||i===t.id){u(null);return}let a=n.getBoundingClientRect();u({id:i,after:e.clientY>a.top+a.height/2})},onPointerUp(){d.current?.dragging&&l&&h(d.current.id,l.id,l.after),g()},onPointerCancel:g,onLostPointerCapture:g,onKeyDown(e){e.key===`Escape`&&g()},onClickCapture(e){f.current&&=(e.preventDefault(),e.stopPropagation(),!1)}})}}var kb=`/ssh-hosts`,Ab=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;function jb(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`SSH Host 列表响应无效。`);let t=e;if(t.ok!==!0||t.schema_version!==`ssh_host_catalog_v0`||!Array.isArray(t.hosts))throw Error(`SSH Host 列表协议不兼容,请更新本机 LoopX 服务。`);let n=new Set;return{hosts:t.hosts.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=String(e.alias??``).trim();return!Ab.test(t)||n.has(t)?[]:(n.add(t),[{alias:t}])}),schemaVersion:`ssh_host_catalog_v0`}}async function Mb(e=fetch,t=kb){let n=await e(t,{cache:`no-store`});if(!n.ok)throw Error(`无法读取本机 SSH Host(HTTP ${n.status})。`);return jb(await n.json())}function Nb(e,t){let n=e.trim();if(!Ab.test(n))return{error:`请选择有效的 SSH Host。`};let r=Number(t);return!Number.isInteger(r)||r<1024||r>65535?{error:`本地端口必须是 1024–65535 之间的整数。`}:{command:`ssh -N -L ${r}:127.0.0.1:8766 ${n}`,label:n,statusUrl:`http://127.0.0.1:${r}/status.json`}}var Pb=`/api/ssh-source/ensure`;async function Fb(e,t){let n=await fetch(Pb,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({host_alias:e,local_port:Number(t)})}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`无法建立 SSH 隧道来源。`);if(!r?.ok)throw Error(`无法建立 SSH 隧道来源。`);return r}function Ib({activeSource:e,connectionState:t,errorMessage:n,onAdd:r,onRemove:i,onSelect:a,sources:o}){let{t:s}=ya(),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(`configured`),[m,h]=(0,z.useState)([]),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(``),[w,T]=(0,z.useState)(``),[E,D]=(0,z.useState)(`8876`),[O,k]=(0,z.useState)(``),ee=`configured:`,A=[...o.map(e=>({label:e.label,value:e.id})),...m.filter(e=>!o.some(t=>t.label===e.alias)).map(e=>({group:s(`source.configuredGroup`,{count:m.length}),label:e.alias,value:`${ee}${e.alias}`}))],j=(0,z.useMemo)(()=>m.some(e=>e.alias===S)?Nb(S,E):{error:s(`source.selectHost`)},[m,S,E,s]);(0,z.useEffect)(()=>{te()},[]);async function te(){y(!0),_(null);try{let e=await Mb();h(e.hosts),C(t=>t||e.hosts[0]?.alias||``),e.hosts.length||_(s(`source.hostEmpty`))}catch(e){_(e instanceof Error?e.message:s(`source.hostLoadError`))}finally{y(!1)}}function ne(){l(!0),p(`configured`),d(null),te()}function re(){l(!1),p(`configured`),_(null),x(!1),C(``),d(null),T(``),D(`8876`),k(``)}function M(){let e=r({label:w,statusUrl:O});if(e.error){d(e.error);return}re()}function N(){if(`error`in j){d(j.error??s(`source.invalid`));return}let e=r({ensureTunnel:!0,label:j.label,statusUrl:j.statusUrl});if(e.error){d(e.error);return}re()}function ie(e){let t=new Set;for(let e of o)try{t.add(new URL(e.statusUrl).port)}catch{}let n=`8877`;for(let e=8877;e<9077;e+=1)if(!t.has(String(e))){n=String(e);break}let i=Nb(e,n);if(`error`in i){d(i.error??s(`source.invalid`));return}let a=r({ensureTunnel:!0,label:i.label,statusUrl:i.statusUrl});a.error?d(a.error):d(null),D(n)}async function ae(){if(`error`in j){d(j.error??s(`source.invalid`));return}try{await navigator.clipboard.writeText(j.command),x(!0),d(null)}catch{d(s(`source.copyError`))}}return(0,B.jsxs)(`section`,{"aria-label":s(`source.controlPlane`),className:`personal-status-source`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{children:`Control plane`}),(0,B.jsx)(`button`,{"aria-label":s(`source.addSsh`),onClick:ne,title:s(`source.add`),type:`button`,children:(0,B.jsx)(dh,{size:14})})]}),(0,B.jsx)(Ky,{ariaLabel:s(`source.select`),className:`personal-status-source-select`,icon:(0,B.jsx)(yh,{size:15}),onChange:e=>{if(e.startsWith(ee)){ie(e.slice(11));return}a(e)},options:A,value:e.id}),(0,B.jsxs)(`div`,{className:`personal-status-source-meta`,children:[(0,B.jsxs)(`span`,{className:`is-${t}`,children:[(0,B.jsx)(`i`,{}),s(t===`loading`?`source.connecting`:t===`error`?`source.notAvailable`:`source.connected`)]}),(0,B.jsx)(`small`,{children:e.readOnly?s(`source.readOnly`):s(`source.localInteractive`)}),e.kind===`ssh_tunnel`?(0,B.jsx)(`button`,{"aria-label":s(`source.remove`,{source:e.label}),onClick:()=>i(e.id),title:s(`source.removeCurrent`),type:`button`,children:(0,B.jsx)(Dh,{size:12})}):null]}),n?(0,B.jsx)(`p`,{className:`personal-status-source-error`,role:`alert`,children:n}):null,c?(0,B.jsxs)(`div`,{className:`personal-status-source-form`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:s(`source.addSsh`)}),(0,B.jsx)(`button`,{"aria-label":s(`source.closeForm`),onClick:re,type:`button`,children:(0,B.jsx)(jh,{size:13})})]}),(0,B.jsxs)(`div`,{"aria-label":s(`source.addMethod`),className:`personal-status-source-modes`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":f===`configured`,onClick:()=>{p(`configured`),d(null)},role:`tab`,type:`button`,children:s(`source.configured`)}),(0,B.jsx)(`button`,{"aria-selected":f===`manual`,onClick:()=>{p(`manual`),d(null)},role:`tab`,type:`button`,children:s(`source.manual`)})]}),f===`configured`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:s(`source.configuredCount`,{count:m.length})}),(0,B.jsxs)(`span`,{className:`personal-status-source-field-row`,children:[(0,B.jsx)(`input`,{"aria-label":s(`source.host`),disabled:v||!m.length,list:`loopx-configured-ssh-hosts`,onChange:e=>{C(e.target.value),x(!1)},placeholder:s(v?`source.loadingHosts`:`source.hostPlaceholder`),value:S}),(0,B.jsx)(`datalist`,{id:`loopx-configured-ssh-hosts`,children:m.map(e=>(0,B.jsx)(`option`,{value:e.alias},e.alias))}),(0,B.jsx)(`button`,{"aria-label":s(`source.refreshHosts`),disabled:v,onClick:()=>void te(),title:s(`source.refreshHosts`),type:`button`,children:(0,B.jsx)(hh,{size:13})})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:s(`source.localPort`)}),(0,B.jsx)(`input`,{"aria-label":s(`source.localPort`),inputMode:`numeric`,onChange:e=>{D(e.target.value),x(!1)},value:E})]}),(0,B.jsxs)(`div`,{className:`personal-status-source-command`,children:[(0,B.jsx)(`code`,{children:`error`in j?s(`source.tunnelCommandPending`):j.command}),(0,B.jsxs)(`button`,{"aria-label":s(`source.copyCommand`),disabled:`error`in j,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(Rm,{size:12}),s(b?`source.copied`:`source.copy`)]})]}),g?(0,B.jsx)(`p`,{className:`is-error`,children:g}):null,(0,B.jsx)(`p`,{children:s(`source.description`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,disabled:`error`in j,onClick:N,type:`button`,children:s(`source.addConfigured`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:s(`source.name`)}),(0,B.jsx)(`input`,{autoFocus:!0,maxLength:48,onChange:e=>T(e.target.value),placeholder:s(`source.namePlaceholder`),value:w})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:s(`source.statusUrl`)}),(0,B.jsx)(`input`,{onChange:e=>k(e.target.value),placeholder:`http://127.0.0.1:8876/status.json`,value:O})]}),(0,B.jsx)(`p`,{children:(0,B.jsx)(`code`,{children:`ssh -N -L 8876:127.0.0.1:8766 `})}),(0,B.jsx)(`p`,{children:s(`source.manualDescription`)}),(0,B.jsx)(`button`,{className:`personal-status-source-add`,onClick:M,type:`button`,children:s(`source.addConfigured`)})]}),u?(0,B.jsx)(`p`,{className:`is-error`,role:`alert`,children:u}):null]}):null]})}var Lb={需修复:`is-danger`,等你:`is-warning`,等待条件:`is-info`,推进中:`is-success`,安静运行:`is-quiet`,已完成:`is-quiet`,已停止:`is-stopped`};function Rb({attentionCount:e,goals:t,goalArchiveLoadState:n={error:null,phase:`ready`},lifecycleBusyGoalIds:r,onRequestGoalCreate:i,onOpenSettings:a,onRetryGoalArchive:o,onRequestGoalLifecycle:s,onSelectGoal:c,selectedGoalId:l,statusSourceControl:u}){let{locale:d,t:f}=ya(),[p,m]=(0,z.useState)(!1),h=Ob(t.filter(e=>e.activationState!==`stopped`),u?.activeSource.statusUrl??`/status.json`),g=h.sorted,_=t.filter(e=>e.activationState===`stopped`),v=(e,t)=>(0,B.jsxs)(`div`,{className:`personal-goal-row${h.target?.id===e.goalId?h.target.after?` is-drop-after`:` is-drop-before`:``}`,"data-reorder-goal":t?void 0:e.goalId,"data-load-error":e.loadError,children:[(0,B.jsxs)(`button`,{...t?{}:h.pointerProps(e.goalId),title:t?void 0:f(`sidebar.dragGoal`),"aria-current":l===e.goalId?`page`:void 0,className:`personal-goal-link`,onClick:()=>c(e.goalId),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-goal-state-dot ${e.loadState?``:Lb[e.state]}`}),(0,B.jsxs)(`span`,{className:`personal-goal-link-copy`,children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsxs)(`small`,{children:[e.loadState&&(!t||l===e.goalId)?f(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):ba(e.state,d),e.needsYou&&!t?` · ${f(`home.lane.needsYou`)}`:``]})]}),(0,B.jsx)(jm,{size:15})]}),!t&&p?(0,B.jsxs)(`div`,{className:`personal-goal-move-actions`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":f(`sidebar.moveUp`,{goal:e.title}),disabled:g[0]?.goalId===e.goalId,onClick:()=>h.moveBy(e.goalId,-1),children:(0,B.jsx)(Sm,{"aria-hidden":`true`,size:13})}),(0,B.jsx)(`button`,{type:`button`,"aria-label":f(`sidebar.moveDown`,{goal:e.title}),disabled:g.at(-1)?.goalId===e.goalId,onClick:()=>h.moveBy(e.goalId,1),children:(0,B.jsx)(vm,{"aria-hidden":`true`,size:13})})]}):null,s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{"aria-label":`${f(t?`sidebar.resume`:`sidebar.stop`)} ${e.title}`,"aria-busy":r?.has(e.goalId)||void 0,className:`personal-goal-lifecycle${r?.has(e.goalId)?` is-pending`:``}`,disabled:r?.has(e.goalId),onClick:()=>s(e,t?`resume`:`stop`),title:f(t?`sidebar.resumeGoal`:`sidebar.stopGoal`),type:`button`,children:r?.has(e.goalId)?(0,B.jsx)(eh,{size:13}):t?(0,B.jsx)(mh,{size:13}):(0,B.jsx)(lh,{size:13})}),t?(0,B.jsx)(`button`,{"aria-label":`${f(`sidebar.delete`)} ${e.title}`,className:`personal-goal-lifecycle personal-goal-delete`,onClick:()=>s(e,`delete`),title:f(`sidebar.deleteGoal`),type:`button`,children:(0,B.jsx)(Dh,{size:13})}):null]}):null]},e.goalId);return(0,B.jsxs)(`div`,{className:`personal-goal-directory`,children:[(0,B.jsxs)(`div`,{className:`personal-sidebar-brand`,children:[(0,B.jsx)(`span`,{className:`personal-brand-mark`,children:(0,B.jsx)(Tm,{size:18})}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:`LoopX`}),(0,B.jsx)(`small`,{children:f(`sidebar.product`)})]})]}),u?(0,B.jsx)(Ib,{...u}):null,(0,B.jsxs)(`nav`,{"aria-label":f(`home.workspace`),className:`personal-sidebar-nav`,children:[(0,B.jsxs)(`button`,{"aria-current":l===null?`page`:void 0,className:`personal-manager-link`,onClick:()=>c(null),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-manager-icon`,children:(0,B.jsx)(Tm,{size:17})}),(0,B.jsx)(`span`,{children:f(`sidebar.manager`)}),e>0?(0,B.jsx)(`span`,{className:`personal-sidebar-count`,children:e}):null,(0,B.jsx)(jm,{size:15})]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-section-title`,children:[(0,B.jsx)(`span`,{children:`Goals`}),(0,B.jsxs)(`span`,{className:`personal-sidebar-title-actions`,children:[(0,B.jsx)(`small`,{children:g.length}),(0,B.jsx)(`button`,{"aria-label":f(`sidebar.sortGoals`),title:f(`sidebar.sortGoals`),"aria-pressed":p,onClick:()=>m(!p),type:`button`,children:(0,B.jsx)(xm,{"aria-hidden":`true`,size:15})}),i?(0,B.jsx)(`button`,{"aria-label":f(`sidebar.createGoal`),onClick:i,type:`button`,children:(0,B.jsx)(dh,{size:15})}):null]})]}),h.saveFailed?(0,B.jsx)(`p`,{role:`status`,children:f(`sidebar.orderNotSaved`)}):null,(0,B.jsx)(`span`,{className:`personal-sr-only`,role:`status`,children:h.lastMoved?f(`sidebar.goalMoved`,{goal:h.lastMoved.title,position:h.lastMoved.position}):``}),(0,B.jsx)(`div`,{className:`personal-goal-list`,children:g.map(e=>v(e,!1))}),_.length||n.phase===`loading`||n.phase===`error`?(0,B.jsxs)(`details`,{className:`personal-stopped-goals`,open:n.phase===`error`||void 0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Am,{size:13}),(0,B.jsx)(`span`,{children:f(`sidebar.stopped`)}),n.phase===`loading`?(0,B.jsx)(eh,{"aria-label":f(`sidebar.stoppedLoading`),className:`is-spinning`,size:13}):(0,B.jsx)(`small`,{children:_.length})]}),(0,B.jsxs)(`div`,{className:`personal-goal-list is-stopped`,children:[n.phase===`error`?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`alert`,children:[(0,B.jsx)(`span`,{children:f(`sidebar.stoppedLoadFailed`)}),o?(0,B.jsx)(`button`,{onClick:o,type:`button`,children:f(`sidebar.retryStopped`)}):null]}):null,_.map(e=>v(e,!0))]})]}):null]}),(0,B.jsxs)(`div`,{className:`personal-sidebar-footer`,children:[(0,B.jsx)(Cb,{}),a?(0,B.jsxs)(`button`,{"aria-label":f(`settings.open`),className:`personal-sidebar-utility`,onClick:a,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-sidebar-utility-icon`,children:(0,B.jsx)(bh,{size:17})}),(0,B.jsxs)(`span`,{className:`personal-sidebar-utility-copy`,children:[(0,B.jsx)(`strong`,{children:f(`settings.open`)}),(0,B.jsx)(`small`,{children:f(`settings.eyebrow`)})]}),(0,B.jsx)(jm,{"aria-hidden":`true`,size:15})]}):null]})]})}var zb=J({ok:Y(!0),total:G().int().nonnegative(),next_cursor:W().nullable(),items:q(J({todo_id:W(),text:W(),claimed_by:W().nullable(),evidence:W().nullable(),priority:W().nullable(),task_class:W().nullable()})).max(40)});function Bb({goal:e,agentId:t,seed:n,enabled:r,listView:i=!1,onSelect:a}){let{t:o}=ya(),s=(0,z.useId)(),[c,l]=(0,z.useState)(!1),u=!i||c,d=i?96:148,[f,p]=(0,z.useState)(n),[m,h]=(0,z.useState)(t===`all`?e.doneTodoCount??n.length:n.length),[g,_]=(0,z.useState)(void 0),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)({top:0,height:600}),[E,D]=(0,z.useState)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(null),[ee,A]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>T({top:e.scrollTop,height:e.clientHeight}));return t.observe(e),()=>{t.disconnect(),k.current?.abort()}},[]);let j=g===void 0||w.top+w.height>=f.length*d-d*2;(0,z.useEffect)(()=>{if(!r||!u||!j||g===null||b||k.current)return;let n=new AbortController;k.current=n,y(!0);let i=new URLSearchParams({goal_id:e.goalId});t!==`all`&&i.set(`agent_id`,t),g&&i.set(`cursor`,g),fetch(`/api/chat/completed-todos?${i}`,{signal:n.signal}).then(async e=>{if(e.status===409&&C(!0),!e.ok)throw Error(`history unavailable`);let t=zb.parse(await e.json());if(n.signal.aborted)return;let r=t.items.map(e=>({todoId:e.todo_id,text:e.text,claimedBy:e.claimed_by,evidence:e.evidence,priority:e.priority,taskClass:e.task_class,done:!0,status:`done`}));p(e=>g===void 0?r:[...e,...r.filter(t=>!e.some(e=>e.todoId===t.todoId))]),h(t.total),_(t.next_cursor)}).catch(()=>{n.signal.aborted||x(!0)}).finally(()=>{n.signal.aborted||(k.current=null,y(!1))})},[r,u,j,g,b,ee,e.goalId,t,v]),(0,z.useEffect)(()=>{O.current&&(O.current.scrollTop=0),T({top:0,height:O.current?.clientHeight??600}),D(null)},[i]);let te=Math.max(0,Math.floor(w.top/d)-3),ne=Math.min(f.length,Math.ceil((w.top+w.height)/d)+3),re=Array.from({length:Math.max(0,ne-te)},(e,t)=>te+t);return E!==null&&El(e=>!e),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:c?`▾`:`▸`}),` `,o(`tasks.completed`)]}):(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-done`}),o(`tasks.completed`)]}),(0,B.jsx)(`span`,{children:m})]}),(0,B.jsxs)(`div`,{id:s,hidden:!u,"aria-label":o(`tasks.completed`),className:`personal-task-lane-scroll`,ref:O,role:`region`,tabIndex:0,onScroll:e=>T({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),children:[(0,B.jsx)(`div`,{className:`personal-completed-window`,style:{height:f.length*d},children:re.map(t=>{let n=f[t];return(0,B.jsx)(`div`,{className:`personal-task-card personal-completed-row`,style:{top:t*d,height:d},children:(0,B.jsxs)(`button`,{type:`button`,onFocus:()=>D(t),onBlur:()=>D(null),onClick:()=>a({kind:`todo`,item:{...n,goalId:e.goalId,goalTitle:e.title,ownerLabel:n.claimedBy??e.agentLabel??e.agentId}}),children:[(0,B.jsx)(`span`,{className:`is-done`,children:`✓`}),(0,B.jsx)(`strong`,{children:n.text}),(0,B.jsx)(`small`,{children:n.claimedBy??e.agentLabel??e.agentId})]})},n.todoId)})}),(0,B.jsx)(`div`,{className:`personal-completed-footer`,role:`status`,children:v?o(`tasks.historyLoading`):b?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:o(S?`tasks.historyExpired`:`tasks.historyError`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{S&&(_(void 0),O.current&&(O.current.scrollTop=0)),C(!1),x(!1),A(e=>e+1)},children:o(`tasks.historyRetry`)})]}):r?g===null?o(`tasks.historyEnd`):(0,B.jsx)(`button`,{type:`button`,onClick:()=>{O.current&&(O.current.scrollTop=f.length*d)},children:o(`tasks.historyMore`)}):o(`tasks.historyLocalOnly`)})]})]})}function Vb({children:e,count:t,label:n,tone:r,listView:i=!1}){let a=(0,z.useId)(),o=(0,z.useRef)(null),s=(0,z.useRef)([]),c=(0,z.useRef)(null),[l,u]=(0,z.useState)({after:!1,before:!1}),d=(0,z.useCallback)(()=>{let e=o.current;if(!e)return;let t={after:Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop>1,before:e.scrollTop>1};u(e=>e.after===t.after&&e.before===t.before?e:t)},[]);return(0,z.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(d);return c.current=t,t.observe(e),e.addEventListener(`scroll`,d,{passive:!0}),d(),()=>{t.disconnect(),c.current=null,s.current=[],e.removeEventListener(`scroll`,d)}},[i,d]),(0,z.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;for(let e of s.current)t.unobserve(e);let n=Array.from(e.children).filter(e=>e instanceof HTMLElement);for(let e of n)t.observe(e);s.current=n,d()},[e,t,i,d]),i?!t&&r!==`done`?null:(0,B.jsxs)(`details`,{className:`personal-task-group tone-${r}`,open:!0,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(Am,{size:16}),(0,B.jsx)(`strong`,{children:n}),(0,B.jsx)(`span`,{children:t})]}),(0,B.jsx)(`div`,{className:`personal-task-list-rows`,children:e})]}):(0,B.jsxs)(`section`,{className:`personal-object-list personal-task-lane`,children:[(0,B.jsxs)(`header`,{id:a,children:[(0,B.jsxs)(`strong`,{children:[(0,B.jsx)(`i`,{"aria-hidden":`true`,className:`personal-kanban-dot tone-${r}`}),n]}),(0,B.jsx)(`span`,{children:t})]}),(0,B.jsx)(`div`,{"aria-labelledby":a,className:`personal-task-lane-scroll${l.before?` has-overflow-before`:``}${l.after?` has-overflow-after`:``}`,ref:o,role:`region`,tabIndex:t>0?0:-1,children:e})]})}function Hb({historyEnabled:e=!1,goal:t,items:n,onDraftTaskFromMessage:r,onOpenChat:i,onQuickComplete:a,quickCompletingTodoIds:o,onSelect:s,selectedTodoId:c=null,userTodos:l}){let{t:u}=ya(),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)({goalId:``,laneId:`all`}),h=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!c)return;let e=window.requestAnimationFrame(()=>h.current?.scrollIntoView({block:`nearest`,inline:`nearest`}));return()=>window.cancelAnimationFrame(e)},[c]);let g=l.filter(e=>e.goalId===t.goalId).map(e=>({...e,goalTitle:t.title})),_=e=>e.priority===`P0`?0:e.priority===`P1`?1:e.priority===`P2`?2:3,v=(0,z.useMemo)(()=>{let e=new Map((t.agentLanes??[]).map(e=>[e.agentId,e]));for(let n of t.agentTodos)n.claimedBy&&!e.has(n.claimedBy)&&e.set(n.claimedBy,{agentId:n.claimedBy,label:n.claimedBy});return[...e.values()]},[t.agentLanes,t.agentTodos]),y=p.goalId===t.goalId&&v.some(e=>e.agentId===p.laneId)?p.laneId:`all`,b=e=>y===`all`||e===y,x=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&!e.done).filter(e=>b(e.claimedBy)).sort((e,t)=>_(e)-_(t)),S=t.agentTodos.filter(e=>e.taskClass!==`continuous_monitor`&&e.done).filter(e=>b(e.claimedBy)),C=n.filter(e=>e.kind===`schedule`&&b(e.schedule.agentId)),w=n.filter(e=>e.kind===`run`&&!!e.run.todoId&&b(e.run.agentId)),T=!g.length&&!x.length&&!S.length&&!C.length,E=n.filter(e=>e.kind===`message`&&(e.message.role===`user`||e.message.role===`assistant`)),D=E.reduce((e,t,n)=>t.message.role===`user`?n:e,-1),O=D>=0?E[D]?.message:null,k=D>=0?E.slice(D+1).reverse().find(e=>e.message.role===`assistant`)?.message:null,ee=D>=0&&E.slice(D+1).some(e=>e.message.role===`assistant`&&e.message.pending);return(0,B.jsxs)(`section`,{"aria-label":u(`header.tasks`),className:`personal-task-board${d?` is-list-view`:``}`,children:[(0,B.jsxs)(`header`,{className:`personal-task-view-toolbar`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:u(`header.tasks`)}),(0,B.jsx)(`span`,{children:u(`tasks.viewDescription`)})]}),(0,B.jsxs)(`div`,{className:`personal-task-view-switch`,role:`group`,"aria-label":u(`tasks.viewLabel`),children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:u(`tasks.listView`)}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:u(`tasks.boardView`)})]})]}),v.length>1?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.agentLaneFilter`),className:`personal-task-lane-filter`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Tm,{size:15}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:u(`tasks.agentLane`)}),(0,B.jsx)(`small`,{children:u(`tasks.agentLaneDescription`)})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`sr-only`,children:u(`tasks.agentLaneFilter`)}),(0,B.jsxs)(`select`,{"aria-label":u(`tasks.agentLaneFilter`),onChange:e=>m({goalId:t.goalId,laneId:e.target.value}),value:y,children:[(0,B.jsx)(`option`,{value:`all`,children:u(`tasks.allAgentLanes`,{count:v.length})}),v.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label},e.agentId))]}),(0,B.jsx)(Am,{"aria-hidden":!0,size:14})]})]}):null,O?(0,B.jsxs)(`section`,{"aria-label":u(`tasks.chatRecent`),className:`personal-task-chat-receipt`,children:[(0,B.jsx)(`span`,{className:`personal-task-chat-icon`,children:(0,B.jsx)(ih,{size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:u(ee?`tasks.chatPending`:k?`tasks.chatAgentReplied`:`tasks.chatRecent`)}),(0,B.jsx)(`small`,{children:t.agentLabel??t.agentId})]}),(0,B.jsxs)(`p`,{className:`is-user`,children:[(0,B.jsx)(`b`,{children:u(`common.you`)}),O.text]}),k&&!k.pending?(0,B.jsxs)(`p`,{className:`is-assistant`,children:[(0,B.jsx)(`b`,{children:u(`common.agent`)}),k.text]}):null,(0,B.jsx)(`small`,{children:u(ee?`tasks.chatPendingDescription`:`tasks.chatUnchangedDescription`)})]}),(0,B.jsxs)(`footer`,{children:[(0,B.jsxs)(`button`,{onClick:i,type:`button`,children:[(0,B.jsx)(ih,{size:14}),u(`tasks.chatViewReply`)]}),k&&!ee&&r?(0,B.jsxs)(`button`,{onClick:()=>r(k.text),type:`button`,children:[(0,B.jsx)($m,{size:14}),u(`tasks.convertToTask`)]}):null]})]}):null,(0,B.jsxs)(`div`,{className:d?`personal-task-grouped-list`:`personal-task-kanban`,children:[(0,B.jsxs)(Vb,{listView:d,count:g.length,label:u(`timeline.waitingConfirmation`),tone:`attention`,children:[g.map(e=>{let t=Sa(e.updatedAt,u);return(0,B.jsxs)(`button`,{onClick:()=>s({item:e,kind:`attention`}),type:`button`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`is-attention`,children:`!`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[(0,B.jsx)(`span`,{className:`personal-row-status ${e.blocking?`is-blocking`:`is-pending`}`,children:e.blocking?u(`tasks.blocked`):u(`tasks.pending`)}),t?(0,B.jsx)(`span`,{className:`personal-task-age`,children:u(`tasks.waitingAge`,{age:t})}):null]})]},e.todoId)}),g.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyConfirm`)})]}),(0,B.jsxs)(Vb,{listView:d,count:x.length,label:u(`tasks.pendingAndRunning`),tone:`progress`,children:[x.map(e=>{let n={...e,goalId:t.goalId,goalTitle:t.title,ownerLabel:e.claimedBy??t.agentLabel??t.agentId},r=w.find(t=>t.run.todoId===e.todoId)?.run;return(0,B.jsxs)(`div`,{className:`personal-task-card${r?` has-session`:``}${c===e.todoId?` is-selected`:``}`,ref:c===e.todoId?e=>{h.current=e}:void 0,children:[(0,B.jsxs)(`button`,{"aria-pressed":c===e.todoId,onClick:()=>s({item:n,kind:`todo`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`○`}),(0,B.jsx)(`strong`,{children:e.text}),(0,B.jsxs)(`small`,{children:[e.priority?(0,B.jsx)(`span`,{className:`personal-priority-badge is-${e.priority.toLowerCase()}`,children:e.priority}):null,e.status===`blocked`?(0,B.jsx)(`span`,{className:`personal-priority-badge is-blocked`,children:u(`tasks.blocked`)}):null,r?(0,B.jsx)(`span`,{className:`personal-task-session-status`,children:r.status===`running`||r.status===`queued`?u(`runs.running`):r.status===`failed`?u(`tasks.sessionError`):u(`common.waiting`)}):null,e.status===`deferred`?(0,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`drawer.taskStatusDeferred`)}):r?null:(0,B.jsx)(`span`,{className:`personal-task-session-status`,children:u(`tasks.waiting`)}),e.claimedBy??t.agentLabel??t.agentId]})]}),(0,B.jsxs)(`div`,{className:`personal-task-card-actions`,children:[r?(0,B.jsxs)(`button`,{className:`personal-task-session-link`,"aria-label":u(`tasks.openExecution`,{name:e.text}),onClick:()=>s({item:r,kind:`run`}),title:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`),type:`button`,children:[(0,B.jsx)(Hm,{size:14}),(0,B.jsx)(`span`,{children:r.status===`completed`?u(`tasks.viewResult`):u(`tasks.viewExecution`)})]}):null,a?(0,B.jsx)(`button`,{"aria-busy":o?.has(e.todoId)||void 0,"aria-label":u(`tasks.markComplete`,{name:e.text}),disabled:o?.has(e.todoId),onClick:()=>void a(n),title:u(`tasks.completed`),type:`button`,children:o?.has(e.todoId)?(0,B.jsx)(eh,{className:`personal-spin`,size:14}):(0,B.jsx)(km,{size:14})}):null,(0,B.jsx)(`button`,{"aria-label":u(`tasks.moreActions`,{name:e.text}),onClick:()=>s({item:n,kind:`todo`}),title:u(`common.actions`),type:`button`,children:(0,B.jsx)(Vm,{size:14})})]})]},e.todoId)}),x.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyRunning`)})]}),(0,B.jsxs)(Vb,{listView:d,count:C.length,label:u(`tasks.scheduled`),tone:`schedule`,children:[C.map(e=>(0,B.jsxs)(`button`,{onClick:()=>s({item:e.schedule,kind:`schedule`}),type:`button`,children:[(0,B.jsx)(`span`,{children:`◷`}),(0,B.jsx)(`strong`,{children:e.schedule.label}),(0,B.jsx)(`small`,{children:e.schedule.status===`paused`?u(`schedule.paused`):u(`schedule.active`)})]},e.id)),C.length?null:(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptySchedules`)})]}),(0,B.jsx)(Bb,{goal:t,agentId:y,seed:S,enabled:e,listView:d,onSelect:s},`${t.goalId}:${y}:${e}`)]}),T?(0,B.jsx)(`p`,{className:`personal-task-empty`,children:u(`tasks.emptyGoal`)}):null]})}function Ub(e,t){return{live_steering:{label:t(`lark.ingressSteering`),detail:t(`lark.ingressSteeringDescription`)},session_queue:{label:t(`lark.ingressQueue`),detail:t(`lark.ingressQueueDescription`)},async_inbox:{label:t(`lark.ingressAsync`),detail:t(`lark.ingressAsyncDescription`)},direct_session:{label:t(`lark.ingressLegacy`),detail:t(`lark.ingressLegacyDescription`)}}[e]}function Wb(e,t){return e.listener_status===`starting`?{label:t(`lark.health.starting`),detail:t(`lark.health.startingDetail`),ready:!1}:e.listener_status===`retrying`?{label:t(`lark.health.retrying`),detail:t(`lark.health.retryingDetail`),ready:!1}:e.listener_status===`stopped`||e.listener_status===null?{label:t(`lark.health.notStarted`),detail:t(`lark.health.notStartedDetail`),ready:!1}:e.last_event_status===`message_context_permission_required`?{label:t(`lark.health.messageContextPermission`),detail:t(`lark.health.messageContextPermissionDetail`),ready:!1}:e.last_event_status===`processing_failed`?{label:t(`lark.health.processingFailed`),detail:t(`lark.health.processingFailedDetail`),ready:!1}:e.health_error_code===`invalid_routing_state`?{label:t(`lark.health.invalidRouting`),detail:t(`lark.health.invalidRoutingDetail`),ready:!1}:e.last_event_status===`queued_for_agent`?{label:t(`lark.health.queued`),detail:t(`lark.health.queuedDetail`,{agent:e.agent_id??t(`lark.targetAgent`)}),ready:!0}:e.last_event_status===`ignored`&&e.last_event_reason===`not_addressed`?{label:t(`lark.health.notAddressed`),detail:t(`lark.health.notAddressedDetail`),ready:!0}:e.last_event_status===`ignored`&&e.last_event_reason===`self_message`?{label:t(`lark.health.listening`),detail:t(`lark.health.ignoredSelf`),ready:!0}:e.health_error_code===`lark_event_route_mismatch`||[`chat_mismatch`,`topic_mismatch`,`route_ambiguous`].includes(e.last_event_reason??``)?{label:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguous`):t(`lark.health.routeMismatch`),detail:e.last_event_reason===`route_ambiguous`?t(`lark.health.routeAmbiguousDetail`):t(`lark.health.routeMismatchDetail`),ready:!1}:[`invalid_event`,`binding_unavailable`].includes(e.last_event_reason??``)?{label:t(`lark.health.routeUnavailable`),detail:t(`lark.health.routeUnavailableDetail`),ready:!1}:e.last_event_status===`replied_and_acknowledged`?{label:t(`lark.health.listening`),detail:t(`lark.health.eventProcessed`,{events:e.event_count,replies:e.replied_count}),ready:!0}:e.health_error_code===`lark_event_delivery_unverified`||e.event_count===0?{label:t(`lark.health.eventUnverified`),detail:t(`lark.health.eventUnverifiedDetail`),ready:!1}:{label:e.reply_ready?t(`lark.health.listening`):t(`lark.health.unavailable`),detail:t(`lark.health.lastStatus`,{status:e.last_event_status??t(`lark.health.waiting`)}),ready:e.reply_ready}}function Gb(e){return e.history_permission_guidance?.api_document_url??null}function Kb(e,t,n){if(e instanceof og){let t=String(e.payload.error_code??``);return{lark_cli_not_installed:n(`lark.error.cliMissing`),lark_cli_not_executable:n(`lark.error.cliExecutable`),lark_cli_start_failed:n(`lark.error.cliStart`),lark_message_permissions_required:n(`lark.error.messagePermissions`),lark_app_required:n(`lark.error.appRequired`),invalid_lark_app:n(`lark.error.invalidApp`),lark_group_lookup_failed:n(`lark.error.groupLookup`),provider_api_failed:n(`lark.error.provider`)}[t]??e.message}return e instanceof Error?e.message:t}function qb({embedded:e=!1,focusGoalConnection:t=!1,goals:n,initialGoalId:r,onChanged:i,onClose:a}){let{t:o}=ya(),[s,c]=(0,z.useState)(`connections`),[l,u]=(0,z.useState)([]),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(!0),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(t),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(r??n[0]?.goalId??``),[T,E]=(0,z.useState)(``),[D,O]=(0,z.useState)([]),[k,ee]=(0,z.useState)(``),[A,j]=(0,z.useState)(!1),[te,ne]=(0,z.useState)(null),[re,M]=(0,z.useState)(`addressed_only`),[N,ie]=(0,z.useState)(`async_inbox`),[ae,oe]=(0,z.useState)(`topic_reply`),[P,F]=(0,z.useState)(``),[se,ce]=(0,z.useState)(!1),[le,ue]=(0,z.useState)(!1),[de,fe]=(0,z.useState)(null),[pe,me]=(0,z.useState)(null),[he,I]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1),[ve,ye]=(0,z.useState)(`loopx-workspace-bot`),[be,xe]=(0,z.useState)(`feishu`),[Se,Ce]=(0,z.useState)(null),[we,Te]=(0,z.useState)(!1),[Ee,De]=(0,z.useState)(null),L=(0,z.useRef)(null),Oe=(0,z.useRef)(null),ke=(0,z.useRef)(!1);async function Ae(){m(!0),g(null);try{let[e,t]=await Promise.all([__(),E_()]);u(e),f(t),S(t=>t||e.find(e=>e.reply_ready)?.app_ref||e.find(e=>e.ready)?.app_ref||e[0]?.app_ref||``)}catch(e){g(Kb(e,o(`lark.error.configuration`),o))}finally{m(!1)}}(0,z.useEffect)(()=>{Ae()},[]),(0,z.useEffect)(()=>{if(!t||p||ke.current||!r)return;ke.current=!0;let e=d.find(e=>e.goal_id===r);e?Be(e):ze(n.find(e=>e.goalId===r))},[d,t,n,r,p]),(0,z.useEffect)(()=>{if(!y||!x){O([]),ee(``),j(!1),ne(null);return}let e=!1;j(!0),ne(null);let t=window.setTimeout(()=>{w_(x,T).then(t=>{e||(O(t),ee(e=>t.some(t=>t.chat_id===e)?e:t[0]?.chat_id??``))}).catch(t=>{e||(O([]),ee(``),ne(Kb(t,o(`lark.error.groupLoad`),o)))}).finally(()=>{e||j(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[x,T,y]),(0,z.useEffect)(()=>{if(!ge||!Se||[`ready`,`failed`,`cancelled`].includes(Se.status))return;let e=!1,t=window.setTimeout(()=>{b_(Se.setup_id).then(async t=>{e||(Ce(t),t.verification_url&&Oe.current!==t.verification_url&&(Oe.current=t.verification_url,L.current&&!L.current.closed&&(L.current.location.href=t.verification_url)),t.status===`ready`&&(await Ae(),S(t.app_ref),_e(!1)),t.status===`failed`&&De(t.error??o(`lark.error.appCreate`)))}).catch(t=>{e||De(Kb(t,o(`lark.error.setupPoll`),o))})},650);return()=>{e=!0,window.clearTimeout(t)}},[ge,Se]);let je=n.find(e=>e.goalId===C),Me=je?.agentId?[{agentId:je.agentId,label:je.agentLabel??je.agentId}]:[],Ne=je?.agentLanes?.length?je.agentLanes:Me,Pe=Ne.some(e=>e.agentId===P),Fe=[];se?Fe=Ne.map(e=>e.agentId):Pe&&(Fe=[P]);let Ie=o(`lark.connect`);pe?Ie=o(`lark.saveConnection`):se&&(Ie=o(`lark.connectAllAgentsAction`,{count:Fe.length}));let R=l.find(e=>e.app_ref===x),Le=D.find(e=>e.chat_id===k),Re=(0,z.useMemo)(()=>{let e=_.trim().toLocaleLowerCase();return e?d.filter(t=>[t.app_label,t.chat_name,t.goal_title,t.topic_name].some(t=>t.toLocaleLowerCase().includes(e))):d},[d,_]);function ze(e){let t=e??n.find(e=>e.goalId===r)??n[0];me(null),w(t?.goalId??``),F(t?.agentId??``),ce(!1),M(`addressed_only`),ie(`async_inbox`),oe(`topic_reply`),E(``),fe(null),b(!0)}function Be(e){me(e.goal_id),S(e.app_ref),w(e.goal_id),F(e.agent_id??n.find(t=>t.goalId===e.goal_id)?.agentId??``),ce(!1),M(e.capture_scope),ie(e.ingress_mode===`direct_session`?`session_queue`:e.ingress_mode),oe(e.reply_mode),E(e.chat_name),fe(null),b(!0)}function Ve(){Ce(null),De(null),Oe.current=null,_e(!0)}async function He(){if(!(we||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(ve))){Te(!0),De(null),Oe.current=null,L.current=window.open(window.location.href,`_blank`);try{let e=await y_({appRef:ve,brand:be});Ce(e)}catch(e){L.current?.close(),De(Kb(e,o(`lark.error.setupStart`),o))}finally{Te(!1)}}}async function Ue(){let e=Se;if(_e(!1),L.current?.close(),e&&![`ready`,`failed`,`cancelled`].includes(e.status))try{await x_(e.setup_id)}catch{}}async function We(){if(!(!x||!C||!Le||Fe.length===0||le)){ue(!0),fe(null);try{let e={appRef:x,captureScope:re,chatId:Le.chat_id,chatName:Le.chat_name,goalId:C,incomingMode:re===`configured_chat_all`?`all`:`mentions`,ingressMode:N,replyMode:ae};for(let t of Fe){let n=await D_({...e,agentId:t,execute:!1});if(!n.ok)throw new og(n.public_summary??n.blocker??o(`lark.error.bindPreview`),{error_code:n.blocker??`provider_api_failed`})}for(let t of Fe){let n=await D_({...e,agentId:t,execute:!0});if(!n.ok)throw new og(n.public_summary??n.blocker??o(`lark.error.bind`),{error_code:n.blocker??`provider_api_failed`})}b(!1),await Ae(),i?.()}catch(e){fe(Kb(e,o(`lark.error.bind`),o))}finally{ue(!1)}}}async function Ge(e,t){if(he!==t){I(t);return}try{await O_(e,t),I(null),await Ae(),i?.()}catch(e){g(Kb(e,o(`lark.error.disconnect`),o))}}return(0,B.jsxs)(`section`,{className:`personal-lark-settings${e?` is-embedded`:``}`,"aria-label":o(`lark.configuration`),children:[e?null:(0,B.jsxs)(`header`,{className:`personal-lark-header`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`settings.goalConnections`)}),(0,B.jsx)(`h1`,{children:`Lark`}),(0,B.jsx)(`p`,{children:o(`lark.description`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeSettings`),className:`personal-icon-button`,onClick:a,type:`button`,children:(0,B.jsx)(jh,{size:18})})]}),(0,B.jsxs)(`nav`,{className:`personal-lark-tabs`,"aria-label":o(`lark.management`),children:[(0,B.jsxs)(`button`,{"aria-current":s===`apps`?`page`:void 0,onClick:()=>c(`apps`),type:`button`,children:[o(`lark.apps`),` `,(0,B.jsx)(`span`,{children:p?`…`:l.length})]}),(0,B.jsxs)(`button`,{"aria-current":s===`connections`?`page`:void 0,onClick:()=>c(`connections`),type:`button`,children:[o(`lark.connections`),` `,(0,B.jsx)(`span`,{children:p?`…`:d.length})]})]}),h?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:h}):null,p?(0,B.jsxs)(`div`,{className:`personal-lark-loading`,children:[(0,B.jsx)(eh,{className:`is-spinning`,size:18}),o(`lark.loading`)]}):null,!p&&s===`apps`?(0,B.jsxs)(`div`,{className:`personal-lark-apps`,children:[(0,B.jsxs)(`div`,{className:`personal-lark-app-toolbar`,children:[(0,B.jsx)(`span`,{children:o(`lark.reusableApps`,{count:l.length})}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,onClick:Ve,type:`button`,children:[(0,B.jsx)(dh,{size:16}),o(`lark.newApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-app-grid`,children:[l.map(e=>(0,B.jsxs)(`article`,{className:`personal-lark-app-card`,children:[(0,B.jsx)(`span`,{className:`personal-lark-app-avatar`,children:(0,B.jsx)(Tm,{size:19})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsxs)(`small`,{children:[e.brand,` · lark-cli profile`]})]}),(0,B.jsx)(`em`,{className:e.reply_ready?`is-ready`:`is-off`,children:e.reply_ready?o(`lark.autoReplyReady`):e.ready?o(`lark.needsMessagePermissions`):o(`lark.needsSetup`)}),(0,B.jsxs)(`p`,{children:[o(`lark.goalConnections`,{count:d.filter(t=>t.app_ref===e.app_ref).length}),e.ready&&!e.reply_ready?` · ${o(`lark.autoReplyUnavailable`)}`:``]})]},e.app_ref)),l.length===0?(0,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noProfiles`)}):null]})]}):null,!p&&s===`connections`?(0,B.jsxs)(`div`,{className:`personal-lark-connections`,children:[(0,B.jsxs)(`div`,{className:`personal-lark-toolbar`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(gh,{size:16}),(0,B.jsx)(`input`,{"aria-label":o(`lark.searchConnections`),onChange:e=>v(e.target.value),placeholder:o(`lark.searchPlaceholder`),type:`search`,value:_})]}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:l.length===0||n.length===0,onClick:()=>ze(),type:`button`,children:[(0,B.jsx)(dh,{size:16}),o(`lark.connectApp`)]})]}),(0,B.jsxs)(`div`,{className:`personal-lark-table`,role:`table`,"aria-label":o(`lark.goalTopicConnections`),children:[(0,B.jsxs)(`div`,{className:`personal-lark-table-head`,role:`row`,children:[(0,B.jsx)(`span`,{children:o(`lark.connection`)}),(0,B.jsx)(`span`,{children:o(`common.goal`)}),(0,B.jsx)(`span`,{children:o(`lark.capture`)}),(0,B.jsx)(`span`,{children:o(`lark.processing`)}),(0,B.jsx)(`span`,{children:o(`common.actions`)})]}),Re.map(e=>(0,B.jsxs)(`div`,{className:`personal-lark-table-row`,role:`row`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.chat_name}),(0,B.jsxs)(`small`,{children:[e.app_label,` · `,Wb(e,o).label]}),(0,B.jsx)(`small`,{children:Wb(e,o).detail}),e.health_error_code===`lark_event_delivery_unverified`?(0,B.jsxs)(`a`,{href:`https://open.feishu.cn/document/server-docs/im-v1/message/events/receive?lang=zh-CN`,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(Hm,{size:12}),o(`lark.openEventSettings`)]}):null,Gb(e)?(0,B.jsxs)(`a`,{href:Gb(e)??void 0,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(Hm,{size:12}),o(`lark.historyPermission`)]}):null]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.goal_title}),(0,B.jsxs)(`small`,{children:[`# `,e.topic_name]})]}),(0,B.jsx)(`span`,{children:e.capture_scope===`addressed_only`?o(`lark.mentionsOnly`):o(`lark.allTopicMessages`)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:Ub(e.ingress_mode,o).label}),(0,B.jsx)(`small`,{children:e.agent_id??Ub(e.ingress_mode,o).detail})]}),(0,B.jsxs)(`span`,{className:`personal-lark-row-actions`,children:[(0,B.jsx)(`button`,{"aria-label":o(`lark.settingsConfigure`,{goal:e.goal_title}),onClick:()=>Be(e),type:`button`,children:(0,B.jsx)(bh,{size:15})}),(0,B.jsxs)(`button`,{"aria-label":o(`lark.settingsDisconnect`,{goal:e.goal_title}),className:he===e.connection_id?`is-confirm`:``,onClick:()=>void Ge(e.goal_id,e.connection_id),type:`button`,children:[(0,B.jsx)(kh,{size:15}),he===e.connection_id?o(`common.confirm`):null]})]})]},e.connection_id)),Re.length===0?(0,B.jsx)(`p`,{className:`personal-lark-empty`,children:o(`lark.noConnections`)}):null]})]}):null,y?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`connect-lark-title`,"aria-modal":`true`,className:`personal-lark-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:`Goal Topic connection`}),(0,B.jsx)(`h2`,{id:`connect-lark-title`,children:o(pe?`lark.editConnection`:`lark.connectApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeConnection`),onClick:()=>b(!1),type:`button`,children:(0,B.jsx)(jh,{size:18})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.appProfile`)}),(0,B.jsx)(`select`,{"aria-label":o(`lark.appProfile`),disabled:p,onChange:e=>{e.target.value===`__register__`?Ve():S(e.target.value)},value:x,children:p?(0,B.jsx)(`option`,{value:``,children:o(`lark.appLoading`)}):(0,B.jsxs)(B.Fragment,{children:[l.map(e=>(0,B.jsxs)(`option`,{disabled:!e.ready,value:e.app_ref,children:[e.label,e.reply_ready?``:e.ready?` · ${o(`lark.needsMessagePermissions`)}`:` · ${o(`lark.needsSetup`)}`]},e.app_ref)),(0,B.jsx)(`option`,{value:`__register__`,children:o(`lark.registerAnother`)})]})})]}),R?.ready&&!R.reply_ready?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:o(`lark.appPermissions`)}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.groupChat`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.groupSearch`),onChange:e=>E(e.target.value),placeholder:o(`lark.groupSearch`),type:`search`,value:T}),A?(0,B.jsxs)(`div`,{className:`personal-lark-group-state`,role:`status`,children:[(0,B.jsx)(eh,{className:`is-spinning`,size:15}),o(`lark.groupLoading`)]}):null,!A&&te?(0,B.jsx)(`div`,{className:`personal-lark-group-state is-error`,role:`alert`,children:te}):null,!A&&!te&&D.length===0?(0,B.jsx)(`div`,{className:`personal-lark-group-state`,role:`status`,children:o(`lark.groupEmpty`)}):null,!A&&!te&&D.length>0?(0,B.jsx)(`select`,{"aria-label":o(`lark.groupChat`),onChange:e=>ee(e.target.value),value:k,children:D.map(e=>(0,B.jsx)(`option`,{value:e.chat_id,children:e.chat_name},e.chat_id))}):null]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.bindGoal`)}),(0,B.jsx)(`select`,{"aria-label":o(`lark.bindGoal`),onChange:e=>{let t=e.target.value;w(t),F(n.find(e=>e.goalId===t)?.agentId??``)},value:C,children:n.map(e=>(0,B.jsx)(`option`,{value:e.goalId,children:e.title},e.goalId))})]}),(0,B.jsxs)(`label`,{className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:!0,readOnly:!0,type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.createAutomatically`)}),(0,B.jsx)(`small`,{children:o(`lark.createAutomaticallyDescription`)})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.topicPreview`)}),(0,B.jsxs)(`div`,{className:`personal-lark-topic-preview`,children:[(0,B.jsx)(ih,{size:15}),`# `,je?.title??je?.goalId??`Goal`]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.captureScope`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.captureScope`),onChange:e=>M(e.target.value),value:re,children:[(0,B.jsx)(`option`,{value:`addressed_only`,children:o(`lark.captureAddressed`)}),(0,B.jsx)(`option`,{value:`configured_chat_all`,children:o(`lark.captureAll`)})]}),(0,B.jsx)(`small`,{children:o(`lark.captureScopeDescription`)})]}),(0,B.jsxs)(`fieldset`,{"aria-label":o(`lark.agentIngress`),className:`personal-lark-ingress`,children:[(0,B.jsx)(`legend`,{children:o(`lark.agentIngress`)}),(0,B.jsx)(`div`,{children:[`live_steering`,`session_queue`,`async_inbox`].map(e=>{let t=Ub(e,o);return(0,B.jsxs)(`label`,{className:N===e?`is-active`:``,children:[(0,B.jsx)(`input`,{"aria-label":t.label,checked:N===e,name:`lark-agent-ingress`,onChange:()=>ie(e),type:`radio`,value:e}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`small`,{children:t.detail})]})]},e)})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.targetAgent`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.targetAgent`),onChange:e=>F(e.target.value),value:P,children:[Pe?null:(0,B.jsx)(`option`,{disabled:!0,value:P,children:P?o(`lark.agentUnavailable`,{agent:P}):o(`lark.noAgentConfigured`)}),Ne.map(e=>(0,B.jsx)(`option`,{value:e.agentId,children:e.label===e.agentId?e.agentId:`${e.label} · ${e.agentId}`},e.agentId))]}),(0,B.jsx)(`small`,{children:o(`lark.targetAgentDescription`)})]}),!pe&&Ne.length>1?(0,B.jsxs)(`label`,{"aria-label":o(`lark.connectAllAgents`),className:`personal-lark-check`,children:[(0,B.jsx)(`input`,{checked:se,onChange:e=>ce(e.target.checked),type:`checkbox`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o(`lark.connectAllAgents`)}),(0,B.jsx)(`small`,{children:o(`lark.connectAllAgentsDescription`,{count:Ne.length})})]})]}):null,Fe.length===0?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:o(`lark.selectRegisteredAgent`)}):null,(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.replyMode`)}),(0,B.jsx)(`select`,{"aria-label":o(`lark.replyMode`),onChange:e=>oe(e.target.value),value:ae,children:(0,B.jsx)(`option`,{value:`topic_reply`,children:o(`lark.topicReply`)})}),(0,B.jsx)(`small`,{children:o(`lark.replyModeDescription`)})]}),(0,B.jsxs)(`p`,{className:`personal-lark-cardinality`,children:[(0,B.jsx)(km,{size:15}),o(`lark.cardinality`)]}),de?(0,B.jsx)(`p`,{className:`personal-notification-error`,role:`alert`,children:de}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>b(!1),type:`button`,children:o(`lark.cancel`)}),(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:p||!x||!R?.reply_ready||!C||!k||Fe.length===0||le,onClick:()=>void We(),type:`button`,children:[le?(0,B.jsx)(eh,{className:`is-spinning`,size:15}):null,Ie]})]})]})}):null,ge?(0,B.jsx)(`div`,{className:`personal-lark-modal-backdrop is-setup`,role:`presentation`,children:(0,B.jsxs)(`section`,{"aria-labelledby":`new-lark-app-title`,"aria-modal":`true`,className:`personal-lark-modal personal-lark-setup-modal`,role:`dialog`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:o(`lark.reusableWorkspaceApp`)}),(0,B.jsx)(`h2`,{id:`new-lark-app-title`,children:o(`lark.newApp`)})]}),(0,B.jsx)(`button`,{"aria-label":o(`lark.closeCreate`),onClick:()=>void Ue(),type:`button`,children:(0,B.jsx)(jh,{size:18})})]}),Se?(0,B.jsxs)(`div`,{className:`personal-lark-setup-progress`,children:[(0,B.jsx)(`span`,{className:`personal-lark-setup-icon is-${Se.status}`,children:Se.status===`ready`?(0,B.jsx)(km,{size:22}):(0,B.jsx)(eh,{className:Se.status===`failed`?``:`is-spinning`,size:22})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:Se.status===`ready`?o(`lark.appCreated`):Se.status===`failed`?o(`lark.appCreateFailed`):o(`lark.waitingFeishu`)}),(0,B.jsx)(`p`,{children:Se.status===`waiting_for_feishu`?o(`lark.waitingFeishuDescription`):Se.status===`starting`?o(`lark.waitingLink`):Se.error})]}),Se.verification_url?(0,B.jsxs)(`a`,{href:Se.verification_url,rel:`noreferrer`,target:`_blank`,children:[(0,B.jsx)(Hm,{size:15}),o(`lark.reopenFeishu`)]}):null]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`personal-lark-setup-copy`,children:o(`lark.setupCopy`)}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.profileName`)}),(0,B.jsx)(`input`,{"aria-label":o(`lark.profileName`),autoComplete:`off`,onChange:e=>ye(e.target.value),placeholder:`loopx-workspace-bot`,value:ve})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:o(`lark.region`)}),(0,B.jsxs)(`select`,{"aria-label":o(`lark.region`),onChange:e=>xe(e.target.value),value:be,children:[(0,B.jsx)(`option`,{value:`feishu`,children:`Feishu`}),(0,B.jsx)(`option`,{value:`lark`,children:`Lark`})]})]}),ve&&!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(ve)?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:o(`lark.profileValidation`)}):null]}),Ee?(0,B.jsx)(`p`,{className:`personal-notification-error`,children:Ee}):null,(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:()=>void Ue(),type:`button`,children:o(`lark.cancel`)}),Se?null:(0,B.jsxs)(`button`,{className:`personal-primary-action`,disabled:we||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(ve),onClick:()=>void He(),type:`button`,children:[we?(0,B.jsx)(eh,{className:`is-spinning`,size:15}):(0,B.jsx)(Hm,{size:15}),o(`lark.continueFeishu`)]})]})]})}):null]})}function Jb(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Yb(e,t,n){let r=Jb(t),i=Jb(n);return Object.fromEntries(e.fields.flatMap(({key:e})=>{let t=r[e],n=i[e];return Object.hasOwn(r,e)&&t!=null?[[e,t]]:Object.hasOwn(i,e)&&n!=null?[[e,n]]:[]}))}function Xb({children:e}){return e?(0,B.jsx)(`small`,{children:e}):null}function Zb({copy:e,field:t,id:n,onChange:r,value:i}){let a=e[t.key]?.label??t.label,o=e[t.key]?.description??t.description,s=!r;if(t.input_kind===`boolean`)return(0,B.jsxs)(`label`,{className:`is-boolean`,htmlFor:n,children:[(0,B.jsx)(`span`,{children:a}),(0,B.jsx)(`input`,{checked:i===!0,id:n,onChange:r?e=>r(t.key,e.target.checked):void 0,readOnly:s,type:`checkbox`}),(0,B.jsx)(Xb,{children:o})]});if(t.input_kind===`select`)return(0,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:a}),(0,B.jsxs)(`select`,{id:n,onChange:r?e=>r(t.key,e.target.value):void 0,value:typeof i==`string`?i:``,children:[(0,B.jsx)(`option`,{value:``}),(t.options??[]).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsx)(Xb,{children:o})]});if(t.input_kind===`string_list`)return(0,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:a}),(0,B.jsx)(`textarea`,{id:n,onChange:r?e=>r(t.key,e.target.value.split(/\r?\n/u).filter(Boolean)):void 0,readOnly:s,rows:4,value:Array.isArray(i)?i.join(` +`):``}),(0,B.jsx)(Xb,{children:o})]});let c=t.input_kind===`number`;return(0,B.jsxs)(`label`,{htmlFor:n,children:[(0,B.jsx)(`span`,{children:a}),(0,B.jsx)(`input`,{id:n,max:t.maximum,min:t.minimum,onChange:r?e=>r(t.key,c?Number(e.target.value):e.target.value):void 0,readOnly:s,required:t.required,type:c?`number`:`text`,value:typeof i==`number`||typeof i==`string`?i:``}),(0,B.jsx)(Xb,{children:o})]})}function Qb({copy:e={},disabled:t=!1,editor:n,omitKeys:r=[],onChange:i,value:a}){let o=(0,z.useId)(),s=new Set(r);return(0,B.jsx)(`fieldset`,{className:`personal-capability-fields`,disabled:t,children:n.fields.filter(e=>!s.has(e.key)).map(t=>(0,B.jsx)(Zb,{copy:e,field:t,id:`${o}-${t.key.replace(/[^a-z0-9_-]/gi,`-`)}`,onChange:i,value:a[t.key]},t.key))})}var $b={en:{change_quality_qualification:{displayName:`Change quality qualification`,description:`Prepares a provider-neutral review packet, allows at most one policy-authorized safe-fix pass, and can require an exact-diff receipt.`},explore_graph:{displayName:`Explore Graph`,description:`Organizes bounded exploration as a typed evidence graph so branches, findings, and synthesis remain inspectable.`},explore_harness:{displayName:`Explore Harness`,description:`Selects a capability-owned planning and research harness profile for bounded multi-step exploration.`},lark_event_inbox:{displayName:`Lark event inbox`,description:`Receives provider events through a local-private inbox binding before LoopX projects them into governed work.`,readOnlyReason:`This capability requires a local-private inbox binding. Manage it in Lark settings or through the capability CLI.`},lark_kanban_heartbeat_sync:{displayName:`Lark Kanban heartbeat sync`,description:`Synchronizes accepted LoopX work state to the configured Lark Kanban heartbeat surface.`},local_authority_shadow:{displayName:`Local authority shadow`,description:`Observes post-commit Todo and task-lease state through the shared authority contract without taking write authority.`},multi_subagent:{displayName:`Adaptive child capacity`,description:`Sets bounded child-agent capacity and the public-safe responsibility domains in which parallel work may be delegated.`},peer_task_coordination:{displayName:`Registered-peer task coordination`,description:`Routes explicitly scoped peer-owned work to one registered coordinator without granting cross-owner mutation authority.`},periodic_report:{displayName:`Periodic reports`,description:`Turns validated Goal stage progress into a frozen report and automatically delivers it through the configured Goal Channel with exact readback.`},reward_memory:{displayName:`Reward Memory experiment`,description:`Runs an opt-in, provider-bound retrieval experiment over an explicitly allowlisted memory corpus.`,readOnlyReason:`This capability requires a reviewed local-private provider binding and an explicit Agent allowlist. Configure it through the capability CLI.`}},"zh-CN":{change_quality_qualification:{displayName:`变更质量验证`,description:`生成与 Provider 无关的审阅包,最多允许一次策略授权的安全修复,并可要求精确 diff 回执。`},explore_graph:{displayName:`探索图谱`,description:`把有界探索组织为 typed 证据图,让探索分支、发现与综合结论都可检查、可追溯。`},explore_harness:{displayName:`探索 Harness`,description:`为有界的多步探索选择由能力负责的规划与研究 Harness profile。`},lark_event_inbox:{displayName:`飞书事件收件箱`,description:`通过本机私有收件箱接收 Provider 事件,再由 LoopX 将其投影为受治理的工作。`,readOnlyReason:`此能力依赖本机私有的收件箱绑定,请在飞书设置或 capability CLI 中管理。`},lark_kanban_heartbeat_sync:{displayName:`飞书看板心跳同步`,description:`把 LoopX 已接受的工作状态同步到配置好的飞书看板心跳界面。`},local_authority_shadow:{displayName:`本地 Authority 影子观测`,description:`通过共享 Authority contract 观测提交后的 Todo 与 task lease 状态,但不取得写入权。`},multi_subagent:{displayName:`自适应子 Agent 容量`,description:`限定子 Agent 容量与可公开的职责域,只有落在这些边界内的工作才能并行委派。`},peer_task_coordination:{displayName:`已注册 Peer 任务协调`,description:`把明确限定的 Peer 工作路由给一个已注册协调者,不授予跨 Owner 修改权限。`},periodic_report:{displayName:`周期报告`,description:`把经过验证的 Goal 阶段进展整理为冻结报告,并通过配置的 Goal Channel 自动发送和精确回读。`},reward_memory:{displayName:`Reward Memory 实验`,description:`在明确 allowlist 的记忆语料上运行可选、Provider 绑定的检索实验。`,readOnlyReason:`此能力依赖经过审阅的本机私有 Provider 绑定和明确的 Agent allowlist,请通过 capability CLI 配置。`}}},ex={en:{allowed_domains:{label:`Allowed responsibility domains`,description:`Enter one bounded, public-safe domain per line.`},coordinator_agent_id:{label:`Coordinator Agent`,description:`Use an already registered Agent id; leave blank to disable coordination.`},enabled:{label:`Enabled`},max_children:{label:`Maximum children`,description:`Hard upper bound for concurrently delegated child work.`},profile:{label:`Planner profile`,description:`Select one registered Explore Harness profile.`},profile_preset:{label:`Report profile`,description:`Capability-owned report profile, such as weekly-progress.`},route_ref:{label:`Goal Channel route`,description:`Public route alias only; credentials and provider identifiers stay outside this form.`},safe_fix:{label:`Allow one bounded safe-fix pass`},strict_receipt:{label:`Require an exact-diff receipt`},timezone:{label:`Timezone`,description:`Use an IANA timezone, for example Asia/Shanghai.`}},"zh-CN":{allowed_domains:{label:`允许的职责域`,description:`每行填写一个有边界、可公开的职责域。`},coordinator_agent_id:{label:`协调 Agent`,description:`填写一个已经注册的 Agent ID;留空表示关闭协调。`},enabled:{label:`启用`},max_children:{label:`最大子 Agent 数`,description:`可同时委派的子任务硬上限。`},profile:{label:`规划 Profile`,description:`选择一个已注册的 Explore Harness profile。`},profile_preset:{label:`报告 Profile`,description:`由该能力管理的报告 profile,例如 weekly-progress。`},route_ref:{label:`Goal Channel 路由`,description:`只填写公开 route alias;凭据与 Provider 标识不会进入此表单。`},safe_fix:{label:`允许一次有界安全修复`},strict_receipt:{label:`要求精确 diff 回执`},timezone:{label:`时区`,description:`使用 IANA 时区,例如 Asia/Shanghai。`}}};function tx(e,t){let n=$b[t][e.capability_id];return n?{...e,display_name:n.displayName,description:n.description,configuration_editor:{...e.configuration_editor,...n.readOnlyReason?{read_only_reason:n.readOnlyReason}:{}}}:e}function nx(e){return ex[e]}Object.freeze(Object.keys($b.en).sort());function rx(e,t){return e.available_scopes.includes(t)&&(t!==`machine`||!!e.machine_namespace)&&e.configuration_editor.editable&&e.configuration_editor.writable_scopes.includes(t)}function ix({values:e,t}){return(0,B.jsxs)(`details`,{className:`personal-capability-raw-values`,children:[(0,B.jsx)(`summary`,{children:t(`capabilities.rawJson`)}),(0,B.jsx)(`div`,{className:`personal-capability-value-grid`,children:e.map(({label:e,value:t})=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`strong`,{children:e}),(0,B.jsx)(`pre`,{children:t?JSON.stringify(t,null,2):`—`})]},e))})]})}function ax({source:e,t}){return e?(0,B.jsxs)(`p`,{className:`personal-capability-effective-source`,children:[(0,B.jsx)(xh,{"aria-hidden":!0,size:15}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t(`capabilities.effectiveSource`)}),t(`capabilities.source.${e}`)]})]}):null}function ox({available:e,description:t,t:n}){return e?null:(0,B.jsxs)(`section`,{className:`personal-capability-editor-status is-read-only`,children:[(0,B.jsx)(Oh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:n(`capabilities.readOnly`)}),(0,B.jsx)(`p`,{children:t})]})]})}function sx(e){return e.availability?.includes(`experimental`)?4:e.capability_id===`multi_subagent`?3:e.configuration_editor.writable_scopes.length===0||e.availability===`supported_explicit_opt_in`?2:e.availability===`supported_explicit_override`?0:1}function cx(e,t){return[...e].sort((e,n)=>{let r=sx(e)-sx(n);if(r!==0)return r;let i=tx(e,t),a=tx(n,t);return i.display_name.localeCompare(a.display_name,t)||e.capability_id.localeCompare(n.capability_id)})}function lx({capabilities:e,locale:t,onSelect:n,scope:r,selectedCapabilityId:i,t:a}){return(0,B.jsx)(`nav`,{"aria-label":a(r===`goal`?`capabilities.catalog`:`machine.capabilityCatalog`),className:`personal-capability-list`,children:cx(e,t).map(e=>{let o=tx(e,t);return(0,B.jsxs)(`button`,{"aria-current":i===o.capability_id?`page`:void 0,onClick:()=>n(o.capability_id),type:`button`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:o.display_name}),(0,B.jsx)(`small`,{children:o.capability_id})]}),(0,B.jsx)(`em`,{children:a(o.available_scopes.includes(r)?r===`goal`?`capabilities.goalScope`:`capabilities.machineScope`:r===`machine`?`capabilities.goalScope`:`capabilities.machineScope`)})]},o.capability_id)})})}function ux({capability:e,locale:t}){let n=tx(e,t);return(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Sh,{"aria-hidden":!0,size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:n.capability_id}),(0,B.jsx)(`h2`,{children:n.display_name}),(0,B.jsx)(`p`,{children:n.description})]})]})}function dx({goalId:e,onApplied:t,selected:n,t:r}){let[i,a]=(0,z.useState)({busy:null,draft:{},partialWrite:null,preview:null}),[o,s]=(0,z.useState)(null);(0,z.useEffect)(()=>{a({busy:null,draft:Yb(n?.configuration_editor??{fields:[]},n?.current??n?.effective_configuration?.configuration??n?.default,n?.default),partialWrite:null,preview:null}),s(null)},[n]);async function c(t){if(!(!n||i.busy)){a(e=>({...e,busy:`preview`,partialWrite:null})),s(null);try{let r=await o_(e,n.capability_id,t);a(e=>({...e,preview:r}))}catch(e){s(e instanceof Error?e.message:r(`capabilities.previewFailed`))}finally{a(e=>({...e,busy:null}))}}}async function l(){if(!(!n||!i.preview||i.busy)){a(e=>({...e,busy:`apply`})),s(null);try{let r=Yb(n.configuration_editor,i.draft,n.default),o=await s_(e,n.capability_id,i.preview.action===`delete`?null:r,i.preview.plan_revision);a(e=>({...e,partialWrite:o.status===`partial_write`?o:null,preview:null})),o.status!==`partial_write`&&t()}catch(e){a(e=>({...e,preview:null})),s(e instanceof Error?e.message:r(`capabilities.applyFailed`))}finally{a(e=>({...e,busy:null}))}}}function u(e,t){a(n=>({...n,draft:{...n.draft,[e]:t},preview:null})),s(null)}return{apply:l,changeDraft:u,error:o,mutation:i,preview:c}}function fx({mutationError:e,onApplied:t,partialWrite:n,preview:r}){let{t:i}=ya();return(0,B.jsxs)(B.Fragment,{children:[e?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:e}):null,n?(0,B.jsxs)(`section`,{"aria-live":`polite`,className:`personal-capability-recovery`,children:[(0,B.jsx)(Oh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:i(`capabilities.partialWrite`)}),(0,B.jsx)(`p`,{children:i(`capabilities.partialWriteDescription`)}),(0,B.jsx)(`small`,{children:n.recommended_action})]}),(0,B.jsxs)(`button`,{onClick:t,type:`button`,children:[(0,B.jsx)(ph,{"aria-hidden":!0,size:15}),i(`capabilities.refreshSource`)]})]}):null,r?(0,B.jsxs)(`section`,{className:`personal-capability-preview`,"aria-label":i(`capabilities.preview`),children:[(0,B.jsx)(`strong`,{children:i(`capabilities.preview`)}),(0,B.jsx)(`span`,{children:i(`machine.action.${r.action}`)}),(0,B.jsx)(`small`,{children:i(`capabilities.previewLocked`)})]}):null]})}function px({catalog:e,goalId:t,onApplied:n}){let{locale:r,t:i}=ya(),[a,o]=(0,z.useState)(e.capabilities[0]?.capability_id??``),s=(0,z.useMemo)(()=>e.capabilities.find(e=>e.capability_id===a)??e.capabilities[0],[e.capabilities,a]),c=(0,z.useMemo)(()=>s?tx(s,r):void 0,[r,s]),{apply:l,changeDraft:u,error:d,mutation:f,preview:p}=dx({goalId:t,onApplied:n,selected:c,t:i}),{busy:m,draft:h,partialWrite:g,preview:_}=f;if(!s||!c)return(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:i(`capabilities.empty`)});let v=c.available_scopes.includes(`goal`),y=rx(c,`goal`),b=c.configuration_editor.read_only_reason??i(v?`capabilities.previewOnly`:`capabilities.machineOnly`);async function x(){if(!c||!y||m)return;let e=Yb(c.configuration_editor,h,c.default);await p(e)}async function S(){!y||m||await p(null)}return(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(lx,{capabilities:e.capabilities,locale:r,onSelect:o,scope:`goal`,selectedCapabilityId:c.capability_id,t:i}),(0,B.jsxs)(`article`,{className:`personal-capability-detail`,children:[(0,B.jsx)(ux,{capability:s,locale:r}),(0,B.jsx)(ax,{source:c.effective_configuration?.source,t:i}),(0,B.jsx)(ox,{available:y,t:i,description:b}),y?(0,B.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,B.jsx)(`strong`,{children:i(`capabilities.fields`)}),(0,B.jsx)(Qb,{disabled:!!m,copy:nx(r),editor:c.configuration_editor,onChange:u,value:h})]}):null,(0,B.jsx)(fx,{mutationError:d,onApplied:n,partialWrite:g,preview:_}),y?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[c.current&&c.available_scopes.includes(`machine`)?(0,B.jsx)(`button`,{disabled:!!m,onClick:()=>void S(),type:`button`,children:i(`capabilities.restoreInheritance`)}):null,(0,B.jsx)(`button`,{disabled:!!m,onClick:()=>void x(),type:`button`,children:i(m===`preview`?`common.loading`:`capabilities.previewChanges`)}),(0,B.jsx)(`button`,{className:`is-primary`,disabled:!!m||!_,onClick:()=>void l(),type:`button`,children:i(m===`apply`?`common.loading`:`capabilities.applyPreview`)})]}):null,(0,B.jsx)(ix,{values:[{label:i(`capabilities.goalValue`),value:c.current},{label:i(c.machine_current?`capabilities.machineValue`:`capabilities.defaultValue`),value:c.machine_current??c.default}],t:i},s.capability_id)]})]})}function mx({goalId:e}){let{t}=ya(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1);function c(){e&&(s(!0),a(null),a_(e).then(r).catch(e=>a(e instanceof Error?e.message:t(`capabilities.loadFailed`))).finally(()=>s(!1)))}return(0,z.useEffect)(c,[e]),e?o&&!n?(0,B.jsxs)(`p`,{"aria-live":`polite`,className:`personal-capability-empty`,children:[(0,B.jsx)(eh,{className:`personal-spin`,size:18}),t(`capabilities.loading`)]}):i?(0,B.jsxs)(`section`,{className:`personal-capability-error`,role:`alert`,children:[(0,B.jsx)(Oh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t(`capabilities.loadFailed`)}),(0,B.jsx)(`small`,{children:i})]}),(0,B.jsxs)(`button`,{onClick:c,type:`button`,children:[(0,B.jsx)(ph,{"aria-hidden":!0,size:15}),t(`capabilities.retry`)]})]}):n?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n.revision,children:[(0,B.jsxs)(`div`,{className:`personal-capability-scope-note`,children:[(0,B.jsx)(xh,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:t(`capabilities.atomicOverride`)}),t(`capabilities.atomicOverrideDescription`)]})]}),(0,B.jsx)(px,{catalog:n.capability_catalog,goalId:e,onApplied:c})]}):null:(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:t(`capabilities.chooseGoal`)})}function hx(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function gx(e,t){let n=t?.machine_namespace;return n?e?.machine_configuration?.namespaces[n]:void 0}function _x(e,t,n){return{...hx(e.default),...hx(t),...n}}function vx(e,t){for(let n of e.configuration_editor.fields){let e=t[n.key];if(n.required&&(e==null||e===``))return!1}return e.capability_id===`periodic_report`&&t.enabled===!0?!!(String(t.profile_preset??``).trim()&&String(t.route_ref??``).trim()&&String(t.timezone??``).trim()):!0}function yx(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}catch{return null}}function bx(e){return e?e===`absent`?e:e.replace(/^sha256:/,``).slice(0,12):`—`}function xx(){let{locale:e,t}=ya(),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)({}),[c,l]=(0,z.useState)(`{}`),[u,d]=(0,z.useState)(`guided`),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(`upsert`),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)(`load`),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),E=n?.capability_catalog.capabilities??[],D=E.find(e=>e.capability_id===i)??E[0],O=D?tx(D,e):void 0,k=gx(n,O),ee=!!(O?.machine_namespace&&k),A=!!(O&&rx(O,`machine`)),j=(0,z.useMemo)(()=>yx(c),[c]),te=O?u===`json`?j:_x(O,k,o):null,ne=!!(O&&(u===`json`?j:vx(O,te??{})));async function re(){r(await i_())}(0,z.useEffect)(()=>{let e=!0;return i_().then(t=>{e&&(r(t),a(t.capability_catalog.capabilities.find(e=>e.available_scopes.includes(`machine`))?.capability_id??``))}).catch(n=>{e&&C(n instanceof Error?n.message:t(`machine.loadError`))}).finally(()=>{e&&x(null)}),()=>{e=!1}},[t]),(0,z.useEffect)(()=>{if(!O)return;let e=gx(n,O),t=Yb(O.configuration_editor,e??O.default,O.default),r=_x(O,e,t);s(t),l(JSON.stringify(r,null,2)),d(A?`guided`:`json`),p(null),h(`upsert`),y(null)},[n,i,e]);function M(e,t){s(n=>({...n,[e]:t})),p(null),h(`upsert`),C(null),T(null)}function N(e){if(O){if(e===`json`)l(JSON.stringify(_x(O,k,o),null,2));else if(j)s(Yb(O.configuration_editor,j,O.default));else{C(t(`machine.jsonInvalid`));return}d(e),p(null),h(`upsert`),C(null)}}async function ie(){if(!(!A||!O?.machine_namespace||!te||!ne||b)){x(`preview`),C(null),T(null);try{h(`upsert`),p(await c_(O.machine_namespace,te))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function ae(){if(!(!A||!O?.machine_namespace||!ee||b)){x(`preview`),C(null),T(null);try{h(`remove`),p(await u_(O.machine_namespace))}catch(e){C(e instanceof Error?e.message:t(`machine.previewError`))}finally{x(null)}}}async function oe(){if(!A||!O?.machine_namespace||!f||b||m===`upsert`&&!te)return;x(`apply`),C(null);let e=m;try{let n=e===`remove`?await d_(O.machine_namespace,f.plan_revision):await l_(O.machine_namespace,te,f.plan_revision);_(n),p(null),h(`upsert`),y(null),await re(),T(n.status===`applied`?t(e===`remove`?`machine.removed`:`machine.applied`):t(`machine.unchanged`))}catch(e){p(null),h(`upsert`),C(e instanceof Error?e.message:t(`machine.applyError`))}finally{x(null)}}async function P(){if(!(!g?.transaction_id||b)){x(`rollback-preview`),C(null);try{y(await f_(g.transaction_id))}catch(e){C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}async function F(){if(!(!g?.transaction_id||!v||b)){x(`rollback`),C(null);try{await p_(g.transaction_id,v.plan_revision),_(null),y(null),p(null),await re(),T(t(`machine.rolledBack`))}catch(e){y(null),C(e instanceof Error?e.message:t(`machine.rollbackError`))}finally{x(null)}}}return b===`load`?(0,B.jsx)(`div`,{className:`personal-machine-loading`,role:`status`,children:t(`common.loading`)}):O?(0,B.jsxs)(`section`,{className:`personal-capability-settings`,"data-revision":n?.revision,children:[(0,B.jsxs)(`div`,{className:`personal-capability-scope-note`,children:[(0,B.jsx)(xh,{"aria-hidden":!0,size:17}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.liveDefault`)}),t(`machine.liveDefaultDescription`)]})]}),(0,B.jsxs)(`div`,{className:`personal-capability-layout`,children:[(0,B.jsx)(lx,{capabilities:E,locale:e,onSelect:a,scope:`machine`,selectedCapabilityId:O.capability_id,t}),(0,B.jsxs)(`article`,{className:`personal-capability-detail`,children:[(0,B.jsx)(ux,{capability:D,locale:e}),O.available_scopes.includes(`machine`)?(0,B.jsx)(ax,{source:ee?`machine_default`:`capability_default`,t}):null,(0,B.jsx)(ox,{available:A,t,description:O.available_scopes.includes(`machine`)?t(`machine.editorUnavailableDescription`):t(`machine.goalOnly`)}),O.capability_id===`periodic_report`?(0,B.jsxs)(`section`,{className:`personal-capability-behavior-note`,children:[(0,B.jsx)(xh,{"aria-hidden":!0,size:18}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.periodicReportActivation`)}),(0,B.jsx)(`p`,{children:t(`machine.periodicReportActivationDescription`)})]})]}):null,A?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`personal-capability-editor-mode`,children:[(0,B.jsx)(`span`,{children:t(`machine.editorMode`)}),(0,B.jsxs)(`div`,{role:`group`,"aria-label":t(`machine.editorMode`),children:[(0,B.jsx)(`button`,{"aria-pressed":u===`guided`,disabled:!A,onClick:()=>N(`guided`),type:`button`,children:t(`machine.visualEditor`)}),(0,B.jsxs)(`button`,{"aria-pressed":u===`json`,onClick:()=>N(`json`),type:`button`,children:[(0,B.jsx)(Lm,{"aria-hidden":!0,size:14}),t(`machine.jsonEditor`)]})]})]}),u===`guided`?(0,B.jsxs)(`section`,{className:`personal-capability-field-summary`,children:[(0,B.jsx)(`strong`,{children:t(`capabilities.fields`)}),(0,B.jsx)(Qb,{copy:nx(e),disabled:!!b,editor:O.configuration_editor,onChange:M,value:o}),ne?null:(0,B.jsx)(`p`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.requiredFields`)})]}):(0,B.jsxs)(`label`,{className:`personal-capability-json-editor`,htmlFor:`machine-configuration-json`,children:[(0,B.jsx)(`span`,{children:t(`machine.jsonConfiguration`)}),(0,B.jsx)(`textarea`,{"aria-describedby":`machine-configuration-json-help`,disabled:!!b,id:`machine-configuration-json`,onChange:e=>{l(e.target.value),p(null),C(null)},rows:12,spellCheck:!1,value:c}),(0,B.jsx)(`small`,{id:`machine-configuration-json-help`,children:t(`machine.jsonConfigurationHelp`)}),j?null:(0,B.jsx)(`span`,{className:`personal-machine-validation`,role:`alert`,children:t(`machine.jsonInvalid`)})]})]}):null,S?(0,B.jsx)(`p`,{className:`personal-machine-error`,role:`alert`,children:S}):null,w?(0,B.jsxs)(`p`,{className:`personal-machine-notice`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(km,{"aria-hidden":!0,size:16}),w]}):null,f?(0,B.jsxs)(`section`,{"aria-label":t(`machine.preview`),className:`personal-machine-preview`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.preview`)}),(0,B.jsx)(`span`,{children:t(`machine.action.${f.action}`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.currentRevision`)}),(0,B.jsx)(`dd`,{title:f.current_revision,children:bx(f.current_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.desiredRevision`)}),(0,B.jsx)(`dd`,{title:f.desired_revision,children:bx(f.desired_revision)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t(`machine.changedNamespaces`)}),(0,B.jsx)(`dd`,{children:f.changed_namespaces.join(`, `)||t(`common.none`)})]})]}),(0,B.jsx)(`p`,{children:t(`machine.previewLocked`)})]}):null,g?.rollback_available&&g.transaction_id?(0,B.jsxs)(`section`,{className:`personal-machine-rollback`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:t(`machine.rollbackAvailable`)}),(0,B.jsx)(`p`,{children:t(v?`machine.rollbackPreviewDescription`:`machine.rollbackDescription`)})]}),(0,B.jsxs)(`button`,{className:`personal-secondary-action`,disabled:!!b||!!(v&&!v.rollback_allowed),onClick:()=>void(v?F():P()),type:`button`,children:[(0,B.jsx)(mh,{"aria-hidden":!0,size:15}),t(b===`rollback`||b===`rollback-preview`?`common.loading`:v?`machine.confirmRollback`:`machine.previewRollback`)]})]}):null,A?(0,B.jsxs)(`footer`,{className:`personal-capability-actions`,children:[ee?(0,B.jsxs)(`button`,{className:`is-danger`,disabled:!!b,onClick:()=>void ae(),type:`button`,children:[(0,B.jsx)(Dh,{"aria-hidden":!0,size:15}),t(`machine.previewRemoval`)]}):null,(0,B.jsx)(`button`,{disabled:!!b||!ne,onClick:()=>void ie(),type:`button`,children:t(b===`preview`?`common.loading`:`machine.previewChanges`)}),(0,B.jsx)(`button`,{className:`is-primary`,disabled:!!b||!f,onClick:()=>void oe(),type:`button`,children:t(b===`apply`?`common.loading`:`machine.applyPreview`)})]}):null,O.available_scopes.includes(`machine`)?(0,B.jsx)(ix,{values:[{label:t(`machine.currentValue`),value:k},{label:t(`capabilities.defaultValue`),value:O.default}],t},O.capability_id):null]})]})]}):(0,B.jsx)(`p`,{className:`personal-capability-empty`,children:t(`machine.capabilityEmpty`)})}var Sx={appearance:sh,capabilities:Sh,language:Xm,lark:bh,machine:vh};function Cx({focusGoalConnection:e=!1,goals:t,initialGoalId:n,initialTab:r=`lark`,onChanged:i,onClose:a,onThemeChange:o,theme:s}){let{locale:c,setLocale:l,t:u}=ya(),[d,f]=(0,z.useState)(r),p=[...n?[{description:u(`settings.capabilitiesTabDescription`),key:`capabilities`,label:u(`capabilities.title`)}]:[],{description:u(`settings.machineTabDescription`),key:`machine`,label:u(`machine.title`)},{description:u(`settings.larkTabDescription`),key:`lark`,label:`Lark`},{description:u(`settings.appearanceTabDescription`),key:`appearance`,label:u(`settings.appearance`)},{description:u(`settings.languageTabDescription`),key:`language`,label:u(`settings.language`)}],m=[{description:u(`settings.languageEnglishDescription`),label:u(`settings.languageEnglish`),value:`en`},{description:u(`settings.languageSimplifiedChineseDescription`),label:u(`settings.languageSimplifiedChinese`),value:`zh-CN`}],h={appearance:{description:u(`settings.appearanceDescription`),eyebrow:u(`settings.workspaceDisplay`),title:u(`settings.appearance`)},capabilities:{description:u(`capabilities.description`),eyebrow:u(`capabilities.goalPolicy`),title:u(`capabilities.title`)},language:{description:u(`settings.languageDescription`),eyebrow:u(`settings.workspaceDisplay`),title:u(`settings.language`)},lark:{description:u(`lark.description`),eyebrow:u(`settings.goalConnections`),title:`Lark`},machine:{description:u(`machine.description`),eyebrow:u(`machine.machinePolicy`),title:u(`machine.title`)}}[d];return(0,B.jsxs)(`section`,{"aria-label":u(`settings.title`),className:`personal-settings-page`,"data-pw-theme":s,children:[(0,B.jsxs)(`aside`,{className:`personal-settings-sidebar`,children:[(0,B.jsxs)(`button`,{className:`personal-settings-back`,onClick:a,type:`button`,children:[(0,B.jsx)(ym,{size:17}),(0,B.jsx)(`span`,{children:u(`settings.back`)})]}),(0,B.jsxs)(`div`,{className:`personal-settings-title`,children:[(0,B.jsx)(`small`,{children:u(`settings.eyebrow`)}),(0,B.jsx)(`strong`,{children:u(`settings.title`)})]}),(0,B.jsx)(`nav`,{"aria-label":u(`settings.categories`),className:`personal-settings-tabs`,children:p.map(e=>{let t=Sx[e.key];return(0,B.jsxs)(`button`,{"aria-current":d===e.key?`page`:void 0,onClick:()=>f(e.key),type:`button`,children:[(0,B.jsx)(t,{size:17}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.description})]})]},e.key)})})]}),(0,B.jsxs)(`main`,{className:`personal-settings-body`,children:[(0,B.jsx)(`header`,{className:`personal-settings-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`small`,{children:h.eyebrow}),(0,B.jsx)(`h1`,{children:h.title}),(0,B.jsx)(`p`,{children:h.description})]})}),d===`lark`?(0,B.jsx)(qb,{embedded:!0,focusGoalConnection:e,goals:t,initialGoalId:n,onChanged:i,onClose:a}):null,d===`machine`?(0,B.jsx)(xx,{}):null,d===`capabilities`?(0,B.jsx)(mx,{goalId:n}):null,d===`appearance`?(0,B.jsxs)(`section`,{className:`personal-detail-card personal-appearance-settings`,children:[(0,B.jsx)(`small`,{children:u(`settings.workspaceDisplay`)}),(0,B.jsx)(`h3`,{children:u(`settings.appearance`)}),(0,B.jsx)(`p`,{children:u(`settings.themeDescription`)}),(0,B.jsxs)(`div`,{className:`personal-settings-choice-group`,role:`radiogroup`,"aria-label":u(`settings.workspaceTheme`),children:[(0,B.jsxs)(`button`,{"aria-checked":s===`loopx`,onClick:()=>o(`loopx`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-loopx`}),(0,B.jsx)(`strong`,{children:u(`settings.themeLoopx`)}),(0,B.jsx)(`small`,{children:u(`settings.themeLoopxDescription`)})]}),(0,B.jsxs)(`button`,{"aria-checked":s===`paper`,onClick:()=>o(`paper`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-paper`}),(0,B.jsx)(`strong`,{children:u(`settings.themeDefault`)}),(0,B.jsx)(`small`,{children:u(`settings.themeDefaultDescription`)})]}),(0,B.jsxs)(`button`,{"aria-checked":s===`brutal`,onClick:()=>o(`brutal`),role:`radio`,type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-settings-theme-swatch is-brutal`}),(0,B.jsx)(`strong`,{children:u(`settings.themeHighContrast`)}),(0,B.jsx)(`small`,{children:u(`settings.themeHighContrastDescription`)})]})]})]}):null,d===`language`?(0,B.jsxs)(`section`,{className:`personal-settings-card`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{className:`personal-settings-icon`,children:(0,B.jsx)(Xm,{size:18})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{children:u(`settings.language`)}),(0,B.jsx)(`p`,{children:u(`settings.languageDescription`)})]})]}),(0,B.jsx)(`div`,{"aria-label":u(`settings.language`),className:`personal-language-options`,role:`radiogroup`,children:m.map(e=>(0,B.jsxs)(`button`,{"aria-checked":c===e.value,className:c===e.value?`is-selected`:``,onClick:()=>l(e.value),role:`radio`,type:`button`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.label}),(0,B.jsx)(`small`,{children:e.description})]}),c===e.value?(0,B.jsx)(km,{"aria-hidden":!0,size:17}):null]},e.value))}),(0,B.jsx)(`footer`,{children:u(`settings.languageStoredLocally`)})]}):null]})]})}var wx=`loopx-pw-theme`,Tx=`loopx`;function Ex(){try{let e=window.localStorage.getItem(wx);return e===`loopx`||e===`paper`||e===`brutal`?e:Tx}catch{return Tx}}function Dx(e){try{window.localStorage.setItem(wx,e)}catch{}}function Ox({drawer:e,drawerMode:t=`panel`,drawerOpen:n,main:r,mobileSidebarOpen:i=!1,onCloseMobileSidebar:a,sidebar:o,theme:s=`loopx`}){let{t:c}=ya(),l=(0,z.useRef)(null),u=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!i)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=l.current?.querySelectorAll(`button:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`);e?.[0]?.focus();function t(t){if(t.key!==`Tab`||!e?.length)return;let n=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),n.focus())}return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),u.current?.focus(),u.current=null}},[i]),(0,B.jsxs)(`section`,{className:`personal-workspace-shell${n?` has-drawer`:``}${n&&t.startsWith(`inspector`)?` has-task-inspector`:``}${t===`inspector-full`?` is-task-inspector-full`:``}${i?` mobile-sidebar-open`:``}`,"data-pw-theme":s,children:[i?(0,B.jsx)(`button`,{"aria-hidden":!0,className:`personal-sidebar-backdrop`,onClick:a,tabIndex:-1,type:`button`}):null,(0,B.jsx)(`aside`,{"aria-label":i?c(`header.goalNavigation`):void 0,"aria-modal":i?!0:void 0,className:`personal-workspace-sidebar`,"data-workspace-sidebar":!0,ref:l,role:i?`dialog`:void 0,children:(0,B.jsxs)(`div`,{className:`personal-workspace-sidebar-inner`,children:[i?(0,B.jsxs)(`button`,{className:`personal-sr-only`,onClick:a,type:`button`,children:[c(`common.close`),` `,c(`header.goalNavigation`)]}):null,o]})}),(0,B.jsx)(`main`,{"aria-hidden":i||void 0,className:`personal-workspace-main`,inert:i||void 0,children:r}),n?(0,B.jsx)(`aside`,{className:`personal-workspace-drawer`,"data-context-drawer":!0,"data-drawer-mode":t,children:e}):null]})}function kx(e){let t=e.match(/(?:下一步|建议|行动项|待办)[::\s]*([^\n]+)/u),n=t?t[1]:e;n=n.replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/[#*~_>]/g,``).replace(/^[-*•\d+.\s]+/u,``).replace(/^(好的|没问题|收到|建议如下|任务如下|分析如下|结论[::])[\s,,::]*/u,``);let r=(n.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)[0]||n).replace(/\s+/gu,` `).trim();return Array.from(r).slice(0,120).join(``)}function Ax(e){let t=new Map;return e.forEach(e=>{let n=e.fields.find(e=>e.key===`todo_id`)?.value??``,r=[e.actionKind,e.goalId??``,n,e.title].join(`:`);t.set(r,e)}),[...t.values()]}function jx(e,t,n){if(!e)return n(`home.noFirstActivity`);let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=new Date,a=new Intl.DateTimeFormat(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return r.toDateString()===i.toDateString()?n(`home.todayAt`,{time:a}):new Intl.DateTimeFormat(t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function Mx({goals:e,onSelectGoal:t,onRetry:n,systemHealth:r}){let{locale:i,t:a}=ya(),o=e.filter(e=>e.activationState===`active`),s=o.filter(e=>e.loadState===`error`).length,c=[{description:a(`home.lane.needsYouDescription`),key:`needs_you`,label:a(`home.lane.needsYou`)},{description:a(`home.lane.runningDescription`),key:`running`,label:a(`home.lane.running`)},{description:a(`home.lane.observingDescription`),key:`observing`,label:a(`home.lane.observing`)},{description:a(`home.lane.scheduledDescription`),key:`scheduled`,label:a(`home.lane.scheduled`)}],l=Object.fromEntries(c.map(e=>[e.key,[]])),u=[],d=[];e.filter(e=>!e.loadState).forEach(e=>{let t=By(e);t===`history`?u.push(e):t===`stopped`?d.push(e):l[t].push(e)});let f=e=>(0,B.jsxs)(`button`,{className:`personal-home-goal-card`,"data-goal-state":e.loadState??e.state,"data-load-error":e.loadError,onClick:()=>t(e.goalId),type:`button`,children:[(0,B.jsxs)(`span`,{className:`personal-home-goal-meta`,children:[(0,B.jsx)(`i`,{}),e.agentLaneCount&&e.agentLaneCount>1?a(`header.workAgentCount`,{count:e.agentLaneCount}):e.agentLabel??e.agentId]}),(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`p`,{children:e.loadError?a(`startup.error.${e.loadError}`):e.needsYou??e.nextSentence}),(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`span`,{children:e.loadState?a(e.loadState===`error`?`startup.goalError`:`startup.goalLoading`):ba(e.state,i)}),(0,B.jsx)(`small`,{title:e.latestActivity,children:e.loadState?``:e.latestActivity?jx(e.latestActivity,i,a):e.agentTodos.length?a(`home.taskCount`,{count:e.agentTodos.length}):a(`home.noActivity`)})]})]},e.goalId);return(0,B.jsxs)(`section`,{"aria-label":a(`home.workspace`),className:`personal-home-board`,children:[r&&(!r.ok||r.issues.length>0||r.freshnessWarning)?(0,B.jsxs)(`div`,{className:`personal-system-health-banner`,role:`alert`,children:[(0,B.jsxs)(`div`,{className:`personal-system-health-header`,children:[(0,B.jsx)(Nm,{size:15}),(0,B.jsx)(`strong`,{children:a(`home.systemHealth`,{summary:r.summary})}),r.freshnessWarning?(0,B.jsxs)(`small`,{children:[`(`,r.freshnessWarning,`)`]}):null]}),r.issues.length>0?(0,B.jsx)(`ul`,{className:`personal-system-health-issues`,children:r.issues.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))}):null]}):null,o.some(e=>e.loadState)?(0,B.jsxs)(`section`,{className:`personal-home-lane`,"aria-live":`polite`,children:[(0,B.jsx)(`header`,{children:a(`startup.progress`,{loaded:o.filter(e=>!e.loadState).length,total:o.length})}),s?(0,B.jsxs)(`div`,{className:`personal-stopped-goal-error`,role:`status`,children:[(0,B.jsx)(`span`,{children:a(`startup.failedCount`,{count:s})}),(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,onClick:n,type:`button`,children:a(`startup.retryFailed`)})]}):null,o.filter(e=>e.loadState).map(f)]}):null,(0,B.jsx)(`div`,{className:`personal-home-lanes`,children:c.map(e=>(0,B.jsxs)(`section`,{className:`personal-home-lane is-${e.key}`,"data-testid":`personal-home-lane-${e.key}`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`i`,{}),e.label]}),(0,B.jsx)(`b`,{children:l[e.key].length})]}),(0,B.jsx)(`p`,{children:e.description}),(0,B.jsx)(`div`,{className:`personal-home-lane-list`,children:l[e.key].length?l[e.key].map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.empty`)})})]},e.key))}),(0,B.jsxs)(`details`,{className:`personal-home-history`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.history`)}),(0,B.jsx)(`b`,{children:u.length}),(0,B.jsx)(`small`,{children:a(`home.completedGoals`)})]}),(0,B.jsx)(`div`,{children:u.length?u.map(f):(0,B.jsx)(`span`,{className:`personal-home-empty`,children:a(`home.noCompletedGoals`)})})]}),d.length?(0,B.jsxs)(`details`,{className:`personal-home-history is-stopped`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`span`,{children:a(`home.stopped`)}),(0,B.jsx)(`b`,{children:d.length}),(0,B.jsx)(`small`,{children:a(`home.preservedState`)})]}),(0,B.jsx)(`div`,{children:d.map(f)})]}):null]})}function Nx({items:e,onSelect:t,reportState:n}){let{locale:r,t:i}=ya();return(0,B.jsxs)(`section`,{className:`personal-object-list personal-files-list`,"data-testid":`personal-goal-outputs`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:i(`files.title`)}),(0,B.jsx)(`span`,{children:e.length})]}),n?.loading?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,role:`status`,children:[(0,B.jsx)(ph,{className:`is-spinning`,size:14}),i(`files.loadingReports`)]}):null,n?.error?(0,B.jsxs)(`p`,{className:`personal-object-list-state is-error`,role:`alert`,children:[(0,B.jsx)(Nm,{size:14}),i(`files.reportLoadFailed`),`: `,n.error]}):null,!n?.loading&&!n?.error&&e.length===0?(0,B.jsxs)(`p`,{className:`personal-object-list-state`,children:[(0,B.jsx)(Km,{size:14}),i(`files.empty`)]}):null,e.map(e=>(0,B.jsxs)(`button`,{"data-output-kind":e.output.kind,onClick:()=>t({item:e.output,kind:`output`}),type:`button`,children:[(0,B.jsx)(`span`,{className:`personal-file-icon`,children:(0,B.jsx)(Km,{size:16})}),(0,B.jsx)(`strong`,{children:e.output.title}),e.output.report?(0,B.jsx)(`em`,{children:i(`files.reportDelta`,{added:e.output.report.addedCount,changed:e.output.report.changedCount})}):null,(0,B.jsx)(`p`,{children:e.output.summary??e.output.safePreview??e.output.kind??i(`files.emptySummary`)}),(0,B.jsx)(`small`,{title:e.output.createdAt,children:[e.output.goalTitle,e.output.kind===`report`?i(`files.verifiedReport`):null,e.output.todoId?`${i(`common.task`)} ${e.output.todoId}`:null,jx(e.output.createdAt,r,i)].filter(Boolean).join(` · `)})]},e.id))]})}function Px({agentLabel:e,messages:t,onClose:n,onDraftTask:r,onOpenConversation:i,title:a}){let{t:o}=ya(),s=t.reduce((e,t,n)=>t.role===`user`?n:e,0),c=t.slice(Math.max(0,s)).slice(-3),l=c.filter(e=>e.role===`assistant`&&!e.pending).at(-1);return(0,z.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,B.jsxs)(`aside`,{"aria-label":o(`conversation.receipt`),className:`personal-manager-conversation-tray`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Tm,{size:16}),(0,B.jsx)(`strong`,{children:a??o(`conversation.title`)}),(0,B.jsx)(`small`,{children:t.at(-1)?.pending?o(`conversation.replying`):o(`common.recently`)})]}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-actions`,children:[r&&l?(0,B.jsxs)(`button`,{className:`personal-manager-conversation-btn`,onClick:()=>r(l.text),title:o(`conversation.convertHint`),type:`button`,children:[(0,B.jsx)($m,{size:13}),(0,B.jsx)(`span`,{children:o(`conversation.toTask`)})]}):null,(0,B.jsx)(`button`,{className:`personal-manager-conversation-link`,onClick:i,type:`button`,children:o(`conversation.full`)}),n?(0,B.jsx)(`button`,{"aria-label":o(`conversation.close`),className:`personal-manager-conversation-close`,onClick:n,title:o(`conversation.close`),type:`button`,children:(0,B.jsx)(jh,{size:14})}):null]})]}),(0,B.jsx)(`div`,{"aria-live":`polite`,className:`personal-manager-conversation-messages`,children:c.map(t=>(0,B.jsxs)(`article`,{className:`is-${t.role}`,children:[(0,B.jsx)(`strong`,{children:t.role===`user`?o(`common.you`):t.agentLabel??e??o(`header.manager`)}),(0,B.jsxs)(`div`,{className:`personal-manager-conversation-bubble`,children:[t.role===`user`?(0,B.jsx)(`p`,{children:t.text}):(0,B.jsx)(eb,{text:t.text}),t.pending?(0,B.jsx)(`small`,{children:o(`conversation.agentPending`)}):null]})]},t.id))})]})}function Fx({onClose:e,onOpenDetails:t,run:n}){let{t:r}=ya();return(0,B.jsxs)(`section`,{"aria-label":r(`session.record`),className:`personal-session-record`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Tm,{size:17}),r(`session.record`)]}),(0,B.jsx)(`button`,{"aria-label":r(`session.closeRecord`),onClick:e,type:`button`,children:(0,B.jsx)(jh,{size:15})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:n.title}),(0,B.jsx)(`p`,{children:r(`session.recordDescription`)})]}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Agent`}),(0,B.jsx)(`dd`,{children:n.agentLabel})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:r(`common.status`)}),(0,B.jsx)(`dd`,{children:xa(n.sessionStatus??n.status,r)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:`Session`}),(0,B.jsx)(`dd`,{title:n.sessionId,children:n.sessionId})]})]}),(0,B.jsx)(`button`,{className:`personal-secondary-action`,onClick:t,type:`button`,children:r(`session.details`)})]})}function Ix(e,t,n){let r=[];if(t===null)return e.userTodos.slice(0,4).forEach(t=>r.push({attention:{...t,goalTitle:t.goalTitle??zy(e,t.goalId)},id:`attention:${t.todoId}`,kind:`attention`})),e.goals.filter(e=>By(e)===`running`).slice(0,4).forEach(e=>r.push({id:`run:${e.goalId}`,kind:`run`,run:{agentId:e.agentId,agentLabel:e.agentLabel??e.agentId,completedSteps:e.doneTodoCount??e.agentTodos.filter(e=>e.done).length,goalId:e.goalId,goalTitle:e.title,latestActivity:e.agentSentence,runId:`goal:${e.goalId}`,status:`running`,title:e.nextSentence,totalSteps:Math.max((e.doneTodoCount??0)+e.agentTodos.filter(e=>!e.done).length,1)}})),r;let i=e.goals.find(e=>e.goalId===t);if(!i)return r;i.needsYou&&r.push({attention:{blocking:i.needsYouBlocking??!1,goalId:i.goalId,goalTitle:i.title,text:i.needsYou,todoId:`${i.goalId}:attention`},id:`attention:${i.goalId}`,kind:`attention`}),r.push({id:`run:${i.goalId}`,kind:`run`,run:{agentId:i.agentId,agentLabel:i.agentLabel??i.agentId,completedSteps:i.doneTodoCount??i.agentTodos.filter(e=>e.done).length,goalId:i.goalId,goalTitle:i.title,latestActivity:i.agentSentence,runId:`goal:${i.goalId}`,status:i.state===`推进中`?`running`:i.state===`需修复`?`failed`:`waiting`,title:i.nextSentence,totalSteps:Math.max((i.doneTodoCount??0)+i.agentTodos.filter(e=>!e.done).length,1)}}),i.agentTodos.filter(e=>e.taskClass===`continuous_monitor`).forEach(t=>{let a=e.timeline?.find(e=>e.kind===`run`&&e.run.goalId===i.goalId&&e.run.todoId===t.todoId&&!!e.run.sessionId);r.push({id:`schedule:${i.goalId}:${t.todoId}`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:a?[{label:a.run.latestActivity||a.run.title,runId:a.run.runId,status:a.run.status===`waiting`||a.run.status===`queued`?`running`:a.run.status,timestamp:i.latestActivity||n(`common.recently`)}]:[],goalId:i.goalId,label:t.text,schedule:t.evidence??n(`schedule.summary`),scheduleId:t.todoId,scheduleKind:`monitor`,sessionId:a?.run.sessionId,status:t.done||t.status===`paused`?`paused`:`active`,stopCondition:n(`drawer.scheduleDefaultStop`),target:t.text,timezone:`Asia/Shanghai`}})});let a=e.timeline?.find(e=>e.kind===`proposal`&&e.proposal.actionKind===`heartbeat.bind`&&e.proposal.goalId===i.goalId);if(a){let e=e=>a.proposal.fields.find(t=>t.key===e)?.value;r.push({id:`schedule:${i.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:i.agentId,executionHistory:[],goalId:i.goalId,label:`${n(`schedule.heartbeat`)} · ${i.title}`,nextRunAt:n(`drawer.schedulePending`),notificationRule:n(`drawer.scheduleDefaultNotification`),schedule:e(`cadence`)??n(`schedule.summary`),scheduleId:`${i.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:a.proposal.status===`applied`?`active`:`draft`,stopCondition:e(`stop_condition`)??n(`drawer.scheduleDefaultStop`),timezone:e(`timezone`)??`Asia/Shanghai`}})}return r}function Lx(e){return e===`preview_ready`?`ready`:e===`cancelled`?`draft`:e===`failed`?`error`:e}function Rx(e,t){let n={agent_id:t(`proposal.field.agentId`),cadence:t(`proposal.field.cadence`),completion_criteria:t(`proposal.field.completionCriteria`),execution_boundary:t(`proposal.field.executionBoundary`),goal_id:t(`proposal.field.goalId`),heartbeat:t(`proposal.field.heartbeat`),initial_todos:t(`proposal.field.initialTodos`),objective:t(`proposal.field.objective`),operation:t(`proposal.field.operation`),permission:t(`proposal.field.permission`),reason:t(`proposal.field.reason`),stop_condition:t(`proposal.field.stopCondition`),target:t(`proposal.field.target`),timezone:t(`proposal.field.timezone`),title:t(`proposal.field.title`),workspace_ref:t(`proposal.field.workspace`)},r=[`title`,`objective`,`completion_criteria`,`execution_boundary`,`permission`,`agent_id`,`workspace_ref`,`initial_todos`,`heartbeat`,`stop_condition`,`goal_id`];return Object.entries(e).sort(([e],[t])=>{let n=r.indexOf(e),i=r.indexOf(t);return(n<0?r.length:n)-(i<0?r.length:i)}).slice(0,10).map(([e,r])=>({key:e,label:n[e]??e.replaceAll(`_`,` `),value:e===`workspace_ref`?r===`current`?t(`proposal.workspace.current`):t(`proposal.workspace.named`,{workspace:String(r??`current`)}):Array.isArray(r)?r.join(` · `):typeof r==`object`&&r?JSON.stringify(r):String(r??`—`)}))}function zx(e){if(e.action_kind!==`goal.lifecycle`)return;let t=e.normalized_parameters.operation;return t===`stop`||t===`resume`||t===`delete`?t:void 0}function Bx(e,t){let n=zx(e),r=typeof e.normalized_parameters.title==`string`?e.normalized_parameters.title:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:``,i=typeof e.normalized_parameters.target==`string`?e.normalized_parameters.target:``,a=e.action_kind===`goal.create`?t(`proposal.summary.goalCreate`,{title:r}):e.action_kind===`heartbeat.bind`?t(`proposal.summary.heartbeat`):e.action_kind===`monitor.create`?t(`proposal.summary.monitor`,{target:i}):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.summary.lifecycleStop`,{title:r}):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.summary.lifecycleDelete`,{title:r}):e.action_kind===`goal.lifecycle`?t(`proposal.summary.lifecycleResume`,{title:r}):e.summary;return{actionKind:e.action_kind,fields:Rx(e.normalized_parameters,t),goalId:typeof e.normalized_parameters.goal_id==`string`?e.normalized_parameters.goal_id:void 0,impact:e.action_kind===`goal.create`?t(`proposal.impact.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.impact.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.impact.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.impact.lifecycleResume`):e.permission_classification===`protected`?t(`proposal.impact.protected`):t(`proposal.impact.default`),previewId:e.proposal_id,lifecycleOperation:n,gate:e.gate?{kind:String(e.gate.kind??`protected_action`),nextAction:typeof e.gate.next_action==`string`?e.gate.next_action:void 0,summary:String(e.gate.summary??t(`proposal.gate.default`))}:void 0,primaryLabel:e.action_kind===`goal.create`?t(`proposal.primary.goalCreate`):e.action_kind===`goal.lifecycle`&&n===`stop`?t(`proposal.primary.lifecycleStop`):e.action_kind===`goal.lifecycle`&&n===`delete`?t(`proposal.primary.lifecycleDelete`):e.action_kind===`goal.lifecycle`?t(`proposal.primary.lifecycleResume`):e.action_kind===`todo.create`&&e.normalized_parameters.start_execution===!0?t(`proposal.primary.todoStart`):t(`proposal.primary.apply`),status:Lx(e.status),title:a}}function Vx(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,42);if(t)return t;let n=2166136261;for(let t of e)n^=t.codePointAt(0)??0,n=Math.imul(n,16777619);return`goal-${(n>>>0).toString(36)}`}function Hx(e,t){let n=e.match(/[「“"]([^」”"]{2,80})[」”"]/u)?.[1];return n?n.trim():e.replace(/^(请|帮我|我想|给我|创建|新建|设置|please|i want to|create|set up)+/iu,``).replace(/(一个|新的)?\s*(goal|目标)/giu,``).replace(/[,。!?].*$/u,``).trim().slice(0,80)||t(`goal.defaultTitle`)}function Ux(e,t){for(let n of e.split(/\r?\n/u)){let e=n.trim();for(let n of t){let t=e.match(RegExp(`^${n.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}\\s*[::]\\s*(.*)$`,`iu`));if(t?.[1]?.trim())return t[1].trim()}}return``}function Wx(e,t){let n=Ux(e,[`目标`,`Objective`]),r=Ux(e,[`完成标准`,`Completion criteria`]),i=Ux(e,[`执行边界(可选)`,`执行边界`,`边界`,`Execution boundary (optional)`,`Execution boundary`,`Boundary`]),a=(n||Hx(e,t)).split(/[。;;\n]/u)[0].trim().slice(0,80)||t(`goal.defaultTitle`),o=[n||a,r?t(`goal.objectiveCompletion`,{criteria:r}):``,i?t(`goal.objectiveBoundary`,{boundary:i}):``].filter(Boolean).join(` +`),s=/(只读|不调用外部工具|不修改(?:仓库|代码|状态)|read.?only|do not (?:call|use) external tools|do not modify (?:repositories|repository|code|state))/iu.test(i||e);return{completionCriteria:r,executionBoundary:i,initialTodos:r?[t(`goal.initialTodo`,{criteria:r})]:[],objective:o,permission:s?`read_only`:`workspace_write_on_confirmation`,title:a}}function Gx(e){let t=e.match(/(?:每|every)\s*(\d{1,3})\s*(?:分钟|minutes?)/iu)?.[1];if(t)return`${t}m`;let n=e.match(/(?:每|every)\s*(\d{1,2})\s*(?:小时|hours?)/iu)?.[1];return n?`${n}h`:/每小时|every hour|hourly/iu.test(e)?`1h`:(/每天|每日|早上|上午|daily|every day/iu.test(e),`1d`)}function Kx(e,t){return/(每周|星期|周[一二三四五六日天]|weekly|every\s+(?:mon|tues|wednes|thurs|fri|satur|sun)day|\d{1,2}\s*[::]\s*\d{2})/iu.test(e)?t(`schedule.unsupportedCalendar`):null}function qx(e,t){return Ux(e,[`检查内容`,`监控内容`,`目标`,`Check target`,`Monitor target`,`Target`])||e.replace(/^(?:为当前 Goal |for the current Goal )?(?:添加|配置|创建|add|configure|create)?\s*(?:定时检查|监控|scheduled check|monitor)[::]?/iu,``).split(/\r?\n/u)[0].trim()||t(`schedule.defaultTarget`)}function Jx(e){return/(mr|pr).{0,8}(合并|merge)/iu.test(e)?`pr_merged`:/发布完成|上线完成|release (?:is )?complete|deployment (?:is )?complete/iu.test(e)?`release_complete`:`goal_complete`}function Yx(e,t){let n=e.toLowerCase();return t.find(e=>n.includes(e.agentId.toLowerCase())||n.includes(e.label.toLowerCase()))}function Xx(e){let t=Ux(e,[`标题`,`任务标题`,`Todo 标题`]),n=Ux(e,[`内容`,`任务内容`,`Todo 内容`]);if(t)return[t,n].filter(Boolean).join(`:`).slice(0,400);let r=e.match(/[「“"]([^」”"]{2,200})[」”"]/u)?.[1];return r?r.trim():e.replace(/^(请|帮我|给我|为当前 Goal |新增|新建|创建|添加|加上|加一个|记一个)+/u,``).replace(/^(一个\s*)?(普通\s*)?(todo|待办|任务)(?:\s*到\s*Tasks?)?[::\s]*/iu,``).replace(/[。;;,,]\s*(?:不要|不需要|无需|禁止|别|暂不).{0,80}(?:heartbeat|心跳|定时|监控|执行).*$/iu,``).replace(/[,,]\s*(并且|然后|再)?\s*(交给|分配给|让).+$/u,``).replace(/\s*(交给|分配给|让)\s+.+$/u,``).trim().slice(0,400)||`推进当前 Goal 的下一项工作`}var Zx=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),Qx=5242880,$x=4;function eS(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onerror=()=>r(Error(t(`composer.imageReadError`,{name:e.name}))),i.onload=()=>n({dataUrl:String(i.result??``),id:crypto.randomUUID(),mimeType:e.type,name:e.name,size:e.size}),i.readAsDataURL(e)})}function tS({agents:e=[{agentId:`codex`,available:!0,capability:`代码与项目执行`,label:`Codex`}],callbacks:t={},goalArchiveLoadState:n={error:null,phase:`ready`},model:r,readOnly:i=!1,selectedAgentId:a,selectedGoalId:o,statusSourceControl:s}){let{locale:c,t:l}=ya(),[u,d]=(0,z.useState)(o??null),[f,p]=(0,z.useState)(a??e.find(e=>e.available)?.agentId??`codex`),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)({}),[S,C]=(0,z.useState)(`chat`),[w,T]=(0,z.useState)(!1),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(!1),[ee,A]=(0,z.useState)(()=>{try{let e=window.sessionStorage.getItem(`loopx-pw-composer-drafts`),t=e?JSON.parse(e):{};return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}),[j,te]=(0,z.useState)(!1),[ne,re]=(0,z.useState)([]),[M,N]=(0,z.useState)(null),[ie,ae]=(0,z.useState)(null),[oe,P]=(0,z.useState)(()=>new Set),[F,se]=(0,z.useState)(()=>new Set),[ce,le]=(0,z.useState)(`idle`),[ue,de]=(0,z.useState)([]),[fe,pe]=(0,z.useState)(!1),[me,he]=(0,z.useState)(Ex),[I,ge]=(0,z.useState)({}),[_e,ve]=(0,z.useState)([]),ye=(0,z.useRef)(!1),be=(0,z.useRef)(NaN),xe=(0,z.useRef)(null),Se=(0,z.useRef)(null),Ce=(0,z.useRef)(null),we=(0,z.useRef)(new Set),Te=(0,z.useRef)(new Set),[Ee,De]=(0,z.useState)(null),L=o===void 0?u:o,Oe=a??f,ke=`${L??`manager`}:${Oe}`,Ae=ee[ke]??``;(0,z.useEffect)(()=>{re([]),N(null)},[ke]);function je(e,t){A(n=>{let r={...n};t?r[e]=t:delete r[e];try{window.sessionStorage.setItem(`loopx-pw-composer-drafts`,JSON.stringify(r))}catch{}return r})}function Me(e){je(ke,e)}function Ne(e){let t=ee[ke]?.trimEnd();Me(t?`${t}\n${e}`:e),window.requestAnimationFrame(()=>xe.current?.focus())}(0,z.useEffect)(()=>{let e=xe.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[Ae]);let Pe=(0,z.useMemo)(()=>r.goals.map(e=>{let t=I[e.goalId];return t?{...e,repository:{branch:t.branch,identity:t.identity,label:t.label,readOnly:!0}}:e}),[I,r.goals]),Fe=(0,z.useMemo)(()=>Pe.filter(e=>By(e)===`needs_you`).length,[Pe]),Ie=(0,z.useMemo)(()=>Pe.filter(e=>By(e)===`needs_you`&&(e.needsYouBlocking||e.state===`等你`)).length,[Pe]),R=Pe.find(e=>e.goalId===L)??null,Le=m?.kind===`settings`,Re=L,ze=(0,z.useMemo)(()=>{let e=Object.values(b).filter(e=>e.actionKind===`heartbeat.bind`&&e.goalId&&e.status===`applied`).map(e=>({id:`schedule:${e.goalId}:heartbeat`,kind:`schedule`,schedule:{agentId:Oe,executionHistory:[],goalId:e.goalId,label:e.title,nextRunAt:l(`drawer.schedulePending`),notificationRule:l(`drawer.scheduleDefaultNotification`),schedule:e.fields.find(e=>e.key===`cadence`)?.value??l(`schedule.summary`),scheduleId:`${e.goalId}:heartbeat`,scheduleKind:`heartbeat`,status:e.status===`applied`?`active`:`draft`,stopCondition:e.fields.find(e=>e.key===`stop_condition`)?.value??l(`drawer.scheduleDefaultStop`),timezone:e.fields.find(e=>e.key===`timezone`)?.value??`Asia/Shanghai`}})),t=[...Ix(r,Re,l),...r.timeline??[],...e,...Ax(Object.values(b)).filter(e=>e.actionKind!==`heartbeat.bind`||e.status!==`applied`).map(e=>({id:`proposal:${e.previewId}`,kind:`proposal`,proposal:e}))];return[...new Map(t.map(e=>[e.id,e])).values()].filter(e=>e.kind!==`proposal`||![`stale`,`error`].includes(e.proposal.status)||ue.includes(e.proposal.previewId)).filter(e=>!L||e.kind===`message`?!0:e.kind===`proposal`?!e.proposal.goalId||e.proposal.goalId===L:e.kind===`attention`?e.attention.goalId===L:e.kind===`run`?e.run.goalId===L:e.kind===`schedule`?e.schedule.goalId===L:e.output.goalId===L)},[Re,r,b,Oe,L,ue,l]),Be=(0,z.useMemo)(()=>v?ze.filter(e=>e.kind===`message`?!0:e.kind===`run`?e.run.runId===v.runId:e.kind===`output`&&e.output.runId===v.runId):ze,[v,ze]);(0,z.useEffect)(()=>{if(!v)return;let e=ze.find(e=>e.kind===`run`&&e.run.runId===v.runId);!e||e.kind!==`run`||JSON.stringify({completedSteps:v.completedSteps,latestActivity:v.latestActivity,messages:v.sessionMessages,sessionStatus:v.sessionStatus,status:v.status,totalSteps:v.totalSteps})!==JSON.stringify({completedSteps:e.run.completedSteps,latestActivity:e.run.latestActivity,messages:e.run.sessionMessages,sessionStatus:e.run.sessionStatus,status:e.run.status,totalSteps:e.run.totalSteps})&&y(e.run)},[v,ze]);let Ve=(0,z.useMemo)(()=>ze.flatMap(e=>e.kind===`message`?[e.message]:[]),[ze]),He=(0,z.useMemo)(()=>R?ze.flatMap(e=>e.kind===`message`?[e.message]:[]):[],[ze,R]);(0,z.useEffect)(()=>{R||w||Ve.some(e=>e.pending)&&D(!0)},[w,Ve,R]),(0,z.useEffect)(()=>{!R||S===`chat`||He.some(e=>e.pending)&&k(!0)},[He,R,S]);let Ue=(0,z.useMemo)(()=>ze.filter(e=>e.kind===`message`||e.kind===`proposal`&&ue.includes(e.proposal.previewId)),[ze,ue]),We=Ue[Ue.length-1],Ge=We?.kind===`message`?We.message.text.length:0;(0,z.useEffect)(()=>{if(!w||!Se.current)return;let e=window.requestAnimationFrame(()=>{Se.current&&(Se.current.scrollTop=Se.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[Ue.length,w,Ge]);let Ke=(0,z.useMemo)(()=>{if(m?.kind===`settings`)return null;if(m?.kind===`goal`){let e=Pe.find(e=>e.goalId===m.item.goalId);return e?{item:e,kind:`goal`}:m}if(m?.kind!==`run`)return m;let e=ze.find(e=>e.kind===`run`&&e.run.runId===m.item.runId);return e?{item:e.run,kind:`run`}:m},[ze,m,Pe]);(0,z.useEffect)(()=>{if(i){ge({}),ve([]);return}let e=!1;return Promise.all([h_(),E_()]).then(([t,n])=>{e||(ge(Object.fromEntries(t.map(e=>[e.goal_id,e.repository]))),ve(n))}).catch(()=>{}),()=>{e=!0}},[i]),(0,z.useEffect)(()=>{if(!fe)return;function e(e){e.key===`Escape`&&pe(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[fe]),(0,z.useEffect)(()=>{if(L||!ze.length)return;if(!ye.current){ye.current=!0;try{be.current=Date.parse(window.localStorage.getItem(`loopx-pw-last-visit`)??``),window.localStorage.setItem(`loopx-pw-last-visit`,new Date().toISOString())}catch{be.current=NaN}}let e=be.current,t=ze.filter(e=>e.kind===`run`).map(e=>e.run),n=t=>{let n=Date.parse(t??``);return!Number.isNaN(e)&&!Number.isNaN(n)&&n>e},r={attention:Fe,done:t.filter(e=>e.status===`completed`&&n(e.latestActivity)).length,failed:t.filter(e=>(e.status===`failed`||e.status===`interrupted`)&&n(e.latestActivity)).length};De(e=>e?.attention===r.attention&&e.done===r.done&&e.failed===r.failed?e:r)},[ze,Fe,L]),(0,z.useEffect)(()=>{if(i){x({});return}let e=!1;return fg(L?{goalId:L}:{contextKind:`manager`}).then(t=>{if(e)return;let n=Object.fromEntries(t.filter(e=>[`ready`,`gated`,`deferred`,`applying`].includes(e.status)).map(e=>{let t=Bx(e,l);return[t.previewId,t]}));x(e=>({...e,...n}))}).catch(()=>{}),()=>{e=!0}},[i,L,l]);async function qe(e,n={}){if(i)throw Error(l(`source.readOnlyWriteError`));let r;try{r=t.onPreviewAction?await t.onPreviewAction(e):Bx(await ug(e),l)}catch(t){if(!(t instanceof og)||t.payload.error_code!==`action_preview_gate`)throw t;let n=t.payload.gate&&typeof t.payload.gate==`object`?t.payload.gate:{},i=(Array.isArray(n.candidates)?n.candidates:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.workspace_ref==`string`&&typeof t.label==`string`?[{label:t.label,workspaceRef:t.workspace_ref}]:[]}),a=String(n.kind??`workspace_selection_required`),o=a===`agent_binding_required`||a===`agent_identity_selection_required`;r={actionKind:e.actionKind,fields:i.map(e=>({key:`workspace_ref:${e.workspaceRef}`,label:e.label,value:e.workspaceRef})),gate:{kind:a,nextAction:typeof n.next_action==`string`?n.next_action:void 0,summary:String(n.summary??l(`proposal.workspaceGate.defaultSummary`))},impact:l(o?`proposal.workspaceGate.agentImpact`:`proposal.workspaceGate.selectionImpact`),previewId:`workspace-choice-${Date.now().toString(36)}`,sourceRequest:e,status:`gated`,title:l(o?`proposal.workspaceGate.agentTitle`:`proposal.workspaceGate.selectionTitle`),workspaceCandidates:i}}return de(e=>e.includes(r.previewId)?e:[...e,r.previewId]),x(e=>({...e,[r.previewId]:r})),n.select!==!1&&h({item:r,kind:`proposal`}),r}function Je(){nt(null),je(`manager:${Oe}`,l(`composer.createGoalTemplate`)),window.requestAnimationFrame(()=>xe.current?.focus())}async function Ye(e,n){let r={delete:`Deleted from the owner workspace`,resume:`Resumed from the owner workspace`,stop:`Stopped from the owner workspace`},i={delete:l(`proposal.summary.lifecycleDelete`,{title:e.title}),resume:l(`proposal.summary.lifecycleResume`,{title:e.title}),stop:l(`proposal.summary.lifecycleStop`,{title:e.title})},a=null,o=!1;try{if(n===`stop`){if(we.current.has(e.goalId))return;we.current.add(e.goalId),P(new Set(we.current)),h(null),a={goalId:e.goalId,next:`stopped`,optimisticApplied:!0,previous:e.activationState},ae(l(`feedback.applying`,{title:i.stop})),t.onGoalActivationStateChange?.(e.goalId,`stopped`)}let s=await qe({actionKind:`goal.lifecycle`,context:{kind:`goal_directory`,goal_id:e.goalId},idempotencyKey:`workspace-goal-${n}-${e.goalId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:n,reason:r[n]},summary:i[n]},{select:n!==`stop`});n===`stop`&&(s.status===`ready`?(o=!0,await $e(s,{lifecycleProjection:a??void 0,presentation:`feedback`})):(a&&t.onGoalActivationStateChange?.(a.goalId,a.previous),ae(s.gate?l(`feedback.gateRequired`,{summary:s.gate.summary}):l(`feedback.notCompleted`,{status:s.status})),h({item:s,kind:`proposal`})))}catch(e){a&&!o&&t.onGoalActivationStateChange?.(a.goalId,a.previous),ae(l(`feedback.executionFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{n===`stop`&&(we.current.delete(e.goalId),P(new Set(we.current)))}}function Xe(e,t){Me(l(t?e===`heartbeat`?`composer.heartbeatTemplate`:`composer.monitorTemplate`:e===`heartbeat`?`composer.heartbeatTemplateWithoutGoal`:`composer.monitorTemplateWithoutGoal`)),h(null),window.requestAnimationFrame(()=>xe.current?.focus())}async function Ze(e,n,r=``){let i=await t.onRequestScheduleConfig?.(e,n);if(i){de(e=>e.includes(i.previewId)?e:[...e,i.previewId]),x(e=>({...e,[i.previewId]:i})),h({item:i,kind:`proposal`});return}if(!n){Me(l(e===`heartbeat`?`composer.heartbeatGoalQuestion`:`composer.monitorGoalQuestion`));return}let a=Date.now().toString(36);await qe({actionKind:e===`heartbeat`?`heartbeat.bind`:`monitor.create`,context:{kind:`schedule`,goal_id:n},idempotencyKey:`workspace-${e}-${n}-${a}`,normalizedParameters:e===`heartbeat`?{agent_id:Oe,cadence:Gx(r),goal_id:n,stop_condition:Jx(r),timezone:`Asia/Shanghai`}:{agent_id:Oe,cadence:Gx(r),goal_id:n,stop_condition:Jx(r),target:qx(r,l),target_key:`goal-${n}`,timezone:`Asia/Shanghai`},summary:e===`heartbeat`?l(`proposal.summary.heartbeat`):l(`proposal.summary.monitor`,{target:qx(r,l)})})}async function Qe(e){if(!Te.current.has(e.todoId)){Te.current.add(e.todoId),se(new Set(Te.current)),ae(l(`feedback.preparingPreview`,{title:e.text}));try{await qe({actionKind:`todo.update`,context:{goal_id:e.goalId,kind:`todo`,todo_id:e.todoId},idempotencyKey:`workspace-todo-${e.todoId}-complete-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,operation:`complete`,todo_id:e.todoId},summary:l(`tasks.markComplete`,{name:e.text})}),ae(null)}catch(e){ae(l(`feedback.previewFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{Te.current.delete(e.todoId),se(new Set(Te.current))}}}async function $e(e,n={}){let i=n.presentation!==`feedback`,a=e.actionKind===`goal.lifecycle`&&e.goalId&&(e.lifecycleOperation===`stop`||e.lifecycleOperation===`resume`)?{goalId:e.goalId,next:e.lifecycleOperation===`stop`?`stopped`:`active`,optimisticApplied:!1,previous:r.goals.find(t=>t.goalId===e.goalId)?.activationState??(e.lifecycleOperation===`stop`?`active`:`stopped`)}:null,o=n.lifecycleProjection??a;ae(l(`feedback.applying`,{title:e.title}));let s={...e,status:`applying`};x(t=>({...t,[e.previewId]:s})),i&&h({item:s,kind:`proposal`}),o&&!o.optimisticApplied&&t.onGoalActivationStateChange?.(o.goalId,o.next);try{if(t.onApplyProposal){await t.onApplyProposal(e);let n={...e,status:`applied`};if(x(t=>({...t,[e.previewId]:n})),i&&h({item:n,kind:`proposal`}),ae(l(`feedback.completed`,{title:e.title})),e.actionKind===`goal.lifecycle`){(e.lifecycleOperation===`stop`||e.lifecycleOperation===`delete`)&&nt(null),e.lifecycleOperation===`delete`&&e.goalId&&t.onGoalDeleted?.(e.goalId);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>void 0)}return}let n=await pg(e.previewId),r=Bx(n.proposal,l);if(x(t=>({...t,[e.previewId]:r})),i&&h({item:r,kind:`proposal`}),n.proposal.status!==`applied`||n.proposal.receipt?.projection_verified!==!0){o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),ae(n.proposal.status===`stale`?l(`feedback.stale`):l(`feedback.notCompleted`,{status:n.proposal.status}));return}if(ae(l(`feedback.completed`,{title:r.title})),r.actionKind===`todo.create`&&await t.onRefresh?.(),r.actionKind===`goal.lifecycle`&&(r.lifecycleOperation===`stop`||r.lifecycleOperation===`delete`)&&nt(null),r.actionKind===`goal.lifecycle`&&r.lifecycleOperation===`delete`&&r.goalId&&t.onGoalDeleted?.(r.goalId),r.actionKind===`goal.lifecycle`){let e=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>e?.()).catch(()=>void 0)}}catch(n){if(o&&t.onGoalActivationStateChange?.(o.goalId,o.previous),n instanceof og&&n.payload.error_code===`protected_action`){let r=n.payload.gate,i=r&&typeof r==`object`?r:{},a={...e,gate:{kind:String(i.kind??`protected_action`),nextAction:typeof i.next_action==`string`?i.next_action:void 0,summary:String(i.summary??n.message)},status:`gated`};x(t=>({...t,[e.previewId]:a})),h({item:a,kind:`proposal`}),ae(l(`feedback.gateRequired`,{summary:a.gate.summary})),e.actionKind===`goal.create`&&e.goalId&&(t.onRefresh?.(),nt(e.goalId));return}let r=n instanceof Error&&/stale|状态.*变化|conflict/i.test(n.message),a={...e,errorMessage:n instanceof Error?n.message:String(n),status:r?`stale`:`error`};x(t=>({...t,[e.previewId]:a})),i&&h({item:a,kind:`proposal`}),ae(l(`feedback.executionFailed`,{error:a.errorMessage}))}}let et={...t,onOpenRunSession:async e=>{e.goalId!==L&&nt(e.goalId),C(`chat`),await t.onOpenRunSession?.(e),y(e),h(null)},onOpenGoal:e=>{nt(e);let n=t.onReconcileStatus??t.onRefresh;Promise.resolve().then(()=>n?.()).catch(()=>{ae(l(`feedback.goalRefreshFailed`))})},onOpenGoalView:e=>{C(e),e===`chat`&&y(null),h(null)},onOpenOutput:e=>{e.goalId!==L&&nt(e.goalId),C(`files`),t.onOpenOutput?.(e)},onApplyProposal:$e,onCancelProposal:async e=>{h(null),x(t=>{let n={...t};return delete n[e.previewId],n});try{t.onCancelProposal?.(e),t.onCancelProposal||await mg(e.previewId)}catch(t){x(t=>({...t,[e.previewId]:e})),ae(l(`feedback.cancelFailed`,{error:t instanceof Error?t.message:String(t)}))}},onTransitionProposal:async(e,t)=>{let n=Bx(await hg(e.previewId,t),l);de(e=>e.includes(n.previewId)?e:[...e,n.previewId]),x(r=>{let i={...r};return t===`regenerate`&&delete i[e.previewId],i[n.previewId]=n,i}),h({item:n,kind:`proposal`})},onSelectWorkspaceCandidate:async(e,t)=>{e.sourceRequest&&(x(t=>{let n={...t};return delete n[e.previewId],n}),await qe({...e.sourceRequest,idempotencyKey:`${e.sourceRequest.idempotencyKey}-${t}`,normalizedParameters:{...e.sourceRequest.normalizedParameters,workspace_ref:t}}))},onPreviewAction:qe,onRequestScheduleConfig:(e,t)=>Xe(e,t),onOpenNotificationSettings:e=>h({goalId:e,kind:`settings`,tab:`lark`}),onFetchNotificationTargets:()=>Rg(),onSetupGoalChannel:e=>Bg(e),onToggleGoalAutoNotify:e=>Vg(e),onUpdateSchedule:async(e,t)=>{let n=Date.now().toString(36),r=e.scheduleKind===`heartbeat`;await qe({actionKind:r?`heartbeat.bind`:`monitor.update`,context:{kind:`schedule`,goal_id:e.goalId},idempotencyKey:`workspace-monitor-${e.scheduleId}-${t}-${n}`,normalizedParameters:{agent_id:e.agentId??Oe,...!r&&t===`run_now`?{endpoint_id:Oe}:{},...t===`edit`?{cadence:`2h`,...r?{timezone:e.timezone??`Asia/Shanghai`}:{}}:{},goal_id:e.goalId,operation:t,...!r&&t===`run_now`&&e.sessionId?{session_id:e.sessionId}:{},...r?{}:{todo_id:e.scheduleId}},summary:t===`pause`?`暂停自动运行:${e.label}`:t===`resume`?`恢复自动运行:${e.label}`:t===`run_now`?`立即运行:${e.label}`:t===`stop`?`停止自动运行:${e.label}`:`编辑自动运行生命周期:${e.label}`})}},tt=i?{onOpenGoal:et.onOpenGoal,onOpenGoalView:et.onOpenGoalView,onOpenOutput:et.onOpenOutput}:et;function nt(e){d(e),T(!1),D(!1),k(!1),y(null),h(null),C(`tasks`),pe(!1),t.onSelectGoal?.(e)}function rt(e){p(e),t.onSelectAgent?.(e)}function it(e){he(e),Dx(e)}async function at(n){let r=n?[]:ne,i=(n??Ae).trim()||(r.length?l(`composer.imageAnalysisPrompt`):``);if(!(!i||j)){n||(Me(``),re([])),N(null),te(!0);try{if(r.length){L?S!==`chat`&&k(!0):D(!0);let e=await t.onSendMessage?.(i,Oe,L,r);e&&await qe(e);return}let n=db(i,{agents:e.map(e=>({agentId:e.agentId,label:e.label})),goalId:L,todos:(R?.agentTodos??[]).map(e=>({text:e.text,todoId:e.todoId}))});if(n.route===`clarify`){Me(i);let e=l(`composer.clarifySingleAction`);n.missingFields.includes(`resume_when`)&&(e=l(`composer.clarifyDefer`)),ae(e);return}if(n.actionKind===`goal.create`){let e=Wx(i,l),t=Vx(e.title);await qe({actionKind:`goal.create`,context:{kind:`manager`,goal_id:null,natural_language:i},idempotencyKey:`workspace-goal-intent-${t}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Oe,completion_criteria:e.completionCriteria,execution_boundary:e.executionBoundary,goal_id:t,heartbeat:{cadence:Gx(i),enabled:n.normalizedParameters.heartbeat_enabled===!0,timezone:`Asia/Shanghai`},initial_todos:e.initialTodos,objective:e.objective,permission:e.permission,stop_condition:Jx(i),title:e.title,workspace_ref:`current`},summary:l(`proposal.summary.goalCreate`,{title:e.title})});return}if(L&&n.actionKind===`heartbeat.bind`){await Ze(`heartbeat`,L,i);return}if(L&&n.actionKind===`monitor.create`){let e=Kx(i,l);if(e){Me(i),ae(e);return}await Ze(`monitor`,L,i);return}let a=Yx(i,e);if(L&&a&&n.actionKind===`agent.bind`){await qe({actionKind:`agent.bind`,context:{kind:`goal`,goal_id:L,natural_language:i},idempotencyKey:`workspace-agent-bind-${L}-${a.agentId}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:a.agentId,goal_id:L},summary:`将 ${a.label} 绑定到 ${R?.title??L}`});return}if(L&&n.actionKind===`todo.create`){if(n.normalizedParameters.start_execution===!0){await qe({actionKind:`todo.create`,context:{kind:`goal`,goal_id:L,natural_language:i},idempotencyKey:`workspace-task-start-${L}-${Date.now().toString(36)}`,normalizedParameters:{endpoint_id:a?.agentId??Oe,goal_id:L,start_execution:!0,text:i},summary:`交给 Agent 执行:${i.slice(0,120)}`});return}let e=a?.agentId??(/(交给|分配给|让).{0,24}(agent|codex|claude|kimi)/iu.test(i)?Oe:null);await qe({actionKind:`todo.create`,context:{kind:`goal`,goal_id:L,natural_language:i},idempotencyKey:`workspace-todo-create-${L}-${Date.now().toString(36)}`,normalizedParameters:{...e?{endpoint_id:e}:{},goal_id:L,text:Xx(i)},summary:`创建 Todo:${Xx(i)}`});return}let o=R?.agentTodos.find(e=>i.includes(e.todoId)||i.includes(e.text)),s=typeof n.normalizedParameters.operation==`string`?n.normalizedParameters.operation:null;if(L&&o&&n.actionKind===`todo.update`&&s){await qe({actionKind:`todo.update`,context:{kind:`todo`,goal_id:L,todo_id:o.todoId,natural_language:i},idempotencyKey:`workspace-todo-update-${o.todoId}-${s}-${Date.now().toString(36)}`,normalizedParameters:{agent_id:Oe,...s===`reassign`&&a?{endpoint_id:a.agentId}:{},...s===`block`?{note:i}:{},...s===`defer`&&typeof n.normalizedParameters.resume_when==`string`?{resume_when:n.normalizedParameters.resume_when}:{},goal_id:L,operation:s,todo_id:o.todoId},summary:`更新 Todo:${o.text}`});return}L?S!==`chat`&&k(!0):D(!0);let c=await t.onSendMessage?.(i,Oe,L);c&&await qe(c)}catch(e){n||(Me(i),re(r));let t=e instanceof Error?e.message:l(`feedback.sendGenericError`);ae(l(`feedback.sendFailed`,{error:t}))}finally{te(!1)}}}let ot=e.find(e=>e.agentId===Oe)?.label??Oe,st=!R&&Ae.startsWith(l(`composer.createGoalDraftLead`)),ct=ze.filter(e=>e.kind===`run`&&!!e.run.sessionId&&!!e.run.canInterrupt&&(e.run.status===`running`||e.run.status===`queued`)).length;async function lt(e){if(!e?.length)return;let t=$x-ne.length,n=Array.from(e).slice(0,Math.max(0,t)),r=n.find(e=>!Zx.has(e.type)),i=n.find(e=>e.size>Qx);if(t<=0){N(l(`composer.imageCountError`,{count:$x}));return}if(r){N(l(`composer.imageTypeError`));return}if(i){N(l(`composer.imageSizeError`,{size:Qx/1024/1024}));return}try{let t=await Promise.all(n.map(e=>eS(e,l)));re(e=>[...e,...t].slice(0,$x)),N(e.length>n.length?l(`composer.imageCountError`,{count:$x}):null)}catch(e){N(e instanceof Error?e.message:l(`composer.imageReadGenericError`))}finally{Ce.current&&(Ce.current.value=``)}}function ut(e){let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]});t.length&&(e.preventDefault(),lt(t))}async function dt(){let e=await E_();ve(e)}async function ft(){await Promise.all([dt(),t.onRefresh?.()])}async function pt(){if(!(!t.onRefresh||ce===`loading`)){le(`loading`);try{await t.onRefresh(),le(`done`)}catch{le(`error`)}window.setTimeout(()=>le(`idle`),1800)}}return Le?(0,B.jsx)(Cx,{focusGoalConnection:!!(m?.kind===`settings`&&m.goalId),goals:Pe,initialGoalId:m?.kind===`settings`?m.goalId??L:L,initialTab:m?.kind===`settings`?m.tab??`lark`:`lark`,onChanged:()=>void ft(),onClose:()=>h(null),onThemeChange:it,theme:me}):(0,B.jsx)(Ox,{drawer:Ke?(0,B.jsx)(yb,{agents:e,callbacks:tt,goalNotifications:r.goalNotifications??[],goals:Pe,inspectorExpanded:g,larkConnections:i?[]:_e,onClose:()=>{Ke.kind===`proposal`&&[`applied`,`rejected`].includes(Ke.item.status)&&(Ke.item.actionKind!==`heartbeat.bind`||Ke.item.status!==`applied`)&&x(e=>{let t={...e};return delete t[Ke.item.previewId],t}),_(!1),h(null)},onToggleInspectorSize:()=>_(e=>!e),readOnly:i,runs:ze.flatMap(e=>e.kind===`run`?[e.run]:[]),selection:Ke}):null,drawerMode:Ke?.kind===`todo`?g?`inspector-full`:`inspector`:`panel`,drawerOpen:Ke!==null,mobileSidebarOpen:fe,onCloseMobileSidebar:()=>pe(!1),theme:me,main:(0,B.jsxs)(`div`,{className:`personal-channel`,children:[(0,B.jsx)(qy,{agents:e,managerChatOpen:w,mobileNavigationOpen:fe,onOpenGoalCapabilities:R?()=>h({goalId:R.goalId,kind:`settings`,tab:`capabilities`}):void 0,onOpenGoalDetail:R&&!R.loadState?()=>h({item:R,kind:`goal`}):void 0,onRefresh:t.onRefresh?()=>void pt():void 0,onOpenNavigation:()=>pe(!0),onOpenManagerChat:()=>{D(!1),T(!0)},onSelectGoalTab:e=>{C(e),e===`chat`&&(y(null),k(!1))},onSelectAgent:rt,onReturnManagerHome:()=>{T(!1),D(!1),window.requestAnimationFrame(()=>Se.current?.scrollTo({behavior:`smooth`,top:0}))},selectedAgentId:Oe,refreshState:ce,readOnlySourceLabel:i?s?.activeSource.label:void 0,selectedGoal:R,selectedGoalTab:S}),(0,B.jsxs)(`div`,{className:`personal-channel-scroll`,ref:Se,children:[!R&&!w&&Ee&&Ee.done+Ee.failed+Ee.attention>0?(0,B.jsxs)(`section`,{className:`personal-digest-card`,"aria-label":l(`digest.away`),children:[(0,B.jsx)(`strong`,{children:l(`digest.away`)}),(0,B.jsxs)(`div`,{className:`personal-digest-stats`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ee.done}),l(`digest.completed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ee.failed}),l(`digest.failed`)]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:Ee.attention}),l(`digest.needsYou`)]})]})]}):null,!R&&!w?(0,B.jsxs)(`section`,{className:`personal-manager-greeting`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(Tm,{size:20})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:l(`home.greeting`)}),(0,B.jsx)(`p`,{children:r.goals.some(e=>e.activationState===`active`&&e.loadState)?l(`startup.partial`):(0,B.jsxs)(B.Fragment,{children:[l(`home.waitingCount`,{count:Fe}),` `,l(`home.blockingSummary`,{count:Ie})]})})]})]}):null,R?.loadState?(0,B.jsx)(`section`,{className:`personal-manager-greeting`,role:`status`,"data-testid":`goal-status-loading`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:l(R.loadState===`error`?`startup.goalError`:`startup.goalLoading`)}),(0,B.jsx)(`p`,{children:l(R.loadError?`startup.error.${R.loadError}`:`startup.independent`)}),R.loadState===`error`?(0,B.jsx)(`button`,{className:`min-h-11 rounded-md border px-3 py-2 text-sm`,type:`button`,onClick:()=>void t.onRefresh?.(),children:l(`startup.retry`)}):null]})}):R&&S===`tasks`?(0,B.jsx)(Hb,{historyEnabled:!i,goal:R,items:ze,onDraftTaskFromMessage:i?void 0:e=>{Me(`创建一个 Task:${kx(e)}`),ae(l(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>xe.current?.focus())},onOpenChat:()=>C(`chat`),onQuickComplete:i?void 0:Qe,onSelect:h,quickCompletingTodoIds:F,selectedTodoId:Ke?.kind===`todo`?Ke.item.todoId:null,userTodos:r.userTodos}):R&&S===`files`?(0,B.jsx)(Nx,{items:ze.filter(e=>e.kind===`output`),onSelect:h,reportState:r.periodicReports}):!R&&!w?(0,B.jsx)(Mx,{goals:Pe,onRetry:()=>void t.onRefresh?.(),onSelectGoal:nt,systemHealth:r.systemHealth}):R?(0,B.jsxs)(B.Fragment,{children:[R&&v?.goalId===R.goalId?(0,B.jsx)(Fx,{onClose:()=>y(null),onOpenDetails:()=>h({item:v,kind:`run`}),run:v}):null,(0,B.jsx)(ab,{items:Be,onSelect:h,selectedGoal:R})]}):(0,B.jsx)(ab,{items:Ue,onSelect:h,selectedGoal:null})]}),(0,B.jsx)(`div`,{className:`personal-composer-wrap`,children:i?(0,B.jsxs)(`div`,{className:`personal-read-only-notice`,children:[(0,B.jsx)(`strong`,{children:l(`source.readOnlyNoticeTitle`)}),(0,B.jsx)(`span`,{children:l(`source.readOnlyNoticeDescription`)})]}):(0,B.jsxs)(B.Fragment,{children:[!R&&!w&&E&&Ve.length?(0,B.jsx)(Px,{messages:Ve,onClose:()=>D(!1),onOpenConversation:()=>{D(!1),T(!0)}}):null,R&&S!==`chat`&&O&&He.length?(0,B.jsx)(Px,{agentLabel:ot,messages:He,onClose:()=>k(!1),onDraftTask:S===`tasks`?e=>{Me(`创建一个 Task:${kx(e)}`),ae(l(`feedback.taskDraftCreated`)),window.requestAnimationFrame(()=>xe.current?.focus())}:void 0,onOpenConversation:()=>{k(!1),C(`chat`)},title:`${R.title} · ${ot}`}):null,ie?(0,B.jsxs)(`div`,{className:`personal-action-feedback`,role:`status`,children:[(0,B.jsx)(`span`,{children:ie}),(0,B.jsx)(`button`,{"aria-label":l(`common.closeActionReceipt`),onClick:()=>ae(null),type:`button`,children:(0,B.jsx)(jh,{size:14})})]}):null,(0,B.jsx)(`p`,{className:`personal-composer-hint`,children:R?ct>0?l(`composer.goalRunningHint`,{agent:ot,count:ct}):l(`composer.goalMessageHint`,{agent:ot}):l(`composer.managerMessageHint`)}),R?(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":l(`composer.nextAction`),className:`is-draft`,onClick:()=>Ne(l(`composer.nextActionPrompt`)),title:l(`composer.prepareDraft`),type:`button`,children:[(0,B.jsx)(rh,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.nextAction`)}),(0,B.jsx)(`small`,{className:`personal-prompt-subtle`,children:l(`composer.draft`)})]}),(0,B.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void at(l(`composer.agentProgressPrompt`)),title:l(`composer.immediate`),type:`button`,children:[(0,B.jsx)(_h,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.agentProgress`)}),(0,B.jsx)(`em`,{className:`personal-prompt-badge`,children:l(`composer.immediate`)})]}),(0,B.jsxs)(`button`,{"aria-label":l(`composer.monitor`),className:`is-draft`,onClick:()=>Xe(`monitor`,L),title:l(`composer.monitorHint`),type:`button`,children:[(0,B.jsx)(Dm,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.monitor`)}),(0,B.jsx)(`small`,{className:`personal-prompt-subtle`,children:l(`composer.draft`)})]})]}):(0,B.jsxs)(`div`,{className:`personal-quick-prompts`,children:[(0,B.jsxs)(`button`,{"aria-label":l(`composer.globalTasks`),className:`is-draft`,onClick:()=>Ne(l(`composer.globalTasksPrompt`)),title:l(`composer.prepareDraft`),type:`button`,children:[(0,B.jsx)(rh,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.globalTasks`)}),(0,B.jsx)(`small`,{className:`personal-prompt-subtle`,children:l(`composer.draft`)})]}),(0,B.jsxs)(`button`,{className:`is-immediate`,disabled:j,onClick:()=>void at(l(`composer.globalProgressPrompt`)),title:l(`composer.immediate`),type:`button`,children:[(0,B.jsx)(_h,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.globalProgress`)}),(0,B.jsx)(`em`,{className:`personal-prompt-badge`,children:l(`composer.immediate`)})]}),(0,B.jsxs)(`button`,{"aria-label":l(`composer.createGoal`),className:`is-draft`,onClick:Je,title:l(`composer.createGoalHint`),type:`button`,children:[(0,B.jsx)(dh,{size:13}),(0,B.jsx)(`span`,{children:l(`composer.createGoal`)}),(0,B.jsx)(`small`,{className:`personal-prompt-subtle`,children:l(`composer.draft`)})]})]}),st?(0,B.jsxs)(`div`,{className:`personal-goal-draft-status`,role:`status`,children:[(0,B.jsx)(`strong`,{children:l(`composer.createGoalDraft`)}),(0,B.jsx)(`span`,{children:l(`composer.createGoalDraftDescription`)})]}):null,ne.length?(0,B.jsx)(`div`,{className:`personal-composer-images`,"aria-label":l(`composer.imagesPending`),children:ne.map(e=>(0,B.jsxs)(`figure`,{children:[(0,B.jsx)(`img`,{alt:e.name,src:e.dataUrl}),(0,B.jsx)(`button`,{"aria-label":l(`composer.sentImageAlt`,{name:e.name}),onClick:()=>re(t=>t.filter(t=>t.id!==e.id)),type:`button`,children:(0,B.jsx)(jh,{size:13})})]},e.id))}):null,M?(0,B.jsx)(`p`,{className:`personal-composer-error`,role:`alert`,children:M}):null,(0,B.jsxs)(`div`,{className:`personal-channel-composer`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`&&e.type.startsWith(`image/`))&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files].filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),lt(t))},children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Tm,{size:17}),e.find(e=>e.agentId===Oe)?.label??Oe]}),(0,B.jsx)(`button`,{"aria-label":l(`composer.addImage`),className:`personal-composer-attach`,disabled:j||ne.length>=$x,onClick:()=>Ce.current?.click(),title:l(`composer.attachImageHint`),type:`button`,children:(0,B.jsx)(ch,{size:17})}),(0,B.jsx)(`input`,{accept:`image/png,image/jpeg,image/webp,image/gif`,"aria-label":l(`composer.imagePicker`),className:`personal-composer-file-input`,disabled:j||ne.length>=$x,multiple:!0,onChange:e=>void lt(e.target.files),ref:Ce,type:`file`}),(0,B.jsx)(`textarea`,{"aria-label":l(`composer.sendMessage`),onChange:e=>Me(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),at())},onPaste:ut,placeholder:R?l(`composer.goalPlaceholder`,{goal:R.title}):l(`composer.managerPlaceholder`),ref:xe,rows:1,value:Ae}),(0,B.jsx)(`button`,{"aria-label":l(st?`composer.createGoal`:`composer.send`),disabled:!Ae.trim()&&ne.length===0||j,onClick:()=>void at(),title:l(st?`composer.createGoalHint`:`composer.sendMessageHint`),type:`button`,children:(0,B.jsx)(_h,{size:18})})]})]})})]}),sidebar:(0,B.jsx)(Rb,{attentionCount:Fe,goals:Pe,goalArchiveLoadState:n,lifecycleBusyGoalIds:oe,onRequestGoalCreate:i?void 0:Je,onRequestGoalLifecycle:i?void 0:(e,t)=>void Ye(e,t),onRetryGoalArchive:t.onRetryGoalArchive||t.onRefresh?()=>void(t.onRetryGoalArchive??t.onRefresh)?.():void 0,onOpenSettings:i?void 0:()=>h({kind:`settings`}),onSelectGoal:nt,selectedGoalId:L,statusSourceControl:s},s?.activeSource.statusUrl??`/status.json`)})}var nS=`/status.json`,rS=`loopx-status-source-catalog-v1`,iS={id:`local`,kind:`local`,label:`本机`,readOnly:!1,statusUrl:nS};function aS(e,t){let n=Ih(e,t).source;if(!n||!n.isLoopback||n.isRelative)return{error:`SSH 隧道来源必须使用显式的 localhost、127.0.0.1 或 ::1 URL。`};let r=new URL(n.url,t);return[`http:`,`https:`].includes(r.protocol)?{url:r.toString()}:{error:`状态来源只支持 HTTP 或 HTTPS。`}}function oS(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`ssh-${(t>>>0).toString(36)}`}function sS(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(n.kind!==`ssh_tunnel`||typeof n.label!=`string`||typeof n.statusUrl!=`string`)return null;let r=n.label.trim(),i=aS(n.statusUrl,t);return!r||r.length>48||!(`url`in i)?null:{id:oS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url}}function cS(){return{schemaVersion:1,sources:[iS]}}function lS(e,t){try{let n=e.getItem(rS);if(!n)return cS();let r=JSON.parse(n);if(r.schemaVersion!==1||!Array.isArray(r.sources))return cS();let i=new Set([iS.statusUrl]);return{schemaVersion:1,sources:[iS,...r.sources.flatMap(e=>{let n=sS(e,t);return!n||i.has(n.statusUrl)?[]:(i.add(n.statusUrl),[n])})]}}catch{return cS()}}function uS(e,t){e.setItem(rS,JSON.stringify({schemaVersion:1,sources:t.sources.filter(e=>e.kind===`ssh_tunnel`)}))}function dS(e,t,n){let r=t.label.trim();if(!r)return{error:`请填写来源名称。`};if(r.length>48)return{error:`来源名称不能超过 48 个字符。`};let i=aS(t.statusUrl,n);if(!(`url`in i))return i;if(e.sources.some(e=>e.statusUrl===i.url))return{error:`这个状态 URL 已经在来源目录中。`};let a={id:oS(i.url),kind:`ssh_tunnel`,label:r,readOnly:!0,statusUrl:i.url};return{catalog:{...e,sources:[...e.sources,a]},source:a}}function fS(e,t){return{...e,sources:e.sources.filter(e=>e.kind===`local`||e.id!==t)}}function pS(e,t,n){if(!t.trim()||Ih(t,n).source?.isRelative)return iS;let r=t.trim();try{r=new URL(r,n).toString()}catch{return null}return e.sources.find(e=>e.statusUrl===r)??null}function mS(e,t,n){return pS(e,t,n)||(Ih(t,n).source?.isRelative?iS:{id:`temporary`,kind:`ssh_tunnel`,label:`临时来源`,readOnly:!0,statusUrl:t.trim()})}function hS(e,t,n,r){return mS(e,t??n,r)}var gS={delete:`删除`,deploy:`部署`,merge:`合并`,payment:`付款`,release:`发布`};function _S(e,t,n){let r=t.replace(/\s+/gu,` `).trim().toLowerCase(),i=n.target.replace(/\s+/gu,` `).trim().toLowerCase();return!i||!r.includes(i)?null:{actionKind:`goal.update`,context:{goal_id:e,kind:`goal`,natural_language:t,semantic_proposal:{operation:n.operation,target:n.target}},idempotencyKey:`workspace-semantic-protected-${e}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e,status:`operator_gate_requested`},summary:`请求受保护操作:${gS[n.operation]} · ${n.target}`}}var vS=nS;async function yS(e){let t=await fetch(e,{cache:`no-store`,signal:AbortSignal.timeout(3e4)});if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return em(await t.json())}function bS(e,t){if(t?.controller_readiness?.decision_advisor_ready||t?.controller_readiness?.write_controller_ready)return`controller_ready`;if(t?.controller_readiness)return`controller_gated`;if(t?.human_reward)return`reward_judged`;if(t?.operator_gate?.decision===`approve`)return`operator_approved`;if(t?.operator_gate)return`operator_gated`;let n=e||t?.classification||``;return n===`connected_without_run`?`connected`:n===`read_only_project_map`||t?.project_map?`mapped`:n===`state_refreshed`?`refreshed`:n&&n!==`no_status`?`adapter_inspected`:`registered`}function xS(e,t){let n=new Map(t.map(e=>[e.goal_id,e])),r=new Set,i=e.map(e=>{r.add(e.id);let t=n.get(e.id),i=e.latest_runs[0],a=t?.lifecycle_phase??e.lifecycle_phase??i?.lifecycle_phase??bS(t?.status??i?.classification??e.status,i),o=t?.lifecycle_flags?.length?t.lifecycle_flags:e.lifecycle_flags?.length?e.lifecycle_flags:i?.lifecycle_flags?.length?i.lifecycle_flags:[a];return{goal:e,queueItem:t,latestRun:i,status:t?.status??i?.classification??e.status??`no_status`,waitingOn:t?.waiting_on??`clear`,severity:t?.severity??`clear`,lifecyclePhase:a,lifecycleFlags:o}});for(let e of t)r.has(e.goal_id)||i.push({goal:{activation_state:e.activation_state,id:e.goal_id,status:e.status,display_name:e.goal_id,latest_runs:[],lifecycle_flags:[e.lifecycle_phase??`registered`],registry_member:!0,legacy_runtime_goal:!1,index_exists:!1,raw_index_records:0,unique_runs:0},queueItem:e,status:e.status,waitingOn:e.waiting_on,severity:e.severity,lifecyclePhase:e.lifecycle_phase??`registered`,lifecycleFlags:e.lifecycle_flags??[`registered`]});return i}function SS(e){return(e??``).replace(/\s+/g,` `).trim()}function CS(e,t=132){let n=SS(e);return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function wS(e){let t=new Map;for(let n of e?.goals??[])t.set(n.goal_id,n);return t}function TS(e,t){if(!e)return null;let n=t===`user`?e.queueItem?.project_asset?.user_todos:e.queueItem?.project_asset?.agent_todos;if(n?.items?.length)return{done_count:n.done??n.items.filter(e=>e.done).length,items:n.items,open_count:n.open??n.items.filter(e=>!e.done).length,total_count:n.total??n.items.length};let r=t===`user`?e.queueItem?.user_todos:e.queueItem?.agent_todos;return r?.items?.length?r:null}function ES(e){return e?.items.find(e=>!e.done)}function DS(e,t,n=`todos`){return e?.items?.length?{advancement_done_count:e.advancement_done_count??t?.advancement_done_count,done_count:e.done??e.items.filter(e=>e.done).length,items:e.items,open_count:e.open??e.items.filter(e=>!e.done).length,total_count:e.total??e.items.length}:t??null}function OS(e){return e?.queueItem?.project_asset?.quota?.state??e?.queueItem?.quota?.state??e?.goal.quota?.state??`waiting`}function kS(e,t,n){let r=[];for(let t of e){let e=TS(t,`agent`);for(let n of e?.items??[])r.push({goalId:t.goal.id,role:`agent`,todo:n})}let i=new Map;for(let e of r){let t=e.todo.claimed_by||`codex`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map((n?.agents??[]).map(e=>[e.agent_id,e]));return Array.from(new Set([...i.keys(),...a.keys()])).map(e=>{let t=i.get(e)??[],n=a.get(e),r=Array.from(new Set([...t.map(e=>e.goalId),n?.current_todo?.goal_id,...n?.goal_ids??[]].filter(Boolean))),o=(t.filter(e=>!e.todo.done)[0]??t[0])?.goalId??n?.current_todo?.goal_id??r[0]??``,s=n?.last_activity_at??null;return{agentId:e,claimedTodos:t,currentTodo:n?.current_todo??null,evidenceRefs:[],goalIds:r,handoffNote:null,lastActivity:s,nextSafeAction:n?.next_action?.trim()||`Inspect status projection before taking work`,primaryGoalId:o,quotaHints:[],staleClaimHint:null,status:{label:`可用`,summary:`正常运行`,variant:`success`},workspaceRef:null}})}function AS(e){return e?.map(e=>({dataUrl:e.data_url,id:e.id,mimeType:e.mime_type,name:e.name,size:e.size}))}var jS=`loopx.personal-agent-selection.v1`;function MS(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(jS)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`))}catch{return{}}}var NS={需修复:`danger`,等你:`warning`,等待条件:`info`,推进中:`success`,安静运行:`neutral`,已停止:`neutral`,已完成:`neutral`};function PS(e,t){return SS(t)||e.replace(/^loopx[-_]/i,`LoopX `).split(/[-_]+/).filter(Boolean).map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(` `)}function FS(e){return e.split(/\r?\n/u).filter(e=>!/^\s*GOAL_(STATUS|PROGRESS)\s*:/u.test(e)).map(e=>/^\s*GOAL_EVIDENCE\s*:/u.test(e)?e.replace(/^\s*GOAL_EVIDENCE\s*:/u,`验证依据:`):/^\s*NEXT_ACTION\s*:/u.test(e)?e.replace(/^\s*NEXT_ACTION\s*:/u,`下一步:`):e).join(` +`).trim()}function IS(e,t){return[`agent`,`assistant`].includes(e.trim().toLowerCase())&&t.trim().length>0}function LS(e,t=``){let n=SS(e);return!n||n===`暂无`?t:/refresh-state|latest_run|latest run-derived/i.test(n)?`刷新 LoopX 状态,确认当前进度仍然有效`:/first read-only adapter tick|read-only adapter/i.test(n)?`执行首次只读适配检查并保存进度`:/todo update recorded for/i.test(n)?`Todo 状态已经更新,正在确认下一步`:/^(loopx|python3|npm|git|run)\s|\s--[a-z0-9-]+|\b[a-z]+_[a-z_]+\b/i.test(n)?t||`Agent 正在整理下一步`:CS(n,120)}function RS(e){let t=e.toLowerCase();return t.includes(`codex`)?`Codex`:t.includes(`claude`)?`Claude Code`:t.includes(`trae`)?`Trae CLI Agent`:t.includes(`coco`)?`Coco Agent`:PS(e)}function zS(e){let t=e.toLowerCase();return t.includes(`codex`)?`代码与项目执行`:t.includes(`claude`)?`复杂分析与长任务`:t.includes(`openai`)||t.includes(`anthropic`)?`管家问答 · 无工具`:t.includes(`trae`)?`前端与交互实现`:t.includes(`coco`)?`通用任务`:`已发现的项目 Agent`}function BS(e,t){let n=e.project_asset;return t===`user`?DS(n?.user_todos,e.user_todos,`project_asset.user_todos`):DS(n?.agent_todos,e.agent_todos,`project_asset.agent_todos`)}function VS(e){return CS(e.title??e.text,112)}function HS(e,t){return{resumeWhen:e.resume_when??null,claimedBy:e.claimed_by??null,done:e.status!==`deferred`&&e.done,evidence:e.evidence?CS(e.evidence,96):null,index:e.index,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,taskDomain:e.task_domain??null,text:VS(e),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.index}`}}function US(e){let t=e.queueItem?.agent_todos,n=t?.items??e.queueItem?.project_asset?.agent_todos?.items??[],r=new Map(n.map(t=>[t.todo_id?.trim()||`${e.goal.id}:agent:${t.index}`,t]));for(let n of t?.deferred_items??[]){let t=n.todo_id?.trim()||`${e.goal.id}:agent:${n.index}`;r.has(t)||r.set(t,n)}return[...r.values()]}function WS(e){return US(e).map(t=>HS(t,e))}function GS(e,t,n){let r=new Map;for(let n of e.todo_index?.items??[]){if(n.goal_id!==t.goal.id||n.role!==`agent`)continue;let e=HS(n,t);r.set(e.todoId,e)}for(let e of n)r.has(e.todoId)||r.set(e.todoId,e);let i=new Map;for(let e of r.values()){if(e.done||e.taskClass!==`advancement_task`)continue;let t=e.taskDomain?.trim();t&&i.set(t,(i.get(t)??0)+1)}return[...i].map(([e,t])=>({domain:e,matchingTodoCount:t}))}function KS(e,t){return{claimedBy:e.claimed_by??null,done:e.status===`done`||e.status===`completed`,index:-1,priority:e.priority??null,status:e.status??null,taskClass:e.task_class??null,text:CS(e.title,112),todoId:e.todo_id?.trim()||`${t.goal.id}:agent:${e.claimed_by??`unknown`}:current`}}function qS(e,t,n){let r=new Map(e.map(e=>[e.todoId,e]));for(let e of t){let t=e.currentTodo;if(!t||t.goal_id!==n.goal.id)continue;let i=KS(t,n);r.has(i.todoId)||r.set(i.todoId,i)}return[...r.values()]}function JS(e){let t=e.queueItem?.project_asset?.agent_todos,n=e.queueItem?.agent_todos,r=US(e),i=t?.advancement_done_count??n?.advancement_done_count??t?.done??n?.done_count??null,a=r.filter(e=>e.done&&e.status!==`deferred`).length,o=Math.max(i??0,a),s=new Set(r.map(e=>e.todo_id?.trim()).filter(e=>!!e)),c=(t?.recent_completed_advancement_items??[]).filter(e=>!e.todo_id?.trim()||!s.has(e.todo_id.trim())).map(t=>HS(t,e)),l=r.find(e=>!e.done);return{doneTodoCount:o,nextTodoText:SS(t?.next??``)||(l?SS(l.title??``)||SS(l.text??``):``)||null,recentCompleted:c}}function YS(e){let t=SS(e);return t?/\b(state_file|registry_goal|authority_sources|source_registry)\b|\b[a-z_]+\s+\d+\/\d+/i.test(t)?`Goal 状态、Todo 与注册信息已验证`:LS(t,`最近验证已经记录`):``}function XS(e,t=4){if(e.length<=t)return e;let n=e.findIndex(e=>!e.done);if(n<0)return e.slice(-t);let r=Math.max(0,Math.min(n-2,e.length-t));return e.slice(r,r+t)}function ZS(e,t){let n=t.queueItem?.project_asset?.latest_validation,r=t.latestRun,i=e.event_ledger_summary?.goals.find(e=>e.goal_id===t.goal.id);if(!n&&!r&&!i)return null;let a=[YS(n?.summary),LS(r?.health_check),LS(r?.recommended_action)].find(e=>e!==``&&e!==`暂无`)??`最近一次 LoopX 运行已经记录`,o=i?.events_24h??0,s=o>0?`24 小时内 ${o} 个事件`:r?.json_exists||r?.markdown_exists?`存在可查看的运行证据`:`公开安全状态投影`;return{generatedAt:n?.generated_at??r?.generated_at??i?.latest_event_at??``,label:n?`最近验证`:`最近运行`,metadata:s,runId:r?`${t.goal.id}:${r.generated_at}`:null,safePreview:[a,s].filter(Boolean).join(` +`),summary:a,todoId:t.queueItem?.project_asset?.agent_todos?.items.find(e=>!e.done)?.todo_id??null}}function QS(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(done|complete|completed|finished|terminal|closed|success)([_\s-]|$)/i.test(e??``))}function $S(e,t){return e.global_registry?.findings?.find(e=>e.severity===`high`&&(e.goal_id===t.goal.id||e.goal_ids.includes(t.goal.id)))}function eC(e){return[e.status,e.goal.status,e.latestRun?.classification,e.lifecyclePhase].filter(Boolean).some(e=>/(^|[_\s-])(failure|failed|error|broken|unhealthy|blocked[_\s-]?health|health[_\s-]?blocked)([_\s-]|$)/i.test(e??``))}function tC(e,t){let n=t.queueItem?.stale_latest_run_warning;return t.severity===`high`||!!$S(e,t)||!!(n?.requires_refresh_state||n?.severity===`high`)||eC(t)}function nC(e,t){let n=$S(e,t);return t.queueItem?.stale_latest_run_warning?.recommended_action??t.queueItem?.stale_latest_run_warning?.reason??n?.recommended_action??n?.message??t.queueItem?.recommended_action??t.latestRun?.recommended_action??`LoopX 状态异常,请进入管理页检查`}function rC(e){let t=e.latestRun?.operator_gate,n=t?.decision?.trim().toLowerCase()??``,r=new Set([`approve`,`approved`,`reject`,`rejected`,`defer`,`deferred`,`cancel`,`cancelled`]),i=[e.queueItem?.recommended_action,e.latestRun?.recommended_action].filter(Boolean).join(` `),a=/(?:等待|需要)(?:用户|你|owner).{0,24}(?:批准|确认|授权|补充|选择|决定)|(?:批准|确认|授权).{0,16}(?:后|才能|方可)/i.test(i);return!!(t&&!r.has(n))||e.lifecyclePhase===`operator_gated`&&!r.has(n)||a}function iC(e){let t=e.latestRun?.operator_gate;return LS(t?.operator_question??t?.reason_summary??t?.follow_up??e.queueItem?.recommended_action??e.latestRun?.recommended_action,`请确认 Agent 下一步需要的权限或决策`)}function aC(e,t){if(t.goal.activation_state===`stopped`)return`已停止`;let n=TS(t,`user`),r=TS(t,`agent`),i=!!ES(n),a=!!ES(r);return[`user_or_controller`,`controller`].includes(t.waitingOn)||i||rC(t)?`等你`:tC(e,t)?`需修复`:t.waitingOn===`external_evidence`?`等待条件`:OS(t)===`eligible`||a?`推进中`:QS(t)?`已完成`:`安静运行`}function oC(e,t,n){if(n===`已停止`)return`已由你停止;历史、Todo 和证据仍保留`;if(n===`需修复`)return LS(nC(e,t),`LoopX 状态需要刷新`);if(n===`等你`)return`Agent 等待你的决定`;if(n===`推进中`){let e=[(TS(t,`agent`)?.items??[]).filter(e=>!e.done).flatMap(e=>[e.title,e.text]).map(e=>SS(e)).find(e=>e!==``&&e!==`暂无`),t.queueItem?.recommended_action,t.latestRun?.recommended_action].map(e=>SS(e)).find(e=>e!==``&&e!==`暂无`);return e?LS(e,`Agent 正在推进当前 Goal`):`Agent 正在推进当前 Goal`}return n===`等待条件`?`正在等待外部条件`:`暂无需要你处理`}function sC(e,t){return t.some(t=>e.includes(t))}function cC(e){return sC(e,[`我现在该做什么`,`该做什么`,`下一步`,`哪些 Goal 在等我`,`哪些 Goal 正在等我`,`等我`,`优先处理`,`全局待办`,`Agent 在做什么`,`哪些 Goal 需要我`])}function lC(e,t,n){if(t.goals.some(e=>e.activationState===`active`&&e.loadState))return{text:`Goal 状态尚未全部加载,暂不能给出完整统计。可先打开已加载的 Goal,失败项可重试。`,lines:[]};if(sC(n,[`Agent`,`agent`,`推进`,`在做`])){let e=t.goals.filter(e=>![`安静运行`,`已完成`,`已停止`].includes(e.state)),n=(e.length>0?e:t.goals).slice(0,3);return n.length===0?{text:`当前状态里还没有 Goal 可供汇总。`,lines:[]}:{text:e.length>0?`Agent 当前关注这些 Goal:`:`当前 Goal 都比较安静:`,lines:n.map(e=>`${e.title} · ${e.state} · ${e.agentSentence}`)}}if(sC(n,[`现在`,`下一步`,`我该`,`该做什么`,`优先处理`])){let e=t.userTodos[0];if(e)return{text:e.blocking?`先处理「${PS(e.goalId)}」:${e.text}`:`当前最先处理「${PS(e.goalId)}」:${e.text}`,lines:[]};let n=t.goals.find(e=>e.state===`需修复`);if(n)return{text:`没有待办,但这个 Goal 需要先修复。`,lines:[`${n.title} · ${n.agentSentence}`]};let r=t.goals.find(e=>e.state===`推进中`);return r?{text:`目前不需要你介入,Agent 正在推进。`,lines:[`${r.title} · ${r.agentSentence}`]}:{text:`当前系统很安静,没有需要你立即处理的事项。`,lines:[]}}if(sC(n,[`等我`,`阻塞`,`需要我`,`全局待办`]))return t.userTodos.length===0?{text:`目前没有 Goal 在等你,开放用户待办为 0。`,lines:[]}:{text:`有 ${t.userTodos.length} 项开放用户待办,阻塞项优先:`,lines:t.userTodos.slice(0,3).map(e=>`${PS(e.goalId)} · ${e.blocking?`阻塞`:`待处理`} · ${e.text}`)};if(sC(n,[`状态`,`异常`,`修复`,`健康`])){let n=t.systemHealth?!t.systemHealth.ok:!e.ok||!e.contract?.ok||!e.global_registry?.ok||(e.global_registry?.summary?.high??0)>0,r=t.goals.filter(e=>e.state===`需修复`),i=r.slice(0,n?2:3).map(e=>`${e.title} · ${e.agentSentence}`);return n&&i.push(`全局状态、契约或注册表健康检查未通过,请进入管理页检查。`),i.length===0?{text:`当前没有发现 Goal 级或全局健康异常。`,lines:[]}:{text:r.length>0?`当前需要关注这些健康问题:`:`Goal 状态正常,但全局健康需要检查:`,lines:i}}return{text:`当前管家支持三类问题:下一步、等待你的事项、Agent 与健康状态。`,lines:[`问“我现在该做什么?”`,`问“哪些 Goal 在等我?”`,`问“Agent 在做什么?”或当前健康状态`]}}function uC(e,t,n=!1){let r=new Map(t.map(e=>[e.goal.id,e])),i=new Set(e.run_history.goals.filter(e=>e.activation_state===`stopped`).map(e=>e.id)),a=wS(e.usage_summary),o=kS(t,e.todo_index,e.agent_management_projection),s=e.attention_queue.items.flatMap((e,t)=>{if(i.has(e.goal_id))return[];let n=[`user_or_controller`,`controller`].includes(e.waiting_on);return(BS(e,`user`)?.items??[]).filter(e=>!e.done).map((r,i)=>({actionKind:r.action_kind??null,blocking:n,goalId:e.goal_id,sourceOrder:t,taskClass:r.task_class??null,text:VS(r),todoId:r.todo_id?.trim()||`${e.goal_id}:user:${r.index}`,todoOrder:i,updatedAt:r.updated_at??null}))}),c=new Set(s.map(e=>e.goalId)),l=t.flatMap((t,n)=>i.has(t.goal.id)||c.has(t.goal.id)||!rC(t)?[]:[{actionKind:`gate.resolve`,blocking:!0,goalId:t.goal.id,sourceOrder:e.attention_queue.items.length+n,taskClass:`user_gate`,text:iC(t),todoId:`${t.goal.id}:operator-gate`,todoOrder:0,updatedAt:t.latestRun?.operator_gate?.recorded_at??t.latestRun?.generated_at??null}]),u=[...s,...l].sort((e,t)=>Number(t.blocking)-Number(e.blocking)||e.sourceOrder-t.sourceOrder||e.todoOrder-t.todoOrder),d=e.run_history.goals.flatMap(t=>{if(t.registry_member===!1)return[];let i=r.get(t.id);if(!i)return[];let s=aC(e,i),c=u.find(e=>e.goalId===t.id),l=c?.text??null,d=JS(i),f=t.coordination?.registered_agents??[],p=new Set(f),m=[...o.filter(e=>e.goalIds.includes(t.id)&&!/unassigned|unknown/i.test(e.agentId)&&(p.size===0||p.has(e.agentId))&&(e.currentTodo?.goal_id===t.id||e.claimedTodos.some(e=>e.goalId===t.id)))].sort((e,t)=>(t.lastActivity??``).localeCompare(e.lastActivity??``)),h=new Set(m.map(e=>e.agentId)),g=[...m.map(e=>({agentId:e.agentId,label:e.agentId,lastActivityAt:e.lastActivity,state:e.status.label})),...f.filter(e=>!h.has(e)).map(e=>({agentId:e,label:e,lastActivityAt:null,state:`registered`}))],_=m[0],v=qS(WS(i),m,i),y=[d.nextTodoText,i.queueItem?.recommended_action,i.latestRun?.recommended_action,oC(e,i,s)].map(e=>LS(e)).find(e=>e!==``&&e!==`暂无`)??`等待 LoopX 更新下一步`;return[{activationState:t.activation_state,agentId:_?.agentId??f[0]??`codex`,agentLaneCount:g.length,agentLanes:g,agentLabel:_?.agentId,agentSentence:oC(e,i,s),agentTodos:[...v,...d.recentCompleted],doneTodoCount:d.doneTodoCount,goalId:t.id,latestActivity:i.latestRun?.generated_at??``,needsYou:l,needsYouActionKind:c?.actionKind??null,needsYouBlocking:c?.blocking??!1,needsYouTaskClass:c?.taskClass??null,needsYouTodoId:c?.todoId??null,nextSentence:y,runEvidence:ZS(e,i),state:s,...n?{subagentExecution:{allowedDomains:t.spawn_policy?.allowed_domains??[],domainCandidates:GS(e,i,v),enabled:t.spawn_policy?.mode===`multi_subagent`&&t.spawn_policy.spawn_allowed===!0&&t.spawn_policy.max_children>0,maxChildren:t.spawn_policy?.max_children??0}}:{},title:PS(t.id,t.display_name),usage:(()=>{let e=a.get(t.id);return e?{costUsd24h:e.cost_usd_24h,costUsd7d:e.cost_usd_7d,durationMs24h:e.duration_ms_24h,durationMs7d:e.duration_ms_7d,tokens24h:e.input_tokens_24h+e.output_tokens_24h,tokens7d:e.input_tokens_7d+e.output_tokens_7d}:null})()}]}),f=[];if(e.ok||f.push(`状态载荷未标记为正常 (payload.ok === false)`),e.contract&&!e.contract.ok){let t=e.contract.summary,n=t?`${t.errors} 项错误 / ${t.warnings} 项警告`:e.contract.errors?.[0]||`请检查控制面契约`;f.push(`契约检查未通过: ${n}`)}if(e.global_registry){e.global_registry.ok||f.push(`注册表状态异常: ${e.global_registry.summary.high} 项高危`);for(let t of e.global_registry.findings||[])t.severity===`high`&&f.push(`[${t.kind}] ${t.message}`)}let p=e.decision_freshness_summary?.summary?.stale_count?`${e.decision_freshness_summary.summary.stale_count} 项决策状态已过期`:null,m=f.length===0&&!p,h={ok:m,summary:m?`所有控制面契约与注册表检查均正常`:`发现 ${f.length+ +!!p} 项系统健康关注点`,issues:f,freshnessWarning:p};return{blockingTodoCount:u.filter(e=>e.blocking).length,goalNotifications:(e.goal_channel_notification_projection?.goals??[]).map(e=>({goalId:e.goal_id,configured:e.configured,enabled:e.enabled,humanGateAutoNotifyEnabled:e.human_gate_auto_notify_enabled,lastNotifiedAt:e.last_notified_at??null,receiptCount:e.receipt_count,targetRef:e.target_ref??null})),goals:d,openUserTodoCount:u.length,systemHealth:h,userTodos:u,visibleUserTodos:u.slice(0,5),workers:(e.agent_management_projection?.agents??[]).map(e=>({agentId:e.agent_id,currentTodoGoalId:e.current_todo?.goal_id??null,currentTodoText:e.current_todo?.title?CS(e.current_todo.title,96):null,lastActivityAt:e.last_activity_at??null,state:e.state??null}))}}function dC({goalArchiveLoadState:e,isLoading:t,onGoalActivationStateChange:n,onGoalDeleted:r,onSelectGoal:i,onReconcileStatus:a,onRefresh:o,onRetryGoalArchive:s,payload:c,progress:l,rows:u,selectedGoalId:d,statusSourceControl:f,theme:p,toggleTheme:m}){let h=f.activeSource.readOnly,{t:g}=ya(),[_,v]=(0,z.useState)([]),[y,b]=(0,z.useState)(!1),x=(0,z.useMemo)(()=>{let e=uC(c,u,y);if(!l)return e;let t=Object.values(l.snapshots).map(e=>uC(e,xS(e.run_history.goals,e.attention_queue.items),y)),n=new Map(t.flatMap(e=>e.goals).map(e=>[e.goalId,e])),r=e.goals.map(e=>n.get(e.goalId)??{...e,loadError:l.errors[e.goalId],loadState:l.errors[e.goalId]?`error`:`loading`,agentId:``,agentSentence:``,nextSentence:``,subagentExecution:void 0}),i=t.flatMap(e=>e.userTodos),a=r.some(e=>e.activationState===`active`&&e.loadState),o=[...new Set(t.flatMap(e=>e.systemHealth?.issues??[]))];return{...e,goals:r,userTodos:i,visibleUserTodos:i.slice(0,5),openUserTodoCount:i.length,blockingTodoCount:i.filter(e=>e.blocking).length,workers:[...new Map(t.flatMap(e=>e.workers??[]).map(e=>[e.agentId,e])).values()],goalNotifications:t.flatMap(e=>e.goalNotifications??[]),systemHealth:a||t.length===0?void 0:{ok:t.every(e=>e.systemHealth?.ok),issues:o,summary:o.length?`发现 ${o.length} 项系统健康关注点`:`状态检查已完成`,freshnessWarning:t.map(e=>e.systemHealth?.freshnessWarning).filter(Boolean).join(`;`)||null}}},[c,u,l,y]),S=x.goals.find(e=>e.goalId===d)??null,C=l?.snapshots[d]??c,[w,T]=(0,z.useState)(null),[E,D]=(0,z.useState)(null),[O,k]=(0,z.useState)(!1),ee=x.goals.some(e=>e.activationState===`active`&&e.loadState===`loading`)?`loading`:x.goals.map(e=>`${e.goalId}:${e.agentId}`).join(`|`),A=S?.goalId??`manager`;x.goals.some(e=>e.activationState===`active`&&e.loadState)||(x.systemHealth?!x.systemHealth.ok:!c.ok)||x.openUserTodoCount>0&&`${x.openUserTodoCount}${x.blockingTodoCount}`;let j=_.length>0?_.map(e=>({agentId:e.agent_id,adapterKind:e.adapter_kind,available:e.available,capability:zS(e.agent_id),interrupt:e.interrupt,label:e.display_name,location:e.location,resume:e.resume,source:e.source,statusLabel:e.available?`可用`:`需要配置`,streaming:e.streaming,toolCalls:e.tool_calls,trustScope:e.trust_scope})):[{agentId:`codex`,available:!0,capability:zS(`codex`),label:`Codex`,statusLabel:`正在检测`}],te=[...j,{agentId:`status-only`,available:!0,capability:`不调用模型`,adapterKind:`status_projection`,interrupt:!1,label:`仅查状态`,resume:!0,statusLabel:`只读`,streaming:!1,toolCalls:!1,trustScope:`read_only`}],ne=j.find(e=>e.label===`Codex`&&e.available)?.agentId??j.find(e=>e.available)?.agentId??`status-only`,[re,M]=(0,z.useState)(MS),N=Gh(te,re[A]??ne,ne),[ie,ae]=(0,z.useState)(!1),[oe,P]=(0,z.useState)(!1),[F,se]=(0,z.useState)(`chat`),[ce,le]=(0,z.useState)(``),[ue,de]=(0,z.useState)({}),[fe,pe]=(0,z.useState)({}),[me,he]=(0,z.useState)(null),[I,ge]=(0,z.useState)({}),[_e,ve]=(0,z.useState)([]),[ye,be]=(0,z.useState)(null),[xe,Se]=(0,z.useState)({}),Ce=(0,z.useRef)(1),we=(0,z.useRef)(1),Te=(0,z.useRef)(new Map),Ee=(0,z.useRef)(new Set),De=(0,z.useRef)(new Map),L=(0,z.useRef)(new Map),Oe=(0,z.useRef)(new Set),ke=(0,z.useRef)(new Set),Ae=(0,z.useRef)(null),je=(0,z.useRef)(null),Me=(0,z.useRef)(null),Ne=(0,z.useRef)(null);(0,z.useRef)(null);let Pe=ue[A]??[];fe[A];let Fe=S?x.userTodos.filter(e=>e.goalId===S.goalId):x.userTodos,Ie=S?.agentTodos??[];XS(Ie,S?.needsYou?3:4);let R=Ie.filter(e=>e.done).length,Le=Ie.length>0?`${R}/${Ie.length}`:`暂无计划`,Re=S?{...x,blockingTodoCount:Fe.filter(e=>e.blocking).length,goals:[S],openUserTodoCount:Fe.length,userTodos:Fe,visibleUserTodos:Fe}:x;(0,z.useEffect)(()=>{let e=Fh(f.activeSource.statusUrl,window.location.href),t=e.source?Vh(C,e.source):null;if(!S||!t?.indexUrl||!t.detailUrl){T(null),D(null),k(!1);return}let{detailUrl:n,indexUrl:r}=t,i=!1;return T(null),D(null),k(!0),Hh(r,S.goalId).then(async e=>{let t=e.items[0]?.detail_ref;return t?Uh(n,t):null}).then(e=>{i||T(e)}).catch(e=>{i||D(tm(e))}).finally(()=>{i||k(!1)}),()=>{i=!0}},[C,S?.goalId,f.activeSource.statusUrl]);function ze(e,t){ge(n=>{if(t===null){let t={...n};return delete t[e],t}return{...n,[e]:t}})}(0,z.useEffect)(()=>{if(h){v([]),b(!1);return}let e=!1;return _g().then(t=>{e||(v(t.adapters??[]),b(t.goal_subagent_configuration===`preview_locked`))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[h]),(0,z.useEffect)(()=>{try{window.localStorage.setItem(jS,JSON.stringify(re))}catch{}},[re]),(0,z.useEffect)(()=>{if(h||!N.available)return;let e=A,t=`${e}:${N.agentId}`,n=S?`goal`:`manager`,r=S?`goal.${S.goalId}`:`manager`,i=S?.goalId??x.goals[0]?.goalId??``,a=!1,o=null,s=null;return(async()=>{try{let c=await Cg({agentId:N.agentId,channelId:r,goalId:S?.goalId});if(a||(de(t=>(t[e]?.length??0)>0?t:{...t,[e]:c.messages.map(e=>({agentLabel:e.role===`user`?void 0:N.label,attachments:AS(e.attachments),id:Ce.current++,lines:[],role:e.role===`user`?`user`:`assistant`,sourceLabel:e.role===`user`?void 0:e.role===`error`?`本地会话记录`:`恢复的 ${N.label} 会话`,text:e.role===`user`?e.text:FS(e.text)}))}),N.agentId===`status-only`))return;let l=c.sessions[0];if(s=l?.session_id??null,l&&!l.resumable){Ee.current.add(t),ze(e,{agentId:N.agentId,resumable:!1,sessionId:l.session_id,status:`resume_failed`});return}let u=l?.goal_id??i;if(!u)return;let d=await yg(u,N.agentId,`resume_latest`,n);if(a)return;Te.current.set(t,d.session_id);let f=c.snapshots.find(e=>e.session.session_id===d.session_id),p=f?.session.active_turn_id??``;if(ze(e,{agentId:N.agentId,resumable:!0,sessionId:d.session_id,status:p?`running`:`ready`,turnId:p||void 0}),Ee.current.delete(t),!p)return;let m=`${d.session_id}:${p}`;if(ke.current.has(m))return;ke.current.add(m),De.current.set(e,p),ze(e,{agentId:N.agentId,resumable:!0,sessionId:d.session_id,status:`running`,turnId:p}),he(e),o=new AbortController,L.current.set(e,o);let h=``,g=Be(e,{activity:[`正在恢复进行中的 Agent 回合`],agentLabel:N.label,lines:[],pending:!0,sourceLabel:`恢复的 ${N.label} 会话`,text:``});try{let t=await Ag(d.session_id,p,{signal:o.signal,onDelta:t=>{h+=t,Ve(e,g,{text:h})},onActivity:t=>{de(n=>({...n,[e]:(n[e]??[]).map(e=>e.id===g?{...e,activity:[...new Set([...e.activity??[],t])].slice(-6)}:e)}))}});if(a)return;Ve(e,g,{lines:t.response.gate?[t.response.gate.summary,t.response.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:t.response.message||h.trim()||`${N.label} 已完成分析。`});let n=x.goals.find(e=>e.goalId===f?.session.goal_id)??S??x.goals[0]??null;if(n&&t.response.proposals.length>0){let r=t.response.proposals.map(e=>({goalId:n.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));pe(t=>({...t,[e]:[...t[e]??[],...r]}))}}catch(t){if(a)return;Ve(e,g,{activity:[],lines:[],pending:!1,reconnect:t instanceof og&&t.payload.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t instanceof Error?t.message:`无法恢复进行中的 Agent 回合。`})}finally{ke.current.delete(m),De.current.get(e)===p&&De.current.delete(e),ze(e,{agentId:N.agentId,resumable:!0,sessionId:d.session_id,status:`ready`}),L.current.get(e)===o&&L.current.delete(e),a||he(t=>t===e?null:t)}}catch(n){if(a)return;n instanceof og&&n.payload.error_code===`resume_failed`&&(Ee.current.add(t),s&&ze(e,{agentId:N.agentId,resumable:!1,sessionId:s,status:`resume_failed`}))}})(),()=>{a=!0,o?.abort()}},[A,x.goals[0]?.goalId,h,S?.goalId,N.agentId,N.available,N.label]),(0,z.useEffect)(()=>{if(h||S||x.goals.length===0||ee===`loading`)return;let e=!1;return Promise.all(x.goals.filter(e=>!e.loadState).map(async e=>{let t=await xg({agentId:e.agentId,channelId:`goal.${e.goalId}`,goalId:e.goalId});return{goalId:e.goalId,session:t.sessions[0]??null}})).then(t=>{e||ge(e=>{let n={...e};for(let e of t)e.session&&(n[e.goalId]={agentId:e.session.agent_id,resumable:e.session.resumable,sessionId:e.session.session_id,status:e.session.active_turn_id?`running`:e.session.status,turnId:e.session.active_turn_id??void 0});return n})}).catch(()=>{}),()=>{e=!0}},[h,ee,S?.goalId]),(0,z.useEffect)(()=>{if(be(null),h){ve([]),Se({});return}if(!S){ve([]),Se({});return}let e=!1,t=0,n=0;ve([]),Se({});let r=async()=>{if(!e){if(document.hidden){t=window.setTimeout(()=>void r(),1e4);return}try{let t=await xg({goalId:S.goalId});if(!e){let r=t.sessions.filter(e=>e.channel_id?.startsWith(`task.`));ve(r);let i=await Promise.allSettled(r.map(e=>bg(e.session_id)));if(!e){let e=i.some(e=>e.status===`rejected`);n=e?n+1:0,be(e?`partial`:null),Se(Object.fromEntries(i.flatMap((e,t)=>e.status===`fulfilled`?[[r[t].session_id,e.value]]:[])))}}}catch{n+=1,e||be(`offline`)}e||(t=window.setTimeout(()=>void r(),Math.min(3e4,2e3*2**Math.min(n,4))))}};return r(),()=>{e=!0,window.clearTimeout(t)}},[h,S?.goalId]),(0,z.useEffect)(()=>{if(!ie)return;let e=window.requestAnimationFrame(()=>{Ae.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()});return()=>{window.cancelAnimationFrame(e),je.current?.focus()}},[ie]),(0,z.useEffect)(()=>{if(!oe)return;let e=window.requestAnimationFrame(()=>Me.current?.focus());return()=>{window.cancelAnimationFrame(e),Ne.current?.focus()}},[oe]),(0,z.useEffect)(()=>{if(!ie&&!oe)return;let e=e=>{e.key===`Escape`&&(ae(!1),P(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ie,oe]);function Be(e,t){let n=Ce.current++;return de(r=>({...r,[e]:[...r[e]??[],{...t,id:n,role:`assistant`}]})),n}function Ve(e,t,n){de(r=>({...r,[e]:(r[e]??[]).map(e=>e.id===t?{...e,...n}:e)}))}async function He(e,t){let n=e.trim();if(!n)return;let r=t&&`goalId`in t?t.goalId??`manager`:A,i=r===`manager`?Re.goals[0]??x.goals[0]??null:x.goals.find(e=>e.goalId===r)??null,a=t?.agentId?Gh(te,t.agentId,ne):N,o=r===`manager`?x:i?{...x,blockingTodoCount:x.userTodos.filter(e=>e.goalId===i.goalId&&e.blocking).length,goals:[i],openUserTodoCount:x.userTodos.filter(e=>e.goalId===i.goalId).length,userTodos:x.userTodos.filter(e=>e.goalId===i.goalId),visibleUserTodos:x.userTodos.filter(e=>e.goalId===i.goalId)}:x,s=Ce.current++;if(de(e=>({...e,[r]:[...e[r]??[],{attachments:t?.attachments,id:s,lines:[],role:`user`,text:n}]})),le(``),he(r),r===`manager`&&cC(n)||a.agentId===`status-only`||!i){let e=lC(C,o,n),t=a.agentId===`status-only`;Be(r,{agentLabel:t?`仅查状态`:`LoopX 管家`,lines:e.lines.slice(0,3),sourceLabel:t?`LoopX 状态投影 · 仅查状态`:`LoopX 状态投影`,text:e.text}),vg({answer:[e.text,...e.lines.slice(0,3)].filter(Boolean).join(` +`),contextKind:r===`manager`?`manager`:`goal`,goalId:r===`manager`?void 0:r,question:n}).catch(()=>{}),he(null);return}let c=`${r}:${a.agentId}`,l=null;try{let e=Te.current.get(c);if(!e){let t=Ee.current.has(c)?`new`:`resume_latest`;e=(await yg(i.goalId,a.agentId,t,r===`manager`?`manager`:`goal`)).session_id,Te.current.set(c,e),ze(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),Ee.current.delete(c)}let o=``;l=Be(r,{activity:[`正在连接 Agent`],agentLabel:a.label,lines:[],pending:!0,sourceLabel:r===`manager`?`${a.label} 管家 · 跨 Goal`:`${a.label} Agent · ${PS(i.goalId)}`,text:``});let s=(await Og(e,n,{attachments:t?.attachments,signal:(()=>{let e=new AbortController;return L.current.set(r,e),e.signal})(),onDelta:e=>{o+=e,l!==null&&Ve(r,l,{text:o})},onActivity:e=>{l!==null&&de(t=>({...t,[r]:(t[r]??[]).map(t=>t.id===l?{...t,activity:[...new Set([...t.activity??[],e])].slice(-6)}:t)}))},onPhase:(t,n)=>{De.current.set(r,n),ze(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`running`,turnId:n})}})).response;if(Ve(r,l,{lines:s.gate?[s.gate.summary,s.gate.next_action].filter(Boolean).slice(0,2):[],pending:!1,text:FS(s.message||o.trim())||`${a.label} 已完成分析。`}),s.proposals.length>0){let e=s.proposals.map(e=>({goalId:i.goalId,id:we.current++,previewId:null,proposal:e,receiptLabel:null,state:`candidate`,statusMessage:null}));pe(t=>({...t,[r]:[...t[r]??[],...e]}))}if(r!==`manager`&&s.protected_action){let e=_S(r,n,s.protected_action);if(e)return e}}catch(e){if(Oe.current.delete(r)){let e={agentLabel:a.label,lines:[],pending:!1,sourceLabel:`${a.label} 会话`,text:`已中断。你可以在当前会话继续发送消息。`};l===null?Be(r,e):Ve(r,l,e);return}let t=e instanceof og?e.payload:null;t&&Kh(t)&&Te.current.delete(c),t?.error_code===`resume_failed`&&(Te.current.delete(c),Ee.current.add(c),ze(r,{agentId:a.agentId,resumable:!1,sessionId:I[r]?.sessionId??`resume-failed`,status:`resume_failed`}));let n=t?.gate,i=n&&typeof n==`object`?String(n.summary??``):``,o={agentLabel:a.label,lines:i?[i]:[],pending:!1,reconnect:t?.reconnectable===!0,sourceLabel:`LoopX Chat 本地后端`,text:t?.error_code===`resume_failed`?`原 ${a.label} 会话无法恢复。本地历史已经保留,请在运行详情里选择“重试恢复”或“开始新 Session”。`:e instanceof Error?e.message:`${a.label} 会话暂时不可用。`};l===null?Be(r,o):Ve(r,l,o)}finally{De.current.delete(r),L.current.delete(r);let e=Te.current.get(c);e&&ze(r,{agentId:a.agentId,resumable:!0,sessionId:e,status:`ready`}),he(e=>e===r?null:e)}}async function Ue(e){let t=e?.goalId??A,n=I[t],r=e?.agentId??n?.agentId??N.agentId,i=`${t}:${r}`,a=e?.sessionId??n?.sessionId??Te.current.get(i),o=e?.turnId??n?.turnId??De.current.get(t);if(!(!a||!o))try{Oe.current.add(t),await Dg(a,o),L.current.get(t)?.abort()}catch(e){throw Oe.current.delete(t),e}finally{De.current.delete(t),ze(t,{agentId:r,resumable:!0,sessionId:a,status:`ready`}),L.current.delete(t),he(e=>e===t?null:e)}}async function We(e){let t=e.goalId,n=`${t}:${e.agentId}`,r=e.sessionId??I[t]?.sessionId??Te.current.get(n);if(r)try{let i=await Mg(r);Te.current.set(n,r),Ee.current.delete(n),ze(t,{agentId:e.agentId,resumable:i.session.resumable,sessionId:r,status:i.session.status})}catch{ze(t,{agentId:e.agentId,resumable:!1,sessionId:r,status:`resume_failed`})}}function Ge(e){let t=`${e.goalId}:${e.agentId}`;Te.current.delete(t),Ee.current.add(t),ze(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:`new-session-pending`,status:`ready`})}async function Ke(e){let t=`${e.goalId}:${e.agentId}`,n=e.sessionId??I[e.goalId]?.sessionId??Te.current.get(t);n&&n!==`new-session-pending`&&await jg(n),Te.current.delete(t),Ee.current.add(t),ze(e.goalId,null)}function qe(e){te.some(t=>t.agentId===e&&t.available)&&(M(t=>({...t,[A]:e})),ae(!1))}function Je(){i(``),se(`chat`)}function Ye(e){i(e),se(`chat`)}S&&NS[S.state],S&&(`${N.label}${S.state}`,Ie.length>0&&`${Le}`,Fe.length>0&&`${Fe.length}`),S?.state===`需修复`||!S&&!c.ok?(S&&RS(S.agentId),S?.nextSentence,S?.agentSentence):S?.state===`等你`?(S.needsYouBlocking,S.needsYouBlocking,S.needsYou??S.nextSentence,S.needsYou):(S&&RS(S.agentId),S?.nextSentence);let Xe=[...!S&&I.manager?.status===`resume_failed`?[{id:`run:manager:resume-failed`,kind:`run`,run:{agentId:I.manager.agentId,agentLabel:RS(I.manager.agentId),canInterrupt:!1,completedSteps:0,goalId:`manager`,goalTitle:`LoopX 管家`,latestActivity:`本地聊天记录已保留,点我查看恢复方式。`,resumable:!1,runId:`manager:resume-failed`,sessionId:I.manager.sessionId,sessionStatus:`resume_failed`,status:`failed`,title:`上次会话需要恢复`,totalSteps:1,outputs:[]}}]:[],...S?_e.map(e=>{let t=e.channel_id?.startsWith(`task.`)?e.channel_id.slice(5):void 0,n=S.agentTodos.find(e=>e.todoId===t),r=!!e.active_turn_id,i=xe[e.session_id],a=i?.messages.some(e=>IS(e.role,e.text))===!0;return{id:`run:task:${e.session_id}`,kind:`run`,run:{agentId:e.agent_id,agentLabel:RS(e.agent_id),canInterrupt:r,completedSteps:n?.done||a?1:0,goalId:S.goalId,goalTitle:S.title,latestActivity:r?`Agent 正在执行,可进入 Session 查看过程或发送纠偏。`:a?`Agent 已返回结果,点击查看结果与完整运行记录。`:`执行 Session 已保留,可继续纠偏或恢复。`,resumable:e.resumable,runId:e.session_id,sessionId:e.session_id,sessionMessages:i?.messages.map(e=>({createdAt:e.created_at,messageId:e.message_id,role:e.role===`user`?`user`:IS(e.role,e.text)?`assistant`:`error`,text:e.role===`user`?e.text:FS(e.text)})),sessionStatus:a?`completed`:e.status,status:n?.done||a?`completed`:r?`running`:e.status===`resume_failed`?`failed`:`waiting`,title:n?.text??`Agent 执行任务`,todoId:t,totalSteps:1,turnId:e.active_turn_id??void 0}}}):[],...S?[{id:`run:${S.goalId}`,kind:`run`,run:{agentId:I[S.goalId]?.agentId??S.agentId,agentLabel:RS(I[S.goalId]?.agentId??S.agentId),canInterrupt:!!I[S.goalId]?.turnId,completedSteps:S.agentTodos.filter(e=>e.done).length,goalId:S.goalId,goalTitle:S.title,latestActivity:S.agentSentence,resumable:I[S.goalId]?.resumable??!0,runId:`goal:${S.goalId}`,sessionId:I[S.goalId]?.sessionId,sessionStatus:I[S.goalId]?.status,status:I[S.goalId]?.turnId?`running`:S.state===`需修复`?`failed`:`waiting`,title:S.nextSentence,totalSteps:S.agentTodos.length||1,turnId:I[S.goalId]?.turnId,outputs:S.runEvidence?[{createdAt:S.runEvidence.generatedAt,kind:`evidence`,outputId:`${S.goalId}:latest-evidence`,title:S.runEvidence.label}]:[]}}]:[],...Pe.map(e=>({id:`message:${e.id}`,kind:`message`,message:{agentLabel:e.agentLabel,attachments:e.attachments,id:String(e.id),pending:e.pending,role:e.role,text:e.text||(e.pending?`Agent 正在处理…`:e.lines.join(` +`))}})),...(S?[S]:x.goals).flatMap(e=>e.runEvidence?[{id:`output:${e.goalId}:${e.runEvidence.generatedAt||`latest`}`,kind:`output`,output:{agentLabel:RS(e.agentId),createdAt:e.runEvidence.generatedAt,goalId:e.goalId,goalTitle:e.title,kind:`evidence`,outputId:`${e.goalId}:latest-evidence`,runId:e.runEvidence.runId??void 0,safePreview:e.runEvidence.safePreview,summary:e.runEvidence.summary,title:e.runEvidence.label,todoId:e.runEvidence.todoId??void 0}}]:[]),...S&&w?[{id:`output:${S.goalId}:report:${w.publication.publication_id}`,kind:`output`,output:{agentId:w.agent_id,agentLabel:RS(w.agent_id),createdAt:w.publication.delivered_at,goalId:S.goalId,goalTitle:S.title,kind:`report`,outputId:w.publication.publication_id,report:{addedCount:w.delta.added_count,changedCount:w.delta.changed_count,deliveredAt:w.publication.delivered_at,generationId:w.generation_id,items:w.delta.items.map(e=>({changeKind:e.change_kind,previousStatus:e.previous_status,sourceRef:e.source_ref,status:e.status,summary:e.summary,title:e.title})),periodEndAt:w.period_window.end_at,periodStartAt:w.period_window.start_at,predecessorPublicationId:w.publication.predecessor_publication_id,publicationId:w.publication.publication_id},safePreview:w.delta.items.map(e=>`${e.change_kind===`added`?`+`:`~`} ${e.title}\n${e.summary}`).join(` + +`),summary:w.summary,title:w.title}}]:[]],Ze={...Ry(x),periodicReports:{error:E,loading:O},timeline:Xe};return(0,B.jsxs)(`div`,{className:p===`dark`?`dark`:``,"data-testid":`personal-goal-home`,children:[ye?(0,B.jsx)(`p`,{role:`status`,className:`m-0 bg-amber-50 px-4 py-2 text-sm text-amber-900`,children:g(ye===`partial`?`runs.discoveryPartial`:`runs.discoveryOffline`)}):null,(0,B.jsx)(tS,{agents:te.map(e=>({adapterKind:e.adapterKind,agentId:e.agentId,available:e.available,capability:e.capability,interrupt:e.interrupt,label:e.label,location:e.location,resume:e.resume,source:e.source,streaming:e.streaming,toolCalls:e.toolCalls,trustScope:e.trustScope,workspaceCompatibility:e.available?`当前 Goal 写入前验证`:`不可用,需先修复 Endpoint`})),callbacks:{onApplyAttention:e=>Ye(e.goalId),onCorrectRun:async(e,t)=>{if(!e.sessionId)throw Error(`这个 Run 还没有可纠偏的执行 Session。`);let n=await pg((await ug({actionKind:`run.correct`,context:{kind:`run`,goal_id:e.goalId,todo_id:e.todoId},idempotencyKey:`workspace-run-correct-${e.sessionId}-${Date.now().toString(36)}`,normalizedParameters:{goal_id:e.goalId,message:t,session_id:e.sessionId},summary:`纠偏执行任务:${e.title}`})).proposal_id),r=typeof n.turn?.turn_id==`string`?n.turn.turn_id:void 0;if(ze(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:r?`running`:`ready`,turnId:r}),r){De.current.set(e.goalId,r);let t=new AbortController;L.current.set(e.goalId,t);let n=``,i=Be(e.goalId,{activity:[`正在把纠偏送入原执行 Session`],agentLabel:e.agentLabel,lines:[],pending:!0,sourceLabel:`${e.agentLabel} · 执行 Session`,text:``});try{let a=await Ag(e.sessionId,r,{signal:t.signal,onDelta:t=>{n+=t,Ve(e.goalId,i,{text:n})}});Ve(e.goalId,i,{activity:[],pending:!1,text:FS(a.response.message||n.trim())||`${e.agentLabel} 已完成纠偏。`})}catch(t){let n=Oe.current.delete(e.goalId);Ve(e.goalId,i,{activity:[],pending:!1,text:n?`已中断。你可以在当前会话继续发送消息。`:t instanceof Error?t.message:`纠偏回合失败。`})}finally{De.current.delete(e.goalId),L.current.delete(e.goalId),ze(e.goalId,{agentId:e.agentId,resumable:!0,sessionId:e.sessionId,status:`ready`})}}},onCloseRunSession:Ke,onInterruptRun:async e=>Ue(e),onOpenGoal:Ye,onOpenRunSession:async e=>{if(!e.sessionId)return;let t=e.sessionId,n=await bg(t);Se(e=>({...e,[t]:n})),Ye(e.goalId),de(t=>({...t,[e.goalId]:n.messages.map(t=>({agentLabel:t.role===`user`?void 0:e.agentLabel,attachments:AS(t.attachments),id:Ce.current++,lines:[],role:t.role===`user`?`user`:`assistant`,sourceLabel:t.role===`user`?void 0:`${e.agentLabel} · 执行 Session`,text:t.role===`user`?t.text:FS(t.text)}))})),ze(e.goalId,{agentId:e.agentId,resumable:n.session.resumable,sessionId:t,status:n.session.active_turn_id?`running`:n.session.status,turnId:n.session.active_turn_id??void 0})},onOpenOutput:e=>Ye(e.goalId),...y?{onPreviewGoalSubagentConfiguration:async e=>{let t=await Fg(e);return{changed:t.changed,configuration:{allowedDomains:t.after.orchestration.allowed_domains,enabled:t.feature_summary.multi_subagent===`enabled`,maxChildren:t.after.orchestration.max_children},previewId:t.preview_id}},onApplyGoalSubagentConfiguration:async({previewId:e,...t})=>{let n=await Ig(t,e);return{allowedDomains:n.after.orchestration.allowed_domains,enabled:n.feature_summary.multi_subagent===`enabled`,maxChildren:n.after.orchestration.max_children}}}:{},onGoalActivationStateChange:n,onGoalDeleted:r,onReconcileStatus:a,onRetryGoalArchive:s,onExportOutput:async e=>{let t=[`# ${e.title}`,``,e.summary??``,``,e.safePreview??`此产出没有可用的公开安全预览。`,``,`Goal: ${e.goalId}`,`Todo: ${e.todoId??`unlinked`}`,`Run: ${e.runId??`unlinked`}`].join(` +`),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=`${e.outputId.replace(/[^a-z0-9._-]+/gi,`-`)}.md`,r.click(),URL.revokeObjectURL(n)},onRefresh:o,onRetryResumeRun:We,onSelectAgent:qe,onSelectGoal:e=>e?Ye(e):Je(),onSendMessage:async(e,t,n,r)=>He(e,{agentId:t,goalId:n,attachments:r}),onStartNewRunSession:Ge},goalArchiveLoadState:e,model:Ze,readOnly:h,selectedAgentId:N.agentId,selectedGoalId:S?.goalId??null,statusSourceControl:f})]})}function fC({error:e,isLoading:t,onRetry:n,requestedUrl:r,theme:i,toggleTheme:a}){let o=!!(e&&/failed to fetch|networkerror|load failed/i.test(e)&&r.includes(`status.json`));return(0,B.jsx)(`div`,{className:i===`dark`?`dark`:``,children:(0,B.jsxs)(`main`,{className:`min-h-screen bg-[#f6f7f9] text-slate-950 dark:bg-[#09090b] dark:text-zinc-50`,children:[(0,B.jsxs)(`header`,{className:`flex min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-950 sm:px-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:`LoopX Workspace`}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-sm text-slate-500 dark:text-zinc-400`,children:`Personal Workspace`})]}),(0,B.jsx)(Fy,{"aria-label":`切换主题`,onClick:a,size:`icon`,variant:`secondary`,children:i===`dark`?(0,B.jsx)(Th,{className:`h-4 w-4`}):(0,B.jsx)(oh,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`div`,{className:`grid min-h-[calc(100vh-80px)] sm:grid-cols-[240px_1fr]`,children:[(0,B.jsxs)(`aside`,{className:`hidden border-r border-slate-200 p-6 dark:border-zinc-800 sm:block`,"aria-label":`Workspace`,children:[(0,B.jsx)(`strong`,{children:`LoopX`}),(0,B.jsx)(`p`,{className:`mt-6 text-sm`,children:`Workspace`}),(0,B.jsx)(`p`,{className:`mt-8 text-xs text-slate-500`,children:`Goals`}),[1,2,3].map(e=>(0,B.jsx)(`div`,{className:`mt-4 h-8 rounded bg-slate-100 dark:bg-zinc-900`},e))]}),(0,B.jsx)(`div`,{className:`p-4 sm:p-8`,children:(0,B.jsx)(Iy,{"data-testid":`initial-status-state`,children:(0,B.jsx)(Ly,{className:`flex min-h-64 items-center justify-center p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-xl text-center`,children:[e?(0,B.jsx)(Nm,{className:`mx-auto h-6 w-6 text-rose-600 dark:text-rose-300`}):(0,B.jsx)(ph,{className:`mx-auto h-6 w-6 animate-spin text-slate-500 dark:text-zinc-400`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e?`无法加载实时状态`:`正在加载实时状态`}),e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-slate-500 dark:text-zinc-400`,children:o?`本地状态服务暂时未连接。升级或启动期间可能短暂断开,请重试;仍失败时重新打开 LoopX App,或运行 loopx doctor。`:e}),o?(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-slate-400 dark:text-zinc-500`,children:`重新加载不会执行任务,也不会改变 Goal 配置。`}):null,(0,B.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:(0,B.jsxs)(Fy,{disabled:t,onClick:n,children:[(0,B.jsx)(ph,{className:`h-4 w-4`}),`重试`]})})]}):(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-500 dark:text-zinc-400`,role:`status`,children:`正在连接 Workspace,Goal 列表将先出现,详细状态会逐个补齐。 / Connecting to your Workspace. Goals load independently.`})]})})})})]})]})})}function pC(){let e=AT.useSearch(),t=AT.useNavigate(),[n,r]=(0,z.useState)(`light`),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(null),s=(0,z.useRef)(e.goalId);s.current=e.goalId;let[c,l]=(0,z.useState)(nm),[u,d]=(0,z.useState)({kind:`example`,label:`bundled example`}),[f,p]=(0,z.useState)(()=>lS(window.localStorage,window.location.href)),[m,h]=(0,z.useState)(e.statusUrl),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)({error:null,phase:`idle`}),[S,C]=(0,z.useState)(e.statusUrl.trim()||null),[w,T]=(0,z.useState)(!1),E=(0,z.useRef)(null),D=(0,z.useRef)(k_(e.statusUrl.trim()||null)),O=!w&&u.kind===`example`?e.statusUrl.trim():``,k=S??O,ee=u.kind===`url`?u.label:vS,A=!!(g&&S),j=hS(f,S,ee,window.location.href),te=u.kind===`example`&&!w,ne=c.attention_queue,re=c.run_history,M=(0,z.useMemo)(()=>xS(re.goals,ne.items),[re.goals,ne.items]);function N(e,t,n=0){x({error:null,phase:`loading`}),yS(Rh(e,`stopped`,window.location.href)).then(r=>{if(!N_(D.current,t))return;let i=r.goal_projection?.registry_revision??null,a=t.registryRevision!==null&&t.registryRevision!==void 0&&i!==null&&t.registryRevision!==i;if(l(e=>tv(e,r)),a&&n<1){oe(e,{background:!0,resyncAttempt:n+1});return}x(a?{error:`Goal 状态在加载历史时发生变化,请重试。`,phase:`error`}:{error:null,phase:`ready`})}).catch(e=>{N_(D.current,t)&&x({error:tm(e),phase:`error`})})}function ie(){let e=u.kind===`url`?u.label:m||vS,t=j_(D.current,e,{background:!0});if(i){oe(e);return}t&&N(e,t)}async function ae(e,n,r){if(r.background)return l(e=>tv(e,n)),!0;let i={kind:`url`,label:e};return D.current.loadedUrl=e,l(n),d(i),h(e),await t({search:t=>({...t,statusUrl:e})}),M_(D.current,r)?(D.current.requestedUrl=null,C(null),!0):!1}async function oe(e,t={}){let n=e.trim(),r=t.background===!0;if(!n){r||_(`状态地址不能为空`);return}let c=j_(D.current,n,{background:r,selectionRevision:t.selectionRevision});if(!c)return;o.current?.abort();let d=new AbortController;o.current=d,r||(E.current=null,T(!1),C(n),y(!0),_(null),x({error:null,phase:`idle`}));try{let e=await am(n,window.location.href).catch(()=>null);if(!N_(D.current,c))return;if(e){let o=t.retryOnly&&u.kind===`url`&&u.label===n&&i?.directory.registry_revision===e.registry_revision?i.snapshots:{};a({directory:e,snapshots:o,errors:{}});let f={...e,goals:e.goals.filter(e=>!o[e.id])},p=!1,m=om(e);if(r)l(m);else if(!await ae(n,m,c))return;if(x({error:null,phase:`loading`}),await sm(n,window.location.href,f,(e,t,n)=>{n===`revision`&&(p=!0),a(r=>r&&{...r,snapshots:t?{...r.snapshots,[e]:t}:r.snapshots,errors:n?{...r.errors,[e]:n}:r.errors})},()=>N_(D.current,c),()=>s.current,d.signal),p&&(t.resyncAttempt??0)<1&&N_(D.current,c)){await oe(n,{resyncAttempt:1});return}N_(D.current,c)&&x({error:null,phase:`ready`});return}let o=await yS(Rh(n,`active`,window.location.href));if(!N_(D.current,c)||(a(null),c.registryRevision=o.goal_projection?.registry_revision??null,!await ae(n,o,c)))return;if(o.goal_projection?.scope!==`active`||o.goal_projection.complete){x({error:null,phase:`ready`});return}N(n,c,t.resyncAttempt??0)}catch(e){if(!M_(D.current,c))return;r||_(tm(e))}finally{!r&&M_(D.current,c)&&y(!1)}}function P(e,t={}){o.current?.abort();let n=A_(D.current,e.statusUrl);E.current=null,T(!1),C(e.statusUrl),y(!0),_(null),(async()=>{if(t.ensureTunnel&&e.kind===`ssh_tunnel`){let t=new URL(e.statusUrl,window.location.href).port;if(t)try{await Fb(e.label,t)}catch{}}D.current.selectionRevision===n&&await oe(e.statusUrl,{selectionRevision:n})})()}function F(e){p(e);try{uS(window.localStorage,e)}catch{}}let se={activeSource:j,connectionState:v?`loading`:A?`error`:`connected`,errorMessage:A?`未切换到 ${S??`所选来源`}:${g}`:null,onAdd:e=>{let t=dS(f,e,window.location.href);return`error`in t?{error:t.error}:(F(t.catalog),P(t.source,{ensureTunnel:e.ensureTunnel}),{})},onRemove:e=>{F(fS(f,e)),j.id===e&&P(iS)},onSelect:e=>{let t=f.sources.find(t=>t.id===e);t&&P(t,{ensureTunnel:t.kind===`ssh_tunnel`})},sources:j.id===`temporary`?[...f.sources,j]:f.sources};(0,z.useEffect)(()=>{let t=e.statusUrl.trim();if(t){if(E.current===t||S&&S!==t)return;(u.kind!==`url`||u.label!==t)&&oe(t);return}E.current=null,!w&&(S||u.kind===`example`&&oe(vS))},[w,S,e.statusUrl,u.kind,u.label]),(0,z.useEffect)(()=>{if(e.statusUrl&&u.kind===`example`)return;let n=new Set(M.map(e=>e.goal.id));if(M.length===0){e.goalId&&t({search:e=>({...e,goalId:``})});return}e.goalId&&!n.has(e.goalId)&&b.phase!==`loading`&&t({search:e=>({...e,goalId:``})})},[b.phase,M,t,e.goalId,e.statusUrl,u.kind]),(0,z.useEffect)(()=>{if(!i||v||!e.goalId||u.kind!==`url`)return;let t=i.directory.goals.find(t=>t.id===e.goalId);t?.activation_state===`stopped`&&!i.snapshots[t.id]&&!i.errors[t.id]&&oe(u.label,{retryOnly:!0})},[e.goalId,v,i,u]);function ce(e){t({search:t=>({...t,goalId:e})})}return te?(0,B.jsx)(fC,{error:g,isLoading:v,onRetry:()=>void oe(k||vS),requestedUrl:k||vS,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)}):(0,B.jsx)(dC,{goalArchiveLoadState:b,isLoading:v,onGoalActivationStateChange:(e,t)=>{D.current.projectionRevision+=1,l(n=>Qp(n,e,t)),a(n=>n&&{...n,snapshots:Object.fromEntries(Object.entries(n.snapshots).map(([n,r])=>[n,Qp(r,e,t)]))})},onGoalDeleted:e=>{D.current.projectionRevision+=1,l(t=>$p(t,e)),a(t=>t&&{...t,snapshots:Object.fromEntries(Object.entries(t.snapshots).filter(([t])=>t!==e))})},onSelectGoal:ce,onReconcileStatus:()=>oe(u.kind===`url`?u.label:m||vS,{background:!0}),onRetryGoalArchive:ie,onRefresh:()=>oe(u.kind===`url`?u.label:m||vS,{retryOnly:!!(i&&Object.keys(i.errors).length)}),payload:c,progress:i,rows:M,selectedGoalId:e.goalId,statusSourceControl:se,theme:n,toggleTheme:()=>r(n===`dark`?`light`:`dark`)})}var mC=ov(`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium`,{variants:{variant:{neutral:`border-slate-200 bg-white text-slate-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-300`,success:`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`,warning:`border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,info:`border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200`,danger:`border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-900 dark:bg-rose-950 dark:text-rose-200`}},defaultVariants:{variant:`neutral`}});function $({className:e,variant:t,...n}){return(0,B.jsx)(`span`,{className:Ny(mC({variant:t}),e),...n})}function hC({className:e,...t}){return(0,B.jsx)(`select`,{className:Ny(`h-9 rounded-md border border-slate-200 bg-white px-3 text-sm text-slate-900 shadow-sm outline-none focus:ring-2 focus:ring-slate-400 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:focus:ring-zinc-500`,e),...t})}function gC(e){let t=e?.toLowerCase();return t?[`done`,`closed`,`resolved`].includes(t)?`success`:[`blocked`,`action_required`,`waiting`,`capability_wait`,`workspace_repair`].includes(t)?`warning`:[`failed`,`error`].includes(t)?`danger`:`info`:`neutral`}function _C(e){return e===`P0`?`danger`:e===`P1`?`warning`:e===`P2`?`info`:`neutral`}function vC(e){return e==null?`n/a`:String(e)}function yC(e){let t=vC(e);return t.length>96?`${t.slice(0,93)}...`:t}function bC(e){return Array.isArray(e)?e.join(`, `):e??`compact source warning`}function xC(e){return e.filter(e=>e.status===`open`).length}function SC(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.todo_id,e.priority,e.status,e.title,e.claimed_by,e.task_class,e.action_kind].filter(Boolean).join(` `).toLowerCase().includes(n)):e}function CC(e){return e.attention_queue.items.flatMap(e=>e.goal_channel_projection?[{goalId:e.goal_id,projection:e.goal_channel_projection}]:[])}function wC({children:e,className:t,icon:n,title:r}){return(0,B.jsxs)(`section`,{className:Ny(`rounded-lg border border-slate-200 bg-white shadow-sm`,t),children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,B.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,B.jsx)(n,{className:`h-4 w-4 text-slate-500`}),r]})}),e]})}function TC({todo:e}){return(0,B.jsxs)(`div`,{className:`grid gap-3 border-b border-slate-200 px-3 py-3 last:border-b-0 md:grid-cols-[96px_minmax(0,1fr)_156px]`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.priority?(0,B.jsx)($,{variant:_C(e.priority),children:e.priority}):null,(0,B.jsx)($,{variant:gC(e.status),children:e.status})]}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`break-words text-sm font-medium leading-6 text-slate-950`,children:e.title}),(0,B.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2 text-[11px] font-medium text-slate-500`,children:[e.todo_id?(0,B.jsx)(`span`,{children:e.todo_id}):null,e.task_class?(0,B.jsx)(`span`,{children:e.task_class}):null]}),e.action_kind?(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)($,{variant:Af(e.action_kind),children:e.action_kind})}):null]}),(0,B.jsx)(`div`,{className:`flex items-start justify-start md:justify-end`,children:e.claimed_by?(0,B.jsxs)($,{variant:`info`,children:[(0,B.jsx)(Tm,{className:`h-3 w-3`}),e.claimed_by]}):(0,B.jsx)($,{variant:`neutral`,children:`unclaimed`})})]})}function EC({children:e}){return(0,B.jsx)(`div`,{className:`px-4 py-4 text-sm font-medium leading-6 text-slate-500`,children:e})}function DC({onNavigate:e,onOpenShowcase:t,search:n}){let[r,i]=(0,z.useState)(n.statusUrl),[a,o]=(0,z.useState)(null),s=(0,z.useMemo)(()=>n.statusUrl?Ih(n.statusUrl,window.location.href):null,[n.statusUrl]),c=it({enabled:!!s?.source,queryFn:()=>Lh(s?.source?.url??``),queryKey:[`deprecated-frontstage-ops-status`,s?.source?.url??``]}),l=c.data??null,u=(0,z.useMemo)(()=>l?CC(l):[],[l]),d=u.some(e=>e.goalId===n.goalId)?n.goalId:u[0]?.goalId??Cf.goal_id,f=u.find(e=>e.goalId===d)?.projection??Cf,p=l&&s?.source?zh(l,s.source):null,m=l&&s?.source?Wh(l,s.source):null,h=a??s?.error??(c.error?tm(c.error):null)??(c.isSuccess&&u.length===0?`status feed has no goal_channel_projection items; showing demo fixture`:null),g=s?.source?c.isFetching?`query fetching`:c.isStale?`query stale`:`query fresh`:`query idle`;(0,z.useEffect)(()=>i(n.statusUrl),[n.statusUrl]),(0,z.useEffect)(()=>{u.length&&n.goalId!==d&&e({goalId:d})},[e,u,n.goalId,d]);async function _(){let t=Ih(r,window.location.href);if(t.error||!t.source){o(t.error??`status URL is invalid`);return}if(o(null),n.statusUrl===t.source.url){await c.refetch();return}await e({goalId:``,statusUrl:t.source.url})}let v=xC(f.user_todos),y=xC(f.agent_todos),b=f.agent_todos.filter(e=>!!e.claimed_by).length,x=Array.from(new Set([...f.agent_todos.map(e=>e.claimed_by),...f.active_leases.map(e=>e.owner_agent)].filter(e=>!!e))),S=`${vC(f.quota.spent_slots)} / ${vC(f.quota.allowed_slots??`?`)}`,C=n.todoLane===`agent`?[]:SC(f.user_todos,n.todoQuery),w=n.todoLane===`user`?[]:SC(f.agent_todos,n.todoQuery),T=C.length+w.length,E=f.user_todos.length+f.agent_todos.length,D=Nf(f),O=`/?${new URLSearchParams({goalId:d,statusUrl:n.statusUrl}).toString()}`;return(0,B.jsxs)(`main`,{className:`frontstage-ops-workspace min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-frontstage-surface":`ops-control-plane`,"data-mode":f.mode,"data-schema":f.schema_version,"data-testid":`goal-channel-frontstage-route`,children:[(0,B.jsxs)(`div`,{className:`mx-auto mb-4 flex max-w-[1500px] flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-950`,"data-testid":`frontstage-ops-deprecated`,role:`status`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:`Deprecated diagnostic surface.`}),` New operator workflows and milestone reports live in Personal Workspace.`]}),(0,B.jsx)(`a`,{className:`rounded-md bg-amber-950 px-3 py-2 font-semibold text-white`,href:O,children:`Open Personal Workspace`})]}),(0,B.jsxs)(`div`,{className:`frontstage-workspace-shell mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)_320px]`,"data-testid":`frontstage-ops-workspace-shell`,children:[(0,B.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md bg-slate-950 text-white`,children:(0,B.jsx)(qm,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:`LoopX`}),(0,B.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Deprecated diagnostics`})]})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`/`,children:[(0,B.jsx)(Zm,{className:`h-4 w-4`}),`Personal Workspace`]}),(0,B.jsxs)(`button`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-left text-sm font-medium`,onClick:()=>void t(),type:`button`,children:[(0,B.jsx)(_m,{className:`h-4 w-4`}),`Public Showcase`]}),(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`/frontstage/developer`,children:[(0,B.jsx)(Hm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,B.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-slate-200 bg-slate-50 p-3`,"data-testid":`frontstage-live-source-panel`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)($,{variant:`warning`,children:`ops live`}),(0,B.jsx)($,{variant:l?`info`:`neutral`,children:l?`live status feed`:`bundled fixture`}),(0,B.jsx)($,{variant:l?`success`:`neutral`,children:g})]}),(0,B.jsx)(`input`,{"aria-label":`Status URL`,className:`h-9 w-full rounded-md border border-slate-200 bg-white px-3 text-xs`,"data-testid":`frontstage-status-url-input`,onChange:e=>i(e.target.value),placeholder:`/status.local.json or http://127.0.0.1:8766/status.json`,value:r}),(0,B.jsx)(`div`,{className:`text-[11px] font-medium text-slate-500`,children:`Ops statusUrl accepts only relative or loopback sources.`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsxs)(Fy,{className:`flex-1`,"data-testid":`frontstage-load-status-url`,disabled:c.isFetching,onClick:()=>void _(),size:`sm`,variant:`primary`,children:[(0,B.jsx)(ph,{className:`h-3.5 w-3.5`}),`Load`]}),(0,B.jsx)(Fy,{"data-testid":`frontstage-reset-demo`,disabled:c.isFetching,onClick:()=>void t(),size:`sm`,children:`Showcase`})]}),u.length?(0,B.jsx)(hC,{"aria-label":`Goal channel`,className:`w-full text-xs`,"data-testid":`frontstage-goal-select`,onChange:t=>void e({goalId:t.target.value}),value:d,children:u.map(e=>(0,B.jsx)(`option`,{value:e.goalId,children:e.projection.display_name},e.goalId))}):null,h?(0,B.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-2 text-xs text-amber-950`,"data-testid":`frontstage-load-error`,children:[(0,B.jsx)(Nm,{className:`h-3.5 w-3.5`}),h]}):null,p?(0,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-2 py-2 text-xs text-amber-950`,"data-testid":`frontstage-stale-daemon-repair`,children:[`status service contract stale · schema v`,p.schemaVersion,(0,B.jsxs)(`p`,{children:[`Restart with`,` `,(0,B.jsx)(`span`,{className:`font-mono`,children:p.reloadHint}),`.`]})]}):null,m?(0,B.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-slate-200 bg-white px-2 py-2 text-xs leading-5 text-slate-600`,"data-testid":`frontstage-local-api-capabilities`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:`TanStack Query`}),(0,B.jsx)($,{variant:m.readOnlyDefault?`success`:`warning`,children:m.readOnlyDefault?`read-only default`:`write opt-in active`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:`local_dashboard_api:`}),` `,m.source]}),(0,B.jsxs)(`span`,{children:[`reward dry-run`,` `,m.rewardDryRunUrl?`advertised`:`not advertised`,`; append`,` `,m.rewardWriteEnabled?`enabled by loopback opt-in`:`disabled`]}),(0,B.jsxs)(`span`,{children:[`control-plane dry-run`,` `,m.controlPlaneDryRunUrl?`advertised`:`not advertised`,`; apply`,` `,m.controlPlaneWriteEnabled?`enabled by loopback opt-in`:`disabled`]}),(0,B.jsx)(`span`,{children:`Write affordances require explicit loopback opt-in and preview-locked APIs.`})]}):null]})]}),(0,B.jsxs)(`section`,{className:`frontstage-ops-main-pane space-y-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`success`,children:`goal_channel_projection_v0`}),(0,B.jsx)($,{variant:`warning`,children:`ops live`}),(0,B.jsx)($,{variant:l?`success`:`neutral`,children:l?`url`:`demo`})]}),(0,B.jsx)(`h1`,{className:`mt-3 text-2xl font-semibold`,children:f.display_name}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-slate-500`,children:`Always-on agent operations, with human judgment kept in the control plane.`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-slate-700`,children:f.next_action}),(0,B.jsx)(`div`,{className:`mt-5 grid gap-2 border-t border-slate-200 pt-4 sm:grid-cols-2 xl:grid-cols-4`,"data-testid":`frontstage-operations-strip`,children:[[`human gate`,f.decision_frame.user_action_required?`explicit`:`clear`],[`agent work`,f.decision_frame.agent_action_required?`running`:`idle`],[`claimed lanes`,`${b} / ${f.agent_todos.length}`],[`evidence loop`,`${f.recent_events.length} events`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase text-slate-500`,children:e}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)($,{variant:`info`,children:t})})]},e))})]}),(0,B.jsx)(wC,{icon:Zm,title:`Management Surface Mock`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3`,"data-testid":`frontstage-management-surface-mock`,children:[[`mission`,`Mission Bar`,`goal_id + next_action`,f.display_name],[`team`,`Team Roster`,`active_leases + claimed_by`,`${x.length} visible agents`],[`tickets`,`Ticket Board`,`user_todos + agent_todos`,`${v+y} open tickets`],[`gates`,`Gate Inbox`,`decision_frame + open_gates`,f.decision_frame.user_action_required?`decision visible`:`clear`],[`cadence`,`Cadence / Budget`,`quota + scheduler hints`,S],[`evidence`,`Evidence Timeline`,`recent_events + artifacts`,`${f.recent_events.length} events`]].map(([e,t,n,r])=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,"data-testid":`frontstage-management-${e}`,children:[(0,B.jsx)(`strong`,{children:t}),(0,B.jsx)(`div`,{className:`text-[11px] text-slate-500`,children:n}),(0,B.jsx)(`div`,{className:`mt-2 text-lg font-semibold`,children:r})]},e))})}),(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,B.jsx)(wC,{icon:Ah,title:`Decision Frame`,children:(0,B.jsxs)(`div`,{className:`grid gap-2 p-4`,children:[(0,B.jsx)($,{variant:f.decision_frame.user_action_required?`success`:`neutral`,children:f.decision_frame.user_action_required?`user action`:`no user action`}),(0,B.jsx)($,{variant:f.decision_frame.agent_action_required?`success`:`neutral`,children:f.decision_frame.agent_action_required?`agent action`:`no agent action`})]})}),(0,B.jsx)(wC,{icon:xh,title:`Quota Guard`,children:(0,B.jsxs)(`div`,{className:`space-y-2 p-4 text-sm`,children:[(0,B.jsx)($,{variant:gC(vC(f.quota.state)),children:vC(f.quota.state)}),(0,B.jsx)(`div`,{children:S}),(0,B.jsx)(`p`,{children:vC(f.quota.spend_policy)})]})}),(0,B.jsx)(wC,{icon:Im,title:`Source Freshness`,children:(0,B.jsx)(`div`,{className:`space-y-2 p-4 text-xs`,children:Object.entries(f.source_refs).map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-md bg-slate-50 p-2`,children:[(0,B.jsx)(`strong`,{children:e}),(0,B.jsx)(`div`,{children:vC(t)})]},e))})})]}),(0,B.jsx)(wC,{icon:Om,title:`Budget & Governance`,children:(0,B.jsx)(`div`,{className:`grid gap-2 p-4 sm:grid-cols-2 xl:grid-cols-5`,"data-testid":`frontstage-budget-governance`,children:[[`budget`,S,`quota state: ${vC(f.quota.state)}`],[`cadence`,vC(f.quota.scheduler_rrule??f.quota.cadence_class??`scheduler hint`),`reset token: ${vC(f.quota.scheduler_reset_token??`not projected`)}`],[`spend rule`,vC(f.quota.spend_policy),`Watch lanes stay monitor state; cadence changes, final checks, and monitor-only polls are no-spend.`],[`controls`,vC(f.quota.override_policy??`preview gated`),vC(f.quota.pause_policy??`writes require CLI or loopback opt-in`)],[`evidence`,vC(f.quota.latest_evidence_ref??f.source_refs.latest_run_generated_at??`run history`),`Audit through todo ids, run history, and quota spend events.`]].map(([e,t,n])=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase text-slate-500`,children:e}),(0,B.jsx)(`strong`,{className:`mt-2 block`,children:t}),(0,B.jsx)(`p`,{className:`mt-2 text-xs`,children:n})]},e))})}),(0,B.jsx)(wC,{icon:Qm,title:`Operator State Legibility`,children:(0,B.jsx)(`div`,{className:`grid gap-2 p-4 sm:grid-cols-2 xl:grid-cols-4`,"data-testid":`frontstage-operator-state-legibility`,children:D.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,"data-testid":`frontstage-state-${e.label}`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase text-slate-500`,children:e.label}),(0,B.jsx)(`strong`,{className:`mt-2 block`,children:e.value}),(0,B.jsx)(`p`,{className:`mt-2 text-xs`,children:e.helper}),(0,B.jsx)($,{variant:e.tone,children:e.label})]},e.label))})}),(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(`div`,{className:`frontstage-ops-command-strip rounded-lg border border-slate-200 bg-white p-4 shadow-sm lg:col-span-2`,"data-testid":`frontstage-ops-command-strip`,children:(0,B.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(220px,1fr)_180px_auto]`,"data-testid":`frontstage-todo-discovery`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`text-[11px] font-semibold uppercase text-slate-500`,children:`Search todo projection`}),(0,B.jsxs)(`span`,{className:`relative mt-1 block`,children:[(0,B.jsx)(gh,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400`}),(0,B.jsx)(`input`,{"aria-label":`Search projected todos`,className:`h-9 w-full rounded-md border border-slate-200 pl-9 pr-3 text-sm`,"data-testid":`frontstage-todo-search`,onChange:t=>void e({todoQuery:t.target.value}),value:n.todoQuery})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`text-[11px] font-semibold uppercase text-slate-500`,children:`Lane`}),(0,B.jsxs)(hC,{"aria-label":`Todo lane filter`,className:`mt-1 w-full text-sm`,"data-testid":`frontstage-todo-lane-filter`,onChange:t=>void e({todoLane:t.target.value}),value:n.todoLane,children:[(0,B.jsx)(`option`,{value:`all`,children:`All lanes`}),(0,B.jsx)(`option`,{value:`user`,children:`User todos`}),(0,B.jsx)(`option`,{value:`agent`,children:`Agent todos`})]})]}),(0,B.jsxs)(`div`,{className:`flex min-h-9 items-center rounded-md border border-slate-200 bg-slate-50 px-3 text-xs font-semibold`,"data-testid":`frontstage-todo-result-count`,children:[`Showing `,T,` of `,E,` projected todos`]})]})}),(0,B.jsx)(wC,{icon:Ah,title:`User Todo Lane`,children:(0,B.jsxs)(`div`,{"data-testid":`frontstage-user-todos`,children:[C.map(e=>(0,B.jsx)(TC,{todo:e},e.todo_id??e.title)),C.length?null:(0,B.jsx)(EC,{children:`No user todos match the current filters.`})]})}),(0,B.jsx)(wC,{icon:Tm,title:`Agent Todo Lane`,children:(0,B.jsxs)(`div`,{"data-testid":`frontstage-agent-todos`,children:[w.map(e=>(0,B.jsx)(TC,{todo:e},e.todo_id??e.title)),w.length?null:(0,B.jsx)(EC,{children:`No agent todos match the current filters.`})]})})]}),(0,B.jsx)(wC,{icon:_m,title:`Run Timeline`,children:(0,B.jsx)(`div`,{className:`divide-y divide-slate-200`,"data-testid":`frontstage-timeline`,children:f.recent_events.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid gap-3 px-4 py-3 md:grid-cols-[190px_180px_minmax(0,1fr)]`,children:[(0,B.jsx)(`div`,{className:`font-mono text-xs text-slate-500`,children:e.generated_at??`n/a`}),(0,B.jsx)($,{variant:jf(e.classification),children:e.classification??`event`}),(0,B.jsx)(`div`,{className:`text-sm`,children:e.summary??`compact event`})]},`${e.generated_at??`event`}-${t}`))})})]}),(0,B.jsxs)(`aside`,{className:`space-y-4`,children:[(0,B.jsx)(wC,{icon:Ah,title:`Role Map`,children:(0,B.jsxs)(`div`,{className:`space-y-3 p-4`,"data-testid":`frontstage-role-map`,children:[(0,B.jsxs)(`div`,{children:[`owner ·`,` `,f.decision_frame.user_action_required?`decision visible`:`no gate`]}),(0,B.jsxs)(`div`,{children:[`agent lane ·`,` `,f.decision_frame.agent_action_required?`active`:`idle`]}),(0,B.jsxs)(`div`,{children:[`claim owners · `,x.join(`, `)||`none`]})]})}),(0,B.jsx)(wC,{icon:Qm,title:`Active Claims`,children:(0,B.jsx)(`div`,{className:`divide-y divide-slate-200`,"data-testid":`frontstage-active-claims`,children:f.active_leases.map((e,t)=>(0,B.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,B.jsx)($,{variant:`info`,children:e.owner_agent??`unknown`}),(0,B.jsx)($,{variant:Mf(e.status),children:e.status??`claim`}),(0,B.jsx)(`div`,{className:`mt-2 text-xs`,children:e.todo_id}),e.lease_until?(0,B.jsxs)(`div`,{children:[`until `,e.lease_until]}):null,e.write_scope?.map(e=>(0,B.jsx)($,{variant:`warning`,children:e},e))]},`${e.todo_id??`claim`}-${t}`))})}),(0,B.jsx)(wC,{icon:Nm,title:`Open Gates`,children:(0,B.jsxs)(`div`,{className:`divide-y divide-slate-200`,"data-testid":`frontstage-open-gates`,children:[f.open_gates.map(e=>(0,B.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,B.jsx)($,{variant:gC(e.status),children:e.status}),(0,B.jsx)($,{variant:`neutral`,children:e.kind}),(0,B.jsx)(`div`,{children:e.gate_id}),e.blocks?.map(e=>(0,B.jsx)($,{variant:`warning`,children:e},e))]},e.gate_id)),f.open_gates.length?null:(0,B.jsx)(EC,{children:`No open gates in this projection.`})]})}),(0,B.jsx)(wC,{icon:Hm,title:`Artifacts`,children:(0,B.jsxs)(`div`,{className:`divide-y divide-slate-200`,"data-testid":`frontstage-artifacts`,children:[f.artifacts.map((e,t)=>(0,B.jsx)(`div`,{className:`space-y-2 px-4 py-3`,children:Object.entries(e).map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-md bg-slate-50 p-2`,children:[(0,B.jsx)(`strong`,{children:e}),(0,B.jsx)(`div`,{children:yC(t)})]},e))},`${e.kind??`artifact`}-${t}`)),f.artifacts.length?null:(0,B.jsx)(EC,{children:`No compact artifacts projected.`})]})}),(0,B.jsx)(wC,{icon:xh,title:`Truth Contract`,children:(0,B.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,B.jsx)($,{variant:f.truth_contract.event_ledger_is_source_of_truth?`success`:`neutral`,children:`ledger truth`}),(0,B.jsx)($,{variant:f.truth_contract.projection_is_writable?`warning`:`success`,children:`read-only`}),(0,B.jsx)(`p`,{children:f.truth_contract.recompute_rule}),(0,B.jsxs)(`p`,{children:[`write authority: `,f.truth_contract.write_authority]})]})}),(0,B.jsx)(wC,{icon:xh,title:`Boundary Warnings`,children:(0,B.jsx)(`div`,{className:`space-y-3 p-4`,"data-testid":`frontstage-source-warnings`,children:f.source_warnings.map((e,t)=>(0,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 p-3 text-sm`,children:[(0,B.jsx)(`strong`,{children:e.kind}),(0,B.jsx)(`p`,{children:bC(e.message)})]},`${e.kind}-${t}`))})})]})]})]})}var OC=[{label:`status payload`,source:`apps/presentation/dashboard/src/data/status.ts`,detail:`status_contract, attention_queue, local_dashboard_api, run_history`},{label:`channel projection`,source:`apps/presentation/dashboard/src/data/goal-channel-frontstage.ts`,detail:`decision_frame, todos, gates, leases, artifacts, truth_contract`},{label:`public showcase catalog`,source:`docs/showcases/showcase-catalog.json`,detail:`case metadata, visual hints, evidence boundaries, story beats`},{label:`route smoke`,source:`apps/presentation/dashboard/smoke/frontstage-route-smoke.ts`,detail:`static route contract, source guards, component expectations`}],kC=[{axis:`schema`,current:`goal_channel_projection_v0`,proposed:`new optional projection field`,gate:`parser default plus route smoke assertion`},{axis:`truth`,current:`event ledger and active state remain source of truth`,proposed:`derived UI state only`,gate:`truth_contract must stay read-only`},{axis:`privacy`,current:`compact source refs and warnings`,proposed:`public-safe fixture field`,gate:`loopx check and browser fake-private fixture`},{axis:`interaction`,current:`render, filter, select, inspect`,proposed:`no browser write by default`,gate:`write affordance requires explicit loopback capability`}],AC=[{title:`Fixture sources`,body:`Use examples/status.example.json, browser-smoke fixtures, and docs/showcases/showcase-catalog.json.`},{title:`Required proof`,body:`Every projection addition needs parser coverage, route smoke assertions, and one browser or bundle check when UI output changes.`},{title:`Never include`,body:`Raw task text, trajectories, transcripts, local paths, private registry state, credentials, or internal document links.`}],jC=[`npm --prefix apps/presentation/dashboard run smoke:frontstage-route`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-browser`,`npm --prefix apps/presentation/dashboard run smoke:frontstage-share-bundle`,`npm --prefix apps/presentation/dashboard run build`,`loopx check --scan-path apps/presentation/dashboard --scan-path docs/status-data-contract.md`],MC=[{name:`Projection lane`,badges:[`read-only`,`schema v0`],body:`Summarizes one compact projection lane without mutating the underlying LoopX state.`},{name:`Capability badge`,badges:[`loopback`,`dry-run`],body:`Shows an advertised local capability only after the status feed declares it.`},{name:`Boundary warning`,badges:[`public-safe`,`omitted`],body:`Names omitted private material and points contributors back to compact source references.`}];function NC({children:e,icon:t,title:n}){return(0,B.jsxs)(`section`,{className:`rounded-lg border border-slate-200 bg-white shadow-sm`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,B.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,B.jsx)(t,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function PC(){return(0,B.jsx)(NC,{icon:Em,title:`Status Contract Explorer`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,"data-testid":`developer-contract-explorer`,children:OC.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:e.label}),(0,B.jsx)($,{variant:`neutral`,children:`public contract`})]}),(0,B.jsx)(`div`,{className:`mt-2 break-words font-mono text-xs text-slate-700`,children:e.source}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.detail})]},e.label))})})}function FC(){return(0,B.jsx)(NC,{icon:Jm,title:`Projection Diffing`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,"data-testid":`developer-projection-diffing`,children:(0,B.jsxs)(`table`,{className:`min-w-full border-separate border-spacing-0 text-left text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`bg-slate-50 text-xs uppercase tracking-normal text-slate-500`,children:[(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Axis`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Current`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Proposed`}),(0,B.jsx)(`th`,{className:`border-b border-slate-200 px-4 py-3 font-semibold`,children:`Gate`})]})}),(0,B.jsx)(`tbody`,{children:kC.map(e=>(0,B.jsxs)(`tr`,{className:`align-top`,children:[(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 font-semibold text-slate-950`,children:e.axis}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.current}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.proposed}),(0,B.jsx)(`td`,{className:`border-b border-slate-100 px-4 py-3 text-slate-600`,children:e.gate})]},e.axis))})]})})})}function IC(){return(0,B.jsx)(NC,{icon:Wm,title:`Fixture Generation`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-fixture-generation`,children:AC.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:e.title}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.title))})})}function LC(){return(0,B.jsx)(NC,{icon:Fm,title:`Smoke Checklist`,children:(0,B.jsx)(`div`,{className:`space-y-2 p-4`,"data-testid":`developer-smoke-checklist`,children:jC.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(Cm,{className:`mt-0.5 h-4 w-4 shrink-0 text-emerald-600`}),(0,B.jsx)(`code`,{className:`break-all text-xs font-semibold leading-5 text-slate-700`,children:e})]},e))})})}function RC(){return(0,B.jsx)(NC,{icon:Lm,title:`Component Examples`,children:(0,B.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-3`,"data-testid":`developer-component-examples`,children:MC.map(e=>(0,B.jsxs)(`article`,{className:`rounded-md border border-slate-200 bg-slate-50 p-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.badges.map(e=>(0,B.jsx)($,{variant:e===`read-only`||e===`public-safe`?`success`:`neutral`,children:e},e))}),(0,B.jsx)(`h3`,{className:`mt-3 text-sm font-semibold leading-6 text-slate-950`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:e.body})]},e.name))})})}function zC(){return(0,B.jsx)(`main`,{className:`min-h-screen bg-[#f7f7f4] px-4 py-4 text-slate-950 sm:px-5`,"data-testid":`frontstage-developer-cockpit`,children:(0,B.jsxs)(`div`,{className:`mx-auto grid max-w-[1500px] gap-4 xl:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,B.jsxs)(`aside`,{className:`rounded-lg border border-slate-200 bg-white p-4 shadow-sm xl:sticky xl:top-4 xl:self-start`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-slate-200 bg-slate-950 text-white`,children:(0,B.jsx)(Eh,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold`,children:`Developer Cockpit`}),(0,B.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Projection extension`})]})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`/`,children:[(0,B.jsx)(Zm,{className:`h-4 w-4`}),`Control home`]}),(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md border border-slate-200 px-3 py-2 text-sm font-medium`,href:`/frontstage`,children:[(0,B.jsx)(Hm,{className:`h-4 w-4`}),`Public frontstage`]}),(0,B.jsxs)(`a`,{className:`flex items-center gap-2 rounded-md bg-slate-950 px-3 py-2 text-sm font-medium text-white`,href:`/frontstage/developer`,children:[(0,B.jsx)(Lm,{className:`h-4 w-4`}),`Developer cockpit`]})]}),(0,B.jsxs)(`div`,{className:`mt-5 space-y-2 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-xs leading-5 text-emerald-950`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`success`,children:`read-only`}),(0,B.jsx)($,{variant:`neutral`,children:`public fixtures`})]}),(0,B.jsx)(`p`,{children:`This route uses static public contracts only; live status feeds, registry files, and browser write APIs stay outside the cockpit.`})]})]}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`rounded-lg border border-slate-200 bg-white px-5 py-5 shadow-sm`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:`frontstage/developer`}),(0,B.jsx)($,{variant:`success`,children:`public-safe`}),(0,B.jsx)($,{variant:`neutral`,children:`no browser writes`})]}),(0,B.jsx)(`h1`,{className:`mt-3 text-3xl font-semibold tracking-normal text-slate-950`,children:`LoopX Projection Developer Cockpit`}),(0,B.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-slate-600`,children:`A read-only contributor workbench for adding dashboard/frontstage projections without reverse-engineering the large operator page.`})]}),(0,B.jsxs)(`div`,{className:`grid min-w-[260px] gap-2 text-sm`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Source of truth`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`status contract + compact fixtures`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Boundary`}),(0,B.jsx)(`div`,{className:`mt-1 font-semibold text-slate-950`,children:`read-only extension surface`})]})]})]})}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,B.jsx)(PC,{}),(0,B.jsx)(FC,{})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,B.jsx)(IC,{}),(0,B.jsx)(LC,{})]}),(0,B.jsx)(RC,{}),(0,B.jsx)(NC,{icon:xh,title:`Extension Boundary`,children:(0,B.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-3`,"data-testid":`developer-extension-boundary`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-emerald-200 bg-emerald-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Allowed`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Versioned parser defaults, public fixtures, read-only route panels, and focused smoke assertions.`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Review`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`New dashboard dependencies, status contract fields, loopback capability display, and browser-visible workflows.`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-rose-200 bg-rose-50 px-3 py-3`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold text-slate-950`,children:`Stop`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-slate-600`,children:`Credentials, private registry material, raw logs, transcripts, production actions, or default browser write authority.`})]})]})})]})]})})}var BC={schema_version:`loopx_showcase_catalog_v1`,updated_at:`2026-09-04`,redaction_policy:{public_repo_may_include:[`sanitized domain labels`,`reusable control-plane patterns`,`synthetic demos`,`explicit evidence boundaries`,`owner-approved user feedback excerpts with hard-sensitive details removed`],public_repo_must_not_include:[`private document links`,`unapproved internal screenshots`,`unredacted raw chats`,`raw benchmark task text`,`private repositories`,`local filesystem paths`,`credentials`,`unpublished domain artifacts`]},source_coverage:[{source_key:`cpp-algorithm-accuracy`,disposition:`promoted_case`,case_id:`2026-07-cpp-accuracy-long-run`,reason:`The report includes a concrete >13h runtime, stated intervention level, outcome, and mechanism evidence.`},{source_key:`four-day-unattended-agent`,disposition:`promoted_case`,case_id:`2026-07-four-day-unattended-agent`,reason:`The report states four days without human intervention and identifies useful work plus a reporting capability.`},{source_key:`public-engine-refactor`,disposition:`promoted_case`,case_id:`2026-07-public-engine-refactor`,reason:`The user report is backed by a public issue and seven merged pull requests.`},{source_key:`small-request-relief`,disposition:`feedback_signal_only`,case_id:null,reason:`Useful satisfaction signal, but it has no duration, intervention, or independently inspectable outcome.`},{source_key:`ecommerce-24x7-interest`,disposition:`not_promoted`,case_id:null,reason:`This is prospective demand for seller analytics and competitor monitoring, not a realized LoopX outcome.`},{source_key:`peer-harness-assessment`,disposition:`not_promoted`,case_id:null,reason:`The material is a positive assessment and a comparable harness report, not evidence that the referenced workloads used LoopX.`}],cases:[{id:`2026-07-cpp-accuracy-long-run`,date:`2026-07`,title:`13+ hour C++ algorithm accuracy run`,status:`owner_approved_user_evidence_case`,case_type:`independent_user`,evidence_strength:`user_report_with_public_method_reference`,case_page:`docs/showcases/cases/independent-cpp-accuracy-long-run.md`,demo_command:null,domain:`complex-cpp-algorithm`,audience:[`engineering-lead`,`long-running-agent-operator`,`C++ developer`],pattern_tags:[`independent_user`,`13h_plus_run`,`vision_replan`,`public_research`,`evidence_retention`],headline:`An independent user reported a >13h multi-stage C++ accuracy task that stayed on goal, found a public code-memory tool, and improved the final precision.`,problem:`A complex C++ algorithm had a precision problem, while direct long-running agent attempts risked parameter thrashing, local-detail drift, and repeated context compression.`,loopx_behavior:[`kept the multi-stage work aligned to the declared vision for more than 13 hours`,`triggered public research when the current route no longer appeared able to satisfy the vision`,`selected a public codebase-memory MCP for C++ call-graph and coupling analysis`,`retained experiment evidence and an explanation of the final approach`],runtime_signal:{duration:`>13h`,agent_scale:`one long-running agent reported`,human_intervention:`no parameter micromanagement or repeated local redirection reported during the multi-stage run`},user_value:`The user reported a clear precision improvement, less context compression, and an explanation that made the result and experiment path understandable after the run.`,evidence_links:[{label:`codebase-memory-mcp`,url:`https://github.com/DeusData/codebase-memory-mcp`,kind:`public_method_reference`}],evidence_assets:[{path:`docs/assets/showcases/user-feedback/cpp-accuracy-13h-user-report.jpg`,alt:`Authorized user feedback reporting a LoopX C++ algorithm run lasting more than 13 hours with improved precision and retained evidence`,caption:`Source: an owner-approved message excerpt from the LoopX public Lark developer group. Runtime and outcome are user-reported; the public MCP reference is independently inspectable.`},{path:`docs/assets/showcases/user-feedback/cpp-accuracy-public-research-user-report.jpg`,alt:`Authorized follow-up explaining that LoopX replan triggered public research and found a code-memory MCP`,caption:`Source: an owner-approved follow-up message excerpt from the same LoopX public Lark developer group, describing the public-research transition.`}],evidence_boundary:`Owner-approved message excerpts from the LoopX public Lark developer group and a public tool reference; the project repository, raw run state, prompts, experiment data, and performance measurements remain private.`,showcase_table:{proof_point:`A >13h engineering run can remain aligned, change method through public research, and retain an understandable evidence trail.`,loopx_intervention:`vision alignment, replan, public research, evidence retention`},frontend_card:{visual_metaphor:`a long C++ investigation changes tools without losing its target`,primary_metric_hint:`>13h user-reported run with improved final precision`,badges:[`Independent user`,`>13h`,`C++ accuracy`],story_beats:[`a complex algorithm accuracy problem resisted the initial route`,`LoopX preserved the vision while replanning`,`public research found a code-memory tool`,`the user reported improved precision and retained evidence`]},evidence_metrics:[{value:`>13h`,labels:{zh:`用户报告运行时长`,en:`user-reported runtime`}},{value:`1`,labels:{zh:`公开工具引用`,en:`public tool reference`}},{value:`0`,labels:{zh:`参数微操报告`,en:`parameter-micromanagement reports`}}],localizations:{zh:{title:`13+ 小时 C++ 算法精度修复`,headline:`外部用户报告:超过 13 小时的多阶段任务保持目标一致,并通过公开研究找到新工具、提升最终精度。`,problem:`一个复杂 C++ 算法存在精度问题;直接长程执行容易出现参数反复调整、局部细节漂移和上下文反复压缩。`,proof_point:`长程工程任务可以在更换方法时不丢失目标,并保留可解释的证据链。`,loopx_intervention:`vision 对齐、replan、public research、证据保留`,loopx_behavior:[`超过 13 小时的多阶段工作持续对齐已声明的 vision`,`当前路径无法继续满足 vision 时触发 public research`,`选择公开 codebase-memory MCP 分析 C++ 调用关系和耦合`,`保留实验证据与最终方案解释`],user_value:`用户报告最终精度明显提升、上下文压缩减少,并能在运行结束后理解过程与方案选择。`,evidence_boundary:`来自 LoopX 公开飞书开发群、经 owner 授权的消息摘录与公开工具引用;项目仓库、原始运行状态、prompt、实验数据和性能测量仍保持私有。`}},interactive_page:`docs/showcases/cases/independent-cpp-accuracy-long-run.html`,interactive_page_zh:`docs/showcases/cases/independent-cpp-accuracy-long-run.html`,interactive_page_en:`docs/showcases/cases/independent-cpp-accuracy-long-run.en.html`,localized_pages:{zh:`docs/showcases/cases/independent-cpp-accuracy-long-run.html`,en:`docs/showcases/cases/independent-cpp-accuracy-long-run.en.html`},showcase_rank:1},{id:`2026-07-four-day-unattended-agent`,date:`2026-07`,title:`Four-day unattended agent run`,status:`owner_approved_user_evidence_case`,case_type:`independent_user`,evidence_strength:`user_report_only`,case_page:`docs/showcases/cases/independent-four-day-unattended-agent.md`,demo_command:null,domain:`long-running-agent-operations`,audience:[`operator`,`agent-platform-developer`,`engineering-lead`],pattern_tags:[`independent_user`,`four_day_run`,`unattended_execution`,`weekly_reporting`],headline:`An independent user reported that an agent ran for four days without human intervention, continued useful work, and exposed a weekly-report capability.`,problem:`Long-running agents often need repeated prompting, and operators cannot easily tell whether unattended work is still useful.`,loopx_behavior:[`kept the task active across a four-day window`,`allowed the agent to continue without reported human intervention`,`made the accumulated work discussable through a periodic report surface`],runtime_signal:{duration:`4d`,agent_scale:`one long-running agent reported`,human_intervention:`none reported during the four-day run`},user_value:`The user described the agent as doing valuable work rather than merely staying alive, while a weekly report gave the operator a way to inspect progress later.`,evidence_links:[],evidence_assets:[{path:`docs/assets/showcases/user-feedback/four-day-unattended-user-report.jpg`,alt:`Redacted authorized chat excerpt reporting a four-day LoopX agent run without human intervention`,caption:`Source: an owner-approved message excerpt from the LoopX public Lark developer group, cropped to remove chat identity and unrelated reporting context. All claims remain user-reported.`}],evidence_boundary:`Owner-approved message excerpt from the LoopX public Lark developer group only; the workload, repository, run history, report contents, and unselected chat context remain private.`,showcase_table:{proof_point:`A user observed four days of unattended work and judged the work useful, with a later reporting surface available for inspection.`,loopx_intervention:`durable task state, unattended continuation, periodic reporting`},frontend_card:{visual_metaphor:`an unattended work loop advances across four days and returns a report`,primary_metric_hint:`4d without reported human intervention`,badges:[`Independent user`,`4 days`,`Unattended`],story_beats:[`the operator left the task running`,`the agent continued for four days`,`the user judged the work valuable`,`a weekly report offered a later inspection point`]},evidence_metrics:[{value:`4d`,labels:{zh:`用户报告运行时长`,en:`user-reported runtime`}},{value:`0`,labels:{zh:`报告的人工干预`,en:`reported human interventions`}},{value:`1`,labels:{zh:`周期报告能力`,en:`periodic report surface`}}],localizations:{zh:{title:`4 天无人干预运行`,headline:`外部用户报告:Agent 在没有人工干预的情况下连续运行 4 天,并持续处理有价值的工作。`,problem:`长程 Agent 往往需要反复催促,operator 也难以判断无人值守期间是否仍在做有价值的工作。`,proof_point:`长程 Agent 不只是保持存活,还需要让用户看见它是否在做有价值的工作。`,loopx_intervention:`持久任务状态、无人值守续跑、周期报告`,loopx_behavior:[`任务在 4 天窗口内持续保持 active`,`Agent 在用户报告的零人工干预下继续推进`,`通过周期报告为后续检查提供入口`],user_value:`用户认为 Agent 在持续做有价值的工作,而周期报告让 operator 可以稍后检查进度。`,evidence_boundary:`仅包含来自 LoopX 公开飞书开发群、经 owner 授权并脱敏的消息摘录;工作负载、仓库、运行历史、报告内容和未选取的聊天上下文仍保持私有。`}},interactive_page:`docs/showcases/cases/independent-four-day-unattended-agent.html`,interactive_page_zh:`docs/showcases/cases/independent-four-day-unattended-agent.html`,interactive_page_en:`docs/showcases/cases/independent-four-day-unattended-agent.en.html`,localized_pages:{zh:`docs/showcases/cases/independent-four-day-unattended-agent.html`,en:`docs/showcases/cases/independent-four-day-unattended-agent.en.html`},showcase_rank:2},{id:`2026-07-public-engine-refactor`,date:`2026-07`,title:`Public engine refactor across seven merged PRs`,status:`public_repository_plus_user_report_case`,case_type:`independent_user`,evidence_strength:`public_repository_plus_user_report`,case_page:`docs/showcases/cases/independent-public-engine-refactor.md`,demo_command:null,domain:`repository-refactor`,audience:[`maintainer`,`engineering-lead`,`long-running-agent-operator`],pattern_tags:[`independent_user`,`public_repository`,`seven_prs`,`incremental_refactor`,`user_reported_scale`],headline:`A user attributed a public Engine decomposition to LoopX; the repository shows the work landing incrementally through seven merged PRs.`,problem:`A monolithic Engine mixed roughly nine responsibility areas and about sixty methods, making behavioral refactoring difficult to review and test.`,loopx_behavior:[`kept the decomposition anchored to one explicit public refactor goal`,`split the work across independently reviewable component extractions`,`allowed later stages to reuse the public issue as a durable coordination point`,`preserved incremental mergeability instead of producing one giant refactor diff`],runtime_signal:{duration:`multi-week public PR sequence`,agent_scale:`not reported`,human_intervention:`maintainer review and merge remained present; the user did not claim a fully unattended run`,token_scale:`1B+ tokens, user-reported and not independently verified`},user_value:`The public repository shows seven related PRs merged into a staged facade-and-components refactor; the user described the LoopX-driven sequence as successful and high quality.`,evidence_links:[{label:`Refactor issue #166`,url:`https://github.com/zilliztech/mfs/issues/166`,kind:`public_goal_and_design`},{label:`PR #131`,url:`https://github.com/zilliztech/mfs/pull/131`,kind:`merged_pull_request`},{label:`PR #137`,url:`https://github.com/zilliztech/mfs/pull/137`,kind:`merged_pull_request`},{label:`PR #160`,url:`https://github.com/zilliztech/mfs/pull/160`,kind:`merged_pull_request`},{label:`PR #164`,url:`https://github.com/zilliztech/mfs/pull/164`,kind:`merged_pull_request`},{label:`PR #171`,url:`https://github.com/zilliztech/mfs/pull/171`,kind:`merged_pull_request`},{label:`PR #175`,url:`https://github.com/zilliztech/mfs/pull/175`,kind:`merged_pull_request`},{label:`PR #176`,url:`https://github.com/zilliztech/mfs/pull/176`,kind:`merged_pull_request`}],evidence_assets:[],evidence_boundary:`The issue and seven merged PRs are public repository evidence. LoopX attribution, perceived quality, and the 1B+ token scale are owner-approved user reports rather than independently verified repository facts.`,showcase_table:{proof_point:`One public refactor goal landed as seven merged PRs instead of a monolithic change.`,loopx_intervention:`durable goal, staged todo sequence, PR-sized delivery, evidence-backed continuation`},frontend_card:{visual_metaphor:`one monolithic engine separates into reviewable components across seven merge points`,primary_metric_hint:`7 merged PRs in a public repository`,badges:[`Independent user`,`7 merged PRs`,`Public repo`],story_beats:[`a public issue defined the target architecture`,`component extractions landed incrementally`,`seven related PRs merged`,`user-reported scale is kept separate from public repository facts`]},evidence_metrics:[{value:`7`,labels:{zh:`公开合并 PR`,en:`public merged PRs`}},{value:`1`,labels:{zh:`公开架构目标`,en:`public architecture goal`}},{value:`1B+`,labels:{zh:`用户报告 token 规模`,en:`user-reported token scale`}}],localizations:{zh:{title:`公开 Engine 重构:7 个合并 PR`,headline:`外部用户将一次公开 Engine 拆分归因于 LoopX;仓库证据显示相关工作通过 7 个 PR 渐进合并。`,problem:`一个 Engine 混合约 9 类职责和约 60 个方法,行为保持型重构难以测试、审阅和一次性合并。`,proof_point:`一个公开重构目标可以拆成 7 个可独立 review、可合并的 PR。`,loopx_intervention:`持久目标、分阶段 todo、PR-sized delivery、证据续跑`,loopx_behavior:[`用一个公开 issue 固定目标架构`,`把组件抽取拆成可独立 review 的阶段`,`后续阶段继续复用公开 issue 作为协调点`,`通过 PR-sized delivery 避免单个巨型重构 diff`],user_value:`公开仓库显示 7 个相关 PR 已合并;用户将这组渐进式重构归因于 LoopX,并评价成功率和质量较好。`,evidence_boundary:`Issue 和 7 个合并 PR 属于公开仓库证据;LoopX 归因、主观质量和 10 亿+ token 规模来自经 owner 授权的用户报告,并非独立验证事实。`}},interactive_page:`docs/showcases/cases/independent-public-engine-refactor.html`,interactive_page_zh:`docs/showcases/cases/independent-public-engine-refactor.html`,interactive_page_en:`docs/showcases/cases/independent-public-engine-refactor.en.html`,localized_pages:{zh:`docs/showcases/cases/independent-public-engine-refactor.html`,en:`docs/showcases/cases/independent-public-engine-refactor.en.html`},showcase_rank:3},{id:`2026-06-27-overnight-pr-batch`,date:`2026-06-27`,title:`Overnight PR batch with reviewable control`,status:`public_evidence_case`,case_type:`creator_dogfooding`,evidence_strength:`public_git_evidence`,case_page:`docs/showcases/cases/0627-overnight-pr-batch.md`,demo_command:null,domain:`agent-platform-self-improvement`,audience:[`operator`,`agent-platform-developer`,`technical-lead`],pattern_tags:[`high_throughput_reviewable_work`,`pr_sized_slices`,`self_merge_policy`,`validation_writeback`,`public_boundary`],headline:`An overnight LoopX run can produce many PR-sized slices while keeping review, validation, and public evidence boundaries visible.`,problem:`High-throughput autonomous work is only useful if the resulting changes remain reviewable, validated, and safe to publish.`,loopx_behavior:[`keep work broken into PR-sized slices instead of a giant unreviewable diff`,`tie runtime, docs, and focused smoke updates together when a control-plane contract changes`,`limit self-merge to narrow validated changes while preserving broader review gates`,`record public evidence from Git history instead of raw agent logs or private screenshots`,`keep public/private boundary checks in the showcase path`],user_value:`The operator can wake up to a compact batch of merged public slices, see what changed, and still trust that gates, validation, and evidence boundaries were not bypassed.`,workload_signal:{scope:`public_repository_window`,window:{from:`2026-06-27T01:29:00+08:00`,to:`2026-06-27T11:29:00+08:00`,hours:10},public_git:{merged_commits:22,files_touched:60,insertions:6695,deletions:223,commit_messages_with_pr_numbers:10},claim_boundary:`public Git history only; contemporaneous private queue notes are not used as public evidence`},evidence_boundary:`Public Git evidence only; no private documents, internal screenshots, raw chats, local active-state bodies, raw logs, credentials, or machine-specific paths.`,interactive_page:`docs/showcases/cases/0627-overnight-pr-batch.html`,interactive_page_zh:`docs/showcases/cases/0627-overnight-pr-batch.html`,interactive_page_en:`docs/showcases/cases/0627-overnight-pr-batch.en.html`,localized_pages:{zh:`docs/showcases/cases/0627-overnight-pr-batch.html`,en:`docs/showcases/cases/0627-overnight-pr-batch.en.html`},showcase_rank:4,showcase_table:{proof_point:`High-throughput multi-lane work can remain PR-sized, reviewable, and merge-safe.`,loopx_intervention:`todo claim, review packet, self-merge boundary, focused smoke, public-boundary scan`},frontend_card:{visual_metaphor:`parallel PR lanes converge into a reviewable merge rail`,primary_metric_hint:`22 reviewable merged commits, including 10 PR-numbered commits, landed inside a 10h public evidence window.`,badges:[`PR batch`,`review packet`,`public boundary`],story_beats:[`keep work broken into PR-sized slices instead of a giant unreviewable diff`,`tie runtime, docs, and focused smoke updates together when a control-plane contract changes`,`limit self-merge to narrow validated changes while preserving broader review gates`,`record public evidence from Git history instead of raw agent logs or private screenshots`]},evidence_metrics:[{value:`22`,labels:{zh:`可审阅 merged commits`,en:`reviewable merged commits`}},{value:`10`,labels:{zh:`带 PR 编号的 commits`,en:`PR-numbered commits`}},{value:`10h`,labels:{zh:`公开证据窗口`,en:`public evidence window`}},{value:`0`,labels:{zh:`raw agent logs 依赖`,en:`raw-agent-log dependency`}}]},{id:`2026-06-24-pr-issue-auto-fix`,date:`2026-06-24`,title:`PR issue automatic fix loop`,status:`public_safe_pattern_case`,case_type:`reproducible_demo`,evidence_strength:`public_safe_pattern`,case_page:`docs/showcases/cases/0624-pr-issue-auto-fix.md`,demo_command:null,domain:`issue-fix-workflow`,audience:[`operator`,`agent-platform-developer`,`open-source-maintainer`],pattern_tags:[`issue_fix_workflow`,`review_feedback`,`repro_smoke`,`command_pack`,`successor_todo`],headline:`Review feedback should become an ordered repair workflow with repro, fix, validation, and reviewer handoff.`,problem:`PR comments and issues are often concrete enough to fix, but unsafe to feed into an agent as unstructured prompt text without routing, repro, and validation.`,loopx_behavior:[`classify the issue or review feedback`,`create ordered repair todos`,`keep gated source reads explicit`,`separate repro, implementation, validation, and reviewer handoff`],user_value:`The operator can turn a PR issue into a controlled fix loop without manually rewriting the review comment as an agent plan.`,evidence_boundary:`Public-safe pattern case only; no private screenshots, raw gated issue bodies, internal review notes, local paths, raw logs, credentials, or unpublished repository artifacts.`,interactive_page:`docs/showcases/cases/0624-pr-issue-auto-fix.html`,interactive_page_zh:`docs/showcases/cases/0624-pr-issue-auto-fix.html`,interactive_page_en:`docs/showcases/cases/0624-pr-issue-auto-fix.en.html`,localized_pages:{zh:`docs/showcases/cases/0624-pr-issue-auto-fix.html`,en:`docs/showcases/cases/0624-pr-issue-auto-fix.en.html`},showcase_rank:5,showcase_table:{proof_point:`Issue and review feedback can enter an executable repair loop.`,loopx_intervention:`issue-fix workflow, command pack, repro smoke, PR review feedback`},frontend_card:{visual_metaphor:`issue feedback closes through repro, fix, validation, and review handoff`,primary_metric_hint:`Feedback becomes a five-stage repair loop with branch-ready fix evidence and reviewer handoff.`,badges:[`issue fix`,`repro smoke`,`PR review`],story_beats:[`classify the issue or review feedback`,`create ordered repair todos`,`keep gated source reads explicit`,`separate repro, implementation, validation, and reviewer handoff`]},evidence_metrics:[{value:`5`,labels:{zh:`修复闭环阶段`,en:`repair-loop stages`}},{value:`1`,labels:{zh:`branch-ready 修复包`,en:`branch-ready fix packet`}},{value:`1`,labels:{zh:`review handoff 保留`,en:`review handoff preserved`}},{value:`0`,labels:{zh:`公开 artifact 中 raw issue body`,en:`raw issue bodies in public artifact`}}]},{id:`2026-06-23-agent-to-agent-pr-comments`,date:`2026-06-23`,title:`Agent-to-agent PR comment and fix loop`,status:`public_safe_pattern_case`,case_type:`reproducible_demo`,evidence_strength:`public_safe_pattern`,case_page:`docs/showcases/cases/0623-agent-to-agent-pr-comments.md`,demo_command:null,domain:`pull-request-review`,audience:[`operator`,`agent-platform-developer`,`open-source-maintainer`],pattern_tags:[`agent_to_agent_handoff`,`pr_comment_loop`,`review_packet`,`claimed_todo`,`successor_todo`],headline:`PR review feedback can become an owned agent todo with fix evidence instead of a loose chat reminder.`,problem:`Multiple agent lanes can see or act on the same PR feedback, but without ownership and handoff state the comment-to-fix loop becomes hard to audit.`,loopx_behavior:[`turn review feedback into a claimed todo`,`route implementation through the owning agent lane`,`record fix and validation evidence in the review packet`,`keep successor work explicit after the comment is handled`],user_value:`The operator can let agents coordinate around PR comments without losing final review visibility or fix evidence.`,evidence_boundary:`Public-safe pattern case only; no private screenshots, raw chats, internal review notes, local state, credentials, or unpublished artifacts.`,interactive_page:`docs/showcases/cases/0623-agent-to-agent-pr-comments.html`,interactive_page_zh:`docs/showcases/cases/0623-agent-to-agent-pr-comments.html`,interactive_page_en:`docs/showcases/cases/0623-agent-to-agent-pr-comments.en.html`,localized_pages:{zh:`docs/showcases/cases/0623-agent-to-agent-pr-comments.html`,en:`docs/showcases/cases/0623-agent-to-agent-pr-comments.en.html`},showcase_rank:6,showcase_table:{proof_point:`Multiple agents can coordinate around PR review comments without losing owner review.`,loopx_intervention:`claimed_by, handoff gate, review packet, comment/fix loop`},frontend_card:{visual_metaphor:`agent comments pass through explicit ownership instead of loose threads`,primary_metric_hint:`Every PR feedback item gets an owner, fix evidence, and a visible reviewer handoff instead of becoming a loose reminder.`,badges:[`handoff`,`PR comment`,`claimed_by`],story_beats:[`turn review feedback into a claimed todo`,`route implementation through the owning agent lane`,`record fix and validation evidence in the review packet`,`keep successor work explicit after the comment is handled`]},evidence_metrics:[{value:`1`,labels:{zh:`每条反馈一个 owner`,en:`owner per feedback item`}},{value:`3`,labels:{zh:`owner/fix/review 可回答问题`,en:`owner/fix/review questions answered`}},{value:`1`,labels:{zh:`review packet handoff`,en:`review-packet handoff`}},{value:`0`,labels:{zh:`无主 PR comment reminder`,en:`unowned PR comment reminders`}}]},{id:`2026-06-23-overnight-project-refactor`,date:`2026-06-23`,title:`Overnight project refactor as PR-sized slices`,status:`public_safe_pattern_case`,case_type:`creator_dogfooding`,evidence_strength:`public_safe_pattern`,case_page:`docs/showcases/cases/0623-overnight-project-refactor.md`,demo_command:null,domain:`repository-refactor`,audience:[`operator`,`agent-platform-developer`,`technical-lead`],pattern_tags:[`long_unattended_goal`,`pr_sized_slices`,`todo_follow_up`,`supersede`,`validation_writeback`],headline:`A broad refactor can run overnight while staying split into human-sized review units.`,problem:`Autonomous refactors become risky when discoveries, stale tasks, cleanup, and behavior changes collapse into one broad diff.`,loopx_behavior:[`keep the current refactor slice explicit`,`convert discoveries into follow-up todos`,`supersede stale tasks when the route changes`,`validate each slice before merge or handoff`],user_value:`The operator can wake up to reviewable PR-sized refactor slices instead of a single giant autonomous diff.`,evidence_boundary:`Public-safe pattern case only; no private screenshots, raw chats, internal planning notes, local paths, credentials, raw logs, or unpublished project artifacts.`,interactive_page:`docs/showcases/cases/0623-overnight-project-refactor.html`,interactive_page_zh:`docs/showcases/cases/0623-overnight-project-refactor.html`,interactive_page_en:`docs/showcases/cases/0623-overnight-project-refactor.en.html`,localized_pages:{zh:`docs/showcases/cases/0623-overnight-project-refactor.html`,en:`docs/showcases/cases/0623-overnight-project-refactor.en.html`},showcase_rank:7,showcase_table:{proof_point:`Long unattended refactors can split into moderate PR slices instead of one unreviewable diff.`,loopx_intervention:`loop, todo follow-up, supersede, PR-sized slices`},frontend_card:{visual_metaphor:`a large refactor moves as small reviewable packets`,primary_metric_hint:`Unattended refactors stay reviewable by landing one PR-sized slice at a time with follow-up and review gates.`,badges:[`refactor`,`PR slices`,`todo evidence`],story_beats:[`keep the current refactor slice explicit`,`convert discoveries into follow-up todos`,`supersede stale tasks when the route changes`,`validate each slice before merge or handoff`]},evidence_metrics:[{value:`1`,labels:{zh:`一次一个 PR-sized slice`,en:`PR-sized slice at a time`}},{value:`3`,labels:{zh:`successor/supersede/handoff 路线`,en:`successor/supersede/handoff routes`}},{value:`1`,labels:{zh:`宽风险 review gate`,en:`review gate for broad risk`}},{value:`0`,labels:{zh:`巨型 diff 目标`,en:`giant-diff target`}}]},{id:`2026-06-19-dynamic-workflow-hardware-agent`,date:`2026-06-19`,title:`Dynamic workflow for hardware-agent development`,status:`public_safe_interactive_case`,case_type:`contributor_case`,evidence_strength:`public_interactive_case`,case_page:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.md`,interactive_page:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.html`,demo_command:null,domain:`hardware-agent-development`,audience:[`agent-platform-developer`,`technical-lead`,`open-source-user`],pattern_tags:[`dynamic_workflow`,`multi_agent_coordination`,`shared_control_plane`,`long_unattended_goal`,`convergence`],headline:`A fuzzy long-running engineering goal needs a shared control plane when multiple worker agents participate.`,problem:`Specialized engineering work can require multiple agents to split work and converge without losing ownership or state.`,loopx_behavior:[`keep durable goal state outside any one chat thread`,`make ownership, quota, and evidence writeback explicit`,`let script-generated worker loops continue only after bounded validation`,`project convergence state and human gates for the operator`],user_value:`A contributor-approved public artifact shows how one control plane can coordinate Claude Code, generated scripts, and hardware-agent workers across five long-running engineering cases.`,evidence_boundary:`Public-safe interactive artifact; no raw chats, screenshots, proprietary design details, private repositories, local paths, task ids, credentials, or unpublished hardware artifacts.`,frontend_card:{visual_metaphor:`multiple worker lanes converging through one shared control plane`,primary_metric_hint:`5 public-safe hardware workflows demonstrate multi-worker convergence while proprietary details stay out of the artifact.`,badges:[`interactive-html`,`multi-agent`,`hardware`],story_beats:[`LoopX owns goal state, quota, todos, claims, evidence, and history`,`Claude Code writes task-specific orchestration scripts under that contract`,`hardware-agent workers perform bounded RTL, simulation, and validation work`,`five public cases show closed tasks, DSE, flagship Fmax optimization, and convergence floors`]},interactive_page_zh:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.html`,interactive_page_en:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.en.html`,localized_pages:{zh:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.html`,en:`docs/showcases/cases/0619-dynamic-workflow-hardware-agent.en.html`},showcase_rank:8,showcase_table:{proof_point:`Fuzzy goals, multiple workers, and long unattended runs can still converge.`,loopx_intervention:`goal state, worker handoff, dynamic workflow`},evidence_metrics:[{value:`5`,labels:{zh:`公开安全硬件 workflow`,en:`public-safe hardware workflows`}},{value:`3`,labels:{zh:`LoopX/编排/worker 角色分离`,en:`LoopX/orchestrator/worker role split`}},{value:`1`,labels:{zh:`canonical artifact 保留`,en:`canonical artifact preserved`}},{value:`0`,labels:{zh:`专有设计细节暴露`,en:`proprietary design details exposed`}}]},{id:`2026-06-19-loopx-self-iteration`,date:`2026-06-19`,title:`LoopX self-iteration loop`,status:`public_evidence_case`,case_type:`creator_dogfooding`,evidence_strength:`public_git_evidence`,case_page:`docs/showcases/cases/0619-loopx-self-iteration.md`,demo_command:null,domain:`agent-platform-self-improvement`,audience:[`open-source-user`,`agent-platform-developer`,`technical-lead`],pattern_tags:[`self_iteration`,`peer_claim_scope`,`todo_claim_ownership`,`identity_aware_prompt`,`self_merge_policy`,`evidence_writeback`,`efficiency_evidence_model`],headline:`A high-churn LoopX repo stayed legible while benchmark, product, docs, planning, and peer lanes moved in parallel.`,problem:`A long-running agent engineering repo needed to keep many public commits, benchmark routes, planning lanes, user gates, docs, smokes, and peer changes reviewable without relying on private chat memory.`,loopx_behavior:[`preserve durable goal, todo, gate, quota, evidence, and run-history state across high repository churn`,`separate benchmark, productization, documentation, planning, and peer lanes into reviewable obligations`,`register peer identities and project advisory scope through automation prompts`,`claim and complete scoped todos with public-safe evidence`,`allow small validated peer self-merges while requiring explicit review handoff for risky work`,`keep public showcases and smokes free of private chat, internal docs, raw trajectories, and raw benchmark evidence`],user_value:`The operator can let a fast-moving multi-lane agent project continue across benchmark, product, docs, and peer work while keeping ownership, gates, validation, follow-up, and conservative efficiency evidence visible in one shared control plane.`,workload_signal:{anchor_commit:`86d6d9d`,scope:`whole_public_repository`,whole_repository:{commit_count:801,files_touched:570,insertions:265703,deletions:49895},recent_window:{since:`2026-06-18T00:00:00+08:00`,commit_count:244,files_touched:216,insertions:52898,deletions:20935},public_window:{from:`2026-05-31T22:57:55+08:00`,to:`2026-06-20T12:18:42+08:00`,calendar_days:19.6,active_commit_days:16},efficiency_model:{baseline:`AI-coding-assisted product process`,estimated_developer_days:{low:59,high:92},single_engineer_calendar_compression:{low:3,high:4.7},two_person_team_calendar_compression:{low:1.8,high:3.2},claim_boundary:`directional, maturity-adjusted, public Git evidence only`},main_surfaces:[`CLI`,`todo lifecycle`,`status and quota projection`,`heartbeat prompt`,`dashboard/status server`,`benchmark adapters`,`frontstage projection`,`docs`,`smokes`,`showcases`,`product positioning`]},feature_points:[`benchmark and adapter maturation`,`control-plane correctness for quota, gates, todo projection, and outcome-floor blockers`,`planning and dreaming lane separation`,`user/operator surfaces including diagnostics, dashboard framing, onboarding, quickstart, README, and showcases`,`registered todo claim ownership and identity-aware scoped heartbeat prompts`,`peer self-merge completion flag with evidence`,`public-boundary smokes and showcase catalog checks`,`conservative efficiency evidence model that converts commits into maturity-adjusted product requirement clusters`],evidence_boundary:`Public Git evidence only; no private thread text, local active-state bodies, internal document links, screenshots, raw benchmark material, credentials, or machine-specific paths.`,frontend_card:{visual_metaphor:`many repo lanes flowing through one control plane, with independently claimed peer lanes branching safely`,primary_metric_hint:`801 public commits, 244 recent commits, and a conservative 59-92 AI-assisted developer-day baseline show self-iteration throughput.`,badges:[`self-iteration`,`commit-backed`,`peer-agent`,`efficiency-model`],story_beats:[`whole repo moves quickly across benchmark, runtime, docs, dashboard, planning, and smoke surfaces`,`LoopX keeps durable goals, todos, gates, quota, evidence, and run history visible`,`one peer lane progresses beside a separately claimed benchmark lane`,`validated peer changes can self-merge while risky work uses explicit review handoff`,`public Git history is converted into conservative product requirement clusters`,`public docs and smokes turn the experience into a reusable case`]},interactive_page:`docs/showcases/cases/0619-loopx-self-iteration.html`,interactive_page_zh:`docs/showcases/cases/0619-loopx-self-iteration.html`,interactive_page_en:`docs/showcases/cases/0619-loopx-self-iteration.en.html`,localized_pages:{zh:`docs/showcases/cases/0619-loopx-self-iteration.html`,en:`docs/showcases/cases/0619-loopx-self-iteration.en.html`},showcase_rank:9,showcase_table:{proof_point:`A high-churn multi-lane project can keep state, boundaries, and evidence coherent.`,loopx_intervention:`todo, quota, gate, evidence, review packet, frontstage`},evidence_metrics:[{value:`801`,labels:{zh:`public commits`,en:`public commits`}},{value:`244`,labels:{zh:`06-18 后 commits`,en:`commits since Jun 18`}},{value:`59-92d`,labels:{zh:`AI-assisted baseline`,en:`AI-assisted baseline`}},{value:`3.0-4.7x`,labels:{zh:`calendar compression`,en:`calendar compression`}}]},{id:`2026-06-17-blocked-p0-safe-rotation`,date:`2026-06-17`,title:`Blocked P0 with safe P1/P2 rotation`,status:`reproducible_synthetic_demo`,case_type:`reproducible_demo`,evidence_strength:`reproducible_synthetic_demo`,case_page:`docs/showcases/cases/0617-blocked-p0-safe-rotation.md`,demo_command:`python3 examples/showcase-0617-blocked-p0-safe-rotation-smoke.py`,domain:`benchmark-rotation`,audience:[`operator`,`agent-platform-developer`,`benchmark-developer`],pattern_tags:[`blocked_priority_fallback`,`concrete_user_gate`,`safe_fallback_work`,`quota_discipline`,`attention_reduction`],headline:`A gated P0 lane should not stall a whole long-running goal when safe fallback work exists.`,problem:`A benchmark lane needed a large local dependency before it could continue, while other no-upload benchmark work remained safe.`,loopx_behavior:[`surface the P0 dependency as a concrete user gate`,`avoid spending on the gated lane`,`select a non-dependent fallback lane`,`record both the blocker and the fallback reason`],user_value:`The operator sees exactly what decision is needed while the agent can keep making bounded progress elsewhere.`,evidence_boundary:`Synthetic public fixture only; no private screenshots, raw tasks, internal links, local image names, or raw run logs.`,frontend_card:{visual_metaphor:`priority lanes with one gated lane and one active fallback lane`,primary_metric_hint:`One concrete P0 user decision is isolated while one safe fallback lane can continue with zero gated-lane spend.`,badges:[`reproducible`,`user-gate`,`fallback`],story_beats:[`P0 lane is blocked by a user decision`,`LoopX projects the decision as a user todo`,`agent continues safe fallback work`,`state records blocker, fallback, validation, and spend policy`]},interactive_page:`docs/showcases/cases/0617-blocked-p0-safe-rotation.html`,interactive_page_zh:`docs/showcases/cases/0617-blocked-p0-safe-rotation.html`,interactive_page_en:`docs/showcases/cases/0617-blocked-p0-safe-rotation.en.html`,localized_pages:{zh:`docs/showcases/cases/0617-blocked-p0-safe-rotation.html`,en:`docs/showcases/cases/0617-blocked-p0-safe-rotation.en.html`},showcase_rank:10,showcase_table:{proof_point:`A user decision should not block all safe work.`,loopx_intervention:`concrete user todo, safe fallback, quota control`},evidence_metrics:[{value:`1`,labels:{zh:`具体 P0 用户决策`,en:`concrete P0 user decision`}},{value:`1`,labels:{zh:`safe fallback lane`,en:`safe fallback lane`}},{value:`0`,labels:{zh:`gated lane 自动推进`,en:`gated-lane auto-progress`}},{value:`0`,labels:{zh:`private upload 依赖`,en:`private upload dependency`}}]},{id:`2026-09-dsh-loopx-replan`,date:`2026-09`,title:`DSH × LoopX Replan`,status:`reproducible_synthetic_demo`,case_type:`reproducible_demo`,evidence_strength:`real_recording_with_reproducible_fixture`,case_page:`docs/showcases/cases/dsh-loopx-replan-demo.md`,demo_command:`python3 examples/dsh-loopx-demo-smoke.py`,recording_path:`docs/assets/showcases/dsh-loopx/dsh-loopx-quickstart-replan.mp4`,page_assets:`shared`,domain:`agent-host-integration`,audience:[`DSH user`,`agent-platform-developer`,`long-running-agent-operator`],pattern_tags:[`deepseek_harness`,`native_skill_activation`,`vision_replan`,`decision_evidence`,`goalbar_closeout`],headline:`A real DSH session changes a logging-library decision after a serverless constraint while preserving the original evidence and successor work.`,problem:`A new material constraint can invalidate an agent's earlier decision, but ordinary chat correction can erase why the plan changed and what still needs validation.`,loopx_behavior:[`activate explicitly through the native DSH skill picker`,`retain the initial decision and evidence`,`record a Replan when the serverless constraint changes the ranking`,`bind successor implementation and tests to the same durable Goal`,`close the visible GoalBar only after the revised work settles`],user_value:`The user can change a material constraint without losing the decision trail, while DSH remains the execution host and LoopX keeps the work frontier visible.`,evidence_assets:[{path:`docs/assets/showcases/dsh-loopx/dsh-loopx-cover.png`,alt:`DSH × LoopX demo cover showing explicit skill activation, durable work, and a real Replan from Pino to Roarr`,caption:`Public cover derived from the edited DSH recording; the linked case provides the video, fixture, and evidence boundary.`}],evidence_boundary:`Edited real DSH recording plus a synthetic public fixture and tests; credentials, provider configuration, raw reasoning, setup retries, local LoopX state, and the unedited recording are excluded.`,frontend_card:{visual_metaphor:`one visible DSH Goal changes route while its earlier decision remains connected to the evidence`,primary_metric_hint:`One recorded Replan changes 12 packages to 4 and closes 3/3 tests with GoalBar 2/2.`,badges:[`DSH`,`real recording`,`reproducible`],story_beats:[`the user selects the LoopX skill inside DSH`,`the agent initially chooses Pino`,`a serverless constraint triggers an explicit Replan to Roarr`,`the revised CLI passes three behavior tests and closes two Todos`]},localized_pages:{zh:`docs/showcases/cases/dsh-loopx-replan-demo.html`,en:`docs/showcases/cases/dsh-loopx-replan-demo.en.html`},localizations:{zh:{title:`DSH × LoopX:约束变化后的显式 Replan`,headline:`真实 DSH 会话在新增 serverless 约束后修正日志库决策,同时保留原始证据和后继工作。`,proof_point:`宿主原生 Agent 可以改变计划,同时保留旧计划为何被替代的证据。`,loopx_intervention:`原生 Skill 激活、Replan、后继 Todo、证据与 GoalBar`,problem:`新的关键约束可能推翻 Agent 的旧决策;普通聊天修正容易抹掉计划为什么变化、后续还需验证什么。`,loopx_behavior:[`在 DSH 技能选择器中显式激活 loopx`,`保留初始决策和证据`,`serverless 约束改变排序时记录 Replan`,`把后继实现与测试绑定到同一个持久 Goal`,`修订后的工作完成后才关闭可见 GoalBar`],user_value:`用户可以改变关键约束而不丢失决策链;DSH 继续负责执行,LoopX 让工作前沿持续可见。`,evidence_boundary:`经编辑的真实 DSH 录屏,加上合成的公开 fixture 与测试;不包含凭证、provider 配置、原始推理、安装重试、本地 LoopX 状态或未剪辑录屏。`}},showcase_rank:11,showcase_table:{proof_point:`A host-native agent can change plans without erasing why the old plan was superseded.`,loopx_intervention:`native skill activation, Replan, successor Todo, evidence, GoalBar`},evidence_metrics:[{value:`60s`,labels:{zh:`真实录屏`,en:`real recording`}},{value:`12→4`,labels:{zh:`依赖包数量`,en:`dependency packages`}},{value:`3/3`,labels:{zh:`行为测试`,en:`behavior tests`}},{value:`2/2`,labels:{zh:`GoalBar Todo`,en:`GoalBar Todos`}}],interactive_page:`docs/showcases/cases/dsh-loopx-replan-demo.html`,interactive_page_zh:`docs/showcases/cases/dsh-loopx-replan-demo.html`,interactive_page_en:`docs/showcases/cases/dsh-loopx-replan-demo.en.html`},{id:`2026-06-20-creator-operator-case-spec`,date:`2026-06-20`,title:`Creator-operator long-running agent case`,status:`public_safe_case_spec`,case_type:`reproducible_demo`,evidence_strength:`public_safe_case_spec`,case_page:`docs/showcases/cases/0620-creator-operator-case-spec.md`,demo_command:null,storyboard_path:`docs/showcases/creator-ops-fake-data-storyboard.md`,feedback_contract_path:`docs/showcases/creator-ops-feedback-boundary-contract.md`,domain:`creator-operations`,audience:[`non-technical-operator`,`creator-operator`,`product-builder`,`open-source-user`],pattern_tags:[`creator_operator_workflow`,`gate_aware_continuation`,`feedback_capture`,`safe_side_path`,`material_library`,`synthetic_case`],headline:`A creator-operator needs a long-running agent loop that keeps research moving while publishing decisions stay gated.`,problem:`Content research, preference mapping, insight extraction, draft queues, and material libraries can all blur together when the user only sees chat logs or raw agent traces.`,loopx_behavior:[`represent the creative objective as durable goal state`,`separate publishing decisions from safe research and organization work`,`turn feedback into preference hints, gate decisions, todo updates, or boundary corrections`,`keep synthetic/public material separate from private notes and unpublished drafts`,`show the next agent move before another automatic run spends compute`],user_value:`A non-technical operator can see what changed, what is blocked, what can safely continue, and how feedback changes the plan without reading prompts, logs, or raw traces.`,evidence_boundary:`Synthetic case spec only; no real platform data, creator notes, screenshots, private drafts, raw browsing traces, local paths, credentials, or performance claims.`,appendix_surface:{reason:`Synthetic product-direction spec; keep as appendix until real public evidence or an approved public-safe user story exists.`,public_surface:`appendix_only`,links:[`docs/showcases/creator-ops-fake-data-storyboard.md`,`docs/showcases/creator-ops-feedback-boundary-contract.md`]},interactive_page:`docs/showcases/cases/0620-creator-operator-case-spec.html`,interactive_page_zh:`docs/showcases/cases/0620-creator-operator-case-spec.html`,interactive_page_en:`docs/showcases/cases/0620-creator-operator-case-spec.en.html`,localized_pages:{zh:`docs/showcases/cases/0620-creator-operator-case-spec.html`,en:`docs/showcases/cases/0620-creator-operator-case-spec.en.html`},evidence_metrics:[{value:`1`,labels:{zh:`publish hard gate`,en:`publish hard gate`}},{value:`1`,labels:{zh:`safe research side path`,en:`safe research side path`}},{value:`0`,labels:{zh:`autopublish 动作`,en:`autopublish actions`}},{value:`0`,labels:{zh:`真实运营数据暴露`,en:`real operations data exposed`}}]}]},VC={schema_version:`frontstage_rollout_projection_bundle_v0`,bundle_id:`frontstage_public_rollout_projection_bundle_v0`,generated_at:`2026-06-27T21:18:00+08:00`,purpose:`Public-safe display projections for turning rollout and trajectory evidence into reusable frontstage visuals.`,truth_contract:{projection_is_writable:!1,write_authority:`none`,evidence_floor:`public GitHub PR metadata and public Git history`,recompute_rule:`Regenerate projections from public event sources before treating them as current.`},public_boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1,private_material_body_recorded:!1},projection_model:{schema_version:`frontstage_rollout_projection_model_v0`,description:`A projection maps source evidence into metrics, actor/state stages, lanes, nodes, and edges. The frontstage renderer consumes this model without knowing whether the source was a PR batch, agent rollout, issue-fix loop, benchmark route, or long-running LoopX iteration.`,required_sections:[`metrics`,`stages`,`lanes`,`nodes`,`edges`],optional_rich_sections:[`timeline`,`rollout_sequence`,`mapping_layers`,`flow_signals`,`relationship_summaries`,`attention_hotspots`],node_contract:`Nodes are compact public-safe work units such as pull_request, event, todo, gate, validation, or artifact.`,edge_contract:`Edges are compact public-safe relationships such as review, followup, handoff, revert, validation, dependency, or successor.`},projections:[{projection_id:`overnight_pr_batch_20260627`,projection_kind:`pr_batch_rollout`,title:`Overnight PR batch with reviewable control`,scene:{scene_id:`scene_recent_pr_batch_review_mesh`,title:`Review mesh over a 30-PR public batch`,stage_label:`Multi-agent flow`,confidence:`observed_public_metadata`,explanation:`A generic rollout projection turns public PR metadata into a visible state graph: PR-sized slices move through runtime, product, benchmark, docs, and review lanes, then converge through validation and merge gates.`,why_current:`This is the first concrete projection instance after the PR #674 trajectory panel: it exercises the generic renderer with a larger public PR/review batch.`},source_contract:{claim_boundary:`Display projection only. Public GitHub PR metadata and public repository history are the evidence floor; raw logs, private chats, local state, and private planning material are excluded.`,anchor_node_id:`pr_674`,sample_window:`#746-#775`,next_projection_hint:`LoopX overall iteration should reuse this projection model instead of adding another bespoke panel.`},timeline:{timeline_id:`overnight_pr_wall_clock`,title:`Overnight wall-clock timeline`,axis_kind:`wall_clock`,window_label:`#746 -> #775 / 13:24-21:30 Asia/Shanghai`,unit_label:`PR nodes`,description:`The timeline is a wall-clock public-safe work-unit axis. This instance positions PR nodes by public GitHub createdAt and shows completedAt/duration on hover; other rollout projections can provide issue, todo, run, or trace timestamps.`,item_node_ids:`pr_746.pr_747.pr_748.pr_749.pr_750.pr_751.pr_752.pr_753.pr_754.pr_755.pr_756.pr_757.pr_758.pr_759.pr_760.pr_761.pr_762.pr_763.pr_764.pr_765.pr_766.pr_767.pr_768.pr_769.pr_770.pr_771.pr_772.pr_773.pr_774.pr_775`.split(`.`),timezone:`Asia/Shanghai`,start_at:`2026-06-27T13:24:51+08:00`,end_at:`2026-06-27T21:30:06+08:00`,time_basis:`node.started_at positions each work unit; node.completed_at and duration_label explain review/merge latency`,ticks:[{tick_id:`tick_1400`,label:`14:00`,at:`2026-06-27T14:00:00+08:00`},{tick_id:`tick_1500`,label:`15:00`,at:`2026-06-27T15:00:00+08:00`},{tick_id:`tick_1600`,label:`16:00`,at:`2026-06-27T16:00:00+08:00`},{tick_id:`tick_1700`,label:`17:00`,at:`2026-06-27T17:00:00+08:00`},{tick_id:`tick_1800`,label:`18:00`,at:`2026-06-27T18:00:00+08:00`},{tick_id:`tick_1900`,label:`19:00`,at:`2026-06-27T19:00:00+08:00`},{tick_id:`tick_2000`,label:`20:00`,at:`2026-06-27T20:00:00+08:00`},{tick_id:`tick_2100`,label:`21:00`,at:`2026-06-27T21:00:00+08:00`}]},mapping_layers:[{layer_id:`source_intake`,label:`Source intake`,role:`Evidence becomes objects`,description:`Public PR metadata is reduced into compact work-unit facts without importing raw chats, local state, or private traces.`,input:`public PR metadata`,output:`32 public nodes`,tone:`info`,node_ids:`pr_674.pr_745.pr_746.pr_747.pr_748.pr_749.pr_750.pr_751.pr_752.pr_753.pr_754.pr_755.pr_756.pr_757.pr_758.pr_759.pr_760.pr_761.pr_762.pr_763.pr_764.pr_765.pr_766.pr_767.pr_768.pr_769.pr_770.pr_771.pr_772.pr_773.pr_774.pr_775`.split(`.`),edge_ids:[]},{layer_id:`state_projection`,label:`State projection`,role:`Nodes gain lifecycle meaning`,description:`Each work unit is mapped onto claim, plan, edit, validate, review, and resume stages so a single agent's progress is visible.`,input:`nodes + public states`,output:`6 actor/state stages`,tone:`success`,node_ids:[`pr_747`,`pr_754`,`pr_759`,`pr_764`,`pr_774`,`pr_775`],edge_ids:[]},{layer_id:`lane_routing`,label:`Lane routing`,role:`Work becomes parallel lanes`,description:`The same nodes are grouped into runtime, product, benchmark, docs, and open-review lanes so multi-agent flow is legible.`,input:`node scopes`,output:`5 lanes`,tone:`neutral`,node_ids:[`pr_747`,`pr_754`,`pr_750`,`pr_749`,`pr_751`],edge_ids:[]},{layer_id:`edge_reasoning`,label:`Edge reasoning`,role:`Relationships explain motion`,description:`Review, revert, validation, CLI, automation, and runtime followups form a mesh that explains why the next slice exists.`,input:`public PR relationships`,output:`10 explainable edges`,tone:`warning`,node_ids:[`pr_674`,`pr_752`,`pr_753`,`pr_759`,`pr_761`,`pr_764`,`pr_765`,`pr_766`,`pr_773`,`pr_774`],edge_ids:[`edge_trajectory_anchor_to_v2`,`edge_gallery_revert_review`,`edge_monitor_watch_to_due`,`edge_monitor_due_to_writeback`,`edge_monitor_writeback_to_smoke`,`edge_monitor_smoke_to_metadata`,`edge_command_onboarding_to_review`]},{layer_id:`operator_readout`,label:`Operator readout`,role:`Display supports decisions`,description:`The renderer highlights merged throughput, open review, follow-up chains, and the next reusable projection target.`,input:`metrics + stages + lanes + edges`,output:`reviewable frontstage story`,tone:`info`,node_ids:[`pr_775`,`pr_766`,`pr_765`,`pr_751`],edge_ids:[`edge_trajectory_anchor_to_v2`,`edge_monitor_smoke_to_metadata`,`edge_command_onboarding_to_review`]}],flow_signals:[{signal_id:`throughput`,label:`Throughput`,value:`29 merged`,description:`Nearly the whole public batch landed during the visible wall-clock window.`,tone:`success`,source_node_ids:[`pr_747`,`pr_754`,`pr_759`,`pr_764`,`pr_774`]},{signal_id:`active_review`,label:`Review resolution`,value:`1 unmerged`,description:`The projection keeps the closed/non-merged branch visible as a review outcome instead of hiding it.`,tone:`warning`,source_node_ids:[`pr_751`,`pr_765`,`pr_766`,`pr_775`]},{signal_id:`cross_lane_edges`,label:`Cross-lane edges`,value:`7 chains`,description:`Relationships cross product, runtime, docs, and benchmark lanes.`,tone:`info`,source_node_ids:[`pr_752`,`pr_753`,`pr_759`,`pr_761`,`pr_764`,`pr_765`,`pr_766`,`pr_773`,`pr_774`]},{signal_id:`reusable_model`,label:`Reusable model`,value:`5 sections`,description:`The same renderer can later map issue-fix, content ops, benchmark, or LoopX iteration rollouts.`,tone:`neutral`,source_node_ids:[`pr_674`,`pr_775`]}],relationship_summaries:[{kind:`runtime_followup`,count:2,label:`Monitor/runtime chain`,description:`Watch routing moves into due selection and poll writeback.`},{kind:`validation_followup`,count:1,label:`Validation chain`,description:`Runtime API work is followed by smoke coverage.`},{kind:`showcase_followup`,count:2,label:`Showcase chain`,description:`Public cases become pages and then a canonical showcase path.`},{kind:`review_revert`,count:1,label:`Review correction`,description:`A public surface review creates a fast revert slice.`},{kind:`review_command_followup`,count:1,label:`Command loop`,description:`Newcomer command path feeds an explicit PR review command.`}],attention_hotspots:[{hotspot_id:`open_runtime_chain`,label:`Runtime chain resolved`,severity:`low`,description:`Monitor scheduler smoke and CLI metadata moved through review and merge; the chain remains visible as a completed follow-up path.`,node_ids:[`pr_765`,`pr_766`],edge_ids:[`edge_monitor_writeback_to_smoke`,`edge_monitor_smoke_to_metadata`]},{hotspot_id:`adapter_review`,label:`Adapter review resolved`,severity:`low`,description:`The memory adapter contract also merged later in the same wall-clock window, showing how a long review branch rejoins the batch.`,node_ids:[`pr_751`],edge_ids:[]},{hotspot_id:`projection_next`,label:`Next projection target`,severity:`low`,description:`After this PR batch projection is accepted, LoopX overall iteration can reuse the same renderer.`,node_ids:[`pr_674`,`pr_775`],edge_ids:[`edge_trajectory_anchor_to_v2`]}],rollout_sequence:{sequence_id:`overnight_requirement_rollout_spine`,title:`Requirement rollout spine`,description:`One demand unlocks the next: each requirement becomes a reviewable slice, validates against the public boundary, and leaves the next requirement visible.`,units:[{unit_id:`req_frontstage_projection`,order:1,requirement:`Show frontstage trajectory as a reusable projection`,triggered_by:`owner presentation need`,outcome:`PR #674 anchors the trajectory panel.`,state:`merged`,lane_id:`product_frontstage`,node_ids:[`pr_674`],unlocks:[`req_public_showcase_case_set`],stage_steps:[{step_id:`intake`,label:`Intake`,status:`done`,node_ids:[`pr_674`]},{step_id:`panel`,label:`Panel`,status:`done`,node_ids:[`pr_674`]},{step_id:`review`,label:`Review`,status:`done`,node_ids:[`pr_674`]}]},{unit_id:`req_public_showcase_case_set`,order:2,requirement:`Turn reusable cases into public showcase pages`,triggered_by:`frontstage needs inspectable examples`,outcome:`Case set, showcase pages, and canonical path landed.`,state:`merged`,lane_id:`public_docs_showcase`,node_ids:[`pr_745`,`pr_752`,`pr_753`,`pr_756`,`pr_771`],unlocks:[`req_update_notes_loop`],stage_steps:[{step_id:`case_set`,label:`Case set`,status:`done`,node_ids:[`pr_745`]},{step_id:`pages`,label:`Pages`,status:`done`,node_ids:[`pr_756`]},{step_id:`surface_review`,label:`Surface review`,status:`done`,node_ids:[`pr_752`,`pr_753`]},{step_id:`canonical`,label:`Canonical path`,status:`done`,node_ids:[`pr_771`]}]},{unit_id:`req_update_notes_loop`,order:3,requirement:`Publish biweekly update notes without relying on memory`,triggered_by:`operator wants durable product rhythm`,outcome:`Archive plus draft PR automation are now visible.`,state:`merged`,lane_id:`product_frontstage`,node_ids:[`pr_754`,`pr_758`],unlocks:[`req_monitor_scheduler_due_work`],stage_steps:[{step_id:`archive`,label:`Archive`,status:`done`,node_ids:[`pr_754`]},{step_id:`automation`,label:`Draft PR job`,status:`done`,node_ids:[`pr_758`]},{step_id:`monitor`,label:`Monitor hook`,status:`done`,node_ids:[`pr_758`]}]},{unit_id:`req_monitor_scheduler_due_work`,order:4,requirement:`Monitor tasks become due work instead of hidden polling`,triggered_by:`continuous monitors need explicit cadence`,outcome:`Watch routing, due selection, and writeback landed; smoke and CLI metadata remain open.`,state:`open`,lane_id:`kernel_runtime`,node_ids:[`pr_759`,`pr_761`,`pr_764`,`pr_765`,`pr_766`],unlocks:[`req_skillsbench_goal_start_bridge`],stage_steps:[{step_id:`watch_route`,label:`Watch route`,status:`done`,node_ids:[`pr_759`]},{step_id:`due_select`,label:`Due select`,status:`done`,node_ids:[`pr_761`]},{step_id:`writeback`,label:`Writeback`,status:`done`,node_ids:[`pr_764`]},{step_id:`smoke`,label:`Smoke`,status:`active`,node_ids:[`pr_765`]},{step_id:`metadata`,label:`CLI metadata`,status:`active`,node_ids:[`pr_766`]}]},{unit_id:`req_skillsbench_goal_start_bridge`,order:5,requirement:`Keep goal-start benchmark routing attributed while product work evolves`,triggered_by:`solver lifecycle needs a stable bridge`,outcome:`Goal-start bridge, closeout attribution, watchdog, and ledger updates landed.`,state:`merged`,lane_id:`benchmark_interface`,node_ids:[`pr_750`,`pr_755`,`pr_757`,`pr_760`,`pr_762`,`pr_767`,`pr_770`,`pr_772`],unlocks:[`req_command_review_loop`],stage_steps:[{step_id:`preserve`,label:`Preserve metadata`,status:`done`,node_ids:[`pr_750`]},{step_id:`host_shape`,label:`Host shape`,status:`done`,node_ids:[`pr_755`]},{step_id:`watchdog`,label:`Watchdog`,status:`done`,node_ids:[`pr_760`]},{step_id:`ledger`,label:`Ledger`,status:`done`,node_ids:[`pr_762`,`pr_767`]},{step_id:`bootstrap`,label:`Bootstrap`,status:`done`,node_ids:[`pr_770`,`pr_772`]}]},{unit_id:`req_command_review_loop`,order:6,requirement:`Let users drive review and newcomer commands explicitly`,triggered_by:`slash commands should be product entry points`,outcome:`Newcomer command path feeds an explicit PR review command.`,state:`merged`,lane_id:`product_frontstage`,node_ids:[`pr_773`,`pr_774`],unlocks:[`req_profile_handoff_route`],stage_steps:[{step_id:`newcomer_path`,label:`Newcomer path`,status:`done`,node_ids:[`pr_773`]},{step_id:`review_command`,label:`Review command`,status:`done`,node_ids:[`pr_774`]},{step_id:`feedback_loop`,label:`Feedback loop`,status:`done`,node_ids:[`pr_773`,`pr_774`]}]},{unit_id:`req_profile_handoff_route`,order:7,requirement:`Route explicit peer review handoffs by task policy instead of profile or prose`,triggered_by:`multi-agent rollout needs a clean next receiver`,outcome:`PR #775 keeps the open handoff route visible for review.`,state:`open`,lane_id:`kernel_runtime`,node_ids:[`pr_775`],unlocks:[],stage_steps:[{step_id:`handoff`,label:`Handoff`,status:`active`,node_ids:[`pr_775`]},{step_id:`route`,label:`Route`,status:`active`,node_ids:[`pr_775`]},{step_id:`review`,label:`Review`,status:`active`,node_ids:[`pr_775`]}]}]},metrics:[{metric_id:`public_sample`,label:`Public sample`,value:`30 PRs`,helper:`#746-#775`,tone:`info`},{metric_id:`merged`,label:`Merged`,value:`29`,helper:`public PR metadata`,tone:`success`},{metric_id:`open_review`,label:`Unmerged`,value:`1`,helper:`0 open / 1 closed`,tone:`warning`},{metric_id:`review_edges`,label:`Review edges`,value:`10`,helper:`follow-up relationships`,tone:`neutral`}],stages:[{stage_id:`claimed`,label:`Claim`,description:`Pick one scoped todo and reserve the lane.`,confidence:`observed`,actor_scope:`single_agent`,current:!1},{stage_id:`planning`,label:`Plan`,description:`Split the target into ordered public-safe slices.`,confidence:`observed`,actor_scope:`single_agent`,current:!1},{stage_id:`editing`,label:`Edit`,description:`Apply a narrow patch against one product or runtime surface.`,confidence:`observed`,actor_scope:`single_agent`,current:!1},{stage_id:`validating`,label:`Validate`,description:`Run focused smokes and boundary checks before writeback.`,confidence:`observed`,actor_scope:`single_agent`,current:!1},{stage_id:`reviewing`,label:`Review`,description:`Attach review packet, handoff, or self-merge decision.`,confidence:`observed_public_metadata`,actor_scope:`single_agent`,current:!0},{stage_id:`resuming`,label:`Resume`,description:`Use the next public todo or monitor due signal for the following loop.`,confidence:`inferred_high`,actor_scope:`single_agent`,current:!1}],lanes:[{lane_id:`kernel_runtime`,label:`Kernel runtime`,role:`product + runtime lane`,summary:`Status, quota, monitor, handoff, and todo projection contracts.`,node_ids:[`pr_747`,`pr_748`,`pr_759`,`pr_761`,`pr_764`,`pr_765`,`pr_766`,`pr_775`]},{lane_id:`product_frontstage`,label:`Product frontstage`,role:`product surface lane`,summary:`Public showcase pages, trajectory panels, command onboarding, and update notes.`,node_ids:[`pr_754`,`pr_756`,`pr_758`,`pr_769`,`pr_771`,`pr_773`,`pr_774`]},{lane_id:`benchmark_interface`,label:`Benchmark interface`,role:`benchmark contract lane`,summary:`Goal-start bridge, runner attribution, reducer preservation, and latest ledger updates.`,node_ids:[`pr_750`,`pr_755`,`pr_757`,`pr_760`,`pr_762`,`pr_767`,`pr_770`,`pr_772`]},{lane_id:`public_docs_showcase`,label:`Docs and showcase`,role:`evidence lane`,summary:`Public-safe case set, local agent launch protocol, release readiness, and adoption loop.`,node_ids:[`pr_749`,`pr_752`,`pr_753`,`pr_768`]},{lane_id:`open_review`,label:`Open review lane`,role:`open review lane`,summary:`Adapter and branch work that stays visible as a review gate.`,node_ids:[`pr_746`,`pr_751`,`pr_763`]}],nodes:[{node_id:`pr_674`,kind:`pull_request`,label:`#674`,title:`feat(dashboard): add frontstage trajectory analysis`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/674`,role:`anchor`,confidence:`observed_public_metadata`},{node_id:`pr_745`,kind:`pull_request`,label:`#745`,title:`Add public-safe showcase case set`,state:`merged`,lane_id:`public_docs_showcase`,url:`https://github.com/huangruiteng/loopx/pull/745`,role:`precursor`,confidence:`observed_public_metadata`},{node_id:`pr_775`,kind:`pull_request`,label:`#775`,title:`Fix task-scoped peer review handoff routing`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/775`,confidence:`observed_public_metadata`,started_at:`2026-06-27T20:50:03+08:00`,completed_at:`2026-06-27T21:23:04+08:00`,occurred_at:`2026-06-27T20:50:03+08:00`,display_time:`20:50 -> 21:23`,duration_label:`33m`,timezone:`Asia/Shanghai`},{node_id:`pr_774`,kind:`pull_request`,label:`#774`,title:`Add PR review slash command`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/774`,confidence:`observed_public_metadata`,started_at:`2026-06-27T20:47:10+08:00`,completed_at:`2026-06-27T21:12:31+08:00`,occurred_at:`2026-06-27T20:47:10+08:00`,display_time:`20:47 -> 21:12`,duration_label:`25m`,timezone:`Asia/Shanghai`},{node_id:`pr_773`,kind:`pull_request`,label:`#773`,title:`docs: add newcomer command path`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/773`,confidence:`observed_public_metadata`,started_at:`2026-06-27T19:58:53+08:00`,completed_at:`2026-06-27T20:31:10+08:00`,occurred_at:`2026-06-27T19:58:53+08:00`,display_time:`19:58 -> 20:31`,duration_label:`32m`,timezone:`Asia/Shanghai`},{node_id:`pr_772`,kind:`pull_request`,label:`#772`,title:`Bootstrap SkillsBench goal-start bridge before task`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/772`,confidence:`observed_public_metadata`,started_at:`2026-06-27T19:48:30+08:00`,completed_at:`2026-06-27T19:49:10+08:00`,occurred_at:`2026-06-27T19:48:30+08:00`,display_time:`19:48 -> 19:49`,duration_label:`40 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_771`,kind:`pull_request`,label:`#771`,title:`docs: add public showcase pages and experimental value path`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/771`,confidence:`observed_public_metadata`,started_at:`2026-06-27T19:45:25+08:00`,completed_at:`2026-06-27T21:07:26+08:00`,occurred_at:`2026-06-27T19:45:25+08:00`,display_time:`19:45 -> 21:07`,duration_label:`1h 22m`,timezone:`Asia/Shanghai`},{node_id:`pr_770`,kind:`pull_request`,label:`#770`,title:`Fix SkillsBench goal-start host-local attribution`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/770`,confidence:`observed_public_metadata`,started_at:`2026-06-27T19:31:35+08:00`,completed_at:`2026-06-27T19:34:32+08:00`,occurred_at:`2026-06-27T19:31:35+08:00`,display_time:`19:31 -> 19:34`,duration_label:`2m`,timezone:`Asia/Shanghai`},{node_id:`pr_769`,kind:`pull_request`,label:`#769`,title:`Add public adoption loop contract`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/769`,confidence:`observed_public_metadata`,started_at:`2026-06-27T19:10:17+08:00`,completed_at:`2026-06-27T19:10:57+08:00`,occurred_at:`2026-06-27T19:10:17+08:00`,display_time:`19:10 -> 19:10`,duration_label:`40 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_768`,kind:`pull_request`,label:`#768`,title:`Add release readiness mental model`,state:`merged`,lane_id:`public_docs_showcase`,url:`https://github.com/huangruiteng/loopx/pull/768`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:59:20+08:00`,completed_at:`2026-06-27T19:00:27+08:00`,occurred_at:`2026-06-27T18:59:20+08:00`,display_time:`18:59 -> 19:00`,duration_label:`1m`,timezone:`Asia/Shanghai`},{node_id:`pr_767`,kind:`pull_request`,label:`#767`,title:`Update SkillsBench goal-start ledger status`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/767`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:45:55+08:00`,completed_at:`2026-06-27T18:47:26+08:00`,occurred_at:`2026-06-27T18:45:55+08:00`,display_time:`18:45 -> 18:47`,duration_label:`1m`,timezone:`Asia/Shanghai`},{node_id:`pr_766`,kind:`pull_request`,label:`#766`,title:`Add monitor cadence todo CLI metadata`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/766`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:36:48+08:00`,completed_at:`2026-06-27T21:30:06+08:00`,occurred_at:`2026-06-27T18:36:48+08:00`,display_time:`18:36 -> 21:30`,duration_label:`2h 53m`,timezone:`Asia/Shanghai`},{node_id:`pr_765`,kind:`pull_request`,label:`#765`,title:`Add monitor scheduler smoke coverage`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/765`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:25:07+08:00`,completed_at:`2026-06-27T21:28:57+08:00`,occurred_at:`2026-06-27T18:25:07+08:00`,display_time:`18:25 -> 21:28`,duration_label:`3h 3m`,timezone:`Asia/Shanghai`},{node_id:`pr_764`,kind:`pull_request`,label:`#764`,title:`Add monitor-poll todo writeback API`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/764`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:17:16+08:00`,completed_at:`2026-06-27T18:17:56+08:00`,occurred_at:`2026-06-27T18:17:16+08:00`,display_time:`18:17 -> 18:17`,duration_label:`40 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_763`,kind:`pull_request`,label:`#763`,title:`Add monitor-poll todo writeback API`,state:`closed`,lane_id:`open_review`,url:`https://github.com/huangruiteng/loopx/pull/763`,confidence:`observed_public_metadata`,started_at:`2026-06-27T18:01:18+08:00`,completed_at:`2026-06-27T18:06:42+08:00`,occurred_at:`2026-06-27T18:01:18+08:00`,display_time:`18:01 -> 18:06`,duration_label:`5m`,timezone:`Asia/Shanghai`},{node_id:`pr_762`,kind:`pull_request`,label:`#762`,title:`Update SkillsBench latest case ledger`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/762`,confidence:`observed_public_metadata`,started_at:`2026-06-27T17:57:39+08:00`,completed_at:`2026-06-27T17:58:31+08:00`,occurred_at:`2026-06-27T17:57:39+08:00`,display_time:`17:57 -> 17:58`,duration_label:`52 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_761`,kind:`pull_request`,label:`#761`,title:`Add due monitor work-lane selection`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/761`,confidence:`observed_public_metadata`,started_at:`2026-06-27T17:45:10+08:00`,completed_at:`2026-06-27T18:06:40+08:00`,occurred_at:`2026-06-27T17:45:10+08:00`,display_time:`17:45 -> 18:06`,duration_label:`21m`,timezone:`Asia/Shanghai`},{node_id:`pr_760`,kind:`pull_request`,label:`#760`,title:`Fix SkillsBench goal-start first-action watchdog`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/760`,confidence:`observed_public_metadata`,started_at:`2026-06-27T17:27:43+08:00`,completed_at:`2026-06-27T17:28:29+08:00`,occurred_at:`2026-06-27T17:27:43+08:00`,display_time:`17:27 -> 17:28`,duration_label:`46 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_759`,kind:`pull_request`,label:`#759`,title:`Fix status watch routing for monitor classifications`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/759`,confidence:`observed_public_metadata`,started_at:`2026-06-27T17:02:53+08:00`,completed_at:`2026-06-27T17:22:49+08:00`,occurred_at:`2026-06-27T17:02:53+08:00`,display_time:`17:02 -> 17:22`,duration_label:`19m`,timezone:`Asia/Shanghai`},{node_id:`pr_758`,kind:`pull_request`,label:`#758`,title:`Add update notes draft PR automation`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/758`,confidence:`observed_public_metadata`,started_at:`2026-06-27T16:12:32+08:00`,completed_at:`2026-06-27T16:14:49+08:00`,occurred_at:`2026-06-27T16:12:32+08:00`,display_time:`16:12 -> 16:14`,duration_label:`2m`,timezone:`Asia/Shanghai`},{node_id:`pr_757`,kind:`pull_request`,label:`#757`,title:`Refine SkillsBench closeout attribution`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/757`,confidence:`observed_public_metadata`,started_at:`2026-06-27T16:07:09+08:00`,completed_at:`2026-06-27T16:07:40+08:00`,occurred_at:`2026-06-27T16:07:09+08:00`,display_time:`16:07 -> 16:07`,duration_label:`31 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_756`,kind:`pull_request`,label:`#756`,title:`Add public showcase case pages`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/756`,confidence:`observed_public_metadata`,started_at:`2026-06-27T15:54:59+08:00`,completed_at:`2026-06-27T15:59:37+08:00`,occurred_at:`2026-06-27T15:54:59+08:00`,display_time:`15:54 -> 15:59`,duration_label:`4m`,timezone:`Asia/Shanghai`},{node_id:`pr_755`,kind:`pull_request`,label:`#755`,title:`Handle SkillsBench host-local ACP return shape`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/755`,confidence:`observed_public_metadata`,started_at:`2026-06-27T15:38:48+08:00`,completed_at:`2026-06-27T15:39:21+08:00`,occurred_at:`2026-06-27T15:38:48+08:00`,display_time:`15:38 -> 15:39`,duration_label:`33 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_754`,kind:`pull_request`,label:`#754`,title:`Add biweekly update note archive`,state:`merged`,lane_id:`product_frontstage`,url:`https://github.com/huangruiteng/loopx/pull/754`,confidence:`observed_public_metadata`,started_at:`2026-06-27T15:23:04+08:00`,completed_at:`2026-06-27T16:01:58+08:00`,occurred_at:`2026-06-27T15:23:04+08:00`,display_time:`15:23 -> 16:01`,duration_label:`38m`,timezone:`Asia/Shanghai`},{node_id:`pr_753`,kind:`pull_request`,label:`#753`,title:`Revert "Add bilingual showcase gallery pages"`,state:`merged`,lane_id:`public_docs_showcase`,url:`https://github.com/huangruiteng/loopx/pull/753`,confidence:`observed_public_metadata`,started_at:`2026-06-27T15:12:29+08:00`,completed_at:`2026-06-27T15:12:40+08:00`,occurred_at:`2026-06-27T15:12:29+08:00`,display_time:`15:12 -> 15:12`,duration_label:`11 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_752`,kind:`pull_request`,label:`#752`,title:`Add bilingual showcase gallery pages`,state:`merged`,lane_id:`public_docs_showcase`,url:`https://github.com/huangruiteng/loopx/pull/752`,confidence:`observed_public_metadata`,started_at:`2026-06-27T15:01:25+08:00`,completed_at:`2026-06-27T15:03:10+08:00`,occurred_at:`2026-06-27T15:01:25+08:00`,display_time:`15:01 -> 15:03`,duration_label:`1m`,timezone:`Asia/Shanghai`},{node_id:`pr_751`,kind:`pull_request`,label:`#751`,title:`Add OpenViking session memory adapter contract`,state:`merged`,lane_id:`open_review`,url:`https://github.com/huangruiteng/loopx/pull/751`,confidence:`observed_public_metadata`,started_at:`2026-06-27T14:25:02+08:00`,completed_at:`2026-06-27T21:16:15+08:00`,occurred_at:`2026-06-27T14:25:02+08:00`,display_time:`14:25 -> 21:16`,duration_label:`6h 51m`,timezone:`Asia/Shanghai`},{node_id:`pr_750`,kind:`pull_request`,label:`#750`,title:`Preserve SkillsBench failure closeout metadata`,state:`merged`,lane_id:`benchmark_interface`,url:`https://github.com/huangruiteng/loopx/pull/750`,confidence:`observed_public_metadata`,started_at:`2026-06-27T14:16:40+08:00`,completed_at:`2026-06-27T14:17:11+08:00`,occurred_at:`2026-06-27T14:16:40+08:00`,display_time:`14:16 -> 14:17`,duration_label:`31 sec`,timezone:`Asia/Shanghai`},{node_id:`pr_749`,kind:`pull_request`,label:`#749`,title:`Add local agent launch dry-run protocol`,state:`merged`,lane_id:`public_docs_showcase`,url:`https://github.com/huangruiteng/loopx/pull/749`,confidence:`observed_public_metadata`,started_at:`2026-06-27T14:06:17+08:00`,completed_at:`2026-06-27T14:33:21+08:00`,occurred_at:`2026-06-27T14:06:17+08:00`,display_time:`14:06 -> 14:33`,duration_label:`27m`,timezone:`Asia/Shanghai`},{node_id:`pr_748`,kind:`pull_request`,label:`#748`,title:`Add agent lane frontier hint contract`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/748`,confidence:`observed_public_metadata`,started_at:`2026-06-27T14:03:52+08:00`,completed_at:`2026-06-27T14:47:54+08:00`,occurred_at:`2026-06-27T14:03:52+08:00`,display_time:`14:03 -> 14:47`,duration_label:`44m`,timezone:`Asia/Shanghai`},{node_id:`pr_747`,kind:`pull_request`,label:`#747`,title:`Fix refresh-state Next Action default`,state:`merged`,lane_id:`kernel_runtime`,url:`https://github.com/huangruiteng/loopx/pull/747`,confidence:`observed_public_metadata`,started_at:`2026-06-27T13:52:32+08:00`,completed_at:`2026-06-27T15:53:58+08:00`,occurred_at:`2026-06-27T13:52:32+08:00`,display_time:`13:52 -> 15:53`,duration_label:`2h 1m`,timezone:`Asia/Shanghai`},{node_id:`pr_746`,kind:`pull_request`,label:`#746`,title:`Accept Harbor reducer wrapper in run ledger upsert`,state:`merged`,lane_id:`open_review`,url:`https://github.com/huangruiteng/loopx/pull/746`,confidence:`observed_public_metadata`,started_at:`2026-06-27T13:24:51+08:00`,completed_at:`2026-06-27T13:25:38+08:00`,occurred_at:`2026-06-27T13:24:51+08:00`,display_time:`13:24 -> 13:25`,duration_label:`47 sec`,timezone:`Asia/Shanghai`}],edges:[{edge_id:`edge_trajectory_anchor_to_v2`,from_node_id:`pr_674`,to_node_id:`pr_775`,edge_kind:`frontstage_followup`,label:`trajectory panel anchor expands into recent PR batch projection`,confidence:`inferred_high`},{edge_id:`edge_gallery_revert_review`,from_node_id:`pr_752`,to_node_id:`pr_753`,edge_kind:`review_revert`,label:`public surface review produced a quick revert slice`,confidence:`observed_public_metadata`},{edge_id:`edge_showcase_case_pack`,from_node_id:`pr_745`,to_node_id:`pr_756`,edge_kind:`showcase_followup`,label:`case set became public showcase pages`,confidence:`observed_public_metadata`},{edge_id:`edge_showcase_canonical`,from_node_id:`pr_756`,to_node_id:`pr_771`,edge_kind:`showcase_followup`,label:`case pages converged into canonical showcase path`,confidence:`observed_public_metadata`},{edge_id:`edge_update_note_loop`,from_node_id:`pr_754`,to_node_id:`pr_758`,edge_kind:`automation_followup`,label:`archive note became scheduled draft automation`,confidence:`observed_public_metadata`},{edge_id:`edge_monitor_watch_to_due`,from_node_id:`pr_759`,to_node_id:`pr_761`,edge_kind:`runtime_followup`,label:`watch routing made due monitor lane selection reviewable`,confidence:`observed_public_metadata`},{edge_id:`edge_monitor_due_to_writeback`,from_node_id:`pr_761`,to_node_id:`pr_764`,edge_kind:`runtime_followup`,label:`due monitor selection led to poll writeback API`,confidence:`observed_public_metadata`},{edge_id:`edge_monitor_writeback_to_smoke`,from_node_id:`pr_764`,to_node_id:`pr_765`,edge_kind:`validation_followup`,label:`writeback API is followed by smoke coverage`,confidence:`observed_public_metadata`},{edge_id:`edge_monitor_smoke_to_metadata`,from_node_id:`pr_765`,to_node_id:`pr_766`,edge_kind:`cli_followup`,label:`smoke contract is followed by CLI metadata affordance`,confidence:`observed_public_metadata`},{edge_id:`edge_command_onboarding_to_review`,from_node_id:`pr_773`,to_node_id:`pr_774`,edge_kind:`review_command_followup`,label:`newcomer command path feeds explicit PR review command`,confidence:`observed_public_metadata`}],frontend_acceptance:{must_render:[`generic projection model contract`,`30 PR relationship mesh`,`timeline axis`,`hoverable node and edge details`,`sequential requirement rollout`,`rollout requirement spine`,`projection capability map`,`30 public PR nodes`,`single-agent stage flow`,`multi-agent lane graph`,`review edge mesh`,`flow signals`,`attention hotspots`,`public evidence boundary`,`wall-clock timeline ticks`,`node time and duration hover details`]}}],planned_projections:[{projection_id:`loopx_overall_iteration`,status:`planned`,reason:`Use the same projection model after the overnight PR batch renderer is validated.`}]},HC={schema_version:`long_horizon_self_iteration_fixture_v0`,fixture_id:`long_horizon_self_iteration_minimal_rollout_public_v0`,goal_id:`public-long-horizon-loop`,generated_at:`2026-06-24T01:12:00+08:00`,purpose:`Minimal public-safe rollout input for long-horizon agent frontstage development and smoke testing.`,public_boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1,private_material_body_recorded:!1},derived_from:{source_docs:[`docs/reference/protocols/long-horizon-agent-state-protocol-v0.md`,`docs/product/surfaces/frontstage-dashboard-interaction-baseline.md`],source_prs:[`https://github.com/huangruiteng/loopx/pull/617`],source_policy:`Compact public-safe metadata only; this fixture is not a source-of-truth event ledger.`},truth_contract:{event_ledger_is_source_of_truth:!0,fixture_is_writable:!1,projection_is_writable:!1,write_authority:`none`,recompute_rule:`Regenerate from active state, rollout events, PR metadata, and public docs; do not edit dashboard state as truth.`},state_partitioning:{schema_version:`long_horizon_state_partitioning_v0`,canonical_stream:{goal_id:`public-long-horizon-loop`,source_surfaces:[`registry`,`active_state`,`run_history`,`rollout_event_log`,`human_reward`],event_stream_count:1,write_authority:`loopx_lifecycle_commands`},derived_view_contract:{views_are_writable:!1,must_reference_canonical_events:!0,recompute_rule:`Filter and rank canonical events by stable join keys; never fork truth into per-agent state unless the goal identity or boundary changes.`},independent_state_file_rule:{use_agent_lane_projection_when:`same goal_id, repo boundary, backlog, and operator policy; only the selected next action or timeline is scoped`,use_independent_state_when:`distinct goal_id, durable objective, protected boundary, owner policy, or backlog would be misleading inside the parent goal`}},derived_views:[{view_id:`agent_codex_product_capability`,view_kind:`per_agent`,filter_keys:{agent_id:`codex-product-capability`,lane_id:`product_capability`},source_event_ids:[`evt_lh_001_protocol_contract_ready`,`evt_lh_002_fixture_scope_narrowed`,`evt_lh_005_minimal_fixture_validated`],projection_is_writable:!1},{view_id:`todo_frontstage_timeline`,view_kind:`per_todo`,filter_keys:{todo_id:`todo_frontstage_timeline`},source_event_ids:[`evt_lh_003_frontstage_impl_handoff`,`evt_lh_007_timeline_ready`],projection_is_writable:!1},{view_id:`case_public_frontstage_rollout`,view_kind:`per_case`,filter_keys:{case_id:`public_frontstage_rollout`},source_event_ids:[`evt_lh_005_minimal_fixture_validated`,`evt_lh_006_sufficiency_ready`,`evt_lh_007_timeline_ready`],projection_is_writable:!1},{view_id:`run_frontstage_validation`,view_kind:`per_run`,filter_keys:{run_id:`run_frontstage_fixture_validation`},source_event_ids:[`evt_lh_005_minimal_fixture_validated`],projection_is_writable:!1}],lanes:[{lane_id:`release_validation`,agent_id:`codex-main-control`,agent_model:`peer_v1`,profile_role:`release-validation`,display_name:`Release validation`},{lane_id:`product_capability`,agent_id:`codex-product-capability`,agent_model:`peer_v1`,profile_role:`product-validation`,display_name:`Product capability`},{lane_id:`implementation_lane`,agent_id:`codex-side-bypass`,agent_model:`peer_v1`,profile_role:`implementation-validation`,display_name:`Implementation lane`}],rollout_events:[{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_001_protocol_contract_ready`,goal_id:`public-long-horizon-loop`,event_kind:`pr_merge`,recorded_at:`2026-06-24T01:12:10+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_protocol_contract`,lane:{lane_id:`product_capability`,agent_model:`peer_v1`},state_transition:{from_state:`protocol_draft`,to_state:`protocol_contract_ready`},causality:{caused_by:`public_protocol_review`,unblocks:[`todo_minimal_rollout_fixture`]},code_refs:{commit_ref:`bd05500`,pr_ref:`huangruiteng/loopx#617`},status:`ready`,classification:`long_horizon_protocol_contract_ready`,delivery_outcome:`outcome_progress`,summary:`Long-horizon protocol now separates source-of-truth state from projection state and defines handoff, gate, evidence, and rollback anchors.`,artifact_refs:[`docs/reference/protocols/long-horizon-agent-state-protocol-v0.md`],source_refs:[{kind:`pull_request`,ref:`https://github.com/huangruiteng/loopx/pull/617`}],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_002_fixture_scope_narrowed`,goal_id:`public-long-horizon-loop`,event_kind:`todo_update`,recorded_at:`2026-06-24T01:13:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_minimal_rollout_fixture`,case_id:`public_frontstage_rollout`,run_id:`run_frontstage_fixture_validation`,lane:{lane_id:`product_capability`,agent_model:`peer_v1`},state_transition:{from_state:`full_history_fixture_planned`,to_state:`minimal_rollout_fixture_required`},causality:{caused_by:`scope_reduction`,source_event_id:`evt_lh_001_protocol_contract_ready`,decision_id:`decision_minimal_fixture_before_frontstage`},status:`open`,classification:`todo_scope_refined`,summary:`The fixture scope narrows to a small public-safe rollout sample for frontend and protocol testing.`,artifact_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`],source_refs:[{kind:`todo`,ref:`todo_minimal_rollout_fixture`}],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_003_frontstage_impl_handoff`,goal_id:`public-long-horizon-loop`,event_kind:`todo_update`,recorded_at:`2026-06-24T01:14:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_frontstage_timeline`,lane:{lane_id:`implementation_lane`,agent_model:`peer_v1`},state_transition:{from_state:`open_product_capability_claim`,to_state:`deferred_implementation_claim`},causality:{caused_by:`frontstage_delegation`,source_event_id:`evt_lh_002_fixture_scope_narrowed`,gate_id:`gate_minimal_rollout_fixture`,decision_id:`decision_frontstage_to_implementation_lane`,blocks:[`todo_frontstage_timeline`],unblocks:[`todo_frontstage_timeline_after_fixture`]},handoff:{to_agent_id:`codex-side-bypass`},status:`deferred`,classification:`frontstage_todo_assigned_to_implementation_lane`,summary:`Frontstage implementation waits for the minimal rollout fixture before broader UI work starts.`,artifact_refs:[`docs/product/surfaces/frontstage-dashboard-interaction-baseline.md`],source_refs:[{kind:`todo`,ref:`todo_frontstage_timeline`}],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_004_sufficiency_check_deferred`,goal_id:`public-long-horizon-loop`,event_kind:`todo_update`,recorded_at:`2026-06-24T01:15:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_frontstage_sufficiency`,lane:{lane_id:`implementation_lane`,agent_model:`peer_v1`},state_transition:{from_state:`open_product_capability_claim`,to_state:`deferred_implementation_claim`},causality:{caused_by:`fixture_dependency`,source_event_id:`evt_lh_003_frontstage_impl_handoff`,gate_id:`gate_minimal_rollout_fixture`,decision_id:`decision_frontstage_to_implementation_lane`,blocks:[`todo_frontstage_sufficiency`]},handoff:{to_agent_id:`codex-side-bypass`},status:`deferred`,classification:`frontstage_sufficiency_waits_for_fixture`,summary:`The sufficiency check remains visible as deferred work and resumes after fixture validation.`,artifact_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`],source_refs:[{kind:`todo`,ref:`todo_frontstage_sufficiency`}],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_005_minimal_fixture_validated`,goal_id:`public-long-horizon-loop`,event_kind:`validation`,recorded_at:`2026-06-24T01:16:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_minimal_rollout_fixture`,case_id:`public_frontstage_rollout`,run_id:`run_frontstage_fixture_validation`,lane:{lane_id:`product_capability`,agent_model:`peer_v1`},state_transition:{from_state:`minimal_rollout_fixture_required`,to_state:`fixture_ready_for_frontstage`},causality:{caused_by:`public_fixture_validation`,source_event_id:`evt_lh_002_fixture_scope_narrowed`,unblocks:[`todo_frontstage_sufficiency`,`todo_frontstage_timeline`]},status:`validated`,classification:`long_horizon_rollout_fixture_ready`,delivery_outcome:`outcome_progress`,summary:`Minimal rollout fixture covers three lanes, a human decision gate, handoff, validation evidence, and one inferred display bridge.`,artifact_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`,`examples/long-horizon-self-iteration-rollout-fixture-smoke.py`],source_refs:[{kind:`fixture`,ref:`examples/fixtures/long-horizon-self-iteration-rollout.public.json`}],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_006_sufficiency_ready`,goal_id:`public-long-horizon-loop`,event_kind:`todo_update`,recorded_at:`2026-06-24T01:17:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_frontstage_sufficiency`,case_id:`public_frontstage_rollout`,lane:{lane_id:`implementation_lane`,agent_model:`peer_v1`},state_transition:{from_state:`deferred_implementation_claim`,to_state:`ready_after_fixture`},causality:{caused_by:`todo_done:todo_minimal_rollout_fixture`,source_event_id:`evt_lh_005_minimal_fixture_validated`,unblocks:[`todo_frontstage_sufficiency`]},handoff:{to_agent_id:`codex-side-bypass`},status:`ready`,classification:`frontstage_sufficiency_ready`,summary:`The implementation lane can now test sufficiency against a concrete minimal rollout fixture.`,artifact_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}},{schema_version:`loopx_rollout_event_v0`,event_id:`evt_lh_007_timeline_ready`,goal_id:`public-long-horizon-loop`,event_kind:`todo_update`,recorded_at:`2026-06-24T01:18:00+08:00`,agent_id:`codex-product-capability`,todo_id:`todo_frontstage_timeline`,case_id:`public_frontstage_rollout`,lane:{lane_id:`implementation_lane`,agent_model:`peer_v1`},state_transition:{from_state:`deferred_implementation_claim`,to_state:`ready_after_fixture`},causality:{caused_by:`todo_done:todo_minimal_rollout_fixture`,source_event_id:`evt_lh_005_minimal_fixture_validated`,unblocks:[`todo_frontstage_timeline`]},handoff:{to_agent_id:`codex-side-bypass`},status:`ready`,classification:`frontstage_timeline_ready`,summary:`The implementation lane can build a multi-lane timeline without reading private state.`,artifact_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`],boundary:{raw_task_text_recorded:!1,raw_logs_recorded:!1,raw_trajectory_recorded:!1,raw_session_transcript_recorded:!1,credential_values_recorded:!1,absolute_paths_recorded:!1}}],animation_events:[{animation_event_id:`anim_protocol_contract`,lane_id:`product_capability`,kind:`deliverable`,title:`Protocol contract ready`,source_event_ids:[`evt_lh_001_protocol_contract_ready`],state_transition:{from_state:`draft`,to_state:`ready`},confidence:`observed`,display_hint:`solid_edge`,evidence_refs:[`https://github.com/huangruiteng/loopx/pull/617`]},{animation_event_id:`anim_frontstage_delegation`,lane_id:`release_validation`,kind:`human_gate`,title:`Operator delegates UI implementation`,source_event_ids:[`evt_lh_003_frontstage_impl_handoff`,`evt_lh_004_sufficiency_check_deferred`],state_transition:{from_state:`single lane owns protocol and UI planning`,to_state:`implementation lane resumes after fixture`},human_effect:{decision_id:`decision_frontstage_to_implementation_lane`,changes:[`claim_owner`,`resume_condition`,`handoff_target`]},confidence:`observed`,display_hint:`gate_node`},{animation_event_id:`anim_fixture_validation`,lane_id:`product_capability`,kind:`validation`,title:`Minimal rollout fixture validated`,source_event_ids:[`evt_lh_005_minimal_fixture_validated`],state_transition:{from_state:`fixture_required`,to_state:`fixture_ready`},confidence:`observed`,display_hint:`solid_edge`,evidence_refs:[`examples/fixtures/long-horizon-self-iteration-rollout.public.json`,`examples/long-horizon-self-iteration-rollout-fixture-smoke.py`]},{animation_event_id:`anim_sufficiency_unblocked`,lane_id:`implementation_lane`,kind:`handoff`,title:`Sufficiency check resumes`,source_event_ids:[`evt_lh_006_sufficiency_ready`],state_transition:{from_state:`deferred`,to_state:`ready`},confidence:`inferred_high`,display_hint:`solid_edge`},{animation_event_id:`anim_timeline_unblocked`,lane_id:`implementation_lane`,kind:`handoff`,title:`Timeline implementation resumes`,source_event_ids:[`evt_lh_007_timeline_ready`],state_transition:{from_state:`deferred`,to_state:`ready`},confidence:`inferred_high`,display_hint:`solid_edge`},{animation_event_id:`anim_fixture_to_ui_bridge`,lane_id:`implementation_lane`,kind:`synthetic_bridge`,title:`Fixture-ready to UI-ready display bridge`,source_event_ids:[`evt_lh_005_minimal_fixture_validated`,`evt_lh_007_timeline_ready`],state_transition:{from_state:`fixture_ready`,to_state:`ui_implementation_candidate`},confidence:`synthetic_bridge`,inference_reason:`The actual UI commit does not exist in this fixture yet; the bridge exists only so frontstage can render a future handoff target.`,display_hint:`dashed_edge`}],frontend_acceptance:{minimum_lane_ids:[`release_validation`,`product_capability`,`implementation_lane`],must_render:[`three agent lanes`,`one human gate node`,`one handoff from product-capability to implementation lane`,`one validation event`,`one PR or commit evidence reference`,`one dashed inferred bridge`],recommended_tests:[`fixture schema smoke`,`frontstage route smoke`,`browser smoke across desktop and mobile once UI consumes this fixture`]}},UC=BC.cases,WC=UC.find(e=>e.id===`2026-06-19-loopx-self-iteration`),GC=UC.filter(e=>e.frontend_card),KC=HC,qC=VC,JC=qC.projections[0];function YC(){return GC.reduce((e,t)=>e+(t.frontend_card?.story_beats?.length??0),0)}function XC(){return Array.from(new Set(GC.map(e=>e.domain).filter(e=>!!e))).sort()}function ZC(e){return[e.title,e.headline,e.domain,e.status,e.evidence_boundary,...e.feature_points??[],...e.pattern_tags??[],...e.frontend_card?.badges??[],e.frontend_card?.primary_metric_hint,e.frontend_card?.visual_metaphor,...e.frontend_card?.story_beats??[]].filter(Boolean).join(` `).toLowerCase()}function QC(e){if(e){if(e.interactive_page)return`https://huangruiteng.github.io/loopx/${e.interactive_page}`;if(e.case_page)return`https://github.com/huangruiteng/loopx/blob/main/${e.case_page}`}}function $C(e,t=`n/a`){return e===void 0?t:new Intl.NumberFormat(`en-US`,{maximumFractionDigits:1}).format(e)}function ew(e,t=``){return!e||e.low===void 0||e.high===void 0?`n/a`:`${$C(e.low)}-${$C(e.high)}${t}`}function tw(e){return e===`observed`||e===`observed_public_metadata`?`success`:e===`synthetic_bridge`?`warning`:e.startsWith(`inferred`)?`info`:`neutral`}function nw(e){return e===`merged`||e===`done`?`success`:e===`open`||e===`active`?`info`:e===`blocked`?`danger`:`warning`}function rw(e){return[`done`,`merged`,`validated`].includes(e)?`success`:[`active`,`reviewing`,`review`].includes(e)?`warning`:[`queued`,`planned`].includes(e)?`neutral`:`info`}var iw=[{ring:`border-cyan-300/40 bg-cyan-300/10 text-cyan-100`,card:`border-cyan-200 bg-cyan-50`,dot:`bg-cyan-300`,line:`bg-cyan-300/40`},{ring:`border-emerald-300/40 bg-emerald-300/10 text-emerald-100`,card:`border-emerald-200 bg-emerald-50`,dot:`bg-emerald-400`,line:`bg-emerald-300/40`},{ring:`border-amber-300/40 bg-amber-300/10 text-amber-100`,card:`border-amber-200 bg-amber-50`,dot:`bg-amber-400`,line:`bg-amber-300/40`},{ring:`border-rose-300/40 bg-rose-300/10 text-rose-100`,card:`border-rose-200 bg-rose-50`,dot:`bg-rose-400`,line:`bg-rose-300/40`},{ring:`border-violet-300/40 bg-violet-300/10 text-violet-100`,card:`border-violet-200 bg-violet-50`,dot:`bg-violet-400`,line:`bg-violet-300/40`}];function aw(e){return iw[e%iw.length]}function ow(e){return new Map(e.nodes.map(e=>[e.node_id,e]))}function sw(e,t){let n=ow(e);return t.node_ids.map(e=>n.get(e)).filter(e=>!!e)}function cw(e){let t=e.node_id.match(/^pr_(\d+)$/);return t?Number(t[1]):null}function lw(e){let t=ow(e);return e.timeline?.item_node_ids.length?e.timeline.item_node_ids.map(e=>t.get(e)).filter(e=>!!e):e.nodes.filter(e=>e.role!==`anchor`&&e.role!==`precursor`).sort((e,t)=>{let n=cw(e),r=cw(t);return n!==null&&r!==null?n-r:e.label.localeCompare(t.label)})}function uw(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function dw(e){return uw(e.occurred_at)??uw(e.started_at)??uw(e.completed_at)}function fw(e,t){let n=t.map(dw).filter(e=>e!==null),r=t.map(e=>uw(e.completed_at)).filter(e=>e!==null),i=uw(e.timeline?.start_at)??(n.length?Math.min(...n):null),a=uw(e.timeline?.end_at)??(r.length?Math.max(...r):n.length?Math.max(...n):null);return i===null||a===null||a<=i?null:{end:a,start:i}}function pw(e,t,n){if(e===null||!t)return n;let r=(e-t.start)/(t.end-t.start);return Math.min(1,Math.max(0,r))}function mw(e,t,n,r){let i=r>1?n/(r-1):.5;return pw(dw(e),t,i)*100}function hw(e,t){return pw(uw(e.at),t,0)*100}function gw(e){return e?.display_time??e?.started_at??e?.occurred_at??`time n/a`}function _w(e){return e?.match(/T(\d{2}:\d{2})/)?.[1]??e??`n/a`}function vw(e){return e?.display_time?.split(` -> `)[0]??_w(e?.started_at??e?.occurred_at)}function yw(e){let t=new Set;return e.filter(e=>{let n=`${e.label}:${e.detail}:${e.time_label}`;return e.time===null||t.has(n)?!1:(t.add(n),!0)})}function bw(e){let t=e.map(e=>({node:e,time:dw(e)})).filter(e=>e.time!==null).sort((e,t)=>e.time-t.time);if(!t.length)return[];let n=t[0],r=t[Math.floor((t.length-1)/2)],i=t[t.length-1],a=e.map(e=>({node:e,time:uw(e.completed_at)})).filter(e=>e.time!==null).sort((e,t)=>t.time-e.time)[0];return yw([{detail:n.node.label,id:`start`,label:`start`,time:n.time,time_label:vw(n.node)},{detail:r.node.label,id:`midpoint`,label:`midpoint`,time:r.time,time_label:vw(r.node)},{detail:i.node.label,id:`last_start`,label:`last start`,time:i.time,time_label:vw(i.node)},{detail:a?.node.label??i.node.label,id:`tail_done`,label:`tail done`,time:a?.time??null,time_label:_w(a?.node.completed_at)}])}function xw({bundle:e,projection:t}){let n=t.nodes.filter(e=>e.role!==`anchor`&&e.role!==`precursor`).slice(0,30);return(0,B.jsxs)(`div`,{className:`frontstage-rollout-projection-constellation relative overflow-hidden rounded-md border border-slate-800 bg-slate-950 p-4 text-white xl:col-span-2`,"data-testid":`frontstage-rollout-projection-constellation`,children:[(0,B.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:`Rollout projection`}),(0,B.jsx)(`h3`,{className:`mt-2 max-w-3xl text-lg font-semibold leading-7 text-white`,children:t.scene.title}),(0,B.jsx)(`p`,{className:`mt-2 max-w-4xl text-sm font-medium leading-6 text-slate-300`,children:t.scene.explanation})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:t.scene.stage_label}),(0,B.jsx)($,{variant:tw(t.scene.confidence),children:t.scene.confidence})]})]}),(0,B.jsx)(`div`,{className:`relative z-10 mt-5 grid gap-3 md:grid-cols-4`,"data-testid":`frontstage-rollout-projection-metrics`,children:t.metrics.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.06] px-3 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:e.label}),(0,B.jsx)($,{variant:e.tone,children:e.helper})]}),(0,B.jsx)(`div`,{className:`mt-2 text-2xl font-semibold leading-8 text-white`,children:e.value})]},e.metric_id))}),(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`frontstage-rollout-node-grid relative z-10 mt-5`,"data-testid":`frontstage-rollout-node-particles`,children:n.map((e,t)=>(0,B.jsx)(`span`,{className:Ny(`frontstage-rollout-node-dot h-2.5 rounded-full`,e.state===`merged`?`bg-emerald-300`:e.state===`open`?`bg-cyan-300`:`bg-amber-300`),style:{animationDelay:`${t*80}ms`},title:`${e.label} ${e.state}`},e.node_id))}),(0,B.jsxs)(`div`,{className:`relative z-10 mt-4 grid gap-2 rounded-md border border-white/10 bg-black/20 px-3 py-2 text-xs font-medium leading-5 text-slate-300 md:grid-cols-[minmax(0,1.2fr)_minmax(260px,0.8fr)]`,"data-testid":`frontstage-rollout-projection-model-contract`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-semibold text-white`,children:`Projection model: `}),e.projection_model.required_sections.join(` / `),`.`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-semibold text-white`,children:`Evidence floor: `}),e.truth_contract.evidence_floor,`.`]})]})]})}function Sw(e,t){let n=t.get(e.from_node_id),r=t.get(e.to_node_id);return`${e.edge_kind}: ${n?.label??e.from_node_id} -> ${r?.label??e.to_node_id}; ${e.label}`}function Cw({projection:e}){let t=lw(e),n=new Map(t.map(e=>[e.node_id,e])),[r,i]=(0,z.useState)(null),a=fw(e,t),o=e.timeline?.ticks??[],s=new Map(e.lanes.map((e,t)=>[e.lane_id,{index:t,y:70+t*112}])),c=new Map;for(let t of e.lanes){let e=t.node_ids.map(e=>n.get(e)).filter(e=>!!e),r=s.get(t.lane_id)?.y??70,i=140;e.forEach((t,n)=>{let o=e.length>1?n/(e.length-1):.5,s=190+pw(dw(t),a,o)*750,l=Math.max(s,i+76),u=Math.min(940,Math.max(190,l));i=u,c.set(t.node_id,{x:u,y:r})})}let l=new Map,u=e=>{let t=`${e.from_node_id}->${e.to_node_id}`,n=l.get(t);(!n||e.edge_kind===`explicit`||e.edge_kind===`lane`&&n.edge_kind===`timeline`)&&l.set(t,e)};t.slice(0,-1).forEach((e,n)=>{let r=t[n+1];u({edge_id:`timeline_${e.node_id}_${r.node_id}`,edge_kind:`timeline`,from_node_id:e.node_id,label:`overnight sequence`,to_node_id:r.node_id})});for(let t of e.lanes){let e=t.node_ids.map(e=>n.get(e)).filter(e=>!!e);e.slice(0,-1).forEach((n,r)=>{let i=e[r+1];u({edge_id:`lane_${t.lane_id}_${n.node_id}_${i.node_id}`,edge_kind:`lane`,from_node_id:n.node_id,label:t.label,to_node_id:i.node_id})})}for(let t of e.edges)c.has(t.from_node_id)&&c.has(t.to_node_id)&&u({edge_id:t.edge_id,edge_kind:`explicit`,from_node_id:t.from_node_id,label:t.label,to_node_id:t.to_node_id});let d=Array.from(l.values()),f=d.filter(e=>e.edge_kind===`explicit`).length,p=d.filter(e=>e.edge_kind===`lane`).length,m=d.filter(e=>e.edge_kind===`timeline`).length,h=d.find(e=>e.edge_id===r)??null,g=e.timeline?.title??`Rollout timeline`,_=e.timeline?.window_label??e.source_contract.sample_window,v=e.timeline?.unit_label??`work nodes`,y=e.timeline?.axis_kind??`ordered`,b=e.timeline?.timezone??`local`,x=bw(t);return(0,B.jsxs)(`div`,{className:`frontstage-rollout-pr-mesh relative overflow-hidden rounded-md border border-slate-800 bg-slate-950 p-4 text-white xl:col-span-2`,"data-testid":`frontstage-rollout-relationship-mesh`,children:[(0,B.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:e.title}),(0,B.jsx)(`h3`,{className:`mt-2 max-w-3xl text-lg font-semibold leading-7 text-white`,children:`A wall-clock rollout map, all at once`}),(0,B.jsxs)(`p`,{className:`mt-2 max-w-4xl text-sm font-medium leading-6 text-slate-300`,children:[`Every work unit in `,_,` is placed on a real time axis. Thin links preserve ordering, lane links show parallel workstreams, and bright links mark explicit review or follow-up relationships. Hover nodes or lines to inspect time, duration, and relationship details.`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)($,{variant:`success`,children:[t.length,` `,v]}),(0,B.jsxs)($,{variant:`info`,children:[d.length,` links`]}),(0,B.jsxs)($,{variant:`warning`,children:[f,` explicit`]}),(0,B.jsx)($,{variant:`neutral`,children:b})]})]}),(0,B.jsxs)(`div`,{className:`frontstage-rollout-timeline relative z-10 mt-4 rounded-md border border-white/10 bg-black/20 p-3`,"data-testid":`frontstage-rollout-timeline`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:g}),(0,B.jsx)(`div`,{className:`mt-1 text-sm font-semibold leading-6 text-white`,children:_}),(0,B.jsx)(`div`,{className:`mt-1 text-[11px] font-medium leading-4 text-slate-400`,children:e.timeline?.time_basis??`work-unit order`})]}),(0,B.jsx)($,{variant:`info`,children:y})]}),(0,B.jsxs)(`div`,{className:`frontstage-rollout-timeline-track mt-3`,"data-testid":`frontstage-rollout-timeline-scale`,children:[o.map(e=>(0,B.jsx)(`span`,{className:`frontstage-rollout-timeline-tick`,"data-testid":`frontstage-rollout-timeline-tick`,style:{left:`${hw(e,a)}%`},children:e.label},e.tick_id)),t.map((e,n)=>(0,B.jsxs)(`a`,{className:Ny(`frontstage-rollout-timeline-point`,e.state===`merged`?`frontstage-rollout-timeline-point-merged`:e.state===`open`?`frontstage-rollout-timeline-point-open`:`frontstage-rollout-timeline-point-closed`),"data-node-time":gw(e),"data-testid":`frontstage-rollout-timeline-point`,href:e.url??`#`,rel:e.url?`noreferrer`:void 0,style:{left:`${mw(e,a,n,t.length)}%`},target:e.url?`_blank`:void 0,title:`${String(n+1).padStart(2,`0`)} ${e.label}: ${e.title} / ${gw(e)}`,children:[(0,B.jsx)(`span`,{children:e.label.replace(`#`,``)}),(0,B.jsx)(`small`,{children:e.display_time?.split(` -> `)[0]??``})]},e.node_id))]}),x.length?(0,B.jsx)(`div`,{className:`frontstage-rollout-time-milestones`,"data-testid":`frontstage-rollout-time-milestones`,children:x.map(e=>(0,B.jsxs)(`span`,{className:`frontstage-rollout-time-milestone`,"data-testid":`frontstage-rollout-time-milestone`,style:{left:`${pw(e.time,a,0)*100}%`},title:`${e.label}: ${e.detail} at ${e.time_label}`,children:[(0,B.jsx)(`strong`,{children:e.time_label}),(0,B.jsxs)(`small`,{children:[e.label,` `,e.detail]})]},e.id))}):null]}),(0,B.jsx)(`div`,{className:`relative z-10 mt-4 overflow-x-auto rounded-md border border-white/10 bg-black/20`,children:(0,B.jsxs)(`div`,{className:`frontstage-rollout-pr-mesh-stage relative`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`frontstage-rollout-pr-mesh-time-grid`,children:o.map(e=>(0,B.jsx)(`span`,{className:`frontstage-rollout-pr-mesh-time-tick`,"data-testid":`frontstage-rollout-mesh-time-tick`,style:{left:`${10+hw(e,a)*.82}%`},children:e.label},`${e.tick_id}-mesh`))}),(0,B.jsx)(`svg`,{"aria-label":`Rollout relationship graph`,className:`frontstage-rollout-pr-mesh-svg`,preserveAspectRatio:`none`,role:`img`,viewBox:`0 0 1000 560`,children:d.map((e,t)=>{let r=c.get(e.from_node_id),a=c.get(e.to_node_id);if(!r||!a)return null;let o=Sw(e,n);return(0,B.jsxs)(`g`,{"aria-label":o,className:`frontstage-rollout-pr-mesh-edge-group`,"data-edge-kind":e.edge_kind,"data-edge-label":e.label,"data-edge-title":o,"data-from-node":e.from_node_id,"data-testid":`frontstage-rollout-mesh-edge`,"data-to-node":e.to_node_id,onBlur:()=>i(t=>t===e.edge_id?null:t),onFocus:()=>i(e.edge_id),onMouseEnter:()=>i(e.edge_id),onMouseLeave:()=>i(t=>t===e.edge_id?null:t),role:`listitem`,style:{animationDelay:`${t*30}ms`},tabIndex:0,children:[(0,B.jsx)(`title`,{children:o}),(0,B.jsx)(`line`,{className:`frontstage-rollout-pr-mesh-edge-hit`,"data-testid":`frontstage-rollout-mesh-edge-hit`,onMouseEnter:()=>i(e.edge_id),onMouseLeave:()=>i(t=>t===e.edge_id?null:t),onPointerEnter:()=>i(e.edge_id),onPointerLeave:()=>i(t=>t===e.edge_id?null:t),x1:r.x,x2:a.x,y1:r.y,y2:a.y}),(0,B.jsx)(`line`,{className:Ny(`frontstage-rollout-pr-mesh-edge`,`frontstage-rollout-pr-mesh-edge-${e.edge_kind}`),onMouseEnter:()=>i(e.edge_id),onMouseLeave:()=>i(t=>t===e.edge_id?null:t),onPointerEnter:()=>i(e.edge_id),onPointerLeave:()=>i(t=>t===e.edge_id?null:t),x1:r.x,x2:a.x,y1:r.y,y2:a.y})]},e.edge_id)})}),d.map(e=>{let t=c.get(e.from_node_id),r=c.get(e.to_node_id);if(!t||!r)return null;let a=Sw(e,n);return(0,B.jsx)(`button`,{"aria-label":a,className:Ny(`frontstage-rollout-mesh-edge-hotspot`,`frontstage-rollout-mesh-edge-hotspot-${e.edge_kind}`),"data-edge-kind":e.edge_kind,"data-edge-label":e.label,"data-edge-title":a,"data-from-node":e.from_node_id,"data-testid":`frontstage-rollout-mesh-edge-hotspot`,"data-to-node":e.to_node_id,onBlur:()=>i(t=>t===e.edge_id?null:t),onFocus:()=>i(e.edge_id),onMouseEnter:()=>i(e.edge_id),onMouseLeave:()=>i(t=>t===e.edge_id?null:t),style:{left:`${(t.x+r.x)/2/1e3*100}%`,top:`${(t.y+r.y)/2/560*100}%`},title:a,type:`button`},`${e.edge_id}-hotspot`)}),e.lanes.map(e=>{let t=s.get(e.lane_id),r=e.node_ids.filter(e=>n.has(e));return!t||!r.length?null:(0,B.jsxs)(`div`,{className:`frontstage-rollout-pr-mesh-lane-label`,"data-testid":`frontstage-rollout-mesh-lane`,style:{top:`${t.y/560*100}%`},children:[(0,B.jsx)(`span`,{children:e.label}),(0,B.jsx)($,{variant:`neutral`,children:r.length})]},e.lane_id)}),t.map((t,n)=>{let r=c.get(t.node_id);if(!r)return null;let i=e.lanes.find(e=>e.lane_id===t.lane_id);return(0,B.jsxs)(`a`,{className:Ny(`frontstage-rollout-pr-mesh-node`,t.state===`merged`?`frontstage-rollout-pr-mesh-node-merged`:t.state===`open`?`frontstage-rollout-pr-mesh-node-open`:`frontstage-rollout-pr-mesh-node-closed`),"data-node-lane":i?.label??t.lane_id,"data-node-state":t.state,"data-node-time":gw(t),"data-node-title":t.title,"data-testid":`frontstage-rollout-mesh-node`,href:t.url??`#`,rel:t.url?`noreferrer`:void 0,style:{animationDelay:`${n*45}ms`,left:`${r.x/1e3*100}%`,top:`${r.y/560*100}%`},target:t.url?`_blank`:void 0,title:`${t.label} ${t.title} / ${i?.label??t.lane_id}`,children:[(0,B.jsx)(`span`,{children:t.label}),(0,B.jsx)(`small`,{children:t.state}),(0,B.jsxs)(`span`,{className:`frontstage-rollout-pr-mesh-node-tooltip`,"data-testid":`frontstage-rollout-mesh-node-tooltip`,children:[(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`span`,{children:t.title}),(0,B.jsxs)(`span`,{children:[`time: `,gw(t)]}),(0,B.jsxs)(`span`,{children:[`duration: `,t.duration_label??`n/a`]}),(0,B.jsxs)(`span`,{children:[`lane: `,i?.label??t.lane_id]}),(0,B.jsxs)(`span`,{children:[`state: `,t.state]})]})]},t.node_id)}),(0,B.jsx)(`div`,{className:Ny(`frontstage-rollout-mesh-edge-hover-card`,h?`frontstage-rollout-mesh-edge-hover-card-visible`:``),"data-testid":`frontstage-rollout-mesh-edge-hover-card`,children:h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:[h.edge_kind,` relation`]}),(0,B.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[(0,B.jsx)($,{variant:`info`,children:n.get(h.from_node_id)?.label??h.from_node_id}),(0,B.jsx)(`span`,{className:`text-slate-500`,children:`->`}),(0,B.jsx)($,{variant:`success`,children:n.get(h.to_node_id)?.label??h.to_node_id})]}),(0,B.jsxs)(`p`,{className:`mt-2 grid gap-1 text-[11px] font-semibold leading-4 text-slate-400`,children:[(0,B.jsxs)(`span`,{children:[`from: `,gw(n.get(h.from_node_id))]}),(0,B.jsxs)(`span`,{children:[`to: `,gw(n.get(h.to_node_id))]})]}),(0,B.jsx)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-slate-300`,children:h.label})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Hover a line`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs font-medium leading-5 text-slate-400`,children:`Relation details appear here without opening raw logs.`})]})})]})}),(0,B.jsxs)(`div`,{className:`relative z-10 mt-3 grid gap-2 md:grid-cols-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Timeline links`}),(0,B.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-white`,children:m})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Lane-flow links`}),(0,B.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-white`,children:p})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Explicit review links`}),(0,B.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-white`,children:f})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Public boundary`}),(0,B.jsx)(`div`,{className:`mt-1 text-sm font-semibold leading-6 text-slate-200`,children:`metadata only`})]})]})]})}function ww({projection:e}){let t=e.rollout_sequence;if(!t)return null;let n=ow(e),r=[...t.units].sort((e,t)=>e.order-t.order),i=new Set(r.map(e=>e.unit_id)),a=new Set(r.flatMap(e=>e.node_ids)).size;return(0,B.jsxs)(`div`,{className:`frontstage-rollout-requirement-spine relative overflow-hidden rounded-md border border-slate-800 bg-slate-950 p-4 text-white xl:col-span-2`,"data-testid":`frontstage-rollout-requirement-spine`,children:[(0,B.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:`Requirement rollout spine`}),(0,B.jsx)(`h3`,{className:`mt-2 max-w-3xl text-lg font-semibold leading-7 text-white`,children:`One demand unlocks the next`}),(0,B.jsx)(`p`,{className:`mt-2 max-w-4xl text-sm font-medium leading-6 text-slate-300`,children:t.description})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)($,{variant:`info`,children:[r.length,` requirements`]}),(0,B.jsxs)($,{variant:`success`,children:[a,` public nodes`]})]})]}),(0,B.jsx)(`div`,{className:`frontstage-rollout-spine-ribbon relative z-10 mt-5 grid gap-2 rounded-md border border-white/10 bg-black/25 p-2 lg:grid-cols-7`,"data-testid":`frontstage-rollout-sequence-ribbon`,children:r.map((e,t)=>(0,B.jsxs)(`div`,{className:`frontstage-rollout-sequence-chip grid min-h-16 grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md border border-white/10 bg-white/[0.06] px-2 py-2`,"data-testid":`frontstage-rollout-sequence-chip`,children:[(0,B.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-md border border-cyan-300/30 bg-cyan-300/10 font-mono text-xs font-semibold text-cyan-100`,children:String(e.order).padStart(2,`0`)}),(0,B.jsxs)(`span`,{className:`min-w-0 text-[11px] font-semibold leading-5 text-slate-200`,children:[e.requirement,t`}):null]})]},e.unit_id))}),(0,B.jsx)(`div`,{className:`frontstage-rollout-spine-track relative z-10 mt-3 grid gap-3 lg:grid-cols-4 2xl:grid-cols-7`,children:r.map((t,r)=>{let a=e.lanes.find(e=>e.lane_id===t.lane_id),o=t.node_ids.map(e=>n.get(e)).filter(e=>!!e),s=t.unlocks.filter(e=>i.has(e));return(0,B.jsxs)(`article`,{className:Ny(`frontstage-rollout-spine-card relative min-h-80 rounded-md border border-white/10 bg-white/[0.06] px-3 py-3`,t.state===`open`?`ring-1 ring-cyan-300/50`:``),"data-testid":`frontstage-rollout-requirement-unit`,style:{animationDelay:`${r*90}ms`},children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`frontstage-rollout-spine-order flex h-10 w-10 items-center justify-center rounded-md border border-cyan-300/30 bg-cyan-300/10 font-mono text-sm font-semibold text-cyan-100`,children:String(t.order).padStart(2,`0`)}),(0,B.jsx)($,{variant:nw(t.state),children:t.state})]}),(0,B.jsx)(`h4`,{className:`mt-3 text-sm font-semibold leading-6 text-white`,children:t.requirement}),(0,B.jsxs)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-slate-400`,children:[`Trigger: `,(0,B.jsx)(`span`,{className:`text-slate-200`,children:t.triggered_by})]}),(0,B.jsx)(`p`,{className:`mt-2 rounded-md border border-white/10 bg-black/20 px-2 py-2 text-xs font-medium leading-5 text-slate-300`,children:t.outcome}),(0,B.jsx)(`div`,{className:`mt-3 flex min-h-10 flex-wrap gap-1.5`,children:o.map(e=>(0,B.jsxs)(`a`,{className:`inline-flex items-center gap-1 rounded-md border border-white/10 bg-white/10 px-2 py-1 text-[11px] font-semibold text-slate-200 transition hover:border-cyan-300/50 hover:text-white`,href:e.url,rel:`noreferrer`,target:`_blank`,title:e.title,children:[e.label,(0,B.jsx)(`span`,{className:Ny(`h-1.5 w-1.5 rounded-full`,e.state===`merged`?`bg-emerald-300`:e.state===`open`?`bg-cyan-300`:`bg-amber-300`)})]},e.node_id))}),(0,B.jsx)(`div`,{className:`mt-3 grid gap-1.5`,children:t.stage_steps.map(e=>(0,B.jsxs)(`div`,{className:`frontstage-rollout-spine-step grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded-md border border-white/10 bg-black/20 px-2 py-1.5`,"data-testid":`frontstage-rollout-requirement-step`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-[11px] font-semibold text-slate-300`,children:e.label}),(0,B.jsx)($,{variant:rw(e.status),children:e.status})]},e.step_id))}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-1 rounded-md border border-white/10 bg-white/[0.04] px-2 py-2 text-[11px] font-medium leading-5 text-slate-400`,children:[(0,B.jsxs)(`span`,{children:[`lane `,(0,B.jsx)(`span`,{className:`text-slate-200`,children:a?.label??t.lane_id})]}),(0,B.jsxs)(`span`,{children:[`unlocks `,(0,B.jsx)(`span`,{className:`text-slate-200`,children:s.length?s.map(e=>e.replace(/^req_/,``)).join(`, `):`next projection`})]})]})]},t.unit_id)})})]})}function Tw(e){return e===`high`?`danger`:e===`medium`?`warning`:`info`}function Ew({bundle:e,projection:t}){let n=t.mapping_layers??[],r=t.flow_signals??[],i=t.relationship_summaries??[],a=t.attention_hotspots??[];return(0,B.jsxs)(`div`,{className:`frontstage-rollout-capability-map relative overflow-hidden rounded-md border border-slate-800 bg-slate-950 p-4 text-white xl:col-span-2`,"data-testid":`frontstage-rollout-capability-map`,children:[(0,B.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-emerald-200`,children:`Projection capability map`}),(0,B.jsx)(`h3`,{className:`mt-2 max-w-3xl text-lg font-semibold leading-7 text-white`,children:`Evidence becomes state, lanes, edges, and operator decisions`}),(0,B.jsx)(`p`,{className:`mt-2 max-w-4xl text-sm font-medium leading-6 text-slate-300`,children:`The renderer reads a generic projection contract, then makes the transformation visible: source facts become work nodes, nodes gain lifecycle state, lanes show parallel flow, edges explain why follow-up work exists, and hotspots keep review attention from getting lost.`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`success`,children:e.projection_model.schema_version}),(0,B.jsxs)($,{variant:`info`,children:[e.projection_model.optional_rich_sections?.length??0,` rich layers`]})]})]}),(0,B.jsx)(`div`,{className:`frontstage-rollout-layer-rail relative z-10 mt-5 grid gap-3 lg:grid-cols-5`,children:n.map((e,t)=>(0,B.jsxs)(`article`,{className:`frontstage-rollout-layer-card relative min-h-44 rounded-md border border-white/10 bg-white/[0.06] px-3 py-3`,"data-testid":`frontstage-rollout-mapping-layer`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] font-semibold text-slate-500`,children:String(t+1).padStart(2,`0`)}),(0,B.jsx)($,{variant:e.tone,children:e.output})]}),(0,B.jsx)(`h4`,{className:`mt-3 text-sm font-semibold leading-6 text-white`,children:e.label}),(0,B.jsx)(`p`,{className:`mt-1 text-xs font-semibold uppercase tracking-normal text-cyan-200`,children:e.role}),(0,B.jsx)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-slate-300`,children:e.description}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-1 rounded-md border border-white/10 bg-black/20 px-2 py-2 text-[11px] font-medium leading-5 text-slate-400`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-slate-500`,children:`in`}),` `,e.input]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-slate-500`,children:`refs`}),` `,e.node_ids.length,` nodes / `,e.edge_ids.length,` edges`]})]})]},e.layer_id))}),(0,B.jsxs)(`div`,{className:`relative z-10 mt-4 grid gap-3 lg:grid-cols-[minmax(0,0.95fr)_minmax(0,1.05fr)]`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] p-3`,"data-testid":`frontstage-rollout-flow-signals`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Flow signals`}),(0,B.jsxs)($,{variant:`neutral`,children:[r.length,` signals`]})]}),(0,B.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:r.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-black/20 px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-white`,children:e.label}),(0,B.jsx)($,{variant:e.tone,children:e.value})]}),(0,B.jsx)(`p`,{className:`mt-1 text-[11px] font-medium leading-5 text-slate-400`,children:e.description})]},e.signal_id))})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] p-3`,"data-testid":`frontstage-rollout-relationship-summaries`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Relationship grammar`}),(0,B.jsxs)($,{variant:`neutral`,children:[i.length,` kinds`]})]}),(0,B.jsx)(`div`,{className:`mt-3 space-y-2`,children:i.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-black/20 px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-white`,children:e.label}),(0,B.jsx)($,{variant:`info`,children:e.count})]}),(0,B.jsx)(`p`,{className:`mt-1 text-[11px] font-medium leading-5 text-slate-400`,children:e.description})]},e.kind))})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-white/[0.04] p-3`,"data-testid":`frontstage-rollout-attention-hotspots`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-400`,children:`Attention hotspots`}),(0,B.jsxs)($,{variant:`warning`,children:[a.length,` visible`]})]}),(0,B.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-white/10 bg-black/20 px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-white`,children:e.label}),(0,B.jsx)($,{variant:Tw(e.severity),children:e.severity})]}),(0,B.jsx)(`p`,{className:`mt-1 text-[11px] font-medium leading-5 text-slate-400`,children:e.description})]},e.hotspot_id))})]})]})]})]})}function Dw({projection:e}){return(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-white px-3 py-3 xl:col-span-2`,"data-testid":`frontstage-rollout-stage-flow`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Actor / state stages`}),(0,B.jsx)(`h3`,{className:`mt-1 text-base font-semibold leading-7 text-slate-950`,children:`One node can move; many lanes can compose`})]}),(0,B.jsx)($,{variant:`neutral`,children:`stage projection`})]}),(0,B.jsxs)(`div`,{className:`frontstage-rollout-stage-flow relative mt-4 grid gap-2 md:grid-cols-6`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`frontstage-rollout-stage-flow-beam`}),e.stages.map((e,t)=>(0,B.jsxs)(`div`,{className:Ny(`relative min-h-36 overflow-hidden rounded-md border px-3 py-3`,e.current?`border-slate-900 bg-slate-950 text-white shadow-sm`:`border-slate-200 bg-slate-50 text-slate-950`),"data-testid":`frontstage-rollout-stage`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:Ny(`flex h-8 w-8 items-center justify-center rounded-md border text-xs font-semibold`,e.current?`border-cyan-300/40 bg-cyan-300/10 text-cyan-100`:`border-slate-200 bg-white text-slate-500`),children:String(t+1).padStart(2,`0`)}),(0,B.jsx)($,{variant:tw(e.confidence),children:e.confidence})]}),(0,B.jsx)(`div`,{className:Ny(`mt-3 text-sm font-semibold leading-6`,e.current?`text-white`:`text-slate-950`),children:e.label}),(0,B.jsx)(`p`,{className:Ny(`mt-1 text-xs font-medium leading-5`,e.current?`text-slate-300`:`text-slate-600`),children:e.description}),e.current?(0,B.jsx)(`div`,{className:`mt-3 rounded-md border border-cyan-300/20 bg-cyan-300/10 px-2 py-1 text-[11px] font-semibold uppercase tracking-normal text-cyan-100`,children:`current scene`}):null]},e.stage_id))]})]})}function Ow({projection:e}){let t=ow(e);return(0,B.jsxs)(`div`,{className:`grid gap-4 rounded-md border border-slate-200 bg-slate-50 p-3 xl:col-span-2 xl:grid-cols-[minmax(0,1fr)_minmax(320px,420px)]`,"data-testid":`frontstage-rollout-lane-graph`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Rollout lane graph`}),(0,B.jsx)(`h3`,{className:`mt-1 text-base font-semibold leading-7 text-slate-950`,children:`Lanes keep throughput reviewable`})]}),(0,B.jsxs)($,{variant:`info`,children:[e.lanes.length,` lanes`]})]}),(0,B.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:e.lanes.map((t,n)=>{let r=aw(n),i=sw(e,t);return(0,B.jsxs)(`article`,{className:Ny(`min-w-0 overflow-hidden rounded-md border px-3 py-3`,r.card),"data-testid":`frontstage-rollout-lane`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:t.role}),(0,B.jsx)(`h4`,{className:`mt-1 text-sm font-semibold leading-6 text-slate-950`,children:t.label})]}),(0,B.jsxs)($,{variant:`neutral`,children:[i.length,` nodes`]})]}),(0,B.jsx)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-slate-600`,children:t.summary}),(0,B.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:i.map(e=>(0,B.jsxs)(`a`,{className:`inline-flex items-center gap-1 rounded-md border border-white/80 bg-white/80 px-2 py-1 text-[11px] font-semibold text-slate-700 transition hover:border-slate-300 hover:text-slate-950`,href:e.url,rel:`noreferrer`,target:`_blank`,title:e.title,children:[(0,B.jsx)(`span`,{children:e.label}),(0,B.jsx)(`span`,{className:Ny(`h-1.5 w-1.5 rounded-full`,r.dot)})]},e.node_id))})]},t.lane_id)})})]}),(0,B.jsxs)(`div`,{className:`min-w-0 rounded-md border border-slate-900 bg-slate-950 p-3 text-white`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:`Review edge mesh`}),(0,B.jsx)(`p`,{className:`mt-1 text-sm font-semibold leading-6 text-white`,children:`Generic edges explain why one node points at another.`})]}),(0,B.jsxs)($,{variant:`neutral`,children:[e.edges.length,` edges`]})]}),(0,B.jsx)(`div`,{className:`frontstage-rollout-edge-list mt-3 space-y-2`,"data-testid":`frontstage-rollout-edge-list`,children:e.edges.map((e,n)=>{let r=t.get(e.from_node_id),i=t.get(e.to_node_id);return(0,B.jsxs)(`div`,{className:`frontstage-rollout-edge relative rounded-md border border-white/10 bg-white/[0.06] px-3 py-2`,"data-testid":`frontstage-rollout-edge`,style:{animationDelay:`${n*120}ms`},children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,B.jsx)($,{variant:`info`,children:r?.label??e.from_node_id}),(0,B.jsx)(`span`,{className:`text-slate-500`,children:`->`}),(0,B.jsx)($,{variant:i?nw(i.state):`neutral`,children:i?.label??e.to_node_id}),(0,B.jsx)($,{variant:tw(e.confidence),children:e.edge_kind})]}),(0,B.jsx)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-slate-300`,children:e.label}),(0,B.jsxs)(`div`,{className:`mt-1 grid gap-1 text-[11px] leading-5 text-slate-500`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:r?.title??`upstream node`}),(0,B.jsx)(`span`,{className:`truncate`,children:i?.title??`downstream node`})]})]},e.edge_id)})})]})]})}function kw({children:e,className:t,title:n,icon:r}){return(0,B.jsxs)(`section`,{className:Ny(`rounded-lg border border-slate-200 bg-white shadow-sm`,t),children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-200 px-4 py-3`,children:(0,B.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-950`,children:[(0,B.jsx)(r,{className:`h-4 w-4 text-slate-500`}),n]})}),e]})}function Aw(){let e=WC?.workload_signal,t=e?.efficiency_model;if(!WC||!e||!t)return null;let n=[{label:`public Git facts`,value:`${$C(e.whole_repository?.commit_count)} commits`,helper:`${$C(e.whole_repository?.files_touched)} files touched`},{label:`actual public window`,value:`${$C(e.public_window?.calendar_days)} days`,helper:`${$C(e.public_window?.active_commit_days)} active commit days`},{label:`AI-assisted baseline`,value:ew(t.estimated_developer_days,` days`),helper:t.baseline??`maturity-adjusted product process`},{label:`single-engineer compression`,value:ew(t.single_engineer_calendar_compression,`x`),helper:`directional range, not a precision metric`}],r=WC.feature_points?.slice(0,4)??[];return(0,B.jsx)(kw,{icon:Om,title:`Efficiency Evidence`,children:(0,B.jsxs)(`div`,{className:`grid gap-4 p-4 lg:grid-cols-[minmax(0,1fr)_minmax(280px,420px)]`,"data-testid":`frontstage-efficiency-evidence`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`success`,children:`commit-backed`}),(0,B.jsx)($,{variant:`info`,children:`maturity-adjusted`}),(0,B.jsx)($,{variant:`neutral`,children:`public-safe`})]}),(0,B.jsx)(`h3`,{className:`text-lg font-semibold leading-7 text-slate-950`,children:WC.title}),(0,B.jsx)(`p`,{className:`text-sm leading-6 text-slate-600`,children:WC.frontend_card?.primary_metric_hint}),(0,B.jsx)(`p`,{className:`text-sm leading-6 text-slate-600`,children:`The comparison converts public commits into product requirement clusters, discounts prototype-level work, and compares that conservative baseline with the actual public Git window.`}),(0,B.jsx)(`p`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-medium leading-5 text-slate-600`,children:t.claim_boundary??WC.evidence_boundary})]}),(0,B.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:n.map(e=>(0,B.jsxs)(`div`,{className:`border-l-2 border-emerald-500 bg-emerald-50 px-3 py-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-emerald-800`,children:e.label}),(0,B.jsx)(`div`,{className:`mt-1 break-words text-xl font-semibold leading-7 text-slate-950`,children:e.value}),(0,B.jsx)(`div`,{className:`mt-0.5 break-words text-xs leading-5 text-slate-600`,children:e.helper})]},e.label))}),r.length?(0,B.jsxs)(`div`,{className:`border-t border-slate-200 pt-3 lg:col-span-2`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`requirement clusters`}),(0,B.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:r.map(e=>(0,B.jsx)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-medium leading-5 text-slate-700`,children:e},e))})]}):null]})})}function jw(){let e=JC,t=ow(e),n=t.get(e.source_contract.anchor_node_id),r=e.stages.find(e=>e.current)??e.stages.at(-1),i=qC.planned_projections?.[0];return(0,B.jsx)(kw,{icon:_m,title:`Trajectory Analysis`,children:(0,B.jsxs)(`div`,{className:`grid gap-4 p-4 xl:grid-cols-[minmax(0,1fr)_minmax(300px,420px)]`,"data-testid":`frontstage-trajectory-analysis`,children:[(0,B.jsx)(xw,{bundle:qC,projection:e}),(0,B.jsx)(Cw,{projection:e}),(0,B.jsx)(ww,{projection:e}),(0,B.jsx)(Ew,{bundle:qC,projection:e}),(0,B.jsxs)(`div`,{className:`min-w-0 rounded-md border border-slate-900 bg-slate-950 p-4 text-white`,"data-testid":`frontstage-trajectory-stage-curve`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-cyan-200`,children:`Stage progress curve`}),(0,B.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm font-semibold leading-6 text-white`,children:`The same projection model maps actor state, lane flow, and review edges without reading raw logs.`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:`read-only projection`}),(0,B.jsxs)($,{variant:`success`,children:[e.nodes.length,` nodes`]}),(0,B.jsxs)($,{variant:`neutral`,children:[e.edges.length,` edges`]})]})]}),(0,B.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.stages.map((t,n)=>(0,B.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[104px_minmax(0,1fr)]`,"data-testid":`frontstage-trajectory-stage`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-2 text-xs font-semibold text-slate-300`,children:[(0,B.jsx)(`span`,{children:t.actor_scope}),(0,B.jsx)(`span`,{className:`font-mono text-slate-500`,children:String(n+1).padStart(2,`0`)})]}),(0,B.jsxs)(`div`,{className:Ny(`relative min-h-10 rounded-md border border-white/10 bg-white/[0.06] px-3 py-2`,t.current?`ring-1 ring-cyan-300/70`:``),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 top-0 rounded-md bg-cyan-300/15`,style:{width:`${Math.max(12,(n+1)/e.stages.length*100)}%`}}),(0,B.jsxs)(`div`,{className:`relative z-10 flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold text-white`,children:t.label}),(0,B.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,children:[(0,B.jsx)($,{variant:tw(t.confidence),children:t.confidence}),t.current?(0,B.jsx)($,{variant:`info`,children:`current`}):null]})]}),(0,B.jsx)(`div`,{className:`relative z-10 mt-1 text-xs font-medium leading-5 text-slate-300`,children:t.description})]})]},t.stage_id))})]}),(0,B.jsxs)(`div`,{className:`grid gap-3`,children:[(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-3`,"data-testid":`frontstage-trajectory-current-scene`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:e.projection_kind}),(0,B.jsx)($,{variant:tw(e.scene.confidence),children:e.scene.confidence})]}),(0,B.jsx)(`h3`,{className:`mt-3 text-base font-semibold leading-7 text-slate-950`,children:e.scene.stage_label}),(0,B.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-slate-700`,children:e.scene.title}),(0,B.jsxs)(`p`,{className:`mt-2 text-xs leading-5 text-slate-500`,children:[r?.label??`No current stage`,` / `,e.source_contract.sample_window]}),(0,B.jsx)(`p`,{className:`mt-2 rounded-md border border-slate-200 bg-white px-2 py-1.5 text-xs font-medium leading-5 text-slate-600`,children:e.scene.why_current})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-cyan-200 bg-cyan-50 px-3 py-3`,"data-testid":`frontstage-trajectory-stage-confidence`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)($,{variant:`info`,children:`projection model`}),(0,B.jsx)($,{variant:tw(e.scene.confidence),children:e.scene.confidence})]}),(0,B.jsx)(`h3`,{className:`mt-3 text-base font-semibold leading-7 text-slate-950`,children:e.scene.stage_label}),(0,B.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-slate-700`,children:e.scene.why_current}),(0,B.jsxs)(`p`,{className:`mt-2 rounded-md border border-cyan-200 bg-white px-2 py-1.5 text-xs font-medium leading-5 text-slate-600`,children:[`Anchor `,n?.label??e.source_contract.anchor_node_id,`: `,n?.role??`projection anchor`,`.`]})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-3 py-3`,"data-testid":`frontstage-trajectory-verdict-card`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-amber-800`,children:`Verdict`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm font-semibold leading-6 text-slate-950`,children:e.source_contract.next_projection_hint}),(0,B.jsx)(`p`,{className:`mt-2 text-xs font-medium leading-5 text-amber-950`,children:`The renderer consumes only the projection bundle. Public GitHub metadata is enough for this batch; raw trajectories and local state stay outside the browser surface.`})]})]}),(0,B.jsx)(Dw,{projection:e}),(0,B.jsx)(Ow,{projection:e}),(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-white px-3 py-3 xl:col-span-2`,"data-testid":`frontstage-trajectory-evidence-drawer`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`Evidence drawer`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs font-medium leading-5 text-slate-600`,children:`Edges, model sections, and planned projections keep the rollout display explainable.`})]}),(0,B.jsxs)($,{variant:`neutral`,children:[e.edges.length,` edges`]})]}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-2`,children:[e.edges.map(e=>{let n=t.get(e.from_node_id),r=t.get(e.to_node_id);return(0,B.jsxs)(`div`,{className:`min-w-0 rounded-md border border-slate-200 bg-slate-50 px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,B.jsx)($,{variant:`info`,children:e.edge_kind}),(0,B.jsx)($,{variant:tw(e.confidence),children:e.confidence}),(0,B.jsx)(`span`,{className:`truncate text-xs font-semibold text-slate-950`,children:e.label})]}),(0,B.jsxs)(`div`,{className:`mt-1 break-words font-mono text-[11px] leading-5 text-slate-600`,children:[n?.label??e.from_node_id,` -> `,r?.label??e.to_node_id]})]},e.edge_id)}),i?(0,B.jsxs)(`div`,{className:`min-w-0 rounded-md border border-dashed border-slate-300 bg-white px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,B.jsx)($,{variant:`neutral`,children:i.status}),(0,B.jsx)(`span`,{className:`truncate text-xs font-semibold text-slate-950`,children:i.projection_id})]}),(0,B.jsx)(`div`,{className:`mt-1 text-xs font-medium leading-5 text-slate-600`,children:i.reason})]}):null]})]})]})})}var Mw=[{card:`border-emerald-200 bg-emerald-50`,dot:`border-emerald-300 bg-emerald-600`,ping:`bg-emerald-400`,line:`bg-emerald-300`},{card:`border-sky-200 bg-sky-50`,dot:`border-sky-300 bg-sky-600`,ping:`bg-sky-400`,line:`bg-sky-300`},{card:`border-amber-200 bg-amber-50`,dot:`border-amber-300 bg-amber-600`,ping:`bg-amber-400`,line:`bg-amber-300`},{card:`border-rose-200 bg-rose-50`,dot:`border-rose-300 bg-rose-600`,ping:`bg-rose-400`,line:`bg-rose-300`}],Nw=[{workflow:`PR review/comment -> fix loop`,output:`Branch-ready fix packet with repro, smoke result, and remaining review owner.`,metric:`Fewer dropped review threads; faster path from comment to validated patch.`,start:`/loopx fix this PR feedback`},{workflow:`Overnight PR-sized refactor`,output:`Reviewable slice list, validation notes, successor todo, and merge boundary.`,metric:`More merged commits without turning the next morning into a giant diff audit.`,start:`/loopx split this refactor into reviewable slices`},{workflow:`P0 blocked -> safe fallback`,output:`Kernel projection of the exact user gate, safe fallback todo, quota decision, and evidence boundary.`,metric:`Less idle agent time while preserving human judgment on the blocked path.`,start:`Appears inside an active /loopx goal when a concrete P0 gate blocks one lane and safe P1/P2 work remains.`}];function Pw(){return(0,B.jsx)(kw,{icon:Qm,title:`Experimental Today Value Path`,children:(0,B.jsxs)(`div`,{className:`space-y-4 p-4`,"data-testid":`frontstage-today-value-experiment`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-base font-semibold text-slate-950`,children:`Pick one capability that earns value today`}),(0,B.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-slate-600`,children:`This lower-priority module does not replace the first screen. It gives evaluators three concrete LoopX capabilities with expected output and user-facing value metrics.`})]}),(0,B.jsx)($,{variant:`info`,children:`experimental`})]}),(0,B.jsx)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:Nw.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 p-4`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-500`,children:`capability`}),(0,B.jsx)(`h4`,{className:`mt-2 text-sm font-semibold leading-6 text-slate-950`,children:e.workflow}),(0,B.jsxs)(`div`,{className:`mt-3 space-y-3 text-xs font-medium leading-5 text-slate-600`,children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`span`,{className:`font-semibold text-slate-950`,children:`Output: `}),e.output]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`span`,{className:`font-semibold text-slate-950`,children:`Value metric: `}),e.metric]}),(0,B.jsx)(`code`,{className:`block rounded-md border border-slate-200 bg-white px-2 py-1.5 text-[11px] text-slate-700`,children:e.start})]})]},e.workflow))})]})})}function Fw(){let[e,t]=(0,z.useState)(GC[0]?.id??``);if(!GC.length)return null;let n=GC.find(t=>t.id===e)??GC[0];if(!n)return null;let r=n.frontend_card?.story_beats?.slice(0,5)??[],i=n.feature_points?.slice(0,3)??[],a=QC(n),o=[{label:`human judgment`,value:`visible gates`,helper:`decisions stay explicit instead of disappearing inside chat logs`},{label:`agent lanes`,value:`day-night work`,helper:`safe side paths keep moving while gated decisions wait`},{label:`evidence loop`,value:`${YC()} story beats`,helper:`each case records blocker, progress, validation, and outcome signals`},{label:`public story`,value:`${GC.length} cases`,helper:`the hosted surface renders public-safe showcase data, not local state`}];return(0,B.jsx)(kw,{icon:_m,title:`Async Work Loop`,children:(0,B.jsxs)(`div`,{className:`space-y-4 p-4`,"data-testid":`frontstage-showcase-motion`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-base font-semibold text-slate-950`,children:`Case-driven motion board`}),(0,B.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-slate-600`,children:`Public cases become motion: human gates, agent lanes, evidence writeback, and recoverable next turns.`})]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-semibold leading-5 text-slate-600`,children:[(0,B.jsx)(`span`,{className:`text-slate-500`,children:`Case source`}),(0,B.jsx)(`span`,{className:`ml-2 text-slate-950`,children:`docs/showcases/showcase-catalog.json`})]})]}),(0,B.jsxs)(`div`,{className:`frontstage-showcase-motion-rail relative overflow-hidden rounded-md border border-slate-800 bg-slate-950 p-3 text-white shadow-sm`,"data-testid":`frontstage-showcase-journey-rail`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`frontstage-showcase-motion-beam`,"data-testid":`frontstage-showcase-motion-beam`}),(0,B.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-normal text-slate-300`,children:`Asynchronous agent rhythm`}),(0,B.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-slate-100`,children:`Agent teams work across turns and off-hours; human judgment stays in the control plane.`})]}),(0,B.jsx)($,{variant:`neutral`,children:`case-first`})]}),(0,B.jsx)(`div`,{className:`relative z-10 mt-4 grid gap-2 lg:grid-cols-4`,children:o.map((e,t)=>(0,B.jsxs)(`div`,{className:`relative rounded-md border border-white/10 bg-white/5 px-3 py-3`,children:[t