From 0acbb42d355a15bcf56b2b83ed7d68a960865327 Mon Sep 17 00:00:00 2001 From: zhengchuyi Date: Fri, 7 Aug 2026 18:55:15 +0800 Subject: [PATCH] fix: support byteplus viking memory and tool filtering --- frontend/src/create/CustomCreate.tsx | 16 +- frontend/src/create/normalizeDraft.ts | 19 +- frontend/src/create/veadkCatalog.ts | 18 + frontend/tests/generatedAgentPlanner.test.mjs | 18 +- frontend/tests/markdownPromptEditor.test.mjs | 10 +- tests/cli/test_studio_rbac.py | 2 +- tests/cli/test_studio_update.py | 2 +- tests/test_vikingdb_knowledge_backend.py | 36 +- tests/test_vikingdb_memory_backend.py | 181 ++++++++ veadk/cli/cli_frontend.py | 15 +- .../ve_viking_db_memory.py | 22 +- .../backends/vikingdb_knowledge_backend.py | 5 +- .../vikingdb_memory_backend.py | 26 +- veadk/utils/cloud_provider.py | 4 + ...tor-1lm8yIe5.js => CodeEditor-D4sAk5ax.js} | 2 +- ...zS.js => MarkdownPromptEditor-By6xKu66.js} | 2 +- .../{index-D88Zv3M6.js => index-BVhYD5_g.js} | 416 +++++++++--------- ...{index-BVfXmA_H.css => index-Gl3bdwkz.css} | 2 +- veadk/webui/index.html | 4 +- 19 files changed, 535 insertions(+), 265 deletions(-) create mode 100644 tests/test_vikingdb_memory_backend.py rename veadk/webui/assets/{CodeEditor-1lm8yIe5.js => CodeEditor-D4sAk5ax.js} (99%) rename veadk/webui/assets/{MarkdownPromptEditor-BdhMqVzS.js => MarkdownPromptEditor-By6xKu66.js} (99%) rename veadk/webui/assets/{index-D88Zv3M6.js => index-BVhYD5_g.js} (67%) rename veadk/webui/assets/{index-BVfXmA_H.css => index-Gl3bdwkz.css} (72%) diff --git a/frontend/src/create/CustomCreate.tsx b/frontend/src/create/CustomCreate.tsx index 00facd6c..0f6aabea 100644 --- a/frontend/src/create/CustomCreate.tsx +++ b/frontend/src/create/CustomCreate.tsx @@ -44,7 +44,7 @@ import { A2A_REGISTRY_DEFAULTS, A2A_REGISTRY_ENV, BUILTIN_TOOLS, - CREATE_BUILTIN_TOOLS, + createBuiltinToolsForProvider, STM_BACKENDS, LTM_BACKENDS, KB_BACKENDS, @@ -2928,14 +2928,24 @@ export function CustomCreate({ // Root-only rich sections read these off the root draft directly. const builtinTools = node.builtinTools ?? []; + const createBuiltinTools = useMemo( + () => createBuiltinToolsForProvider(cloudProvider), + [cloudProvider], + ); + const createBuiltinToolIds = useMemo( + () => new Set(createBuiltinTools.map((tool) => tool.id)), + [createBuiltinTools], + ); const mcpTools = node.mcpTools ?? []; const selectedSkills = node.selectedSkills ?? []; - const toggleBuiltin = (id: string) => + const toggleBuiltin = (id: string) => { + if (!createBuiltinToolIds.has(id)) return; patch({ builtinTools: builtinTools.includes(id) ? builtinTools.filter((x) => x !== id) : [...builtinTools, id], }); + }; // Detail-pane branching is driven by the SELECTED node's type. const orchestrator = isOrchestratorType(node.agentType); @@ -3923,7 +3933,7 @@ export function CustomCreate({
tool.id)); const AGENT_TYPES = new Set(["llm", "sequential", "parallel", "loop", "a2a"]); function asString(v: unknown, fallback = ""): string { @@ -283,11 +283,18 @@ export function normalizeDraft(raw: unknown): AgentDraft { }; } -export function sanitizeGeneratedDraftCapabilities(draft: AgentDraft): AgentDraft { +export function sanitizeGeneratedDraftCapabilities( + draft: AgentDraft, + inheritedCloudProvider: CloudProvider = draft.cloudProvider ?? "volcengine", +): AgentDraft { + const cloudProvider = draft.cloudProvider ?? inheritedCloudProvider; + const generatedToolIds = new Set( + createBuiltinToolsForProvider(cloudProvider).map((tool) => tool.id), + ); return { ...draft, builtinTools: (draft.builtinTools ?? []).filter((toolId) => - GENERATED_TOOL_IDS.has(toolId), + generatedToolIds.has(toolId), ), tracing: false, tracingExporters: [], @@ -298,6 +305,8 @@ export function sanitizeGeneratedDraftCapabilities(draft: AgentDraft): AgentDraf knowledgebase: false, knowledgebaseBackend: DEFAULT_KB_BACKEND, knowledgebaseIndex: "", - subAgents: draft.subAgents.map(sanitizeGeneratedDraftCapabilities), + subAgents: draft.subAgents.map((child) => + sanitizeGeneratedDraftCapabilities(child, cloudProvider), + ), }; } diff --git a/frontend/src/create/veadkCatalog.ts b/frontend/src/create/veadkCatalog.ts index 71ae5f4b..175f7ef4 100644 --- a/frontend/src/create/veadkCatalog.ts +++ b/frontend/src/create/veadkCatalog.ts @@ -5,6 +5,8 @@ // Each option carries enough metadata to (a) render a picker and (b) emit // runnable Python + a complete .env.example. +import type { CloudProvider } from "../adk/cloudProvider"; + export interface EnvVar { key: string; /** Whether the feature is non-functional without it (still emitted, but flagged). */ @@ -250,10 +252,26 @@ const HIDDEN_CREATE_TOOL_IDS = new Set([ "text_to_speech", "vesearch", ]); + +const BYTEPLUS_HIDDEN_CREATE_TOOL_IDS = new Set([ + "web_search", + "parallel_web_search", +]); + export const CREATE_BUILTIN_TOOLS = BUILTIN_TOOLS.filter( (tool) => !HIDDEN_CREATE_TOOL_IDS.has(tool.id), ); +export function createBuiltinToolsForProvider( + cloudProvider: CloudProvider = "volcengine", +): ToolOption[] { + const hidden = + cloudProvider === "byteplus" + ? BYTEPLUS_HIDDEN_CREATE_TOOL_IDS + : new Set(); + return CREATE_BUILTIN_TOOLS.filter((tool) => !hidden.has(tool.id)); +} + /* ------------------------------------------------------------------ * * Short-term memory backends. * ------------------------------------------------------------------ */ diff --git a/frontend/tests/generatedAgentPlanner.test.mjs b/frontend/tests/generatedAgentPlanner.test.mjs index b08410d4..50616101 100644 --- a/frontend/tests/generatedAgentPlanner.test.mjs +++ b/frontend/tests/generatedAgentPlanner.test.mjs @@ -25,7 +25,11 @@ test("removes hidden capabilities from every generated Agent", () => { ); const sanitizer = normalizeSource.slice(start); - assert.match(sanitizer, /GENERATED_TOOL_IDS\.has\(toolId\)/); + assert.match( + sanitizer, + /createBuiltinToolsForProvider\(cloudProvider\)\.map\(\(tool\) => tool\.id\)/, + ); + assert.match(sanitizer, /generatedToolIds\.has\(toolId\)/); assert.match(sanitizer, /tracing: false/); assert.match(sanitizer, /tracingExporters: \[\]/); assert.match(sanitizer, /memory: \{ shortTerm: false, longTerm: false \}/); @@ -37,7 +41,7 @@ test("removes hidden capabilities from every generated Agent", () => { assert.match(sanitizer, /knowledgebaseIndex: ""/); assert.match( sanitizer, - /subAgents: draft\.subAgents\.map\(sanitizeGeneratedDraftCapabilities\)/, + /subAgents: draft\.subAgents\.map\(\(child\) =>[\s\S]*?sanitizeGeneratedDraftCapabilities\(child, cloudProvider\)/, ); assert.match( createSource, @@ -49,8 +53,14 @@ test("keeps OpenViking long-term memory when normalizing imported drafts", () => assert.match(normalizeSource, /"openviking"/); }); -test("feeds supported generated tool ids into the checklist selection", () => { - assert.match(createSource, /items=\{CREATE_BUILTIN_TOOLS\}/); +test("feeds provider-supported generated tool ids into the checklist selection", () => { + assert.match( + createSource, + /createBuiltinToolsForProvider\(cloudProvider\)/, + ); + assert.match(createSource, /new Set\(createBuiltinTools\.map\(\(tool\) => tool\.id\)\)/); + assert.match(createSource, /if \(!createBuiltinToolIds\.has\(id\)\) return/); + assert.match(createSource, /items=\{createBuiltinTools\}/); assert.match(createSource, /selected=\{builtinTools\}/); }); diff --git a/frontend/tests/markdownPromptEditor.test.mjs b/frontend/tests/markdownPromptEditor.test.mjs index e2facabc..24be51c9 100644 --- a/frontend/tests/markdownPromptEditor.test.mjs +++ b/frontend/tests/markdownPromptEditor.test.mjs @@ -581,11 +581,19 @@ test("advanced model connection settings use an accessible disclosure", () => { }); test("built-in tools adapt columns and scroll after six rows", () => { - assert.match(createSource, /items=\{CREATE_BUILTIN_TOOLS\}[\s\S]*?scrollRows=\{6\}/); + assert.match(createSource, /items=\{createBuiltinTools\}[\s\S]*?scrollRows=\{6\}/); assert.match( catalogSource, /HIDDEN_CREATE_TOOL_IDS = new Set\(\[[\s\S]*?"web_scraper"[\s\S]*?"text_to_speech"[\s\S]*?"vesearch"/, ); + assert.match( + catalogSource, + /BYTEPLUS_HIDDEN_CREATE_TOOL_IDS = new Set\(\[[\s\S]*?"web_search"[\s\S]*?"parallel_web_search"/, + ); + assert.match( + catalogSource, + /cloudProvider === "byteplus"[\s\S]*?BYTEPLUS_HIDDEN_CREATE_TOOL_IDS[\s\S]*?return CREATE_BUILTIN_TOOLS\.filter\(\(tool\) => !hidden\.has\(tool\.id\)\)/, + ); assert.match( createStyles, /\.cw-tools-list-shell\s*\{[\s\S]*?container-type:\s*inline-size;/, diff --git a/tests/cli/test_studio_rbac.py b/tests/cli/test_studio_rbac.py index 9f2294cb..9bec29f4 100644 --- a/tests/cli/test_studio_rbac.py +++ b/tests/cli/test_studio_rbac.py @@ -436,7 +436,7 @@ async def initialize_evaluation_sets(**_kwargs: Any) -> list[str]: runtime_envs = cloud["runtime_envs"] assert runtime_envs["CLOUD_PROVIDER"] == "byteplus" assert runtime_envs["AGENTKIT_CLOUD_PROVIDER"] == "byteplus" - assert runtime_envs["DATABASE_VIKING_REGION"] == "ap-southeast-1" + assert runtime_envs["DATABASE_VIKING_REGION"] == "cn-hongkong" assert "BYTEPLUS_ACCESS_KEY" not in runtime_envs assert "BYTEPLUS_SECRET_KEY" not in runtime_envs assert "BYTEPLUS_SESSION_TOKEN" not in runtime_envs diff --git a/tests/cli/test_studio_update.py b/tests/cli/test_studio_update.py index 04be06bf..1675e2dd 100644 --- a/tests/cli/test_studio_update.py +++ b/tests/cli/test_studio_update.py @@ -451,7 +451,7 @@ def update_application_code_bundle(self, **kwargs: object) -> str: "CLOUD_PROVIDER": "byteplus", "AGENTKIT_CLOUD_PROVIDER": "byteplus", "BYTEPLUS_REGION": "ap-southeast-1", - "DATABASE_VIKING_REGION": "ap-southeast-1", + "DATABASE_VIKING_REGION": "cn-hongkong", } diff --git a/tests/test_vikingdb_knowledge_backend.py b/tests/test_vikingdb_knowledge_backend.py index 8faad6fe..e8b5e7fc 100644 --- a/tests/test_vikingdb_knowledge_backend.py +++ b/tests/test_vikingdb_knowledge_backend.py @@ -87,7 +87,7 @@ def test_viking_knowledgebase_reads_byteplus_credentials( assert backend.session_token == "bp-token" -def test_byteplus_viking_knowledgebase_uses_byteplus_region( +def test_byteplus_viking_knowledgebase_uses_hong_kong_fallback( monkeypatch: pytest.MonkeyPatch, ) -> None: from veadk.knowledgebase.backends.vikingdb_knowledge_backend import ( @@ -107,9 +107,35 @@ def test_byteplus_viking_knowledgebase_uses_byteplus_region( backend = VikingDBKnowledgeBackend(index="vikingkl_we4191n") - assert backend.region == "ap-southeast-1" - assert backend.host == "api-knowledgebase.mlp.ap-southeast-1.bytepluses.com" + assert backend.region == "cn-hongkong" + assert backend.host == "api-knowledgebase.mlp.cn-hongkong.bytepluses.com" assert ( - backend.base_url - == "https://api-knowledgebase.mlp.ap-southeast-1.bytepluses.com" + backend.base_url == "https://api-knowledgebase.mlp.cn-hongkong.bytepluses.com" + ) + + +def test_byteplus_viking_knowledgebase_keeps_hong_kong_region( + monkeypatch: pytest.MonkeyPatch, +) -> None: + from veadk.knowledgebase.backends.vikingdb_knowledge_backend import ( + VikingDBKnowledgeBackend, + ) + + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("DATABASE_VIKING_REGION", "cn-hongkong") + monkeypatch.setenv("BYTEPLUS_ACCESS_KEY", "bp-ak") + monkeypatch.setenv("BYTEPLUS_SECRET_KEY", "bp-sk") + monkeypatch.setattr( + VikingDBKnowledgeBackend, + "collection_status", + lambda self: {"existed": True}, + ) + + backend = VikingDBKnowledgeBackend(index="vikingkl_we4191n") + + assert backend.region == "cn-hongkong" + assert backend.host == "api-knowledgebase.mlp.cn-hongkong.bytepluses.com" + assert ( + backend.base_url == "https://api-knowledgebase.mlp.cn-hongkong.bytepluses.com" ) diff --git a/tests/test_vikingdb_memory_backend.py b/tests/test_vikingdb_memory_backend.py new file mode 100644 index 00000000..bf9a9b4a --- /dev/null +++ b/tests/test_vikingdb_memory_backend.py @@ -0,0 +1,181 @@ +# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import importlib +import sys +import types +from typing import Any + +import pytest + + +def _load_backend_module(monkeypatch: pytest.MonkeyPatch): + class FakeIAM: + def __init__(self, **_: Any) -> None: + pass + + class FakeVikingDBModule(types.ModuleType): + IAM: type[FakeIAM] + + class FakeVikingMem: + def __init__(self, **_: Any) -> None: + pass + + class FakeVikingDBMemoryModule(types.ModuleType): + VikingMem: type[FakeVikingMem] + + vikingdb_module = FakeVikingDBModule("vikingdb") + vikingdb_module.IAM = FakeIAM + vikingdb_memory_module = FakeVikingDBMemoryModule("vikingdb.memory") + vikingdb_memory_module.VikingMem = FakeVikingMem + monkeypatch.setitem(sys.modules, "vikingdb", vikingdb_module) + monkeypatch.setitem(sys.modules, "vikingdb.memory", vikingdb_memory_module) + + module_name = "veadk.memory.long_term_memory_backends.vikingdb_memory_backend" + sys.modules.pop(module_name, None) + return importlib.import_module(module_name) + + +def test_byteplus_viking_memory_uses_fixed_hong_kong_region( + monkeypatch: pytest.MonkeyPatch, +) -> None: + module = _load_backend_module(monkeypatch) + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("DATABASE_VIKING_REGION", "cn-beijing") + monkeypatch.setenv("BYTEPLUS_ACCESS_KEY", "bp-ak") + monkeypatch.setenv("BYTEPLUS_SECRET_KEY", "bp-sk") + monkeypatch.setattr( + module.VikingDBLTMBackend, + "_collection_exist", + lambda self: True, + ) + + backend = module.VikingDBLTMBackend(index="agent_memory") + + assert backend.region == "cn-hongkong" + + +def test_byteplus_viking_memory_ignores_explicit_region( + monkeypatch: pytest.MonkeyPatch, +) -> None: + module = _load_backend_module(monkeypatch) + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("BYTEPLUS_ACCESS_KEY", "bp-ak") + monkeypatch.setenv("BYTEPLUS_SECRET_KEY", "bp-sk") + monkeypatch.setattr( + module.VikingDBLTMBackend, + "_collection_exist", + lambda self: True, + ) + + backend = module.VikingDBLTMBackend(index="agent_memory", region="ap-southeast-1") + + assert backend.region == "cn-hongkong" + + +def test_byteplus_viking_memory_client_uses_fixed_hong_kong_host( + monkeypatch: pytest.MonkeyPatch, +) -> None: + module = _load_backend_module(monkeypatch) + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("BYTEPLUS_ACCESS_KEY", "bp-ak") + monkeypatch.setenv("BYTEPLUS_SECRET_KEY", "bp-sk") + monkeypatch.setattr( + module.VikingDBLTMBackend, + "_collection_exist", + lambda self: True, + ) + + captured: dict[str, str] = {} + + class FakeClient: + def __init__(self, **kwargs: str) -> None: + captured.update(kwargs) + + monkeypatch.setattr(module, "VikingDBMemoryClient", FakeClient) + + backend = module.VikingDBLTMBackend(index="agent_memory") + backend._get_client() + + assert backend.region == "cn-hongkong" + assert captured["region"] == "cn-hongkong" + assert captured["host"] == "api-knowledgebase.mlp.cn-hongkong.bytepluses.com" + + +def test_direct_byteplus_viking_memory_client_uses_fixed_hong_kong_default( + monkeypatch: pytest.MonkeyPatch, +) -> None: + from veadk.integrations.ve_viking_db_memory.ve_viking_db_memory import ( + VikingDBMemoryClient, + ) + + if hasattr(VikingDBMemoryClient, "_instance"): + delattr(VikingDBMemoryClient, "_instance") + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setattr( + VikingDBMemoryClient, + "get_body", + lambda self, api, params, body: "{}", + ) + + client = VikingDBMemoryClient(region="ap-southeast-1") + + assert client.get_host() == "api-knowledgebase.mlp.cn-hongkong.bytepluses.com" + assert client.service_info.credentials.region == "cn-hongkong" + + +def test_byteplus_viking_memory_keeps_hong_kong_region( + monkeypatch: pytest.MonkeyPatch, +) -> None: + module = _load_backend_module(monkeypatch) + monkeypatch.setenv("CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "byteplus") + monkeypatch.setenv("DATABASE_VIKING_REGION", "cn-hongkong") + monkeypatch.setenv("BYTEPLUS_ACCESS_KEY", "bp-ak") + monkeypatch.setenv("BYTEPLUS_SECRET_KEY", "bp-sk") + monkeypatch.setattr( + module.VikingDBLTMBackend, + "_collection_exist", + lambda self: True, + ) + + backend = module.VikingDBLTMBackend(index="agent_memory") + + assert backend.region == "cn-hongkong" + + +def test_volcengine_viking_memory_keeps_volcengine_region( + monkeypatch: pytest.MonkeyPatch, +) -> None: + module = _load_backend_module(monkeypatch) + monkeypatch.setenv("CLOUD_PROVIDER", "volcengine") + monkeypatch.setenv("AGENTKIT_CLOUD_PROVIDER", "volcengine") + monkeypatch.setenv("DATABASE_VIKING_REGION", "cn-shanghai") + monkeypatch.setenv("VOLCENGINE_ACCESS_KEY", "volc-ak") + monkeypatch.setenv("VOLCENGINE_SECRET_KEY", "volc-sk") + monkeypatch.setattr( + module.VikingDBLTMBackend, + "_collection_exist", + lambda self: True, + ) + + backend = module.VikingDBLTMBackend(index="agent_memory") + + assert backend.region == "cn-shanghai" diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index 4df1083e..bc6a0ec1 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -52,6 +52,7 @@ from veadk.consts import STUDIO_APMPLUS_ENV from veadk.utils.cloud_provider import ( DEFAULT_BYTEPLUS_REGION, + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION, DEFAULT_CLOUD_PROVIDER, CloudProvider, agentkit_openapi_base, @@ -1556,7 +1557,7 @@ def _collect_runtime_envs() -> dict[str, str]: if provider == "byteplus": out["CLOUD_PROVIDER"] = "byteplus" out["AGENTKIT_CLOUD_PROVIDER"] = "byteplus" - out["DATABASE_VIKING_REGION"] = DEFAULT_BYTEPLUS_REGION + out["DATABASE_VIKING_REGION"] = DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION return out def _model_name(model: object) -> str: @@ -3359,7 +3360,9 @@ def _agentkit_sdk_credential_env(): if provider == "byteplus": runtime_envs["CLOUD_PROVIDER"] = "byteplus" runtime_envs["AGENTKIT_CLOUD_PROVIDER"] = "byteplus" - runtime_envs["DATABASE_VIKING_REGION"] = DEFAULT_BYTEPLUS_REGION + runtime_envs["DATABASE_VIKING_REGION"] = ( + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION + ) # TOS build-artifact buckets are region-scoped. The SDK default template # ("agentkit-platform-") produces a single global name, which @@ -7646,7 +7649,9 @@ def frontend_deploy( veadk_environments["AGENTKIT_CLOUD_PROVIDER"] = provider_id if provider_id == "byteplus": veadk_environments["BYTEPLUS_REGION"] = region - veadk_environments["DATABASE_VIKING_REGION"] = DEFAULT_BYTEPLUS_REGION + veadk_environments["DATABASE_VIKING_REGION"] = ( + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION + ) byteplus_web_search_api_key = os.getenv( "BYTEPLUS_WEB_SEARCH_API_KEY", "", @@ -8074,7 +8079,9 @@ def frontend_update( environment_overrides["CLOUD_PROVIDER"] = provider_id environment_overrides["AGENTKIT_CLOUD_PROVIDER"] = provider_id environment_overrides["BYTEPLUS_REGION"] = target.region - environment_overrides["DATABASE_VIKING_REGION"] = DEFAULT_BYTEPLUS_REGION + environment_overrides["DATABASE_VIKING_REGION"] = ( + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION + ) service_client = getattr(service, "client", None) has_explicit_sandbox_tool = any( tool_id is not None diff --git a/veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py b/veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py index efb8d68b..ba1d50da 100644 --- a/veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py +++ b/veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py @@ -22,12 +22,13 @@ from volcengine.Credentials import Credentials from volcengine.ServiceInfo import ServiceInfo -from veadk.utils.misc import getenv from veadk.utils.cloud_provider import ( - DEFAULT_BYTEPLUS_REGION, + DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST, + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION, DEFAULT_VOLCENGINE_REGION, cloud_provider_from_env, ) +from veadk.utils.misc import getenv class VikingDBMemoryException(Exception): @@ -64,16 +65,13 @@ def __init__( socket_timeout=30, ): provider = cloud_provider_from_env() - if not region: - region = ( - DEFAULT_BYTEPLUS_REGION - if provider == "byteplus" - else DEFAULT_VOLCENGINE_REGION - ) - if not host: - if provider == "byteplus": - host = f"api-knowledgebase.mlp.{region}.bytepluses.com" - else: + if provider == "byteplus": + region = DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION + host = host or DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST + else: + if not region: + region = DEFAULT_VOLCENGINE_REGION + if not host: host = f"api-knowledgebase.mlp.{region}.volces.com" env_host = getenv( "DATABASE_VIKINGMEM_BASE_URL", diff --git a/veadk/knowledgebase/backends/vikingdb_knowledge_backend.py b/veadk/knowledgebase/backends/vikingdb_knowledge_backend.py index 66a68baa..f0523493 100644 --- a/veadk/knowledgebase/backends/vikingdb_knowledge_backend.py +++ b/veadk/knowledgebase/backends/vikingdb_knowledge_backend.py @@ -35,7 +35,6 @@ from veadk.configs.database_configs import NormalTOSConfig, TOSConfig from veadk.knowledgebase.backends.base_backend import BaseKnowledgebaseBackend from veadk.knowledgebase.entry import KnowledgebaseEntry -from veadk.utils.cloud_provider import DEFAULT_BYTEPLUS_REGION from veadk.utils.logger import get_logger from veadk.utils.misc import formatted_timestamp, getenv from veadk.integrations.ve_tos.ve_tos import VeTOS @@ -73,8 +72,8 @@ def _viking_session_token_from_env() -> str: def _byteplus_viking_region(region: str | None) -> str: """Return the supported BytePlus VikingDB Knowledge Base region.""" region = (region or "").strip() - if not region or region.startswith("cn-"): - return DEFAULT_BYTEPLUS_REGION + if not region or region in {"cn-beijing", "cn-shanghai", "cn-guangzhou"}: + return "cn-hongkong" return region diff --git a/veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py b/veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py index 13b25f9b..3b82719d 100644 --- a/veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py +++ b/veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py @@ -32,7 +32,10 @@ from veadk.memory.long_term_memory_backends.base_backend import ( BaseLongTermMemoryBackend, ) -from veadk.utils.cloud_provider import DEFAULT_BYTEPLUS_REGION +from veadk.utils.cloud_provider import ( + DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST, + DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION, +) from veadk.utils.logger import get_logger logger = get_logger(__name__) @@ -89,15 +92,11 @@ class VikingDBLTMBackend(BaseLongTermMemoryBackend): memory_type: list[str] = Field(default_factory=list) - def model_post_init(self, __context: Any) -> None: - if not self.region: - if self.cloud_provider.lower() == "byteplus": - self.region = os.getenv( - "DATABASE_VIKING_REGION", - DEFAULT_BYTEPLUS_REGION, - ) - else: - self.region = os.getenv("DATABASE_VIKING_REGION", "cn-beijing") + def model_post_init(self, __context: Any, /) -> None: + if self.cloud_provider.lower() == "byteplus": + self.region = DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION + elif not self.region: + self.region = os.getenv("DATABASE_VIKING_REGION", "cn-beijing") # We get memory type from: # 1. user input @@ -136,7 +135,8 @@ def _collection_exist(self) -> bool: ) logger.info(f"Collection {self.index} exist.") return True - except Exception: + except Exception: # noqa: BLE001 + # The VikingDB SDK raises broad service/client errors for missing collections. logger.info(f"Collection {self.index} not exist.") return False @@ -181,7 +181,7 @@ def _get_ak_sk_sts(self) -> tuple[str, str, str]: def _get_client(self) -> VikingDBMemoryClient: ak, sk, sts_token = self._get_ak_sk_sts() if self.cloud_provider.lower() == "byteplus": - host = f"api-knowledgebase.mlp.{self.region}.bytepluses.com" + host = DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST else: host = f"api-knowledgebase.mlp.{self.region}.volces.com" logger.info(f"Cloud provider: {self.cloud_provider.lower()}") @@ -198,7 +198,7 @@ def _get_client(self) -> VikingDBMemoryClient: def _get_sdk_client(self) -> VikingMem: ak, sk, sts_token = self._get_ak_sk_sts() if self.cloud_provider.lower() == "byteplus": - host = f"api-knowledgebase.mlp.{self.region}.bytepluses.com" + host = DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST else: host = f"api-knowledgebase.mlp.{self.region}.volces.com" logger.info(f"Cloud provider: {self.cloud_provider.lower()}") diff --git a/veadk/utils/cloud_provider.py b/veadk/utils/cloud_provider.py index f955ecc2..3980f5f5 100644 --- a/veadk/utils/cloud_provider.py +++ b/veadk/utils/cloud_provider.py @@ -24,6 +24,10 @@ SUPPORTED_CLOUD_PROVIDERS: tuple[CloudProvider, ...] = ("volcengine", "byteplus") DEFAULT_CLOUD_PROVIDER: CloudProvider = "volcengine" DEFAULT_BYTEPLUS_REGION = "ap-southeast-1" +DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION = "cn-hongkong" +DEFAULT_BYTEPLUS_VIKING_MEMORY_HOST = ( + f"api-knowledgebase.mlp.{DEFAULT_BYTEPLUS_VIKING_MEMORY_REGION}.bytepluses.com" +) DEFAULT_VOLCENGINE_REGION = "cn-beijing" _VEFAAS_APPLICATION_TEMPLATE_IDS: dict[CloudProvider, dict[str, str]] = { "volcengine": { diff --git a/veadk/webui/assets/CodeEditor-1lm8yIe5.js b/veadk/webui/assets/CodeEditor-D4sAk5ax.js similarity index 99% rename from veadk/webui/assets/CodeEditor-1lm8yIe5.js rename to veadk/webui/assets/CodeEditor-D4sAk5ax.js index 6b30d377..0ecc1afb 100644 --- a/veadk/webui/assets/CodeEditor-1lm8yIe5.js +++ b/veadk/webui/assets/CodeEditor-D4sAk5ax.js @@ -1,4 +1,4 @@ -import{L as xe,D as sf}from"./index-D88Zv3M6.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` +import{L as xe,D as sf}from"./index-BVhYD5_g.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=n),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new le(n,r)),n=[],r=-1);return r>-1&&t.push(new le(n,r)),t}}class Ot extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?n.push(l):l.decompose(e-o,t-o,n,h)}o=a+1}}replace(e,t,n){if([e,t]=Vi(this,e,t),n.lines=s&&t<=l){let a=o.replace(e-s,t-s,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Ot(c,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=n),eo&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ot))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let u of e)n+=u.lines;if(n<32){let u=[];for(let d of e)d.flatten(u);return new le(u,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ot)for(let m of u.children)O(m);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof le&&a&&(d=c[c.length-1])instanceof le&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new le(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>r&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ot.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ot(l,t)}}D.empty=new le([""],0);function Vg(i){let e=-1;for(let t of i)e+=t.length+1;return e}function zr(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s=t&&(a>n&&(l=l.slice(0,n-r)),r0?1:(e instanceof le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof le?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof le){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof le?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Sf{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new gn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},gn.prototype[Symbol.iterator]=Sf.prototype[Symbol.iterator]=bf.prototype[Symbol.iterator]=function(){return this});let Yg=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Vi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function de(i,e,t=!0,n=!0){return Eg(i,e,t,n)}function Lg(i){return i>=56320&&i<57344}function Dg(i){return i>=55296&&i<56320}function Re(i,e){let t=i.charCodeAt(e);if(!Dg(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Lg(n)?(t-55296<<10)+(n-56320)+65536:t}function oa(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ft(i){return i<65536?1:2}const Jo=/\r\n?|\n/;var Se=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Se||(Se={}));class Qt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(n!=Se.Simple&&h>=e&&(n==Se.TrackDel&&re||n==Se.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qt(e)}static create(e){return new Qt(e)}}class ce extends Qt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return el(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return tl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&Bt(n,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;of||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?D.of(u.split(n||Jo)):u:D.empty,m=d.length;if(O==f&&m==0)return;Oo&&ke(r,O-o,-1),ke(r,f-O,m),Bt(s,r,d),o=f}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function Bt(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,h,s,c,O),r=h,s=c}}}function tl(i,e,t,n=!1){let r=[],s=n?[]:null,o=new Xn(i),l=new Xn(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ke(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>h),s.forward2(a),o.forward(a)}}}}class Xn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?D.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Lt(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,n,r){return new Lt(e,t,n,r)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;rr.from-s.from),t=e.indexOf(n);for(let r=1;rs.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function xf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let la=0;class C{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=la++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new C(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:aa),!!e.static,e.enables)}of(e){return new _r([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function aa(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class _r{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=la++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:((t=e[O.id])!==null&&t!==void 0?t:1)&1||c.push(e[O.id]);return{create(O){return O.values[o]=n(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||il(O,c)){let u=n(O);if(l?!Zh(u,O.values[o],r):!r(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let m=es(f,d);if(this.dependencies.every(g=>g instanceof C?f.facet(g)===O.facet(g):g instanceof ye?f.field(g,!1)==O.field(g,!1):!0)||(l?Zh(u=n(O),m,r):r(u=n(O),m)))return O.values[o]=m,0}else u=n(O);return O.values[o]=u,1}}}get extension(){return this}}function Zh(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let h=[];for(let c=0;cn===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let s=n.facet(ur),o=r.facet(ur),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(n.values[t]=l.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const ai={lowest:4,low:3,default:2,high:1,highest:0};function on(i){return e=>new kf(e,i)}const _t={highest:on(ai.highest),high:on(ai.high),default:on(ai.default),low:on(ai.low),lowest:on(ai.lowest)};class kf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Xs{of(e){return new nl(this,e)}reconfigure(e){return Xs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class nl{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class Jr{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let f of Gg(e,t,o))f instanceof ye?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of r)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=n==null?void 0:n.config.facets;for(let f in s){let u=s[f],d=u[0].facet,m=c&&c[f]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,aa(m,u))a.push(n.facet(d));else{let g=d.combine(u.map(Q=>Q.value));a.push(n&&d.compare(g,n.facet(d))?n.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(Q=>g.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(g=>Bg(g,d,u))}}let O=h.map(f=>f(l));return new Jr(e,o,O,l,a,s)}}function Gg(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=n[a].indexOf(o);h>-1&&n[a].splice(h,1),o instanceof nl&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof nl){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof kf)s(o.inner,o.prec);else if(o instanceof ye)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _r)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,ai.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ai.default),n.reduce((o,l)=>o.concat(l))}function Qn(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function es(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Pf=C.define(),rl=C.define({combine:i=>i.some(e=>e),static:!0}),$f=C.define({combine:i=>i.length?i[0]:void 0,static:!0}),wf=C.define(),vf=C.define(),Tf=C.define(),Xf=C.define({combine:i=>i.length?i[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ig}}class Ig{of(e){return new bt(this,e)}}class Ug{constructor(e){this.map=e}of(e){return new W(this,e)}}class W{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new W(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ug(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}}W.reconfigure=W.define();W.appendConfig=W.define();class he{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xf(n,t.newLength),s.some(l=>l.type==he.time)||(this.annotations=s.concat(he.time.of(Date.now())))}static create(e,t,n,r,s,o){return new he(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(he.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}he.time=bt.define();he.userEvent=bt.define();he.addToHistory=bt.define();he.remote=bt.define();function Ng(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n=i[n]))s=i[n++],o=i[n++];else if(r=0;r--){let s=n[r](i);s instanceof he?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof he?i=s[0]:i=Rf(e,Ai(s),!1)}return i}function Hg(i){let e=i.startState,t=e.facet(Tf),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=Cf(n,sl(e,s,i.changes.newLength),!0))}return n==i?i:he.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const Kg=[];function Ai(i){return i==null?Kg:Array.isArray(i)?i:[i]}var te=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(te||(te={}));const Jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ol;try{ol=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function e0(i){if(ol)return ol.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Jg.test(t)))return!0}return!1}function t0(i){return e=>{if(!/\S/.test(e))return te.Space;if(e0(e))return te.Word;for(let t=0;t-1)return te.Word;return te.Other}}class Y{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(W.reconfigure)?(t=null,n=l.value):l.is(W.appendConfig)&&(t=null,n=Ai(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Jr.resolve(n,r,this),s=new Y(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(rl)?e.newSelection:e.newSelection.asSingle();new Y(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Ai(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return Y.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Jr.resolve(e.extensions||[],new Map),n=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(Y.lineSeparator)||Jo)),r=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return xf(r,n.length),t.staticFacet(rl)||(r=r.asSingle()),new Y(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Y.tabSize)}get lineBreak(){return this.facet(Y.lineSeparator)||` diff --git a/veadk/webui/assets/MarkdownPromptEditor-BdhMqVzS.js b/veadk/webui/assets/MarkdownPromptEditor-By6xKu66.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-BdhMqVzS.js rename to veadk/webui/assets/MarkdownPromptEditor-By6xKu66.js index a75a75bf..f27d5eb5 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-BdhMqVzS.js +++ b/veadk/webui/assets/MarkdownPromptEditor-By6xKu66.js @@ -1,4 +1,4 @@ -var px=Object.defineProperty;var mx=(t,e,n)=>e in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-D88Zv3M6.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-BVhYD5_g.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ni.map(i=>d[i]); -var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var zC=(e,t,n)=>RK(e,typeof t!="symbol"?t+"":t,n),VC=(e,t,n)=>t.has(e)||HC("Cannot "+n);var Li=(e,t,n)=>(VC(e,t,"read from private field"),n?n.call(e):t.get(e)),GC=(e,t,n)=>t.has(e)?HC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ZE=(e,t,n,s)=>(VC(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function OK(e,t){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Bl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var JD={exports:{}},V1={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-By6xKu66.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var zC=(e,t,n)=>RK(e,typeof t!="symbol"?t+"":t,n),VC=(e,t,n)=>t.has(e)||HC("Cannot "+n);var Pi=(e,t,n)=>(VC(e,t,"read from private field"),n?n.call(e):t.get(e)),GC=(e,t,n)=>t.has(e)?HC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ZE=(e,t,n,s)=>(VC(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function OK(e,t){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Ul=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var JD={exports:{}},V1={};/** * @license React * react-jsx-runtime.production.js * @@ -7,7 +7,7 @@ var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var MK=Symbol.for("react.transitional.element"),LK=Symbol.for("react.fragment");function e5(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:MK,type:e,key:s,ref:t!==void 0?t:null,props:n}}V1.Fragment=LK;V1.jsx=e5;V1.jsxs=e5;JD.exports=V1;var o=JD.exports,t5={exports:{}},It={};/** + */var MK=Symbol.for("react.transitional.element"),LK=Symbol.for("react.fragment");function e5(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:MK,type:e,key:s,ref:t!==void 0?t:null,props:n}}V1.Fragment=LK;V1.jsx=e5;V1.jsxs=e5;JD.exports=V1;var o=JD.exports,t5={exports:{}},jt={};/** * @license React * react.production.js * @@ -15,7 +15,7 @@ var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dT=Symbol.for("react.transitional.element"),DK=Symbol.for("react.portal"),PK=Symbol.for("react.fragment"),BK=Symbol.for("react.strict_mode"),UK=Symbol.for("react.profiler"),FK=Symbol.for("react.consumer"),$K=Symbol.for("react.context"),HK=Symbol.for("react.forward_ref"),zK=Symbol.for("react.suspense"),VK=Symbol.for("react.memo"),n5=Symbol.for("react.lazy"),GK=Symbol.for("react.activity"),KC=Symbol.iterator;function KK(e){return e===null||typeof e!="object"?null:(e=KC&&e[KC]||e["@@iterator"],typeof e=="function"?e:null)}var s5={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},i5=Object.assign,r5={};function Kf(e,t,n){this.props=e,this.context=t,this.refs=r5,this.updater=n||s5}Kf.prototype.isReactComponent={};Kf.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")};Kf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function a5(){}a5.prototype=Kf.prototype;function fT(e,t,n){this.props=e,this.context=t,this.refs=r5,this.updater=n||s5}var hT=fT.prototype=new a5;hT.constructor=fT;i5(hT,Kf.prototype);hT.isPureReactComponent=!0;var qC=Array.isArray;function y_(){}var rs={H:null,A:null,T:null,S:null},o5=Object.prototype.hasOwnProperty;function pT(e,t,n){var s=n.ref;return{$$typeof:dT,type:e,key:t,ref:s!==void 0?s:null,props:n}}function qK(e,t){return pT(e.type,t,e.props)}function mT(e){return typeof e=="object"&&e!==null&&e.$$typeof===dT}function YK(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var YC=/\/+/g;function JE(e,t){return typeof e=="object"&&e!==null&&e.key!=null?YK(""+e.key):t.toString(36)}function WK(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(y_,y_):(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 dd(e,t,n,s,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(r){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case dT:case DK:a=!0;break;case n5:return a=e._init,dd(a(e._payload),t,n,s,i)}}if(a)return i=i(e),a=s===""?"."+JE(e,0):s,qC(i)?(n="",a!=null&&(n=a.replace(YC,"$&/")+"/"),dd(i,t,n,"",function(u){return u})):i!=null&&(mT(i)&&(i=qK(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(YC,"$&/")+"/")+a)),t.push(i)),1;a=0;var l=s===""?".":s+":";if(qC(e))for(var c=0;c{throw TypeError(e)};var RK=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(C,I){var D=C.length;C.push(I);e:for(;0>>1,O=C[$];if(0>>1;$i(P,D))Qi(ee,P)?(C[$]=ee,C[Q]=D,$=Q):(C[$]=P,C[se]=D,$=se);else if(Qi(ee,D))C[$]=ee,C[Q]=D,$=Q;else break e}}return I}function i(C,I){var D=C.sortIndex-I.sortIndex;return D!==0?D:C.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(C){for(var I=n(u);I!==null;){if(I.callback===null)s(u);else if(I.startTime<=C)s(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function S(C){if(b=!1,w(C),!m)if(n(c)!==null)m=!0,_||(_=!0,B());else{var I=n(u);I!==null&&F(S,I.startTime-C)}}var _=!1,T=-1,k=5,A=-1;function j(){return v?!0:!(e.unstable_now()-AC&&j());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var O=$(f.expirationTime<=C);if(C=e.unstable_now(),typeof O=="function"){f.callback=O,w(C),I=!0;break t}f===n(c)&&s(c),w(C)}else s(c);f=n(c)}if(f!==null)I=!0;else{var te=n(u);te!==null&&F(S,te.startTime-C),I=!1}}break e}finally{f=null,h=D,p=!1}I=void 0}}finally{I?B():_=!1}}}var B;if(typeof E=="function")B=function(){E(R)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,L=z.port2;z.port1.onmessage=R,B=function(){L.postMessage(null)}}else B=function(){y(R,0)};function F(C,I){T=y(function(){C(e.unstable_now())},I)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125$?(C.sortIndex=D,t(u,C),n(c)===null&&C===n(u)&&(b?(x(T),T=-1):b=!0,F(S,D-$))):(C.sortIndex=O,t(c,C),m||p||(m=!0,_||(_=!0,B()))),C},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(C){var I=h;return function(){var D=h;h=I;try{return C.apply(this,arguments)}finally{h=D}}}})(u5);c5.exports=u5;var ZK=c5.exports,d5={exports:{}},tr={};/** + */(function(e){function t(C,I){var D=C.length;C.push(I);e:for(;0>>1,O=C[$];if(0>>1;$i(P,D))Zi(te,P)?(C[$]=te,C[Z]=D,$=Z):(C[$]=P,C[se]=D,$=se);else if(Zi(te,D))C[$]=te,C[Z]=D,$=Z;else break e}}return I}function i(C,I){var D=C.sortIndex-I.sortIndex;return D!==0?D:C.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(C){for(var I=n(u);I!==null;){if(I.callback===null)s(u);else if(I.startTime<=C)s(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function S(C){if(b=!1,w(C),!m)if(n(c)!==null)m=!0,_||(_=!0,B());else{var I=n(u);I!==null&&F(S,I.startTime-C)}}var _=!1,T=-1,k=5,A=-1;function j(){return v?!0:!(e.unstable_now()-AC&&j());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var O=$(f.expirationTime<=C);if(C=e.unstable_now(),typeof O=="function"){f.callback=O,w(C),I=!0;break t}f===n(c)&&s(c),w(C)}else s(c);f=n(c)}if(f!==null)I=!0;else{var ne=n(u);ne!==null&&F(S,ne.startTime-C),I=!1}}break e}finally{f=null,h=D,p=!1}I=void 0}}finally{I?B():_=!1}}}var B;if(typeof E=="function")B=function(){E(R)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,L=z.port2;z.port1.onmessage=R,B=function(){L.postMessage(null)}}else B=function(){y(R,0)};function F(C,I){T=y(function(){C(e.unstable_now())},I)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125$?(C.sortIndex=D,t(u,C),n(c)===null&&C===n(u)&&(b?(x(T),T=-1):b=!0,F(S,D-$))):(C.sortIndex=O,t(c,C),m||p||(m=!0,_||(_=!0,B()))),C},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(C){var I=h;return function(){var D=h;h=I;try{return C.apply(this,arguments)}finally{h=D}}}})(u5);c5.exports=u5;var ZK=c5.exports,d5={exports:{}},ir={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var JK=g;function f5(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h5)}catch(e){console.error(e)}}h5(),d5.exports=tr;var wi=d5.exports;/** + */var JK=g;function f5(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h5)}catch(e){console.error(e)}}h5(),d5.exports=ir;var wi=d5.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var jK=Object.defineProperty;var HC=e=>{throw TypeError(e)};var RK=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fi=ZK,p5=g,nq=wi;function Te(e){var t="https://react.dev/errors/"+e;if(1wd||(e.current=S_[wd],S_[wd]=null,wd--)}function Hn(e,t){wd++,S_[wd]=e.current,e.current=t}var lo=mo(null),um=mo(null),Kl=mo(null),yy=mo(null);function xy(e,t){switch(Hn(Kl,t),Hn(um,e),Hn(lo,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sj(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sj(t),e=F6(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}vi(lo),Hn(lo,e)}function df(){vi(lo),vi(um),vi(Kl)}function N_(e){e.memoizedState!==null&&Hn(yy,e);var t=lo.current,n=F6(t,e.type);t!==n&&(Hn(um,e),Hn(lo,n))}function Ey(e){um.current===e&&(vi(lo),vi(um)),yy.current===e&&(vi(yy),vm._currentValue=Wc)}var ev,ZC;function jc(e){if(ev===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ev=t&&t[1]||"",ZC=-1_d||(e.current=S_[_d],S_[_d]=null,_d--)}function zn(e,t){_d++,S_[_d]=e.current,e.current=t}var co=go(null),um=go(null),ql=go(null),yy=go(null);function xy(e,t){switch(zn(ql,t),zn(um,e),zn(co,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sj(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sj(t),e=F6(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}vi(co),zn(co,e)}function ff(){vi(co),vi(um),vi(ql)}function N_(e){e.memoizedState!==null&&zn(yy,e);var t=co.current,n=F6(t,e.type);t!==n&&(zn(um,e),zn(co,n))}function Ey(e){um.current===e&&(vi(co),vi(um)),yy.current===e&&(vi(yy),vm._currentValue=Xc)}var ev,ZC;function Rc(e){if(ev===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ev=t&&t[1]||"",ZC=-1)":-1i||c[s]!==u[i]){var d=` -`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=s&&0<=i);break}}}finally{tv=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?jc(n):""}function oq(e,t){switch(e.tag){case 26:case 27:case 5:return jc(e.type);case 16:return jc("Lazy");case 13:return e.child!==t&&t!==null?jc("Suspense Fallback"):jc("Suspense");case 19:return jc("SuspenseList");case 0:case 15:return nv(e.type,!1);case 11:return nv(e.type.render,!1);case 1:return nv(e.type,!0);case 31:return jc("Activity");default:return""}}function JC(e){try{var t="",n=null;do t+=oq(e,n),n=e,e=e.return;while(e);return t}catch(s){return` +`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=s&&0<=i);break}}}finally{tv=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Rc(n):""}function oq(e,t){switch(e.tag){case 26:case 27:case 5:return Rc(e.type);case 16:return Rc("Lazy");case 13:return e.child!==t&&t!==null?Rc("Suspense Fallback"):Rc("Suspense");case 19:return Rc("SuspenseList");case 0:case 15:return nv(e.type,!1);case 11:return nv(e.type.render,!1);case 1:return nv(e.type,!0);case 31:return Rc("Activity");default:return""}}function JC(e){try{var t="",n=null;do t+=oq(e,n),n=e,e=e.return;while(e);return t}catch(s){return` Error generating stack: `+s.message+` -`+s.stack}}var T_=Object.prototype.hasOwnProperty,yT=fi.unstable_scheduleCallback,sv=fi.unstable_cancelCallback,lq=fi.unstable_shouldYield,cq=fi.unstable_requestPaint,Mr=fi.unstable_now,uq=fi.unstable_getCurrentPriorityLevel,v5=fi.unstable_ImmediatePriority,w5=fi.unstable_UserBlockingPriority,vy=fi.unstable_NormalPriority,dq=fi.unstable_LowPriority,_5=fi.unstable_IdlePriority,fq=fi.log,hq=fi.unstable_setDisableYieldValue,rg=null,Lr=null;function Ul(e){if(typeof fq=="function"&&hq(e),Lr&&typeof Lr.setStrictMode=="function")try{Lr.setStrictMode(rg,e)}catch{}}var Dr=Math.clz32?Math.clz32:gq,pq=Math.log,mq=Math.LN2;function gq(e){return e>>>=0,e===0?32:31-(pq(e)/mq|0)|0}var N0=256,T0=262144,k0=4194304;function Rc(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 q1(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=s&134217727;return l!==0?(s=l&~r,s!==0?i=Rc(s):(a&=l,a!==0?i=Rc(a):n||(n=l&~e,n!==0&&(i=Rc(n))))):(l=s&~r,l!==0?i=Rc(l):a!==0?i=Rc(a):n||(n=s&~e,n!==0&&(i=Rc(n)))),i===0?0:t!==0&&t!==i&&!(t&r)&&(r=i&-i,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:i}function ag(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bq(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 S5(){var e=k0;return k0<<=1,!(k0&62914560)&&(k0=4194304),e}function iv(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function og(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yq(e,t,n,s,i,r){var a=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 l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Sq=/[\n"\\]/g;function ia(e){return e.replace(Sq,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function C_(e,t,n,s,i,r,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zr(t)):e.value!==""+Zr(t)&&(e.value=""+Zr(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?I_(e,a,Zr(t)):n!=null?I_(e,a,Zr(n)):s!=null&&e.removeAttribute("value"),i==null&&r!=null&&(e.defaultChecked=!!r),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+Zr(l):e.removeAttribute("name")}function O5(e,t,n,s,i,r,a,l){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){A_(e);return}n=n!=null?""+Zr(n):"",t=t!=null?""+Zr(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??i,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),A_(e)}function I_(e,t,n){t==="number"&&wy(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Xd(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),R_=!1;if(sl)try{var Uh={};Object.defineProperty(Uh,"passive",{get:function(){R_=!0}}),window.addEventListener("test",Uh,Uh),window.removeEventListener("test",Uh,Uh)}catch{R_=!1}var Fl=null,ST=null,jb=null;function B5(){if(jb)return jb;var e,t=ST,n=t.length,s,i="value"in Fl?Fl.value:Fl.textContent,r=i.length;for(e=0;e=Cp),uI=" ",dI=!1;function F5(e,t){switch(e){case"keyup":return Zq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nd=!1;function eY(e,t){switch(e){case"compositionend":return $5(t);case"keypress":return t.which!==32?null:(dI=!0,uI);case"textInput":return e=t.data,e===uI&&dI?null:e;default:return null}}function tY(e,t){if(Nd)return e==="compositionend"||!TT&&F5(e,t)?(e=B5(),jb=ST=Fl=null,Nd=!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=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=gI(n)}}function G5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?G5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function K5(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wy(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=wy(e.document)}return t}function kT(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 cY=sl&&"documentMode"in document&&11>=document.documentMode,Td=null,O_=null,jp=null,M_=!1;function yI(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;M_||Td==null||Td!==wy(s)||(s=Td,"selectionStart"in s&&kT(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),jp&&hm(jp,s)||(jp=s,s=Fy(O_,"onSelect"),0>=a,i-=a,io=1<<32-Dr(t)+i|n<k?(A=T,T=null):A=T.sibling;var j=h(y,T,E[k],w);if(j===null){T===null&&(T=A);break}e&&T&&j.alternate===null&&t(y,T),x=r(j,x,k),_===null?S=j:_.sibling=j,_=j,T=A}if(k===E.length)return n(y,T),Zt&&Fo(y,k),S;if(T===null){for(;kk?(A=T,T=null):A=T.sibling;var R=h(y,T,j.value,w);if(R===null){T===null&&(T=A);break}e&&T&&R.alternate===null&&t(y,T),x=r(R,x,k),_===null?S=R:_.sibling=R,_=R,T=A}if(j.done)return n(y,T),Zt&&Fo(y,k),S;if(T===null){for(;!j.done;k++,j=E.next())j=f(y,j.value,w),j!==null&&(x=r(j,x,k),_===null?S=j:_.sibling=j,_=j);return Zt&&Fo(y,k),S}for(T=s(T);!j.done;k++,j=E.next())j=p(T,y,k,j.value,w),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?k:j.key),x=r(j,x,k),_===null?S=j:_.sibling=j,_=j);return e&&T.forEach(function(B){return t(y,B)}),Zt&&Fo(y,k),S}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===vd&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case S0:e:{for(var S=E.key;x!==null;){if(x.key===S){if(S=E.type,S===vd){if(x.tag===7){n(y,x.sibling),w=i(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Cl&&Oc(S)===x.type){n(y,x.sibling),w=i(x,E.props),$h(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===vd?(w=Xc(E.props.children,y.mode,w,E.key),w.return=y,y=w):(w=Ob(E.type,E.key,E.props,null,y.mode,w),$h(w,E),w.return=y,y=w)}return a(y);case cp:e:{for(S=E.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=i(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=hv(E,y.mode,w),w.return=y,y=w}return a(y);case Cl:return E=Oc(E),v(y,x,E,w)}if(up(E))return m(y,x,E,w);if(Bh(E)){if(S=Bh(E),typeof S!="function")throw Error(Te(150));return E=S.call(E),b(y,x,E,w)}if(typeof E.then=="function")return v(y,x,j0(E),w);if(E.$$typeof===zo)return v(y,x,I0(y,E),w);R0(y,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,x!==null&&x.tag===6?(n(y,x.sibling),w=i(x,E),w.return=y,y=w):(n(y,x),w=fv(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{gm=0;var S=v(y,x,E,w);return Jd=null,S}catch(T){if(T===Qf||T===J1)throw T;var _=Ir(29,T,null,y.mode);return _.lanes=w,_.return=y,_}finally{}}}var du=o4(!0),l4=o4(!1),Il=!1;function DT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $_(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 Yl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wl(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,hn&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,t=Sy(e),J5(e,null,n),t}return Z1(e,s,t,n),Sy(e)}function Op(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,T5(e,n)}}function mv(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?i=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?i=r=t:r=r.next=t}else i=r=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var H_=!1;function Mp(){if(H_){var e=Zd;if(e!==null)throw e}}function Lp(e,t,n,s){H_=!1;var i=e.updateQueue;Il=!1;var r=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?r=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(r!==null){var f=i.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(Wt&h)===h:(s&h)===h){h!==0&&h===pf&&(H_=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;h=t;var v=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(v,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,h=typeof m=="function"?m.call(v,f,h):m,h==null)break e;f=os({},f,h);break e;case 2:Il=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,r===null&&(i.shared.lanes=0),oc|=a,e.lanes=a,e.memoizedState=f}}function c4(e,t){if(typeof e!="function")throw Error(Te(191,e));e.call(t)}function u4(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;er?r:8;var a=yt.T,l={};yt.T=l,WT(e,!1,t,n);try{var c=i(),u=yt.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=yY(c,s);Dp(e,t,d,Pr(e))}else Dp(e,t,s,Pr(e))}catch(f){Dp(e,t,{then:function(){},status:"rejected",reason:f},Pr())}finally{pn.p=r,a!==null&&l.types!==null&&(a.types=l.types),yt.T=a}}function SY(){}function q_(e,t,n,s){if(e.tag!==5)throw Error(Te(476));var i=L4(e).queue;M4(e,i,t,Wc,n===null?SY:function(){return D4(e),n(s)})}function L4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Wc,baseState:Wc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:Wc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function D4(e){var t=L4(e);t.next===null&&(t=e.alternate.memoizedState),Dp(e,t.next.queue,{},Pr())}function YT(){return Ii(vm)}function P4(){return zs().memoizedState}function B4(){return zs().memoizedState}function NY(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Pr();e=Yl(n);var s=Wl(t,e,n);s!==null&&(mr(s,t,n),Op(s,t,n)),t={cache:OT()},e.payload=t;return}t=t.return}}function TY(e,t,n){var s=Pr();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},sx(e)?F4(t,n):(n=CT(e,t,n,s),n!==null&&(mr(n,e,s),$4(n,t,s)))}function U4(e,t,n){var s=Pr();Dp(e,t,n,s)}function Dp(e,t,n,s){var i={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(sx(e))F4(t,i);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var a=t.lastRenderedState,l=r(a,n);if(i.hasEagerState=!0,i.eagerState=l,Fr(l,a))return Z1(e,t,i,0),Un===null&&Q1(),!1}catch{}finally{}if(n=CT(e,t,i,s),n!==null)return mr(n,e,s),$4(n,t,s),!0}return!1}function WT(e,t,n,s){if(s={lane:2,revertLane:ik(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},sx(e)){if(t)throw Error(Te(479))}else t=CT(e,n,s,2),t!==null&&mr(t,e,2)}function sx(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function F4(e,t){ef=Iy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $4(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,T5(e,n)}}var ym={readContext:Ii,use:tx,useCallback:Is,useContext:Is,useEffect:Is,useImperativeHandle:Is,useLayoutEffect:Is,useInsertionEffect:Is,useMemo:Is,useReducer:Is,useRef:Is,useState:Is,useDebugValue:Is,useDeferredValue:Is,useTransition:Is,useSyncExternalStore:Is,useId:Is,useHostTransitionStatus:Is,useFormState:Is,useActionState:Is,useOptimistic:Is,useMemoCache:Is,useCacheRefresh:Is};ym.useEffectEvent=Is;var H4={readContext:Ii,use:tx,useCallback:function(e,t){return Yi().memoizedState=[e,t===void 0?null:t],e},useContext:Ii,useEffect:OI,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Db(4194308,4,C4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Db(4194308,4,e,t)},useInsertionEffect:function(e,t){Db(4,2,e,t)},useMemo:function(e,t){var n=Yi();t=t===void 0?null:t;var s=e();if(fu){Ul(!0);try{e()}finally{Ul(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Yi();if(n!==void 0){var i=n(t);if(fu){Ul(!0);try{n(t)}finally{Ul(!1)}}}else i=t;return s.memoizedState=s.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},s.queue=e,e=e.dispatch=TY.bind(null,Rt,e),[s.memoizedState,e]},useRef:function(e){var t=Yi();return e={current:e},t.memoizedState=e},useState:function(e){e=G_(e);var t=e.queue,n=U4.bind(null,Rt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:KT,useDeferredValue:function(e,t){var n=Yi();return qT(n,e,t)},useTransition:function(){var e=G_(!1);return e=M4.bind(null,Rt,e.queue,!0,!1),Yi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Rt,i=Yi();if(Zt){if(n===void 0)throw Error(Te(407));n=n()}else{if(n=t(),Un===null)throw Error(Te(349));Wt&127||m4(s,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,OI(b4.bind(null,s,r,e),[e]),s.flags|=2048,gf(9,{destroy:void 0},g4.bind(null,s,r,n,t),null),n},useId:function(){var e=Yi(),t=Un.identifierPrefix;if(Zt){var n=ro,s=io;n=(s&~(1<<32-Dr(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=jy++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof s.is=="string"?a.createElement("select",{is:s.is}):a.createElement("select"),s.multiple?r.multiple=!0:s.size&&(r.size=s.size);break;default:r=typeof s.is=="string"?a.createElement(i,{is:s.is}):a.createElement(i)}}r[ki]=t,r[yr]=s;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=r;e:switch(Ri(r,i,s),i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Ro(t)}}return es(t),_v(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ro(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Te(166));if(e=Kl.current,Qu(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,i=Ai,i!==null)switch(i.tag){case 27:case 5:s=i.memoizedProps}e[ki]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||U6(e.nodeValue,n)),e||rc(t,!0)}else e=$y(e).createTextNode(s),e[ki]=t,t.stateNode=e}return es(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Qu(t),n!==null){if(e===null){if(!s)throw Error(Te(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Te(557));e[ki]=t}else cu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;es(t),e=!1}else n=pv(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Cr(t),t):(Cr(t),null);if(t.flags&128)throw Error(Te(558))}return es(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Qu(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(Te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Te(317));i[ki]=t}else cu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;es(t),i=!1}else i=pv(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Cr(t),t):(Cr(t),null)}return Cr(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,i=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(i=s.alternate.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==i&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),O0(t,t.updateQueue),es(t),null);case 4:return df(),e===null&&rk(t.stateNode.containerInfo),es(t),null;case 10:return Xo(t.type),es(t),null;case 19:if(vi(Fs),s=t.memoizedState,s===null)return es(t),null;if(i=(t.flags&128)!==0,r=s.rendering,r===null)if(i)Hh(s,!1);else{if(Rs!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=Cy(e),r!==null){for(t.flags|=128,Hh(s,!1),e=r.updateQueue,t.updateQueue=e,O0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)e4(n,e),n=n.sibling;return Hn(Fs,Fs.current&1|2),Zt&&Fo(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Mr()>Ly&&(t.flags|=128,i=!0,Hh(s,!1),t.lanes=4194304)}else{if(!i)if(e=Cy(r),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,O0(t,e),Hh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!r.alternate&&!Zt)return es(t),null}else 2*Mr()-s.renderingStartTime>Ly&&n!==536870912&&(t.flags|=128,i=!0,Hh(s,!1),t.lanes=4194304);s.isBackwards?(r.sibling=t.child,t.child=r):(e=s.last,e!==null?e.sibling=r:t.child=r,s.last=r)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Mr(),e.sibling=null,n=Fs.current,Hn(Fs,i?n&1|2:n&1),Zt&&Fo(t,s.treeForkCount),e):(es(t),null);case 22:case 23:return Cr(t),PT(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(es(t),t.subtreeFlags&6&&(t.flags|=8192)):es(t),n=t.updateQueue,n!==null&&O0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&vi(Qc),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xo(ti),es(t),null;case 25:return null;case 30:return null}throw Error(Te(156,t.tag))}function jY(e,t){switch(RT(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xo(ti),df(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ey(t),null;case 31:if(t.memoizedState!==null){if(Cr(t),t.alternate===null)throw Error(Te(340));cu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Cr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Te(340));cu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vi(Fs),null;case 4:return df(),null;case 10:return Xo(t.type),null;case 22:case 23:return Cr(t),PT(),e!==null&&vi(Qc),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xo(ti),null;case 25:return null;default:return null}}function e6(e,t){switch(RT(t),t.tag){case 3:Xo(ti),df();break;case 26:case 27:case 5:Ey(t);break;case 4:df();break;case 31:t.memoizedState!==null&&Cr(t);break;case 13:Cr(t);break;case 19:vi(Fs);break;case 10:Xo(t.type);break;case 22:case 23:Cr(t),PT(),e!==null&&vi(Qc);break;case 24:Xo(ti)}}function fg(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){s=void 0;var r=n.create,a=n.inst;s=r(),a.destroy=s}n=n.next}while(n!==i)}}catch(l){Tn(t,t.return,l)}}function ac(e,t,n){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var r=i.next;s=r;do{if((s.tag&e)===e){var a=s.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){Tn(i,c,d)}}}s=s.next}while(s!==r)}}catch(d){Tn(t,t.return,d)}}function t6(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{u4(t,n)}catch(s){Tn(e,e.return,s)}}}function n6(e,t,n){n.props=hu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Tn(e,t,s)}}function Pp(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(i){Tn(e,t,i)}}function ao(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(i){Tn(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Tn(e,t,i)}else n.current=null}function s6(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(i){Tn(e,e.return,i)}}function Sv(e,t,n){try{var s=e.stateNode;JY(s,e.type,n,t),s[yr]=t}catch(i){Tn(e,e.return,i)}}function i6(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&mc(e.type)||e.tag===4}function Nv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||i6(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&&mc(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Z_(e,t,n){var s=e.tag;if(s===5||s===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=Vo));else if(s!==4&&(s===27&&mc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Z_(e,t,n),e=e.sibling;e!==null;)Z_(e,t,n),e=e.sibling}function My(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&mc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(My(e,t,n),e=e.sibling;e!==null;)My(e,t,n),e=e.sibling}function r6(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ri(t,s,n),t[ki]=e,t[yr]=n}catch(r){Tn(e,e.return,r)}}var $o=!1,ei=!1,Tv=!1,KI=typeof WeakSet=="function"?WeakSet:Set,bi=null;function RY(e,t){if(e=e.containerInfo,rS=Gy,e=K5(e),kT(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==r||s!==0&&f.nodeType!==3||(c=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===r&&++d===s&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(aS={focusedElem:e,selectionRange:n},Gy=!1,bi=t;bi!==null;)if(t=bi,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bi=e;else for(;bi!==null;){switch(t=bi,r=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ri(r,s,n),r[ki]=e,yi(r),s=r;break e;case"link":var a=fj("link","href",i).get(s+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=b,b=a);var y=bI(l,b),x=bI(l,v);if(y&&x&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var E=f.createRange();E.setStart(y.node,y.offset),p.removeAllRanges(),b>v?(p.addRange(E),p.extend(x.node,x.offset)):(E.setEnd(x.node,x.offset),p.addRange(E))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,yt.T=null,n=tS,tS=null;var r=Ql,a=Qo;if(di=0,yf=Ql=null,Qo=0,hn&6)throw Error(Te(331));var l=hn;if(hn|=4,g6(r.current),h6(r,r.current,a,n),hn=l,hg(0,!1),Lr&&typeof Lr.onPostCommitFiberRoot=="function")try{Lr.onPostCommitFiberRoot(rg,r)}catch{}return!0}finally{pn.p=i,yt.T=s,j6(e,t)}}function XI(e,t,n){t=ra(n,t),t=W_(e.stateNode,t,2),e=Wl(e,t,2),e!==null&&(og(e,2),go(e))}function Tn(e,t,n){if(e.tag===3)XI(e,e,n);else for(;t!==null;){if(t.tag===3){XI(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Xl===null||!Xl.has(s))){e=ra(n,e),n=q4(2),s=Wl(t,n,2),s!==null&&(Y4(n,s,t,e),og(s,2),go(s));break}}t=t.return}}function Av(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new LY;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(tk=!0,i.add(n),e=FY.bind(null,e,t,n),t.then(e,e))}function FY(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Un===e&&(Wt&n)===n&&(Rs===4||Rs===3&&(Wt&62914560)===Wt&&300>Mr()-ix?!(hn&2)&&xf(e,0):nk|=n,bf===Wt&&(bf=0)),go(e)}function O6(e,t){t===0&&(t=S5()),e=Cu(e,t),e!==null&&(og(e,t),go(e))}function $Y(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),O6(e,n)}function HY(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(Te(314))}s!==null&&s.delete(t),O6(e,n)}function zY(e,t){return yT(e,t)}var By=null,hd=null,sS=!1,Uy=!1,Cv=!1,zl=0;function go(e){e!==hd&&e.next===null&&(hd===null?By=hd=e:hd=hd.next=e),Uy=!0,sS||(sS=!0,GY())}function hg(e,t){if(!Cv&&Uy){Cv=!0;do for(var n=!1,s=By;s!==null;){if(e!==0){var i=s.pendingLanes;if(i===0)var r=0;else{var a=s.suspendedLanes,l=s.pingedLanes;r=(1<<31-Dr(42|e)+1)-1,r&=i&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,QI(s,r))}else r=Wt,r=q1(s,s===Un?r:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(r&3)||ag(s,r)||(n=!0,QI(s,r));s=s.next}while(n);Cv=!1}}function VY(){M6()}function M6(){Uy=sS=!1;var e=0;zl!==0&&tW()&&(e=zl);for(var t=Mr(),n=null,s=By;s!==null;){var i=s.next,r=L6(s,t);r===0?(s.next=null,n===null?By=i:n.next=i,i===null&&(hd=n)):(n=s,(e!==0||r&3)&&(Uy=!0)),s=i}di!==0&&di!==5||hg(e),zl!==0&&(zl=0)}function L6(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&nj(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function V6(e,t,n){var s=Jf;if(s&&typeof t=="string"&&t){var i=ia(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),cj.has(i)||(cj.add(i),e={rel:e,crossOrigin:n,href:t},s.querySelector(i)===null&&(t=s.createElement("link"),Ri(t,"link",e),yi(t),s.head.appendChild(t)))}}function uW(e){fl.D(e),V6("dns-prefetch",e,null)}function dW(e,t){fl.C(e,t),V6("preconnect",e,t)}function fW(e,t,n){fl.L(e,t,n);var s=Jf;if(s&&e&&t){var i='link[rel="preload"][as="'+ia(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+ia(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+ia(n.imageSizes)+'"]')):i+='[href="'+ia(e)+'"]';var r=i;switch(t){case"style":r=Ef(e);break;case"script":r=eh(e)}fa.has(r)||(e=os({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),fa.set(r,e),s.querySelector(i)!==null||t==="style"&&s.querySelector(pg(r))||t==="script"&&s.querySelector(mg(r))||(t=s.createElement("link"),Ri(t,"link",e),yi(t),s.head.appendChild(t)))}}function hW(e,t){fl.m(e,t);var n=Jf;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ia(s)+'"][href="'+ia(e)+'"]',r=i;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=eh(e)}if(!fa.has(r)&&(e=os({rel:"modulepreload",href:e},t),fa.set(r,e),n.querySelector(i)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(mg(r)))return}s=n.createElement("link"),Ri(s,"link",e),yi(s),n.head.appendChild(s)}}}function pW(e,t,n){fl.S(e,t,n);var s=Jf;if(s&&e){var i=Wd(s).hoistableStyles,r=Ef(e);t=t||"default";var a=i.get(r);if(!a){var l={loading:0,preload:null};if(a=s.querySelector(pg(r)))l.loading=5;else{e=os({rel:"stylesheet",href:e,"data-precedence":t},n),(n=fa.get(r))&&ak(e,n);var c=a=s.createElement("link");yi(c),Ri(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Fb(a,t,s)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(r,a)}}}function mW(e,t){fl.X(e,t);var n=Jf;if(n&&e){var s=Wd(n).hoistableScripts,i=eh(e),r=s.get(i);r||(r=n.querySelector(mg(i)),r||(e=os({src:e,async:!0},t),(t=fa.get(i))&&ok(e,t),r=n.createElement("script"),yi(r),Ri(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function gW(e,t){fl.M(e,t);var n=Jf;if(n&&e){var s=Wd(n).hoistableScripts,i=eh(e),r=s.get(i);r||(r=n.querySelector(mg(i)),r||(e=os({src:e,async:!0,type:"module"},t),(t=fa.get(i))&&ok(e,t),r=n.createElement("script"),yi(r),Ri(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function uj(e,t,n,s){var i=(i=Kl.current)?Hy(i):null;if(!i)throw Error(Te(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ef(n.href),n=Wd(i).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ef(n.href);var r=Wd(i).hoistableStyles,a=r.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=i.querySelector(pg(e)))&&!r._p&&(a.instance=r,a.state.loading=5),fa.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},fa.set(e,n),r||bW(i,e,n,a.state))),t&&s===null)throw Error(Te(528,""));return a}if(t&&s!==null)throw Error(Te(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=eh(n),n=Wd(i).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(Te(444,e))}}function Ef(e){return'href="'+ia(e)+'"'}function pg(e){return'link[rel="stylesheet"]['+e+"]"}function G6(e){return os({},e,{"data-precedence":e.precedence,precedence:null})}function bW(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ri(t,"link",n),yi(t),e.head.appendChild(t))}function eh(e){return'[src="'+ia(e)+'"]'}function mg(e){return"script[async]"+e}function dj(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ia(n.href)+'"]');if(s)return t.instance=s,yi(s),s;var i=os({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),yi(s),Ri(s,"style",i),Fb(s,n.precedence,e),t.instance=s;case"stylesheet":i=Ef(n.href);var r=e.querySelector(pg(i));if(r)return t.state.loading|=4,t.instance=r,yi(r),r;s=G6(n),(i=fa.get(i))&&ak(s,i),r=(e.ownerDocument||e).createElement("link"),yi(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ri(r,"link",s),t.state.loading|=4,Fb(r,n.precedence,e),t.instance=r;case"script":return r=eh(n.src),(i=e.querySelector(mg(r)))?(t.instance=i,yi(i),i):(s=n,(i=fa.get(r))&&(s=os({},n),ok(s,i)),e=e.ownerDocument||e,i=e.createElement("script"),yi(i),Ri(i,"link",s),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(Te(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,Fb(s,n.precedence,e));return t.instance}function Fb(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=s.length?s[s.length-1]:null,r=i,a=0;a title"):null)}function yW(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 K6(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function xW(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=Ef(s.href),r=t.querySelector(pg(i));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zy.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,yi(r);return}r=t.ownerDocument||t,s=G6(s),(i=fa.get(i))&&ak(s,i),r=r.createElement("link"),yi(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ri(r,"link",s),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=zy.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Lv=0;function EW(e,t){return e.stylesheets&&e.count===0&&Hb(e,e.stylesheets),0Lv?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(i)}}:null}function zy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vy=null;function Hb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vy=new Map,t.forEach(vW,e),Vy=null,zy.call(e))}function vW(e,t){if(!(t.state.loading&4)){var n=Vy.get(e);if(n)var s=n.get(null);else{n=new Map,Vy.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eP)}catch(e){console.error(e)}}eP(),l5.exports=G1;var CW=l5.exports;const IW=Gf(CW),fk=g.createContext({});function cx(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const ux=g.createContext(null),Sm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class jW extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function RW({children:e,isPresent:t}){const n=g.useId(),s=g.useRef(null),i=g.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=g.useContext(Sm);return g.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!s.current||!a||!l)return;s.current.dataset.motionPopId=n;const d=document.createElement("style");return r&&(d.nonce=r),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+s.stack}}var T_=Object.prototype.hasOwnProperty,yT=pi.unstable_scheduleCallback,sv=pi.unstable_cancelCallback,lq=pi.unstable_shouldYield,cq=pi.unstable_requestPaint,Lr=pi.unstable_now,uq=pi.unstable_getCurrentPriorityLevel,v5=pi.unstable_ImmediatePriority,w5=pi.unstable_UserBlockingPriority,vy=pi.unstable_NormalPriority,dq=pi.unstable_LowPriority,_5=pi.unstable_IdlePriority,fq=pi.log,hq=pi.unstable_setDisableYieldValue,rg=null,Dr=null;function Fl(e){if(typeof fq=="function"&&hq(e),Dr&&typeof Dr.setStrictMode=="function")try{Dr.setStrictMode(rg,e)}catch{}}var Pr=Math.clz32?Math.clz32:gq,pq=Math.log,mq=Math.LN2;function gq(e){return e>>>=0,e===0?32:31-(pq(e)/mq|0)|0}var N0=256,T0=262144,k0=4194304;function Oc(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 q1(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=s&134217727;return l!==0?(s=l&~r,s!==0?i=Oc(s):(a&=l,a!==0?i=Oc(a):n||(n=l&~e,n!==0&&(i=Oc(n))))):(l=s&~r,l!==0?i=Oc(l):a!==0?i=Oc(a):n||(n=s&~e,n!==0&&(i=Oc(n)))),i===0?0:t!==0&&t!==i&&!(t&r)&&(r=i&-i,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:i}function ag(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bq(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 S5(){var e=k0;return k0<<=1,!(k0&62914560)&&(k0=4194304),e}function iv(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function og(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yq(e,t,n,s,i,r){var a=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 l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Sq=/[\n"\\]/g;function ra(e){return e.replace(Sq,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function C_(e,t,n,s,i,r,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Jr(t)):e.value!==""+Jr(t)&&(e.value=""+Jr(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?I_(e,a,Jr(t)):n!=null?I_(e,a,Jr(n)):s!=null&&e.removeAttribute("value"),i==null&&r!=null&&(e.defaultChecked=!!r),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+Jr(l):e.removeAttribute("name")}function O5(e,t,n,s,i,r,a,l){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){A_(e);return}n=n!=null?""+Jr(n):"",t=t!=null?""+Jr(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??i,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),A_(e)}function I_(e,t,n){t==="number"&&wy(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Qd(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),R_=!1;if(il)try{var Uh={};Object.defineProperty(Uh,"passive",{get:function(){R_=!0}}),window.addEventListener("test",Uh,Uh),window.removeEventListener("test",Uh,Uh)}catch{R_=!1}var $l=null,ST=null,jb=null;function B5(){if(jb)return jb;var e,t=ST,n=t.length,s,i="value"in $l?$l.value:$l.textContent,r=i.length;for(e=0;e=Cp),uI=" ",dI=!1;function F5(e,t){switch(e){case"keyup":return Zq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Td=!1;function eY(e,t){switch(e){case"compositionend":return $5(t);case"keypress":return t.which!==32?null:(dI=!0,uI);case"textInput":return e=t.data,e===uI&&dI?null:e;default:return null}}function tY(e,t){if(Td)return e==="compositionend"||!TT&&F5(e,t)?(e=B5(),jb=ST=$l=null,Td=!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=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=gI(n)}}function G5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?G5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function K5(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wy(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=wy(e.document)}return t}function kT(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 cY=il&&"documentMode"in document&&11>=document.documentMode,kd=null,O_=null,jp=null,M_=!1;function yI(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;M_||kd==null||kd!==wy(s)||(s=kd,"selectionStart"in s&&kT(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),jp&&hm(jp,s)||(jp=s,s=Fy(O_,"onSelect"),0>=a,i-=a,ro=1<<32-Pr(t)+i|n<k?(A=T,T=null):A=T.sibling;var j=h(y,T,E[k],w);if(j===null){T===null&&(T=A);break}e&&T&&j.alternate===null&&t(y,T),x=r(j,x,k),_===null?S=j:_.sibling=j,_=j,T=A}if(k===E.length)return n(y,T),Zt&&$o(y,k),S;if(T===null){for(;kk?(A=T,T=null):A=T.sibling;var R=h(y,T,j.value,w);if(R===null){T===null&&(T=A);break}e&&T&&R.alternate===null&&t(y,T),x=r(R,x,k),_===null?S=R:_.sibling=R,_=R,T=A}if(j.done)return n(y,T),Zt&&$o(y,k),S;if(T===null){for(;!j.done;k++,j=E.next())j=f(y,j.value,w),j!==null&&(x=r(j,x,k),_===null?S=j:_.sibling=j,_=j);return Zt&&$o(y,k),S}for(T=s(T);!j.done;k++,j=E.next())j=p(T,y,k,j.value,w),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?k:j.key),x=r(j,x,k),_===null?S=j:_.sibling=j,_=j);return e&&T.forEach(function(B){return t(y,B)}),Zt&&$o(y,k),S}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===wd&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case S0:e:{for(var S=E.key;x!==null;){if(x.key===S){if(S=E.type,S===wd){if(x.tag===7){n(y,x.sibling),w=i(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Il&&Mc(S)===x.type){n(y,x.sibling),w=i(x,E.props),$h(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===wd?(w=Qc(E.props.children,y.mode,w,E.key),w.return=y,y=w):(w=Ob(E.type,E.key,E.props,null,y.mode,w),$h(w,E),w.return=y,y=w)}return a(y);case cp:e:{for(S=E.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=i(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=hv(E,y.mode,w),w.return=y,y=w}return a(y);case Il:return E=Mc(E),v(y,x,E,w)}if(up(E))return m(y,x,E,w);if(Bh(E)){if(S=Bh(E),typeof S!="function")throw Error(Ne(150));return E=S.call(E),b(y,x,E,w)}if(typeof E.then=="function")return v(y,x,j0(E),w);if(E.$$typeof===Vo)return v(y,x,I0(y,E),w);R0(y,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,x!==null&&x.tag===6?(n(y,x.sibling),w=i(x,E),w.return=y,y=w):(n(y,x),w=fv(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{gm=0;var S=v(y,x,E,w);return ef=null,S}catch(T){if(T===Zf||T===J1)throw T;var _=jr(29,T,null,y.mode);return _.lanes=w,_.return=y,_}finally{}}}var fu=o4(!0),l4=o4(!1),jl=!1;function DT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $_(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 Wl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xl(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,hn&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,t=Sy(e),J5(e,null,n),t}return Z1(e,s,t,n),Sy(e)}function Op(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,T5(e,n)}}function mv(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?i=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?i=r=t:r=r.next=t}else i=r=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var H_=!1;function Mp(){if(H_){var e=Jd;if(e!==null)throw e}}function Lp(e,t,n,s){H_=!1;var i=e.updateQueue;jl=!1;var r=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?r=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(r!==null){var f=i.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(Wt&h)===h:(s&h)===h){h!==0&&h===mf&&(H_=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;h=t;var v=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(v,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,h=typeof m=="function"?m.call(v,f,h):m,h==null)break e;f=ss({},f,h);break e;case 2:jl=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,r===null&&(i.shared.lanes=0),lc|=a,e.lanes=a,e.memoizedState=f}}function c4(e,t){if(typeof e!="function")throw Error(Ne(191,e));e.call(t)}function u4(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;er?r:8;var a=vt.T,l={};vt.T=l,WT(e,!1,t,n);try{var c=i(),u=vt.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=yY(c,s);Dp(e,t,d,Br(e))}else Dp(e,t,s,Br(e))}catch(f){Dp(e,t,{then:function(){},status:"rejected",reason:f},Br())}finally{pn.p=r,a!==null&&l.types!==null&&(a.types=l.types),vt.T=a}}function SY(){}function q_(e,t,n,s){if(e.tag!==5)throw Error(Ne(476));var i=L4(e).queue;M4(e,i,t,Xc,n===null?SY:function(){return D4(e),n(s)})}function L4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Xc,baseState:Xc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:Xc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function D4(e){var t=L4(e);t.next===null&&(t=e.alternate.memoizedState),Dp(e,t.next.queue,{},Br())}function YT(){return ji(vm)}function P4(){return Fs().memoizedState}function B4(){return Fs().memoizedState}function NY(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Br();e=Wl(n);var s=Xl(t,e,n);s!==null&&(gr(s,t,n),Op(s,t,n)),t={cache:OT()},e.payload=t;return}t=t.return}}function TY(e,t,n){var s=Br();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},sx(e)?F4(t,n):(n=CT(e,t,n,s),n!==null&&(gr(n,e,s),$4(n,t,s)))}function U4(e,t,n){var s=Br();Dp(e,t,n,s)}function Dp(e,t,n,s){var i={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(sx(e))F4(t,i);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var a=t.lastRenderedState,l=r(a,n);if(i.hasEagerState=!0,i.eagerState=l,$r(l,a))return Z1(e,t,i,0),Bn===null&&Q1(),!1}catch{}finally{}if(n=CT(e,t,i,s),n!==null)return gr(n,e,s),$4(n,t,s),!0}return!1}function WT(e,t,n,s){if(s={lane:2,revertLane:ik(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},sx(e)){if(t)throw Error(Ne(479))}else t=CT(e,n,s,2),t!==null&&gr(t,e,2)}function sx(e){var t=e.alternate;return e===Ot||t!==null&&t===Ot}function F4(e,t){tf=Iy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $4(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,T5(e,n)}}var ym={readContext:ji,use:tx,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useLayoutEffect:Cs,useInsertionEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useSyncExternalStore:Cs,useId:Cs,useHostTransitionStatus:Cs,useFormState:Cs,useActionState:Cs,useOptimistic:Cs,useMemoCache:Cs,useCacheRefresh:Cs};ym.useEffectEvent=Cs;var H4={readContext:ji,use:tx,useCallback:function(e,t){return Qi().memoizedState=[e,t===void 0?null:t],e},useContext:ji,useEffect:OI,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Db(4194308,4,C4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Db(4194308,4,e,t)},useInsertionEffect:function(e,t){Db(4,2,e,t)},useMemo:function(e,t){var n=Qi();t=t===void 0?null:t;var s=e();if(hu){Fl(!0);try{e()}finally{Fl(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Qi();if(n!==void 0){var i=n(t);if(hu){Fl(!0);try{n(t)}finally{Fl(!1)}}}else i=t;return s.memoizedState=s.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},s.queue=e,e=e.dispatch=TY.bind(null,Ot,e),[s.memoizedState,e]},useRef:function(e){var t=Qi();return e={current:e},t.memoizedState=e},useState:function(e){e=G_(e);var t=e.queue,n=U4.bind(null,Ot,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:KT,useDeferredValue:function(e,t){var n=Qi();return qT(n,e,t)},useTransition:function(){var e=G_(!1);return e=M4.bind(null,Ot,e.queue,!0,!1),Qi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ot,i=Qi();if(Zt){if(n===void 0)throw Error(Ne(407));n=n()}else{if(n=t(),Bn===null)throw Error(Ne(349));Wt&127||m4(s,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,OI(b4.bind(null,s,r,e),[e]),s.flags|=2048,bf(9,{destroy:void 0},g4.bind(null,s,r,n,t),null),n},useId:function(){var e=Qi(),t=Bn.identifierPrefix;if(Zt){var n=ao,s=ro;n=(s&~(1<<32-Pr(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=jy++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof s.is=="string"?a.createElement("select",{is:s.is}):a.createElement("select"),s.multiple?r.multiple=!0:s.size&&(r.size=s.size);break;default:r=typeof s.is=="string"?a.createElement(i,{is:s.is}):a.createElement(i)}}r[Ai]=t,r[xr]=s;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=r;e:switch(Oi(r,i,s),i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Oo(t)}}return Xn(t),_v(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Oo(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Ne(166));if(e=ql.current,Zu(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,i=Ci,i!==null)switch(i.tag){case 27:case 5:s=i.memoizedProps}e[Ai]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||U6(e.nodeValue,n)),e||ac(t,!0)}else e=$y(e).createTextNode(s),e[Ai]=t,t.stateNode=e}return Xn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Zu(t),n!==null){if(e===null){if(!s)throw Error(Ne(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ne(557));e[Ai]=t}else uu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Xn(t),e=!1}else n=pv(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ir(t),t):(Ir(t),null);if(t.flags&128)throw Error(Ne(558))}return Xn(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Zu(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(Ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ne(317));i[Ai]=t}else uu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Xn(t),i=!1}else i=pv(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Ir(t),t):(Ir(t),null)}return Ir(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,i=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(i=s.alternate.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==i&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),O0(t,t.updateQueue),Xn(t),null);case 4:return ff(),e===null&&rk(t.stateNode.containerInfo),Xn(t),null;case 10:return Qo(t.type),Xn(t),null;case 19:if(vi(Ps),s=t.memoizedState,s===null)return Xn(t),null;if(i=(t.flags&128)!==0,r=s.rendering,r===null)if(i)Hh(s,!1);else{if(js!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=Cy(e),r!==null){for(t.flags|=128,Hh(s,!1),e=r.updateQueue,t.updateQueue=e,O0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)e4(n,e),n=n.sibling;return zn(Ps,Ps.current&1|2),Zt&&$o(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Lr()>Ly&&(t.flags|=128,i=!0,Hh(s,!1),t.lanes=4194304)}else{if(!i)if(e=Cy(r),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,O0(t,e),Hh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!r.alternate&&!Zt)return Xn(t),null}else 2*Lr()-s.renderingStartTime>Ly&&n!==536870912&&(t.flags|=128,i=!0,Hh(s,!1),t.lanes=4194304);s.isBackwards?(r.sibling=t.child,t.child=r):(e=s.last,e!==null?e.sibling=r:t.child=r,s.last=r)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Lr(),e.sibling=null,n=Ps.current,zn(Ps,i?n&1|2:n&1),Zt&&$o(t,s.treeForkCount),e):(Xn(t),null);case 22:case 23:return Ir(t),PT(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Xn(t),t.subtreeFlags&6&&(t.flags|=8192)):Xn(t),n=t.updateQueue,n!==null&&O0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&vi(Zc),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qo(ni),Xn(t),null;case 25:return null;case 30:return null}throw Error(Ne(156,t.tag))}function jY(e,t){switch(RT(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qo(ni),ff(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ey(t),null;case 31:if(t.memoizedState!==null){if(Ir(t),t.alternate===null)throw Error(Ne(340));uu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ir(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ne(340));uu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vi(Ps),null;case 4:return ff(),null;case 10:return Qo(t.type),null;case 22:case 23:return Ir(t),PT(),e!==null&&vi(Zc),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qo(ni),null;case 25:return null;default:return null}}function e6(e,t){switch(RT(t),t.tag){case 3:Qo(ni),ff();break;case 26:case 27:case 5:Ey(t);break;case 4:ff();break;case 31:t.memoizedState!==null&&Ir(t);break;case 13:Ir(t);break;case 19:vi(Ps);break;case 10:Qo(t.type);break;case 22:case 23:Ir(t),PT(),e!==null&&vi(Zc);break;case 24:Qo(ni)}}function fg(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){s=void 0;var r=n.create,a=n.inst;s=r(),a.destroy=s}n=n.next}while(n!==i)}}catch(l){_n(t,t.return,l)}}function oc(e,t,n){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var r=i.next;s=r;do{if((s.tag&e)===e){var a=s.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){_n(i,c,d)}}}s=s.next}while(s!==r)}}catch(d){_n(t,t.return,d)}}function t6(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{u4(t,n)}catch(s){_n(e,e.return,s)}}}function n6(e,t,n){n.props=pu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){_n(e,t,s)}}function Pp(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(i){_n(e,t,i)}}function oo(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(i){_n(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){_n(e,t,i)}else n.current=null}function s6(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(i){_n(e,e.return,i)}}function Sv(e,t,n){try{var s=e.stateNode;JY(s,e.type,n,t),s[xr]=t}catch(i){_n(e,e.return,i)}}function i6(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&gc(e.type)||e.tag===4}function Nv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||i6(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&&gc(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Z_(e,t,n){var s=e.tag;if(s===5||s===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=Go));else if(s!==4&&(s===27&&gc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Z_(e,t,n),e=e.sibling;e!==null;)Z_(e,t,n),e=e.sibling}function My(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&gc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(My(e,t,n),e=e.sibling;e!==null;)My(e,t,n),e=e.sibling}function r6(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Oi(t,s,n),t[Ai]=e,t[xr]=n}catch(r){_n(e,e.return,r)}}var Ho=!1,ti=!1,Tv=!1,KI=typeof WeakSet=="function"?WeakSet:Set,bi=null;function RY(e,t){if(e=e.containerInfo,rS=Gy,e=K5(e),kT(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==r||s!==0&&f.nodeType!==3||(c=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===r&&++d===s&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(aS={focusedElem:e,selectionRange:n},Gy=!1,bi=t;bi!==null;)if(t=bi,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bi=e;else for(;bi!==null;){switch(t=bi,r=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Oi(r,s,n),r[Ai]=e,yi(r),s=r;break e;case"link":var a=fj("link","href",i).get(s+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=b,b=a);var y=bI(l,b),x=bI(l,v);if(y&&x&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var E=f.createRange();E.setStart(y.node,y.offset),p.removeAllRanges(),b>v?(p.addRange(E),p.extend(x.node,x.offset)):(E.setEnd(x.node,x.offset),p.addRange(E))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,vt.T=null,n=tS,tS=null;var r=Zl,a=Zo;if(hi=0,xf=Zl=null,Zo=0,hn&6)throw Error(Ne(331));var l=hn;if(hn|=4,g6(r.current),h6(r,r.current,a,n),hn=l,hg(0,!1),Dr&&typeof Dr.onPostCommitFiberRoot=="function")try{Dr.onPostCommitFiberRoot(rg,r)}catch{}return!0}finally{pn.p=i,vt.T=s,j6(e,t)}}function XI(e,t,n){t=aa(n,t),t=W_(e.stateNode,t,2),e=Xl(e,t,2),e!==null&&(og(e,2),bo(e))}function _n(e,t,n){if(e.tag===3)XI(e,e,n);else for(;t!==null;){if(t.tag===3){XI(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ql===null||!Ql.has(s))){e=aa(n,e),n=q4(2),s=Xl(t,n,2),s!==null&&(Y4(n,s,t,e),og(s,2),bo(s));break}}t=t.return}}function Av(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new LY;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(tk=!0,i.add(n),e=FY.bind(null,e,t,n),t.then(e,e))}function FY(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bn===e&&(Wt&n)===n&&(js===4||js===3&&(Wt&62914560)===Wt&&300>Lr()-ix?!(hn&2)&&Ef(e,0):nk|=n,yf===Wt&&(yf=0)),bo(e)}function O6(e,t){t===0&&(t=S5()),e=Iu(e,t),e!==null&&(og(e,t),bo(e))}function $Y(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),O6(e,n)}function HY(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(Ne(314))}s!==null&&s.delete(t),O6(e,n)}function zY(e,t){return yT(e,t)}var By=null,pd=null,sS=!1,Uy=!1,Cv=!1,Vl=0;function bo(e){e!==pd&&e.next===null&&(pd===null?By=pd=e:pd=pd.next=e),Uy=!0,sS||(sS=!0,GY())}function hg(e,t){if(!Cv&&Uy){Cv=!0;do for(var n=!1,s=By;s!==null;){if(e!==0){var i=s.pendingLanes;if(i===0)var r=0;else{var a=s.suspendedLanes,l=s.pingedLanes;r=(1<<31-Pr(42|e)+1)-1,r&=i&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,QI(s,r))}else r=Wt,r=q1(s,s===Bn?r:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(r&3)||ag(s,r)||(n=!0,QI(s,r));s=s.next}while(n);Cv=!1}}function VY(){M6()}function M6(){Uy=sS=!1;var e=0;Vl!==0&&tW()&&(e=Vl);for(var t=Lr(),n=null,s=By;s!==null;){var i=s.next,r=L6(s,t);r===0?(s.next=null,n===null?By=i:n.next=i,i===null&&(pd=n)):(n=s,(e!==0||r&3)&&(Uy=!0)),s=i}hi!==0&&hi!==5||hg(e),Vl!==0&&(Vl=0)}function L6(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&nj(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function V6(e,t,n){var s=eh;if(s&&typeof t=="string"&&t){var i=ra(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),cj.has(i)||(cj.add(i),e={rel:e,crossOrigin:n,href:t},s.querySelector(i)===null&&(t=s.createElement("link"),Oi(t,"link",e),yi(t),s.head.appendChild(t)))}}function uW(e){hl.D(e),V6("dns-prefetch",e,null)}function dW(e,t){hl.C(e,t),V6("preconnect",e,t)}function fW(e,t,n){hl.L(e,t,n);var s=eh;if(s&&e&&t){var i='link[rel="preload"][as="'+ra(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+ra(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+ra(n.imageSizes)+'"]')):i+='[href="'+ra(e)+'"]';var r=i;switch(t){case"style":r=vf(e);break;case"script":r=th(e)}ha.has(r)||(e=ss({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ha.set(r,e),s.querySelector(i)!==null||t==="style"&&s.querySelector(pg(r))||t==="script"&&s.querySelector(mg(r))||(t=s.createElement("link"),Oi(t,"link",e),yi(t),s.head.appendChild(t)))}}function hW(e,t){hl.m(e,t);var n=eh;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ra(s)+'"][href="'+ra(e)+'"]',r=i;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=th(e)}if(!ha.has(r)&&(e=ss({rel:"modulepreload",href:e},t),ha.set(r,e),n.querySelector(i)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(mg(r)))return}s=n.createElement("link"),Oi(s,"link",e),yi(s),n.head.appendChild(s)}}}function pW(e,t,n){hl.S(e,t,n);var s=eh;if(s&&e){var i=Xd(s).hoistableStyles,r=vf(e);t=t||"default";var a=i.get(r);if(!a){var l={loading:0,preload:null};if(a=s.querySelector(pg(r)))l.loading=5;else{e=ss({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ha.get(r))&&ak(e,n);var c=a=s.createElement("link");yi(c),Oi(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Fb(a,t,s)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(r,a)}}}function mW(e,t){hl.X(e,t);var n=eh;if(n&&e){var s=Xd(n).hoistableScripts,i=th(e),r=s.get(i);r||(r=n.querySelector(mg(i)),r||(e=ss({src:e,async:!0},t),(t=ha.get(i))&&ok(e,t),r=n.createElement("script"),yi(r),Oi(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function gW(e,t){hl.M(e,t);var n=eh;if(n&&e){var s=Xd(n).hoistableScripts,i=th(e),r=s.get(i);r||(r=n.querySelector(mg(i)),r||(e=ss({src:e,async:!0,type:"module"},t),(t=ha.get(i))&&ok(e,t),r=n.createElement("script"),yi(r),Oi(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function uj(e,t,n,s){var i=(i=ql.current)?Hy(i):null;if(!i)throw Error(Ne(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=vf(n.href),n=Xd(i).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=vf(n.href);var r=Xd(i).hoistableStyles,a=r.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=i.querySelector(pg(e)))&&!r._p&&(a.instance=r,a.state.loading=5),ha.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},ha.set(e,n),r||bW(i,e,n,a.state))),t&&s===null)throw Error(Ne(528,""));return a}if(t&&s!==null)throw Error(Ne(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=th(n),n=Xd(i).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(Ne(444,e))}}function vf(e){return'href="'+ra(e)+'"'}function pg(e){return'link[rel="stylesheet"]['+e+"]"}function G6(e){return ss({},e,{"data-precedence":e.precedence,precedence:null})}function bW(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Oi(t,"link",n),yi(t),e.head.appendChild(t))}function th(e){return'[src="'+ra(e)+'"]'}function mg(e){return"script[async]"+e}function dj(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ra(n.href)+'"]');if(s)return t.instance=s,yi(s),s;var i=ss({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),yi(s),Oi(s,"style",i),Fb(s,n.precedence,e),t.instance=s;case"stylesheet":i=vf(n.href);var r=e.querySelector(pg(i));if(r)return t.state.loading|=4,t.instance=r,yi(r),r;s=G6(n),(i=ha.get(i))&&ak(s,i),r=(e.ownerDocument||e).createElement("link"),yi(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Oi(r,"link",s),t.state.loading|=4,Fb(r,n.precedence,e),t.instance=r;case"script":return r=th(n.src),(i=e.querySelector(mg(r)))?(t.instance=i,yi(i),i):(s=n,(i=ha.get(r))&&(s=ss({},n),ok(s,i)),e=e.ownerDocument||e,i=e.createElement("script"),yi(i),Oi(i,"link",s),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(Ne(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,Fb(s,n.precedence,e));return t.instance}function Fb(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=s.length?s[s.length-1]:null,r=i,a=0;a title"):null)}function yW(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 K6(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function xW(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=vf(s.href),r=t.querySelector(pg(i));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zy.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,yi(r);return}r=t.ownerDocument||t,s=G6(s),(i=ha.get(i))&&ak(s,i),r=r.createElement("link"),yi(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Oi(r,"link",s),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=zy.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Lv=0;function EW(e,t){return e.stylesheets&&e.count===0&&Hb(e,e.stylesheets),0Lv?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(i)}}:null}function zy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vy=null;function Hb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vy=new Map,t.forEach(vW,e),Vy=null,zy.call(e))}function vW(e,t){if(!(t.state.loading&4)){var n=Vy.get(e);if(n)var s=n.get(null);else{n=new Map,Vy.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eP)}catch(e){console.error(e)}}eP(),l5.exports=G1;var CW=l5.exports;const IW=Kf(CW),fk=g.createContext({});function cx(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const ux=g.createContext(null),Sm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class jW extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function RW({children:e,isPresent:t}){const n=g.useId(),s=g.useRef(null),i=g.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=g.useContext(Sm);return g.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!s.current||!a||!l)return;s.current.dataset.motionPopId=n;const d=document.createElement("style");return r&&(d.nonce=r),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -55,7 +55,7 @@ Error generating stack: `+s.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(jW,{isPresent:t,childRef:s,sizeRef:i,children:g.cloneElement(e,{ref:s})})}const OW=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:a})=>{const l=cx(MW),c=g.useId(),u=g.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;s&&s()},[l,s]),d=g.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return g.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),a==="popLayout"&&(e=o.jsx(RW,{isPresent:n,children:e})),o.jsx(ux.Provider,{value:d,children:e})};function MW(){return new Map}function tP(e=!0){const t=g.useContext(ux);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,r=g.useId();g.useEffect(()=>{e&&i(r)},[e]);const a=g.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,a]:[!0]}const U0=e=>e.key||"";function Ej(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const hk=typeof window<"u",nP=hk?g.useLayoutEffect:g.useEffect,Ko=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=tP(a),u=g.useMemo(()=>Ej(e),[e]),d=a&&!l?[]:u.map(U0),f=g.useRef(!0),h=g.useRef(u),p=cx(()=>new Map),[m,b]=g.useState(u),[v,y]=g.useState(u);nP(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=U0(w),_=a&&!l?!1:u===v||d.includes(S),T=()=>{if(p.has(S))p.set(S,!0);else return;let k=!0;p.forEach(A=>{A||(k=!1)}),k&&(E==null||E(),y(h.current),a&&(c==null||c()),s&&s())};return o.jsx(OW,{isPresent:_,initial:!f.current||n?void 0:!1,custom:_?void 0:t,presenceAffectsLayout:i,mode:r,onExitComplete:_?void 0:T,children:w},S)})})},Br=e=>e;let sP=Br;const LW={useManualTiming:!1};function DW(e){let t=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){r.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?t:n;return d&&r.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),r.delete(u)},process:u=>{if(a=u,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(u))}};return c}const F0=["read","resolveKeyframes","update","preRender","render","postRender"],PW=40;function iP(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=F0.reduce((y,x)=>(y[x]=DW(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,PW),1),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(p))},m=()=>{n=!0,s=!0,i.isProcessing||e(p)};return{schedule:F0.reduce((y,x)=>{const E=a[x];return y[x]=(w,S=!1,_=!1)=>(n||m(),E.schedule(w,S,_)),y},{}),cancel:y=>{for(let x=0;xvj[e].some(n=>!!t[n])};function BW(e){for(const t in e)wf[t]={...wf[t],...e[t]}}const UW=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function qy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||UW.has(e)}let aP=e=>!qy(e);function oP(e){e&&(aP=t=>t.startsWith("on")?!qy(t):e(t))}try{oP(require("@emotion/is-prop-valid").default)}catch{}function FW(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(aP(i)||n===!0&&qy(i)||!t&&!qy(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function $W({children:e,isValidProp:t,...n}){t&&oP(t),n={...g.useContext(Sm),...n},n.isStatic=cx(()=>n.isStatic);const s=g.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(Sm.Provider,{value:s,children:e})}function HW(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const dx=g.createContext({});function Nm(e){return typeof e=="string"||Array.isArray(e)}function fx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const pk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mk=["initial",...pk];function hx(e){return fx(e.animate)||mk.some(t=>Nm(e[t]))}function lP(e){return!!(hx(e)||e.variants)}function zW(e,t){if(hx(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Nm(n)?n:void 0,animate:Nm(s)?s:void 0}}return e.inherit!==!1?t:{}}function VW(e){const{initial:t,animate:n}=zW(e,g.useContext(dx));return g.useMemo(()=>({initial:t,animate:n}),[wj(t),wj(n)])}function wj(e){return Array.isArray(e)?e.join(" "):e}const GW=Symbol.for("motionComponentSymbol");function Od(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function KW(e,t,n){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):Od(n)&&(n.current=s))},[t])}const gk=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qW="framerAppearId",cP="data-"+gk(qW),{schedule:bk}=iP(queueMicrotask,!1),uP=g.createContext({});function YW(e,t,n,s,i){var r,a;const{visualElement:l}=g.useContext(dx),c=g.useContext(rP),u=g.useContext(ux),d=g.useContext(Sm).reducedMotion,f=g.useRef(null);s=s||c.renderer,!f.current&&s&&(f.current=s(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=g.useContext(uP);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&WW(f.current,n,i,p);const m=g.useRef(!1);g.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const b=n[cP],v=g.useRef(!!b&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return nP(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),bk.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),g.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function WW(e,t,n,s){const{layoutId:i,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:dP(e.parent)),e.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!a||l&&Od(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:u})}function dP(e){if(e)return e.options.allowProjection!==!1?e.projection:dP(e.parent)}function XW({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var r,a;e&&BW(e);function l(u,d){let f;const h={...g.useContext(Sm),...u,layoutId:QW(u)},{isStatic:p}=h,m=VW(u),b=s(u,p);if(!p&&hk){ZW();const v=JW(h);f=v.MeasureLayout,m.visualElement=YW(i,b,h,t,v.ProjectionNode)}return o.jsxs(dx.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(i,u,KW(b,m.visualElement,d),b,p,m.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(r=i.displayName)!==null&&r!==void 0?r:i.name)!==null&&a!==void 0?a:""})`}`;const c=g.forwardRef(l);return c[GW]=i,c}function QW({layoutId:e}){const t=g.useContext(fk).id;return t&&e!==void 0?t+"-"+e:e}function ZW(e,t){g.useContext(rP).strict}function JW(e){const{drag:t,layout:n}=wf;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const eX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function yk(e){return typeof e!="string"||e.includes("-")?!1:!!(eX.indexOf(e)>-1||/[A-Z]/u.test(e))}function _j(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function xk(e,t,n,s){if(typeof t=="function"){const[i,r]=_j(s);t=t(n!==void 0?n:e.custom,i,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,r]=_j(s);t=t(n!==void 0?n:e.custom,i,r)}return t}const pS=e=>Array.isArray(e),tX=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),nX=e=>pS(e)?e[e.length-1]||0:e,Pi=e=>!!(e&&e.getVelocity);function Vb(e){const t=Pi(e)?e.get():e;return tX(t)?t.toValue():t}function sX({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,r){const a={latestValues:iX(s,i,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:s,current:l,...a}),a.onUpdate=l=>n(l)),a}const fP=e=>(t,n)=>{const s=g.useContext(dx),i=g.useContext(ux),r=()=>sX(e,t,s,i);return n?r():cx(r)};function iX(e,t,n,s){const i={},r=s(e,{});for(const h in r)i[h]=Vb(r[h]);let{initial:a,animate:l}=e;const c=hx(e),u=lP(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!fx(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),pP=hP("--"),rX=hP("var(--"),Ek=e=>rX(e)?aX.test(e.split("/*")[0].trim()):!1,aX=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,mP=(e,t)=>t&&typeof e=="number"?t.transform(e):e,ll=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Tm={...nh,transform:e=>ll(0,1,e)},$0={...nh,default:1},gg=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tl=gg("deg"),co=gg("%"),gt=gg("px"),oX=gg("vh"),lX=gg("vw"),Sj={...co,parse:e=>co.parse(e)/100,transform:e=>co.transform(e*100)},cX={borderWidth:gt,borderTopWidth:gt,borderRightWidth:gt,borderBottomWidth:gt,borderLeftWidth:gt,borderRadius:gt,radius:gt,borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomRightRadius:gt,borderBottomLeftRadius:gt,width:gt,maxWidth:gt,height:gt,maxHeight:gt,top:gt,right:gt,bottom:gt,left:gt,padding:gt,paddingTop:gt,paddingRight:gt,paddingBottom:gt,paddingLeft:gt,margin:gt,marginTop:gt,marginRight:gt,marginBottom:gt,marginLeft:gt,backgroundPositionX:gt,backgroundPositionY:gt},uX={rotate:Tl,rotateX:Tl,rotateY:Tl,rotateZ:Tl,scale:$0,scaleX:$0,scaleY:$0,scaleZ:$0,skew:Tl,skewX:Tl,skewY:Tl,distance:gt,translateX:gt,translateY:gt,translateZ:gt,x:gt,y:gt,z:gt,perspective:gt,transformPerspective:gt,opacity:Tm,originX:Sj,originY:Sj,originZ:gt},Nj={...nh,transform:Math.round},vk={...cX,...uX,zIndex:Nj,size:gt,fillOpacity:Tm,strokeOpacity:Tm,numOctaves:Nj},dX={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fX=th.length;function hX(e,t,n){let s="",i=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),gP=()=>({...Sk(),attrs:{}}),Nk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function bP(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const r in n)e.style.setProperty(r,n[r])}const yP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function xP(e,t,n,s){bP(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(yP.has(i)?i:gk(i),t.attrs[i])}const Yy={};function yX(e){Object.assign(Yy,e)}function EP(e,{layout:t,layoutId:n}){return ju.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Yy[e]||e==="opacity")}function Tk(e,t,n){var s;const{style:i}=e,r={};for(const a in i)(Pi(i[a])||t.style&&Pi(t.style[a])||EP(a,e)||((s=n==null?void 0:n.getValue(a))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(r[a]=i[a]);return r}function vP(e,t,n){const s=Tk(e,t,n);for(const i in e)if(Pi(e[i])||Pi(t[i])){const r=th.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=e[i]}return s}function xX(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const kj=["x","y","width","height","cx","cy","r"],EX={useVisualState:fP({scrapeMotionValuesFromProps:vP,createRenderState:gP,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in i)if(ju.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{xX(n,s),as.render(()=>{_k(s,i,Nk(n.tagName),e.transformTemplate),xP(n,s)})})}})},vX={useVisualState:fP({scrapeMotionValuesFromProps:Tk,createRenderState:Sk})};function wP(e,t,n){for(const s in t)!Pi(t[s])&&!EP(s,n)&&(e[s]=t[s])}function wX({transformTemplate:e},t){return g.useMemo(()=>{const n=Sk();return wk(n,t,e),Object.assign({},n.vars,n.style)},[t])}function _X(e,t){const n=e.style||{},s={};return wP(s,n,e),Object.assign(s,wX(e,t)),s}function SX(e,t){const n={},s=_X(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}function NX(e,t,n,s){const i=g.useMemo(()=>{const r=gP();return _k(r,t,Nk(s),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};wP(r,e.style,e),i.style={...r,...i.style}}return i}function TX(e=!1){return(n,s,i,{latestValues:r},a)=>{const c=(yk(n)?NX:SX)(s,r,a,n),u=FW(s,typeof n=="string",e),d=n!==g.Fragment?{...u,...c,ref:i}:{},{children:f}=s,h=g.useMemo(()=>Pi(f)?f.get():f,[f]);return g.createElement(n,{...d,children:h})}}function kX(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...yk(s)?EX:vX,preloadedFeatures:e,useRender:TX(i),createVisualElement:t,Component:s};return XW(a)}}function _P(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s(Gb===void 0&&uo.set(Si.isProcessing||LW.useManualTiming?Si.timestamp:performance.now()),Gb),set:e=>{Gb=e,queueMicrotask(AX)}};function Ak(e,t){e.indexOf(t)===-1&&e.push(t)}function Ck(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Ik{constructor(){this.subscriptions=[]}add(t){return Ak(this.subscriptions,t),()=>Ck(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let r=0;r!isNaN(parseFloat(e));class IX{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const r=uo.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=uo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=CX(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ik);const s=this.events[t].add(n);return t==="change"?()=>{s(),as.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=uo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Aj)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Aj);return NP(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function km(e,t){return new IX(e,t)}function jX(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,km(n))}function RX(e,t){const n=px(e,t);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const a in r){const l=nX(r[a]);jX(e,a,l)}}function OX(e){return!!(Pi(e)&&e.add)}function mS(e,t){const n=e.getValue("willChange");if(OX(n))return n.add(t)}function TP(e){return e.props[cP]}function jk(e){let t;return()=>(t===void 0&&(t=e()),t)}const MX=jk(()=>window.ScrollTimeline!==void 0);class LX{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let s=0;s{if(MX()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,r)=>{i&&i(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class DX extends LX{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Zo=e=>e*1e3,Jo=e=>e/1e3;function Rk(e){return typeof e=="function"}function Cj(e,t){e.timeline=t,e.onfinish=null}const Ok=e=>Array.isArray(e)&&typeof e[0]=="number",PX={linearEasing:void 0};function BX(e,t){const n=jk(e);return()=>{var s;return(s=PX[t])!==null&&s!==void 0?s:n()}}const Wy=BX(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),_f=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},kP=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${s})`,gS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pp([0,.65,.55,1]),circOut:pp([.55,0,1,.45]),backIn:pp([.31,.01,.66,-.59]),backOut:pp([.33,1.53,.69,.99])};function CP(e,t){if(e)return typeof e=="function"&&Wy()?kP(e,t):Ok(e)?pp(e):Array.isArray(e)?e.map(n=>CP(n,t)||gS.easeOut):gS[e]}const IP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,UX=1e-7,FX=12;function $X(e,t,n,s,i){let r,a,l=0;do a=t+(n-t)/2,r=IP(a,s,i)-e,r>0?n=a:t=a;while(Math.abs(r)>UX&&++l$X(r,0,1,e,n);return r=>r===0||r===1?r:IP(i(r),t,s)}const jP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,RP=e=>t=>1-e(1-t),OP=bg(.33,1.53,.69,.99),Mk=RP(OP),MP=jP(Mk),LP=e=>(e*=2)<1?.5*Mk(e):.5*(2-Math.pow(2,-10*(e-1))),Lk=e=>1-Math.sin(Math.acos(e)),DP=RP(Lk),PP=jP(Lk),BP=e=>/^0[^.\s]+$/u.test(e);function HX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||BP(e):!0}const Hp=e=>Math.round(e*1e5)/1e5,Dk=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function zX(e){return e==null}const VX=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Pk=(e,t)=>n=>!!(typeof n=="string"&&VX.test(n)&&n.startsWith(e)||t&&!zX(n)&&Object.prototype.hasOwnProperty.call(n,t)),UP=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,r,a,l]=s.match(Dk);return{[e]:parseFloat(i),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},GX=e=>ll(0,255,e),Pv={...nh,transform:e=>Math.round(GX(e))},Vc={test:Pk("rgb","red"),parse:UP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Pv.transform(e)+", "+Pv.transform(t)+", "+Pv.transform(n)+", "+Hp(Tm.transform(s))+")"};function KX(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const bS={test:Pk("#"),parse:KX,transform:Vc.transform},Md={test:Pk("hsl","hue"),parse:UP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+co.transform(Hp(t))+", "+co.transform(Hp(n))+", "+Hp(Tm.transform(s))+")"},Di={test:e=>Vc.test(e)||bS.test(e)||Md.test(e),parse:e=>Vc.test(e)?Vc.parse(e):Md.test(e)?Md.parse(e):bS.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Vc.transform(e):Md.transform(e)},qX=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function YX(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Dk))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(qX))===null||n===void 0?void 0:n.length)||0)>0}const FP="number",$P="color",WX="var",XX="var(",Ij="${}",QX=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Am(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const l=t.replace(QX,c=>(Di.test(c)?(s.color.push(r),i.push($P),n.push(Di.parse(c))):c.startsWith(XX)?(s.var.push(r),i.push(WX),n.push(c)):(s.number.push(r),i.push(FP),n.push(parseFloat(c))),++r,Ij)).split(Ij);return{values:n,split:l,indexes:s,types:i}}function HP(e){return Am(e).values}function zP(e){const{split:t,types:n}=Am(e),s=t.length;return i=>{let r="";for(let a=0;atypeof e=="number"?0:e;function JX(e){const t=HP(e);return zP(e)(t.map(ZX))}const cc={test:YX,parse:HP,createTransformer:zP,getAnimatableNone:JX},eQ=new Set(["brightness","contrast","saturate","opacity"]);function tQ(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Dk)||[];if(!s)return e;const i=n.replace(s,"");let r=eQ.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+i+")"}const nQ=/\b([a-z-]*)\(.*?\)/gu,yS={...cc,getAnimatableNone:e=>{const t=e.match(nQ);return t?t.map(tQ).join(" "):e}},sQ={...vk,color:Di,backgroundColor:Di,outlineColor:Di,fill:Di,stroke:Di,borderColor:Di,borderTopColor:Di,borderRightColor:Di,borderBottomColor:Di,borderLeftColor:Di,filter:yS,WebkitFilter:yS},Bk=e=>sQ[e];function VP(e,t){let n=Bk(e);return n!==yS&&(n=cc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iQ=new Set(["auto","none","0"]);function rQ(e,t,n){let s=0,i;for(;se===nh||e===gt,Rj=(e,t)=>parseFloat(e.split(", ")[t]),Oj=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return Rj(i[1],t);{const r=s.match(/^matrix\((.+)\)$/u);return r?Rj(r[1],e):0}},aQ=new Set(["x","y","z"]),oQ=th.filter(e=>!aQ.has(e));function lQ(e){const t=[];return oQ.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Sf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Oj(4,13),y:Oj(5,14)};Sf.translateX=Sf.x;Sf.translateY=Sf.y;const eu=new Set;let xS=!1,ES=!1;function GP(){if(ES){const e=Array.from(eu).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=lQ(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,a])=>{var l;(l=s.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}ES=!1,xS=!1,eu.forEach(e=>e.complete()),eu.clear()}function KP(){eu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ES=!0)})}function cQ(){KP(),GP()}class Uk{constructor(t,n,s,i,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(eu.add(this),xS||(xS=!0,as.read(KP),as.resolveKeyframes(GP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function dQ(e){const t=uQ.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function YP(e,t,n=1){const[s,i]=dQ(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const a=r.trim();return qP(a)?parseFloat(a):a}return Ek(i)?YP(i,t,n+1):i}const WP=e=>t=>t.test(e),fQ={test:e=>e==="auto",parse:e=>e},XP=[nh,gt,co,Tl,lX,oX,fQ],Mj=e=>XP.find(WP(e));class QP extends Uk{constructor(t,n,s,i,r){super(t,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const Lj=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(cc.test(e)||e==="0")&&!e.startsWith("url("));function hQ(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function mx(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(mQ),r=t&&n!=="loop"&&t%2===1?0:i.length-1;return!r||s===void 0?i[r]:s}const gQ=40;class ZP{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=uo.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>gQ?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&cQ(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=uo.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!pQ(t,s,i,r))if(a)this.options.duration=0;else{c&&c(mx(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const vS=2e4;function JP(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t=vS?1/0:t}const ws=(e,t,n)=>e+(t-e)*n;function Bv(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function bQ({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,r=0,a=0;if(!t)i=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=Bv(c,l,e+1/3),r=Bv(c,l,e),a=Bv(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:s}}function Xy(e,t){return n=>n>0?t:e}const Uv=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},yQ=[bS,Vc,Md],xQ=e=>yQ.find(t=>t.test(e));function Dj(e){const t=xQ(e);if(!t)return!1;let n=t.parse(e);return t===Md&&(n=bQ(n)),n}const Pj=(e,t)=>{const n=Dj(e),s=Dj(t);if(!n||!s)return Xy(e,t);const i={...n};return r=>(i.red=Uv(n.red,s.red,r),i.green=Uv(n.green,s.green,r),i.blue=Uv(n.blue,s.blue,r),i.alpha=ws(n.alpha,s.alpha,r),Vc.transform(i))},EQ=(e,t)=>n=>t(e(n)),yg=(...e)=>e.reduce(EQ),wS=new Set(["none","hidden"]);function vQ(e,t){return wS.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function wQ(e,t){return n=>ws(e,t,n)}function Fk(e){return typeof e=="number"?wQ:typeof e=="string"?Ek(e)?Xy:Di.test(e)?Pj:NQ:Array.isArray(e)?eB:typeof e=="object"?Di.test(e)?Pj:_Q:Xy}function eB(e,t){const n=[...e],s=n.length,i=e.map((r,a)=>Fk(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in s)n[r]=s[r](i);return n}}function SQ(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;r{const n=cc.createTransformer(t),s=Am(e),i=Am(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?wS.has(e)&&!i.values.length||wS.has(t)&&!s.values.length?vQ(e,t):yg(eB(SQ(s,i),i.values),n):Xy(e,t)};function tB(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?ws(e,t,n):Fk(e)(e,t)}const TQ=5;function nB(e,t,n){const s=Math.max(t-TQ,0);return NP(n-e(s),t-s)}const js={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Fv=.001;function kQ({duration:e=js.duration,bounce:t=js.bounce,velocity:n=js.velocity,mass:s=js.mass}){let i,r,a=1-t;a=ll(js.minDamping,js.maxDamping,a),e=ll(js.minDuration,js.maxDuration,Jo(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=_S(u,a),m=Math.exp(-f);return Fv-h/p*m},r=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),b=_S(Math.pow(u,2),a);return(-i(u)+Fv>0?-1:1)*((h-p)*m)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Fv+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=CQ(i,r,l);if(e=Zo(e),isNaN(c))return{stiffness:js.stiffness,damping:js.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:e}}}const AQ=12;function CQ(e,t,n){let s=n;for(let i=1;ie[n]!==void 0)}function RQ(e){let t={velocity:js.velocity,stiffness:js.stiffness,damping:js.damping,mass:js.mass,isResolvedFromDuration:!1,...e};if(!Bj(e,jQ)&&Bj(e,IQ))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*ll(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:js.mass,stiffness:i,damping:r}}else{const n=kQ(e);t={...t,...n,mass:js.mass},t.isResolvedFromDuration=!0}return t}function sB(e=js.visualDuration,t=js.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=RQ({...n,velocity:-Jo(n.velocity||0)}),m=h||0,b=u/(2*Math.sqrt(c*d)),v=a-r,y=Jo(Math.sqrt(c/d)),x=Math.abs(v)<5;s||(s=x?js.restSpeed.granular:js.restSpeed.default),i||(i=x?js.restDelta.granular:js.restDelta.default);let E;if(b<1){const S=_S(y,b);E=_=>{const T=Math.exp(-b*y*_);return a-T*((m+b*y*v)/S*Math.sin(S*_)+v*Math.cos(S*_))}}else if(b===1)E=S=>a-Math.exp(-y*S)*(v+(m+y*v)*S);else{const S=y*Math.sqrt(b*b-1);E=_=>{const T=Math.exp(-b*y*_),k=Math.min(S*_,300);return a-T*((m+b*y*v)*Math.sinh(k)+S*v*Math.cosh(k))/S}}const w={calculatedDuration:p&&f||null,next:S=>{const _=E(S);if(p)l.done=S>=f;else{let T=0;b<1&&(T=S===0?Zo(m):nB(E,S,_));const k=Math.abs(T)<=s,A=Math.abs(a-_)<=i;l.done=k&&A}return l.value=l.done?a:_,l},toString:()=>{const S=Math.min(JP(w),vS),_=kP(T=>w.next(S*T).value,S,30);return S+"ms "+_}};return w}function Uj({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=k=>l!==void 0&&kc,m=k=>l===void 0?c:c===void 0||Math.abs(l-k)-b*Math.exp(-k/s),E=k=>y+x(k),w=k=>{const A=x(k),j=E(k);h.done=Math.abs(A)<=u,h.value=h.done?y:j};let S,_;const T=k=>{p(h.value)&&(S=k,_=sB({keyframes:[h.value,m(h.value)],velocity:nB(E,k,h.value),damping:i,stiffness:r,restDelta:u,restSpeed:d}))};return T(0),{calculatedDuration:null,next:k=>{let A=!1;return!_&&S===void 0&&(A=!0,w(k),T(k)),S!==void 0&&k>=S?_.next(k-S):(!A&&w(k),h)}}}const OQ=bg(.42,0,1,1),MQ=bg(0,0,.58,1),iB=bg(.42,0,.58,1),LQ=e=>Array.isArray(e)&&typeof e[0]!="number",DQ={linear:Br,easeIn:OQ,easeInOut:iB,easeOut:MQ,circIn:Lk,circInOut:PP,circOut:DP,backIn:Mk,backInOut:MP,backOut:OP,anticipate:LP},Fj=e=>{if(Ok(e)){sP(e.length===4);const[t,n,s,i]=e;return bg(t,n,s,i)}else if(typeof e=="string")return DQ[e];return e};function PQ(e,t,n){const s=[],i=n||tB,r=e.length-1;for(let a=0;at[0];if(r===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=PQ(t,s,i),c=l.length,u=d=>{if(a&&d1)for(;fu(ll(e[0],e[r-1],d)):u}function UQ(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=_f(0,t,s);e.push(ws(n,1,i))}}function FQ(e){const t=[0];return UQ(t,e.length-1),t}function $Q(e,t){return e.map(n=>n*t)}function HQ(e,t){return e.map(()=>t||iB).splice(0,e.length-1)}function Qy({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=LQ(s)?s.map(Fj):Fj(s),r={done:!1,value:t[0]},a=$Q(n&&n.length===t.length?n:FQ(t),e),l=BQ(a,t,{ease:Array.isArray(i)?i:HQ(t,i)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const zQ=e=>{const t=({timestamp:n})=>e(n);return{start:()=>as.update(t,!0),stop:()=>lc(t),now:()=>Si.isProcessing?Si.timestamp:uo.now()}},VQ={decay:Uj,inertia:Uj,tween:Qy,keyframes:Qy,spring:sB},GQ=e=>e/100;class $k extends ZP{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:r}=this.options,a=(i==null?void 0:i.KeyframeResolver)||Uk,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,s,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=this.options,l=Rk(n)?n:VQ[n]||Qy;let c,u;l!==Qy&&typeof t[0]!="number"&&(c=yg(GQ,tB(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});r==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=JP(d));const{calculatedDuration:f}=d,h=f+i,p=h*(s+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:s}=this;if(!s){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:i,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=s;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:b,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let E=this.currentTime,w=r;if(p){const k=Math.min(this.currentTime,d)/f;let A=Math.floor(k),j=k%1;!j&&k>=1&&(j=1),j===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(m==="reverse"?(j=1-j,b&&(j-=b/f)):m==="mirror"&&(w=a)),E=ll(0,1,j)*f}const S=x?{done:!1,value:c[0]}:w.next(E);l&&(S.value=l(S.value));let{done:_}=S;!x&&u!==null&&(_=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_);return T&&i!==void 0&&(S.value=mx(c,this.options,i)),v&&v(S.value),T&&this.finish(),S}get duration(){const{resolved:t}=this;return t?Jo(t.calculatedDuration):0}get time(){return Jo(this.currentTime)}set time(t){t=Zo(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Jo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=zQ,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const KQ=new Set(["opacity","clipPath","filter","transform"]);function qQ(e,t,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=CP(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:s,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const YQ=jk(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Zy=10,WQ=2e4;function XQ(e){return Rk(e.type)||e.type==="spring"||!AP(e.ease)}function QQ(e,t){const n=new $k({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let r=0;for(;!s.done&&rthis.onKeyframesResolved(a,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&Wy()&&ZQ(r)&&(r=rB[r]),XQ(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...b}=this.options,v=QQ(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,i=v.times,r=v.ease,a="keyframes"}const d=qQ(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Cj(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(mx(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:s,times:i,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Jo(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Jo(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=Zo(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Br;const{animation:s}=n;Cj(s,t)}return Br}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:s,duration:i,type:r,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new $k({...p,keyframes:s,duration:i,type:r,ease:a,times:l,isGenerator:!0}),b=Zo(this.time);u.setWithVelocity(m.sample(b-Zy).value,m.sample(b).value,Zy)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:s,repeatDelay:i,repeatType:r,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return YQ()&&s&&KQ.has(s)&&!c&&!u&&!i&&r!=="mirror"&&a!==0&&l!=="inertia"}}const JQ={type:"spring",stiffness:500,damping:25,restSpeed:10},eZ=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),tZ={type:"keyframes",duration:.8},nZ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sZ=(e,{keyframes:t})=>t.length>2?tZ:ju.has(e)?e.startsWith("scale")?eZ(t[1]):JQ:nZ;function iZ({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Hk=(e,t,n,s={},i,r)=>a=>{const l=kk(s,e)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Zo(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:i};iZ(l)||(d={...d,...sZ(e,d)}),d.duration&&(d.duration=Zo(d.duration)),d.repeatDelay&&(d.repeatDelay=Zo(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!r&&t.get()!==void 0){const h=mx(d.keyframes,l);if(h!==void 0)return as.update(()=>{d.onUpdate(h),d.onComplete()}),new DX([])}return!r&&$j.supports(d)?new $j(d):new $k(d)};function rZ({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function aB(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(a=s);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(r=e.latestValues[f])!==null&&r!==void 0?r:null),p=c[f];if(p===void 0||d&&rZ(d,f))continue;const m={delay:n,...kk(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=TP(e);if(y){const x=window.MotionHandoffAnimation(y,f,as);x!==null&&(m.startTime=x,b=!0)}}mS(e,f),h.start(Hk(f,h,p,e.shouldReduceMotion&&SP.has(f)?{type:!1}:m,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{as.update(()=>{l&&RX(e,l)})}),u}function SS(e,t,n={}){var s;const i=px(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const a=i?()=>Promise.all(aB(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return aZ(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=r;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function aZ(e,t,n=0,s=0,i=1,r){const a=[],l=(e.variantChildren.size-1)*s,c=i===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(e.variantChildren).sort(oZ).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(SS(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function oZ(e,t){return e.sortNodePosition(t)}function lZ(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(r=>SS(e,r,n));s=Promise.all(i)}else if(typeof t=="string")s=SS(e,t,n);else{const i=typeof t=="function"?px(e,t,n.custom):t;s=Promise.all(aB(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const cZ=mk.length;function oB(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?oB(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:s})=>lZ(e,n,s)))}function hZ(e){let t=fZ(e),n=Hj(),s=!0;const i=c=>(u,d)=>{var f;const h=px(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...b}=h;u={...u,...b,...m}}return u};function r(c){t=c(e)}function a(c){const{props:u}=e,d=oB(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,A=!1;const j=Array.isArray(E)?E:[E];let R=j.reduce(i(y),{});S===!1&&(R={});const{prevResolvedValues:B={}}=x,z={...B,...R},L=I=>{k=!0,h.has(I)&&(A=!0,h.delete(I)),x.needsAnimating[I]=!0;const D=e.getValue(I);D&&(D.liveStyle=!1)};for(const I in z){const D=R[I],$=B[I];if(p.hasOwnProperty(I))continue;let O=!1;pS(D)&&pS($)?O=!_P(D,$):O=D!==$,O?D!=null?L(I):h.add(I):D!==void 0&&h.has(I)?L(I):x.protectedKeys[I]=!0}x.prevProp=E,x.prevResolvedValues=R,x.isActive&&(p={...p,...R}),s&&e.blockInitialAnimation&&(k=!1),k&&(!(_&&T)||A)&&f.push(...j.map(I=>({animation:I,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),E=e.getValue(y);E&&(E.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),s=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=Hj(),s=!0}}}function pZ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!_P(t,e):!1}function kc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Hj(){return{animate:kc(!0),whileInView:kc(),whileHover:kc(),whileTap:kc(),whileDrag:kc(),whileFocus:kc(),exit:kc()}}class gc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class mZ extends gc{constructor(t){super(t),t.animationState||(t.animationState=hZ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fx(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let gZ=0;class bZ extends gc{constructor(){super(...arguments),this.id=gZ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const yZ={animation:{Feature:mZ},exit:{Feature:bZ}},Ta={x:!1,y:!1};function lB(){return Ta.x||Ta.y}function xZ(e){return e==="x"||e==="y"?Ta[e]?null:(Ta[e]=!0,()=>{Ta[e]=!1}):Ta.x||Ta.y?null:(Ta.x=Ta.y=!0,()=>{Ta.x=Ta.y=!1})}const zk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Cm(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function xg(e){return{point:{x:e.pageX,y:e.pageY}}}const EZ=e=>t=>zk(t)&&e(t,xg(t));function zp(e,t,n,s){return Cm(e,t,EZ(n),s)}const zj=(e,t)=>Math.abs(e-t);function vZ(e,t){const n=zj(e.x,t.x),s=zj(e.y,t.y);return Math.sqrt(n**2+s**2)}class cB{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:r=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Hv(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=vZ(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:b}=Si;this.history.push({...m,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=$v(h,this.transformPagePoint),as.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Hv(f.type==="pointercancel"?this.lastMoveEventInfo:$v(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!zk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const a=xg(t),l=$v(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Si;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Hv(l,this.history)),this.removeListeners=yg(zp(this.contextWindow,"pointermove",this.handlePointerMove),zp(this.contextWindow,"pointerup",this.handlePointerUp),zp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),lc(this.updatePoint)}}function $v(e,t){return t?{point:t(e.point)}:e}function Vj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hv({point:e},t){return{point:e,delta:Vj(e,uB(t)),offset:Vj(e,wZ(t)),velocity:_Z(t,.1)}}function wZ(e){return e[0]}function uB(e){return e[e.length-1]}function _Z(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=uB(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>Zo(t)));)n--;if(!s)return{x:0,y:0};const r=Jo(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const a={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const dB=1e-4,SZ=1-dB,NZ=1+dB,fB=.01,TZ=0-fB,kZ=0+fB;function Hr(e){return e.max-e.min}function AZ(e,t,n){return Math.abs(e-t)<=n}function Gj(e,t,n,s=.5){e.origin=s,e.originPoint=ws(t.min,t.max,e.origin),e.scale=Hr(n)/Hr(t),e.translate=ws(n.min,n.max,e.origin)-e.originPoint,(e.scale>=SZ&&e.scale<=NZ||isNaN(e.scale))&&(e.scale=1),(e.translate>=TZ&&e.translate<=kZ||isNaN(e.translate))&&(e.translate=0)}function Vp(e,t,n,s){Gj(e.x,t.x,n.x,s?s.originX:void 0),Gj(e.y,t.y,n.y,s?s.originY:void 0)}function Kj(e,t,n){e.min=n.min+t.min,e.max=e.min+Hr(t)}function CZ(e,t,n){Kj(e.x,t.x,n.x),Kj(e.y,t.y,n.y)}function qj(e,t,n){e.min=t.min-n.min,e.max=e.min+Hr(t)}function Gp(e,t,n){qj(e.x,t.x,n.x),qj(e.y,t.y,n.y)}function IZ(e,{min:t,max:n},s){return t!==void 0&&en&&(e=s?ws(n,e,s.max):Math.min(e,n)),e}function Yj(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function jZ(e,{top:t,left:n,bottom:s,right:i}){return{x:Yj(e.x,n,i),y:Yj(e.y,t,s)}}function Wj(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.mins?n=_f(t.min,t.max-s,e.min):s>i&&(n=_f(e.min,e.max-i,t.min)),ll(0,1,n)}function MZ(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const NS=.35;function LZ(e=NS){return e===!1?e=0:e===!0&&(e=NS),{x:Xj(e,"left","right"),y:Xj(e,"top","bottom")}}function Xj(e,t,n){return{min:Qj(e,t),max:Qj(e,n)}}function Qj(e,t){return typeof e=="number"?e:e[t]||0}const Zj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ld=()=>({x:Zj(),y:Zj()}),Jj=()=>({min:0,max:0}),Us=()=>({x:Jj(),y:Jj()});function Xr(e){return[e("x"),e("y")]}function hB({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function DZ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function PZ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function zv(e){return e===void 0||e===1}function TS({scale:e,scaleX:t,scaleY:n}){return!zv(e)||!zv(t)||!zv(n)}function Lc(e){return TS(e)||pB(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function pB(e){return eR(e.x)||eR(e.y)}function eR(e){return e&&e!=="0%"}function Jy(e,t,n){const s=e-n,i=t*s;return n+i}function tR(e,t,n,s,i){return i!==void 0&&(e=Jy(e,i,s)),Jy(e,n,s)+t}function kS(e,t=0,n=1,s,i){e.min=tR(e.min,t,n,s,i),e.max=tR(e.max,t,n,s,i)}function mB(e,{x:t,y:n}){kS(e.x,t.translate,t.scale,t.originPoint),kS(e.y,n.translate,n.scale,n.originPoint)}const nR=.999999999999,sR=1.0000000000001;function BZ(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let r,a;for(let l=0;lnR&&(t.x=1),t.ynR&&(t.y=1)}function Dd(e,t){e.min=e.min+t,e.max=e.max+t}function iR(e,t,n,s,i=.5){const r=ws(e.min,e.max,i);kS(e,t,n,r,s)}function Pd(e,t){iR(e.x,t.x,t.scaleX,t.scale,t.originX),iR(e.y,t.y,t.scaleY,t.scale,t.originY)}function gB(e,t){return hB(PZ(e.getBoundingClientRect(),t))}function UZ(e,t,n){const s=gB(e,n),{scroll:i}=t;return i&&(Dd(s.x,i.offset.x),Dd(s.y,i.offset.y)),s}const bB=({current:e})=>e?e.ownerDocument.defaultView:null,FZ=new WeakMap;class $Z{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Us(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(xg(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xZ(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Xr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(co.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=Hr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&as.postRender(()=>m(d,f)),mS(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(p&&this.currentDirection===null){this.currentDirection=HZ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Xr(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new cB(t,{onSessionStart:i,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:bB(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&as.postRender(()=>r(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!H0(t,i,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(a=IZ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,r=this.constraints;n&&Od(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=jZ(i.layoutBox,n):this.constraints=!1,this.elastic=LZ(s),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Xr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=MZ(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Od(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=UZ(s,i.root,this.visualElement.getTransformPagePoint());let a=RZ(i.layout.layoutBox,r);if(n){const l=n(DZ(a));this.hasMutatedConstraints=!!l,l&&(a=hB(l))}return a}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Xr(d=>{if(!H0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:s?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return mS(this.visualElement,t),s.start(Hk(t,s,0,n,this.visualElement,!1))}stopAnimation(){Xr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Xr(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Xr(n=>{const{drag:s}=this.getProps();if(!H0(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];r.set(t[n]-ws(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Od(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Xr(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=OZ({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Xr(a=>{if(!H0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(ws(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;FZ.set(this.visualElement,this);const t=this.visualElement.current,n=zp(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Od(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),as.read(s);const a=Cm(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Xr(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:a=NS,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function H0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function HZ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class zZ extends gc{constructor(t){super(t),this.removeGroupControls=Br,this.removeListeners=Br,this.controls=new $Z(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Br}unmount(){this.removeGroupControls(),this.removeListeners()}}const rR=e=>(t,n)=>{e&&as.postRender(()=>e(t,n))};class VZ extends gc{constructor(){super(...arguments),this.removePointerDownListener=Br}onPointerDown(t){this.session=new cB(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:bB(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:rR(t),onStart:rR(n),onMove:s,onEnd:(r,a)=>{delete this.session,i&&as.postRender(()=>i(r,a))}}}mount(){this.removePointerDownListener=zp(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Kb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function aR(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Gh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(gt.test(e))e=parseFloat(e);else return e;const n=aR(e,t.target.x),s=aR(e,t.target.y);return`${n}% ${s}%`}},GZ={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=cc.parse(e);if(i.length>5)return s;const r=cc.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=ws(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),r(i)}};class KZ extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=t;yX(qZ),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Kb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,a=s.projection;return a&&(a.isPresent=r,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||as.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),bk.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yB(e){const[t,n]=tP(),s=g.useContext(fk);return o.jsx(KZ,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(uP),isPresent:t,safeToRemove:n})}const qZ={borderRadius:{...Gh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Gh,borderTopRightRadius:Gh,borderBottomLeftRadius:Gh,borderBottomRightRadius:Gh,boxShadow:GZ};function YZ(e,t,n){const s=Pi(e)?e:km(e);return s.start(Hk("",s,t,n)),s.animation}function WZ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const XZ=(e,t)=>e.depth-t.depth;class QZ{constructor(){this.children=[],this.isDirty=!1}add(t){Ak(this.children,t),this.isDirty=!0}remove(t){Ck(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(XZ),this.isDirty=!1,this.children.forEach(t)}}function ZZ(e,t){const n=uo.now(),s=({timestamp:i})=>{const r=i-n;r>=t&&(lc(s),e(r-t))};return as.read(s,!0),()=>lc(s)}const xB=["TopLeft","TopRight","BottomLeft","BottomRight"],JZ=xB.length,oR=e=>typeof e=="string"?parseFloat(e):e,lR=e=>typeof e=="number"||gt.test(e);function eJ(e,t,n,s,i,r){i?(e.opacity=ws(0,n.opacity!==void 0?n.opacity:1,tJ(s)),e.opacityExit=ws(t.opacity!==void 0?t.opacity:1,0,nJ(s))):r&&(e.opacity=ws(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let a=0;ast?1:n(_f(e,t,s))}function uR(e,t){e.min=t.min,e.max=t.max}function Wr(e,t){uR(e.x,t.x),uR(e.y,t.y)}function dR(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function fR(e,t,n,s,i){return e-=t,e=Jy(e,1/n,s),i!==void 0&&(e=Jy(e,1/i,s)),e}function sJ(e,t=0,n=1,s=.5,i,r=e,a=e){if(co.test(t)&&(t=parseFloat(t),t=ws(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=ws(r.min,r.max,s);e===r&&(l-=t),e.min=fR(e.min,t,n,l,i),e.max=fR(e.max,t,n,l,i)}function hR(e,t,[n,s,i],r,a){sJ(e,t[n],t[s],t[i],t.scale,r,a)}const iJ=["x","scaleX","originX"],rJ=["y","scaleY","originY"];function pR(e,t,n,s){hR(e.x,t,iJ,n?n.x:void 0,s?s.x:void 0),hR(e.y,t,rJ,n?n.y:void 0,s?s.y:void 0)}function mR(e){return e.translate===0&&e.scale===1}function vB(e){return mR(e.x)&&mR(e.y)}function gR(e,t){return e.min===t.min&&e.max===t.max}function aJ(e,t){return gR(e.x,t.x)&&gR(e.y,t.y)}function bR(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function wB(e,t){return bR(e.x,t.x)&&bR(e.y,t.y)}function yR(e){return Hr(e.x)/Hr(e.y)}function xR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class oJ{constructor(){this.members=[]}add(t){Ak(this.members,t),t.scheduleRender()}remove(t){if(Ck(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function lJ(e,t,n){let s="";const i=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||r||a)&&(s=`translate3d(${i}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),p&&(s+=`skewX(${p}deg) `),m&&(s+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Dc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},mp=typeof window<"u"&&window.MotionDebug!==void 0,Vv=["","X","Y","Z"],cJ={visibility:"hidden"},ER=1e3;let uJ=0;function Gv(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function _B(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=TP(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",as,!(i||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&_B(s)}function SB({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=uJ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mp&&(Dc.totalNodes=Dc.resolvedTargetDeltas=Dc.recalculatedProjection=0),this.nodes.forEach(hJ),this.nodes.forEach(yJ),this.nodes.forEach(xJ),this.nodes.forEach(pJ),mp&&window.MotionDebug.record(Dc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=ZZ(h,250),Kb.hasAnimatedSinceResize&&(Kb.hasAnimatedSinceResize=!1,this.nodes.forEach(wR))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||SJ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!wB(this.targetLayout,m)||p,E=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,E);const w={...kk(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||wR(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,lc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(EJ),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&_B(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const S=w/1e3;_R(f.x,a.x,S),_R(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Gp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),wJ(this.relativeTarget,this.relativeTargetOrigin,h,S),E&&aJ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Us()),Wr(E,this.relativeTarget)),b&&(this.animationValues=d,eJ(d,u,this.latestValues,S,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(lc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=as.update(()=>{Kb.hasAnimatedSinceResize=!0,this.currentAnimation=YZ(0,ER,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ER),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&NB(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Us();const f=Hr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Hr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Wr(l,c),Pd(l,d),Vp(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new oJ),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Gv("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(vR),this.root.sharedNodes.clear()}}}function dJ(e){e.updateLayout()}function fJ(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Xr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Hr(h);h.min=s[f].min,h.max=h.min+p}):NB(r,n.layoutBox,s)&&Xr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Hr(s[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Ld();Vp(l,s,n.layoutBox);const c=Ld();a?Vp(c,e.applyTransform(i,!0),n.measuredBox):Vp(c,s,n.layoutBox);const u=!vB(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=Us();Gp(m,n.layoutBox,h.layoutBox);const b=Us();Gp(b,s,p.layoutBox),wB(m,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function hJ(e){mp&&Dc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pJ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function mJ(e){e.clearSnapshot()}function vR(e){e.clearMeasurements()}function gJ(e){e.isLayoutDirty=!1}function bJ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function wR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function yJ(e){e.resolveTargetDelta()}function xJ(e){e.calcProjection()}function EJ(e){e.resetSkewAndRotation()}function vJ(e){e.removeLeadSnapshot()}function _R(e,t,n){e.translate=ws(t.translate,0,n),e.scale=ws(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function SR(e,t,n,s){e.min=ws(t.min,n.min,s),e.max=ws(t.max,n.max,s)}function wJ(e,t,n,s){SR(e.x,t.x,n.x,s),SR(e.y,t.y,n.y,s)}function _J(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const SJ={duration:.45,ease:[.4,0,.1,1]},NR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),TR=NR("applewebkit/")&&!NR("chrome/")?Math.round:Br;function kR(e){e.min=TR(e.min),e.max=TR(e.max)}function NJ(e){kR(e.x),kR(e.y)}function NB(e,t,n){return e==="position"||e==="preserve-aspect"&&!AZ(yR(t),yR(n),.2)}function TJ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const kJ=SB({attachResizeListener:(e,t)=>Cm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Kv={current:void 0},TB=SB({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Kv.current){const e=new kJ({});e.mount(window),e.setOptions({layoutScroll:!0}),Kv.current=e}return Kv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),AJ={pan:{Feature:VZ},drag:{Feature:zZ,ProjectionNode:TB,MeasureLayout:yB}};function CJ(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const r=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function kB(e,t){const n=CJ(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function AR(e){return t=>{t.pointerType==="touch"||lB()||e(t)}}function IJ(e,t,n={}){const[s,i,r]=kB(e,n),a=AR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=AR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),r}function CR(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&as.postRender(()=>r(t,xg(t)))}class jJ extends gc{mount(){const{current:t}=this.node;t&&(this.unmount=IJ(t,n=>(CR(this.node,n,"Start"),s=>CR(this.node,s,"End"))))}unmount(){}}class RJ extends gc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yg(Cm(this.node.current,"focus",()=>this.onFocus()),Cm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const AB=(e,t)=>t?e===t?!0:AB(e,t.parentElement):!1,OJ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function MJ(e){return OJ.has(e.tagName)||e.tabIndex!==-1}const gp=new WeakSet;function IR(e){return t=>{t.key==="Enter"&&e(t)}}function qv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const LJ=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=IR(()=>{if(gp.has(n))return;qv(n,"down");const i=IR(()=>{qv(n,"up")}),r=()=>qv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function jR(e){return zk(e)&&!lB()}function DJ(e,t,n={}){const[s,i,r]=kB(e,n),a=l=>{const c=l.currentTarget;if(!jR(l)||gp.has(c))return;gp.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!jR(p)||!gp.has(c))&&(gp.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||AB(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return s.forEach(l=>{!MJ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>LJ(u,i),i)}),r}function RR(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&as.postRender(()=>r(t,xg(t)))}class PJ extends gc{mount(){const{current:t}=this.node;t&&(this.unmount=DJ(t,n=>(RR(this.node,n,"Start"),(s,{success:i})=>RR(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const AS=new WeakMap,Yv=new WeakMap,BJ=e=>{const t=AS.get(e.target);t&&t(e)},UJ=e=>{e.forEach(BJ)};function FJ({root:e,...t}){const n=e||document;Yv.has(n)||Yv.set(n,{});const s=Yv.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(UJ,{root:e,...t})),s[i]}function $J(e,t,n){const s=FJ(t);return AS.set(e,n),s.observe(e),()=>{AS.delete(e),s.unobserve(e)}}const HJ={some:0,all:1};class zJ extends gc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:HJ[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return $J(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(VJ(t,n))&&this.startObserver()}unmount(){}}function VJ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const GJ={inView:{Feature:zJ},tap:{Feature:PJ},focus:{Feature:RJ},hover:{Feature:jJ}},KJ={layout:{ProjectionNode:TB,MeasureLayout:yB}},CS={current:null},CB={current:!1};function qJ(){if(CB.current=!0,!!hk)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>CS.current=e.matches;e.addListener(t),t()}else CS.current=!1}const YJ=[...XP,Di,cc],WJ=e=>YJ.find(WP(e)),OR=new WeakMap;function XJ(e,t,n){for(const s in t){const i=t[s],r=n[s];if(Pi(i))e.addValue(s,i);else if(Pi(r))e.addValue(s,km(i,{owner:e}));else if(r!==i)if(e.hasValue(s)){const a=e.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,km(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const MR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class QJ{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Uk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=uo.now();this.renderScheduledAtthis.bindToMotionValue(s,n)),CB.current||qJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:CS.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){OR.delete(this.current),this.projection&&this.projection.unmount(),lc(this.notifyUpdate),lc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=ju.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&as.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),r(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in wf){const n=wf[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Us()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=km(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(qP(i)||BP(i))?i=parseFloat(i):!WJ(i)&&cc.test(n)&&(i=VP(t,n)),this.setBaseTarget(t,Pi(i)?i.get():i)),Pi(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const a=xk(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Pi(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ik),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class IB extends QJ{constructor(){super(...arguments),this.KeyframeResolver=QP}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Pi(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZJ(e){return window.getComputedStyle(e)}class JJ extends IB{constructor(){super(...arguments),this.type="html",this.renderInstance=bP}readValueFromInstance(t,n){if(ju.has(n)){const s=Bk(n);return s&&s.default||0}else{const s=ZJ(t),i=(pP(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return gB(t,n)}build(t,n,s){wk(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Tk(t,n,s)}}class eee extends IB{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Us}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(ju.has(n)){const s=Bk(n);return s&&s.default||0}return n=yP.has(n)?n:gk(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return vP(t,n,s)}build(t,n,s){_k(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){xP(t,n,s,i)}mount(t){this.isSVGTag=Nk(t.tagName),super.mount(t)}}const tee=(e,t)=>yk(e)?new eee(t):new JJ(t,{allowProjection:e!==g.Fragment}),nee=kX({...yZ,...GJ,...AJ,...KJ},tee),is=HW(nee);function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?g.useEffect:g.useLayoutEffect;function pd(e,t,n){var s=g.useRef(t);s.current=t,g.useEffect(function(){function i(r){s.current(r)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var see=["container"];function iee(e){var t=e.container,n=t===void 0?document.body:t,s=gx(e,see);return wi.createPortal(Lt.createElement("div",ui({},s)),n)}function ree(e){return Lt.createElement("svg",ui({width:"44",height:"44",viewBox:"0 0 768 768"},e),Lt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function aee(e){return Lt.createElement("svg",ui({width:"44",height:"44",viewBox:"0 0 768 768"},e),Lt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function oee(e){return Lt.createElement("svg",ui({width:"44",height:"44",viewBox:"0 0 768 768"},e),Lt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function lee(){return g.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function DR(e){var t=e.touches[0],n=t.clientX,s=t.clientY;if(e.touches.length>=2){var i=e.touches[1],r=i.clientX,a=i.clientY;return[(n+r)/2,(s+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-s,2))]}return[n,s,0]}var jl=function(e,t,n,s){var i,r=n*t,a=(r-s)/2,l=e;return r<=s?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function Wv(e,t,n,s,i,r,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=jl(e,r,n,innerWidth)[0],f=jl(t,r,s,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/i*(a-(h+e))-h+(s/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/i*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function RS(e,t,n){var s=e%180!=0;return s?[n,t,s]:[t,n,s]}function Xv(e,t,n){var s=RS(n,innerWidth,innerHeight),i=s[0],r=s[1],a=0,l=i,c=r,u=e/t*r,d=t/e*i;return e=r?l=u:e>=i&&ti/r?c=d:t/e>=3&&!s[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function V0(e,t){var n=t.leading,s=n!==void 0&&n,i=t.maxWait,r=t.wait,a=r===void 0?i||0:r,l=g.useRef(e);l.current=e;var c=g.useRef(0),u=g.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=g.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var b=c.current,v=p-b;if(b===0&&(s&&m(),c.current=p),i!==void 0){if(v>i)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var uee={T:0,L:0,W:0,H:0,FIT:void 0},RB=function(){var e=g.useRef(!1);return g.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},dee=["className"];function fee(e){var t=e.className,n=t===void 0?"":t,s=gx(e,dee);return Lt.createElement("div",ui({className:"PhotoView__Spinner "+n},s),Lt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Lt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),Lt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var hee=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function pee(e){var t=e.src,n=e.loaded,s=e.broken,i=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=gx(e,hee),u=RB();return t&&!s?Lt.createElement(Lt.Fragment,null,Lt.createElement("img",ui({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&r({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&r({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Lt.createElement("span",{className:"PhotoView__icon"},a):Lt.createElement(fee,{className:"PhotoView__icon"}))):l?Lt.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var mee={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function gee(e){var t=e.item,n=t.src,s=t.render,i=t.width,r=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,_=e.isActive,T=e.expose,k=e1(mee),A=k[0],j=k[1],R=g.useRef(0),B=RB(),z=A.naturalWidth,L=z===void 0?r:z,F=A.naturalHeight,C=F===void 0?l:F,I=A.width,D=I===void 0?r:I,$=A.height,O=$===void 0?l:$,te=A.loaded,se=te===void 0?!n:te,P=A.broken,Q=A.x,ee=A.y,V=A.touched,X=A.stopRaf,K=A.maskTouched,ce=A.rotate,he=A.scale,be=A.CX,ue=A.CY,we=A.lastX,Le=A.lastY,Ne=A.lastCX,ae=A.lastCY,me=A.lastScale,_e=A.touchTime,Je=A.touchLength,Pe=A.pause,Fe=A.reach,Ye=tu({onScale:function(ye){return Ce(z0(ye))},onRotate:function(ye){ce!==ye&&(T({rotate:ye}),j(ui({rotate:ye},Xv(L,C,ye))))}});function Ce(ye,We,Ge){he!==ye&&(T({scale:ye}),j(ui({scale:ye},Wv(Q,ee,D,O,he,ye,We,Ge),ye<=1&&{x:0,y:0})))}var Ve=V0(function(ye,We,Ge){if(Ge===void 0&&(Ge=0),(V||K)&&_){var ht=RS(ce,D,O),Vn=ht[0],un=ht[1];if(Ge===0&&R.current===0){var Ht=Math.abs(ye-be)<=20,sn=Math.abs(We-ue)<=20;if(Ht&&sn)return void j({lastCX:ye,lastCY:We});R.current=Ht?We>ue?3:2:1}var kn,zt=ye-Ne,ot=We-ae;if(Ge===0){var An=jl(zt+we,he,Vn,innerWidth)[0],mn=jl(ot+Le,he,un,innerHeight);kn=function(Os,Ms,bs,vn){return Ms&&Os===1||vn==="x"?"x":bs&&Os>1||vn==="y"?"y":void 0}(R.current,An,mn[0],Fe),kn!==void 0&&E(kn,ye,We,he)}if(kn==="x"||K)return void j({reach:"x"});var At=z0(he+(Ge-Je)/100/2*he,L/D,.2);T({scale:At}),j(ui({touchLength:Ge,reach:kn,scale:At},Wv(Q,ee,D,O,he,At,ye,We,zt,ot)))}},{maxWait:8});function Ue(ye){return!X&&!V&&(B.current&&j(ui({},ye,{pause:u})),B.current)}var W,oe,Z,Ee,Me,lt,Ot,ut,xn=(Me=function(ye){return Ue({x:ye})},lt=function(ye){return Ue({y:ye})},Ot=function(ye){return B.current&&(T({scale:ye}),j({scale:ye})),!V&&B.current},ut=tu({X:function(ye){return Me(ye)},Y:function(ye){return lt(ye)},S:function(ye){return Ot(ye)}}),function(ye,We,Ge,ht,Vn,un,Ht,sn,kn,zt,ot){var An=RS(zt,Vn,un),mn=An[0],At=An[1],Os=jl(ye,sn,mn,innerWidth),Ms=Os[0],bs=Os[1],vn=jl(We,sn,At,innerHeight),Gn=vn[0],ls=vn[1],Kn=Date.now()-ot;if(Kn>=200||sn!==Ht||Math.abs(kn-Ht)>1){var Ss=Wv(ye,We,Vn,un,Ht,sn),Ns=Ss.x,hi=Ss.y,Cn=Ms?bs:Ns!==ye?Ns:null,Ks=Gn?ls:hi!==We?hi:null;return Cn!==null&&Hc(ye,Cn,ut.X),Ks!==null&&Hc(We,Ks,ut.Y),void(sn!==Ht&&Hc(Ht,sn,ut.S))}var cs=(ye-Ge)/Kn,qn=(We-ht)/Kn,Yn=Math.sqrt(Math.pow(cs,2)+Math.pow(qn,2)),Wn=!1,Ls=!1;(function(ys,gn){var fn,dn=ys,rn=0,an=0,xs=function(Be){fn||(fn=Be);var it=Be-fn,et=Math.sign(ys),Et=-.001*et,je=Math.sign(-dn)*Math.pow(dn,2)*2e-4,Ln=dn*it+(Et+je)*Math.pow(it,2)/2;rn+=Ln,fn=Be,et*(dn+=(Et+je)*it)<=0?Ie():gn(rn)?de():Ie()};function de(){an=requestAnimationFrame(xs)}function Ie(){cancelAnimationFrame(an)}de()})(Yn,function(ys){var gn=ye+ys*(cs/Yn),fn=We+ys*(qn/Yn),dn=jl(gn,Ht,mn,innerWidth),rn=dn[0],an=dn[1],xs=jl(fn,Ht,At,innerHeight),de=xs[0],Ie=xs[1];if(rn&&!Wn&&(Wn=!0,Ms?Hc(gn,an,ut.X):PR(an,gn+(gn-an),ut.X)),de&&!Ls&&(Ls=!0,Gn?Hc(fn,Ie,ut.Y):PR(Ie,fn+(fn-Ie),ut.Y)),Wn&&Ls)return!1;var Be=Wn||ut.X(an),it=Ls||ut.Y(Ie);return Be&&it})}),xt=(W=y,oe=function(ye,We){Fe||Ce(he!==1?1:Math.max(2,L/D),ye,We)},Z=g.useRef(0),Ee=V0(function(){Z.current=0,W.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);Z.current+=1,Ee.apply(void 0,ye),Z.current>=2&&(Ee.cancel(),Z.current=0,oe.apply(void 0,ye))});function wt(ye,We){if(R.current=0,(V||K)&&_){j({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Ge=z0(he,L/D);if(xn(Q,ee,we,Le,D,O,he,Ge,me,ce,_e),w(ye,We),be===ye&&ue===We){if(V)return void xt(ye,We);K&&x(ye,We)}}}function En(ye,We,Ge){Ge===void 0&&(Ge=0),j({touched:!0,CX:ye,CY:We,lastCX:ye,lastCY:We,lastX:Q,lastY:ee,lastScale:he,touchLength:Ge,touchTime:Date.now()})}function Ut(ye){j({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:Q,lastY:ee})}pd(Bo?void 0:"mousemove",function(ye){ye.preventDefault(),Ve(ye.clientX,ye.clientY)}),pd(Bo?void 0:"mouseup",function(ye){wt(ye.clientX,ye.clientY)}),pd(Bo?"touchmove":void 0,function(ye){ye.preventDefault();var We=DR(ye);Ve.apply(void 0,We)},{passive:!1}),pd(Bo?"touchend":void 0,function(ye){var We=ye.changedTouches[0];wt(We.clientX,We.clientY)},{passive:!1}),pd("resize",V0(function(){se&&!V&&(j(Xv(L,C,ce)),S())},{maxWait:8})),jS(function(){_&&T(ui({scale:he,rotate:ce},Ye))},[_]);var Pt=function(ye,We,Ge,ht,Vn,un,Ht,sn,kn,zt){var ot=function(Ns,hi,Cn,Ks,cs){var qn=g.useRef(!1),Yn=e1({lead:!0,scale:Cn}),Wn=Yn[0],Ls=Wn.lead,ys=Wn.scale,gn=Yn[1],fn=V0(function(dn){try{return cs(!0),gn({lead:!1,scale:dn}),Promise.resolve()}catch(rn){return Promise.reject(rn)}},{wait:Ks});return jS(function(){qn.current?(cs(!1),gn({lead:!0}),fn(Cn)):qn.current=!0},[Cn]),Ls?[Ns*ys,hi*ys,Cn/ys]:[Ns*Cn,hi*Cn,1]}(un,Ht,sn,kn,zt),An=ot[0],mn=ot[1],At=ot[2],Os=function(Ns,hi,Cn,Ks,cs){var qn=g.useState(uee),Yn=qn[0],Wn=qn[1],Ls=g.useState(0),ys=Ls[0],gn=Ls[1],fn=g.useRef(),dn=tu({OK:function(){return Ns&&gn(4)}});function rn(an){cs(!1),gn(an)}return g.useEffect(function(){if(fn.current||(fn.current=Date.now()),Cn){if(function(an,xs){var de=an&&an.current;if(de&&de.nodeType===1){var Ie=de.getBoundingClientRect();xs({T:Ie.top,L:Ie.left,W:Ie.width,H:Ie.height,FIT:de.tagName==="IMG"?getComputedStyle(de).objectFit:void 0})}}(hi,Wn),Ns)return Date.now()-fn.current<250?(gn(1),requestAnimationFrame(function(){gn(2),requestAnimationFrame(function(){return rn(3)})}),void setTimeout(dn.OK,Ks)):void gn(4);rn(5)}},[Ns,Cn]),[ys,Yn]}(ye,We,Ge,kn,zt),Ms=Os[0],bs=Os[1],vn=bs.W,Gn=bs.FIT,ls=innerWidth/2,Kn=innerHeight/2,Ss=Ms<3||Ms>4;return[Ss?vn?bs.L:ls:ht+(ls-un*sn/2),Ss?vn?bs.T:Kn:Vn+(Kn-Ht*sn/2),An,Ss&&Gn?An*(bs.H/vn):mn,Ms===0?At:Ss?vn/(un*sn)||.01:At,Ss?Gn?1:0:1,Ms,Gn]}(u,c,se,Q,ee,D,O,he,d,function(ye){return j({pause:ye})}),at=Pt[4],ft=Pt[6],He="transform "+d+"ms "+f,_t={className:p,onMouseDown:Bo?void 0:function(ye){ye.stopPropagation(),ye.button===0&&En(ye.clientX,ye.clientY,0)},onTouchStart:Bo?function(ye){ye.stopPropagation(),En.apply(void 0,DR(ye))}:void 0,onWheel:function(ye){if(!Fe){var We=z0(he-ye.deltaY/100/2,L/D);j({stopRaf:!0}),Ce(We,ye.clientX,ye.clientY)}},style:{width:Pt[2]+"px",height:Pt[3]+"px",opacity:Pt[5],objectFit:ft===4?void 0:Pt[7],transform:ce?"rotate("+ce+"deg)":void 0,transition:ft>2?He+", opacity "+d+"ms ease, height "+(ft<4?d/2:ft>4?d:0)+"ms "+f:void 0}};return Lt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Bo&&_?Ut:void 0,onTouchStart:Bo&&_?function(ye){return Ut(ye.touches[0])}:void 0},Lt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+at+", 0, 0, "+at+", "+Pt[0]+", "+Pt[1]+")",transition:V||Pe?void 0:He,willChange:_?"transform":void 0}},n?Lt.createElement(pee,ui({src:n,loaded:se,broken:P},_t,{onPhotoLoad:function(ye){j(ui({},ye,ye.loaded&&Xv(ye.naturalWidth||0,ye.naturalHeight||0,ce)))},loadingElement:b,brokenElement:v})):s&&s({attrs:_t,scale:at,rotate:ce})))}var BR={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function bee(e){var t=e.loop,n=t===void 0?3:t,s=e.speed,i=e.easing,r=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,_=e.images,T=e.index,k=T===void 0?0:T,A=e.onIndexChange,j=e.visible,R=e.onClose,B=e.afterClose,z=e.portalContainer,L=e1(BR),F=L[0],C=L[1],I=g.useState(0),D=I[0],$=I[1],O=F.x,te=F.touched,se=F.pause,P=F.lastCX,Q=F.lastCY,ee=F.bg,V=ee===void 0?u:ee,X=F.lastBg,K=F.overlay,ce=F.minimal,he=F.scale,be=F.rotate,ue=F.onScale,we=F.onRotate,Le=e.hasOwnProperty("index"),Ne=Le?k:D,ae=Le?A:$,me=g.useRef(Ne),_e=_.length,Je=_[Ne],Pe=typeof n=="boolean"?n:_e>n,Fe=function(at,ft){var He=g.useReducer(function(Ge){return!Ge},!1)[1],_t=g.useRef(0),ye=function(Ge){var ht=g.useRef(Ge);function Vn(un){ht.current=un}return g.useMemo(function(){(function(un){at?(un(at),_t.current=1):_t.current=2})(Vn)},[Ge]),[ht.current,Vn]}(at),We=ye[1];return[ye[0],_t.current,function(){He(),_t.current===2&&(We(!1),ft&&ft()),_t.current=0}]}(j,B),Ye=Fe[0],Ce=Fe[1],Ve=Fe[2];jS(function(){if(Ye)return C({pause:!0,x:Ne*-(innerWidth+Ju)}),void(me.current=Ne);C(BR)},[Ye]);var Ue=tu({close:function(at){we&&we(0),C({overlay:!0,lastBg:V}),R(at)},changeIndex:function(at,ft){ft===void 0&&(ft=!1);var He=Pe?me.current+(at-Ne):at,_t=_e-1,ye=IS(He,0,_t),We=Pe?He:ye,Ge=innerWidth+Ju;C({touched:!1,lastCX:void 0,lastCY:void 0,x:-Ge*We,pause:ft}),me.current=We,ae&&ae(Pe?at<0?_t:at>_t?0:at:ye)}}),W=Ue.close,oe=Ue.changeIndex;function Z(at){return at?W():C({overlay:!K})}function Ee(){C({x:-(innerWidth+Ju)*Ne,lastCX:void 0,lastCY:void 0,pause:!0}),me.current=Ne}function Me(at,ft,He,_t){at==="x"?function(ye){if(P!==void 0){var We=ye-P,Ge=We;!Pe&&(Ne===0&&We>0||Ne===_e-1&&We<0)&&(Ge=We/2),C({touched:!0,lastCX:P,x:-(innerWidth+Ju)*me.current+Ge,pause:!1})}else C({touched:!0,lastCX:ye,x:O,pause:!1})}(ft):at==="y"&&function(ye,We){if(Q!==void 0){var Ge=u===null?null:IS(u,.01,u-Math.abs(ye-Q)/100/4);C({touched:!0,lastCY:Q,bg:We===1?Ge:u,minimal:We===1})}else C({touched:!0,lastCY:ye,bg:V,minimal:!0})}(He,_t)}function lt(at,ft){var He=at-(P??at),_t=ft-(Q??ft),ye=!1;if(He<-40)oe(Ne+1);else if(He>40)oe(Ne-1);else{var We=-(innerWidth+Ju)*me.current;Math.abs(_t)>100&&ce&&f&&(ye=!0,W()),C({touched:!1,x:We,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||K})}}pd("keydown",function(at){if(j)switch(at.key){case"ArrowLeft":oe(Ne-1,!0);break;case"ArrowRight":oe(Ne+1,!0);break;case"Escape":W()}});var Ot=function(at,ft,He){return g.useMemo(function(){var _t=at.length;return He?at.concat(at).concat(at).slice(_t+ft-1,_t+ft+2):at.slice(Math.max(ft-1,0),Math.min(ft+2,_t+1))},[at,ft,He])}(_,Ne,Pe);if(!Ye)return null;var ut=K&&!Ce,xn=j?V:X,xt=ue&&we&&{images:_,index:Ne,visible:j,onClose:W,onIndexChange:oe,overlayVisible:ut,overlay:Je&&Je.overlay,scale:he,rotate:be,onScale:ue,onRotate:we},wt=s?s(Ce):400,En=i?i(Ce):LR,Ut=s?s(3):600,Pt=i?i(3):LR;return Lt.createElement(iee,{className:"PhotoView-Portal"+(ut?"":" PhotoView-Slider__clean")+(j?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(at){return at.stopPropagation()},container:z},j&&Lt.createElement(lee,null),Lt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Ce===1?" PhotoView-Slider__fadeIn":Ce===2?" PhotoView-Slider__fadeOut":""),style:{background:xn?"rgba(0, 0, 0, "+xn+")":void 0,transitionTimingFunction:En,transitionDuration:(te?0:wt)+"ms",animationDuration:wt+"ms"},onAnimationEnd:Ve}),p&&Lt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Lt.createElement("div",{className:"PhotoView-Slider__Counter"},Ne+1," / ",_e),Lt.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&xt&&b(xt),Lt.createElement(ree,{className:"PhotoView-Slider__toolbarIcon",onClick:W}))),Ot.map(function(at,ft){var He=Pe||Ne!==0?me.current-1+ft:Ne+ft;return Lt.createElement(gee,{key:Pe?at.key+"/"+at.src+"/"+He:at.key,item:at,speed:wt,easing:En,visible:j,onReachMove:Me,onReachUp:lt,onPhotoTap:function(){return Z(r)},onMaskTap:function(){return Z(l)},wrapClassName:E,className:x,style:{left:(innerWidth+Ju)*He+"px",transform:"translate3d("+O+"px, 0px, 0)",transition:te||se?void 0:"transform "+Ut+"ms "+Pt},loadingElement:w,brokenElement:S,onPhotoResize:Ee,isActive:me.current===He,expose:C})}),!Bo&&p&&Lt.createElement(Lt.Fragment,null,(Pe||Ne!==0)&&Lt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return oe(Ne-1,!0)}},Lt.createElement(aee,null)),(Pe||Ne+1<_e)&&Lt.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return oe(Ne+1,!0)}},Lt.createElement(oee,null))),m&&xt&&Lt.createElement("div",{className:"PhotoView-Slider__Overlay"},m(xt)))}var yee=["children","onIndexChange","onVisibleChange"],xee={images:[],visible:!1,index:0};function Eee(e){var t=e.children,n=e.onIndexChange,s=e.onVisibleChange,i=gx(e,yee),r=e1(xee),a=r[0],l=r[1],c=g.useRef(0),u=a.images,d=a.visible,f=a.index,h=tu({nextId:function(){return c.current+=1},update:function(b){var v=u.findIndex(function(x){return x.key===b.key});if(v>-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),s&&s(!0,v,a)}}),p=tu({close:function(){l({visible:!1}),s&&s(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),m=g.useMemo(function(){return ui({},a,h)},[a,h]);return Lt.createElement(jB.Provider,{value:m},t,Lt.createElement(bee,ui({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var OB=function(e){var t,n,s=e.src,i=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=g.useContext(jB),h=(t=function(){return f.nextId()},(n=g.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=g.useRef(null);g.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),g.useEffect(function(){return function(){f.remove(h)}},[]);var m=tu({render:function(v){return i&&i(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),b=g.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return g.useEffect(function(){f.update({key:h,src:s,originRef:p,render:m.render,overlay:r,width:a,height:l})},[s]),d?g.Children.only(g.cloneElement(d,ui({},b,{ref:p}))):null};/** + `),()=>{document.head.removeChild(d)}},[t]),o.jsx(jW,{isPresent:t,childRef:s,sizeRef:i,children:g.cloneElement(e,{ref:s})})}const OW=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:a})=>{const l=cx(MW),c=g.useId(),u=g.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;s&&s()},[l,s]),d=g.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return g.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),a==="popLayout"&&(e=o.jsx(RW,{isPresent:n,children:e})),o.jsx(ux.Provider,{value:d,children:e})};function MW(){return new Map}function tP(e=!0){const t=g.useContext(ux);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,r=g.useId();g.useEffect(()=>{e&&i(r)},[e]);const a=g.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,a]:[!0]}const U0=e=>e.key||"";function Ej(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const hk=typeof window<"u",nP=hk?g.useLayoutEffect:g.useEffect,qo=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=tP(a),u=g.useMemo(()=>Ej(e),[e]),d=a&&!l?[]:u.map(U0),f=g.useRef(!0),h=g.useRef(u),p=cx(()=>new Map),[m,b]=g.useState(u),[v,y]=g.useState(u);nP(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=U0(w),_=a&&!l?!1:u===v||d.includes(S),T=()=>{if(p.has(S))p.set(S,!0);else return;let k=!0;p.forEach(A=>{A||(k=!1)}),k&&(E==null||E(),y(h.current),a&&(c==null||c()),s&&s())};return o.jsx(OW,{isPresent:_,initial:!f.current||n?void 0:!1,custom:_?void 0:t,presenceAffectsLayout:i,mode:r,onExitComplete:_?void 0:T,children:w},S)})})},Ur=e=>e;let sP=Ur;const LW={useManualTiming:!1};function DW(e){let t=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){r.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?t:n;return d&&r.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),r.delete(u)},process:u=>{if(a=u,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(u))}};return c}const F0=["read","resolveKeyframes","update","preRender","render","postRender"],PW=40;function iP(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=F0.reduce((y,x)=>(y[x]=DW(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,PW),1),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(p))},m=()=>{n=!0,s=!0,i.isProcessing||e(p)};return{schedule:F0.reduce((y,x)=>{const E=a[x];return y[x]=(w,S=!1,_=!1)=>(n||m(),E.schedule(w,S,_)),y},{}),cancel:y=>{for(let x=0;xvj[e].some(n=>!!t[n])};function BW(e){for(const t in e)_f[t]={..._f[t],...e[t]}}const UW=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function qy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||UW.has(e)}let aP=e=>!qy(e);function oP(e){e&&(aP=t=>t.startsWith("on")?!qy(t):e(t))}try{oP(require("@emotion/is-prop-valid").default)}catch{}function FW(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(aP(i)||n===!0&&qy(i)||!t&&!qy(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function $W({children:e,isValidProp:t,...n}){t&&oP(t),n={...g.useContext(Sm),...n},n.isStatic=cx(()=>n.isStatic);const s=g.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(Sm.Provider,{value:s,children:e})}function HW(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const dx=g.createContext({});function Nm(e){return typeof e=="string"||Array.isArray(e)}function fx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const pk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mk=["initial",...pk];function hx(e){return fx(e.animate)||mk.some(t=>Nm(e[t]))}function lP(e){return!!(hx(e)||e.variants)}function zW(e,t){if(hx(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Nm(n)?n:void 0,animate:Nm(s)?s:void 0}}return e.inherit!==!1?t:{}}function VW(e){const{initial:t,animate:n}=zW(e,g.useContext(dx));return g.useMemo(()=>({initial:t,animate:n}),[wj(t),wj(n)])}function wj(e){return Array.isArray(e)?e.join(" "):e}const GW=Symbol.for("motionComponentSymbol");function Md(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function KW(e,t,n){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):Md(n)&&(n.current=s))},[t])}const gk=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qW="framerAppearId",cP="data-"+gk(qW),{schedule:bk}=iP(queueMicrotask,!1),uP=g.createContext({});function YW(e,t,n,s,i){var r,a;const{visualElement:l}=g.useContext(dx),c=g.useContext(rP),u=g.useContext(ux),d=g.useContext(Sm).reducedMotion,f=g.useRef(null);s=s||c.renderer,!f.current&&s&&(f.current=s(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=g.useContext(uP);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&WW(f.current,n,i,p);const m=g.useRef(!1);g.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const b=n[cP],v=g.useRef(!!b&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return nP(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),bk.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),g.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function WW(e,t,n,s){const{layoutId:i,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:dP(e.parent)),e.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!a||l&&Md(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:u})}function dP(e){if(e)return e.options.allowProjection!==!1?e.projection:dP(e.parent)}function XW({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var r,a;e&&BW(e);function l(u,d){let f;const h={...g.useContext(Sm),...u,layoutId:QW(u)},{isStatic:p}=h,m=VW(u),b=s(u,p);if(!p&&hk){ZW();const v=JW(h);f=v.MeasureLayout,m.visualElement=YW(i,b,h,t,v.ProjectionNode)}return o.jsxs(dx.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(i,u,KW(b,m.visualElement,d),b,p,m.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(r=i.displayName)!==null&&r!==void 0?r:i.name)!==null&&a!==void 0?a:""})`}`;const c=g.forwardRef(l);return c[GW]=i,c}function QW({layoutId:e}){const t=g.useContext(fk).id;return t&&e!==void 0?t+"-"+e:e}function ZW(e,t){g.useContext(rP).strict}function JW(e){const{drag:t,layout:n}=_f;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const eX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function yk(e){return typeof e!="string"||e.includes("-")?!1:!!(eX.indexOf(e)>-1||/[A-Z]/u.test(e))}function _j(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function xk(e,t,n,s){if(typeof t=="function"){const[i,r]=_j(s);t=t(n!==void 0?n:e.custom,i,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,r]=_j(s);t=t(n!==void 0?n:e.custom,i,r)}return t}const pS=e=>Array.isArray(e),tX=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),nX=e=>pS(e)?e[e.length-1]||0:e,Ui=e=>!!(e&&e.getVelocity);function Vb(e){const t=Ui(e)?e.get():e;return tX(t)?t.toValue():t}function sX({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,r){const a={latestValues:iX(s,i,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:s,current:l,...a}),a.onUpdate=l=>n(l)),a}const fP=e=>(t,n)=>{const s=g.useContext(dx),i=g.useContext(ux),r=()=>sX(e,t,s,i);return n?r():cx(r)};function iX(e,t,n,s){const i={},r=s(e,{});for(const h in r)i[h]=Vb(r[h]);let{initial:a,animate:l}=e;const c=hx(e),u=lP(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!fx(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),pP=hP("--"),rX=hP("var(--"),Ek=e=>rX(e)?aX.test(e.split("/*")[0].trim()):!1,aX=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,mP=(e,t)=>t&&typeof e=="number"?t.transform(e):e,cl=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Tm={...sh,transform:e=>cl(0,1,e)},$0={...sh,default:1},gg=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),kl=gg("deg"),uo=gg("%"),gt=gg("px"),oX=gg("vh"),lX=gg("vw"),Sj={...uo,parse:e=>uo.parse(e)/100,transform:e=>uo.transform(e*100)},cX={borderWidth:gt,borderTopWidth:gt,borderRightWidth:gt,borderBottomWidth:gt,borderLeftWidth:gt,borderRadius:gt,radius:gt,borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomRightRadius:gt,borderBottomLeftRadius:gt,width:gt,maxWidth:gt,height:gt,maxHeight:gt,top:gt,right:gt,bottom:gt,left:gt,padding:gt,paddingTop:gt,paddingRight:gt,paddingBottom:gt,paddingLeft:gt,margin:gt,marginTop:gt,marginRight:gt,marginBottom:gt,marginLeft:gt,backgroundPositionX:gt,backgroundPositionY:gt},uX={rotate:kl,rotateX:kl,rotateY:kl,rotateZ:kl,scale:$0,scaleX:$0,scaleY:$0,scaleZ:$0,skew:kl,skewX:kl,skewY:kl,distance:gt,translateX:gt,translateY:gt,translateZ:gt,x:gt,y:gt,z:gt,perspective:gt,transformPerspective:gt,opacity:Tm,originX:Sj,originY:Sj,originZ:gt},Nj={...sh,transform:Math.round},vk={...cX,...uX,zIndex:Nj,size:gt,fillOpacity:Tm,strokeOpacity:Tm,numOctaves:Nj},dX={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fX=nh.length;function hX(e,t,n){let s="",i=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),gP=()=>({...Sk(),attrs:{}}),Nk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function bP(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const r in n)e.style.setProperty(r,n[r])}const yP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function xP(e,t,n,s){bP(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(yP.has(i)?i:gk(i),t.attrs[i])}const Yy={};function yX(e){Object.assign(Yy,e)}function EP(e,{layout:t,layoutId:n}){return Ru.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Yy[e]||e==="opacity")}function Tk(e,t,n){var s;const{style:i}=e,r={};for(const a in i)(Ui(i[a])||t.style&&Ui(t.style[a])||EP(a,e)||((s=n==null?void 0:n.getValue(a))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(r[a]=i[a]);return r}function vP(e,t,n){const s=Tk(e,t,n);for(const i in e)if(Ui(e[i])||Ui(t[i])){const r=nh.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=e[i]}return s}function xX(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const kj=["x","y","width","height","cx","cy","r"],EX={useVisualState:fP({scrapeMotionValuesFromProps:vP,createRenderState:gP,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in i)if(Ru.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{xX(n,s),ns.render(()=>{_k(s,i,Nk(n.tagName),e.transformTemplate),xP(n,s)})})}})},vX={useVisualState:fP({scrapeMotionValuesFromProps:Tk,createRenderState:Sk})};function wP(e,t,n){for(const s in t)!Ui(t[s])&&!EP(s,n)&&(e[s]=t[s])}function wX({transformTemplate:e},t){return g.useMemo(()=>{const n=Sk();return wk(n,t,e),Object.assign({},n.vars,n.style)},[t])}function _X(e,t){const n=e.style||{},s={};return wP(s,n,e),Object.assign(s,wX(e,t)),s}function SX(e,t){const n={},s=_X(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}function NX(e,t,n,s){const i=g.useMemo(()=>{const r=gP();return _k(r,t,Nk(s),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};wP(r,e.style,e),i.style={...r,...i.style}}return i}function TX(e=!1){return(n,s,i,{latestValues:r},a)=>{const c=(yk(n)?NX:SX)(s,r,a,n),u=FW(s,typeof n=="string",e),d=n!==g.Fragment?{...u,...c,ref:i}:{},{children:f}=s,h=g.useMemo(()=>Ui(f)?f.get():f,[f]);return g.createElement(n,{...d,children:h})}}function kX(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...yk(s)?EX:vX,preloadedFeatures:e,useRender:TX(i),createVisualElement:t,Component:s};return XW(a)}}function _P(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s(Gb===void 0&&fo.set(Ni.isProcessing||LW.useManualTiming?Ni.timestamp:performance.now()),Gb),set:e=>{Gb=e,queueMicrotask(AX)}};function Ak(e,t){e.indexOf(t)===-1&&e.push(t)}function Ck(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Ik{constructor(){this.subscriptions=[]}add(t){return Ak(this.subscriptions,t),()=>Ck(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let r=0;r!isNaN(parseFloat(e));class IX{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const r=fo.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=fo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=CX(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ik);const s=this.events[t].add(n);return t==="change"?()=>{s(),ns.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=fo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Aj)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Aj);return NP(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function km(e,t){return new IX(e,t)}function jX(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,km(n))}function RX(e,t){const n=px(e,t);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const a in r){const l=nX(r[a]);jX(e,a,l)}}function OX(e){return!!(Ui(e)&&e.add)}function mS(e,t){const n=e.getValue("willChange");if(OX(n))return n.add(t)}function TP(e){return e.props[cP]}function jk(e){let t;return()=>(t===void 0&&(t=e()),t)}const MX=jk(()=>window.ScrollTimeline!==void 0);class LX{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let s=0;s{if(MX()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,r)=>{i&&i(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class DX extends LX{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Jo=e=>e*1e3,el=e=>e/1e3;function Rk(e){return typeof e=="function"}function Cj(e,t){e.timeline=t,e.onfinish=null}const Ok=e=>Array.isArray(e)&&typeof e[0]=="number",PX={linearEasing:void 0};function BX(e,t){const n=jk(e);return()=>{var s;return(s=PX[t])!==null&&s!==void 0?s:n()}}const Wy=BX(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Sf=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},kP=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${s})`,gS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pp([0,.65,.55,1]),circOut:pp([.55,0,1,.45]),backIn:pp([.31,.01,.66,-.59]),backOut:pp([.33,1.53,.69,.99])};function CP(e,t){if(e)return typeof e=="function"&&Wy()?kP(e,t):Ok(e)?pp(e):Array.isArray(e)?e.map(n=>CP(n,t)||gS.easeOut):gS[e]}const IP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,UX=1e-7,FX=12;function $X(e,t,n,s,i){let r,a,l=0;do a=t+(n-t)/2,r=IP(a,s,i)-e,r>0?n=a:t=a;while(Math.abs(r)>UX&&++l$X(r,0,1,e,n);return r=>r===0||r===1?r:IP(i(r),t,s)}const jP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,RP=e=>t=>1-e(1-t),OP=bg(.33,1.53,.69,.99),Mk=RP(OP),MP=jP(Mk),LP=e=>(e*=2)<1?.5*Mk(e):.5*(2-Math.pow(2,-10*(e-1))),Lk=e=>1-Math.sin(Math.acos(e)),DP=RP(Lk),PP=jP(Lk),BP=e=>/^0[^.\s]+$/u.test(e);function HX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||BP(e):!0}const Hp=e=>Math.round(e*1e5)/1e5,Dk=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function zX(e){return e==null}const VX=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Pk=(e,t)=>n=>!!(typeof n=="string"&&VX.test(n)&&n.startsWith(e)||t&&!zX(n)&&Object.prototype.hasOwnProperty.call(n,t)),UP=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,r,a,l]=s.match(Dk);return{[e]:parseFloat(i),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},GX=e=>cl(0,255,e),Pv={...sh,transform:e=>Math.round(GX(e))},Gc={test:Pk("rgb","red"),parse:UP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Pv.transform(e)+", "+Pv.transform(t)+", "+Pv.transform(n)+", "+Hp(Tm.transform(s))+")"};function KX(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const bS={test:Pk("#"),parse:KX,transform:Gc.transform},Ld={test:Pk("hsl","hue"),parse:UP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+uo.transform(Hp(t))+", "+uo.transform(Hp(n))+", "+Hp(Tm.transform(s))+")"},Bi={test:e=>Gc.test(e)||bS.test(e)||Ld.test(e),parse:e=>Gc.test(e)?Gc.parse(e):Ld.test(e)?Ld.parse(e):bS.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Gc.transform(e):Ld.transform(e)},qX=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function YX(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Dk))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(qX))===null||n===void 0?void 0:n.length)||0)>0}const FP="number",$P="color",WX="var",XX="var(",Ij="${}",QX=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Am(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const l=t.replace(QX,c=>(Bi.test(c)?(s.color.push(r),i.push($P),n.push(Bi.parse(c))):c.startsWith(XX)?(s.var.push(r),i.push(WX),n.push(c)):(s.number.push(r),i.push(FP),n.push(parseFloat(c))),++r,Ij)).split(Ij);return{values:n,split:l,indexes:s,types:i}}function HP(e){return Am(e).values}function zP(e){const{split:t,types:n}=Am(e),s=t.length;return i=>{let r="";for(let a=0;atypeof e=="number"?0:e;function JX(e){const t=HP(e);return zP(e)(t.map(ZX))}const uc={test:YX,parse:HP,createTransformer:zP,getAnimatableNone:JX},eQ=new Set(["brightness","contrast","saturate","opacity"]);function tQ(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Dk)||[];if(!s)return e;const i=n.replace(s,"");let r=eQ.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+i+")"}const nQ=/\b([a-z-]*)\(.*?\)/gu,yS={...uc,getAnimatableNone:e=>{const t=e.match(nQ);return t?t.map(tQ).join(" "):e}},sQ={...vk,color:Bi,backgroundColor:Bi,outlineColor:Bi,fill:Bi,stroke:Bi,borderColor:Bi,borderTopColor:Bi,borderRightColor:Bi,borderBottomColor:Bi,borderLeftColor:Bi,filter:yS,WebkitFilter:yS},Bk=e=>sQ[e];function VP(e,t){let n=Bk(e);return n!==yS&&(n=uc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iQ=new Set(["auto","none","0"]);function rQ(e,t,n){let s=0,i;for(;se===sh||e===gt,Rj=(e,t)=>parseFloat(e.split(", ")[t]),Oj=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return Rj(i[1],t);{const r=s.match(/^matrix\((.+)\)$/u);return r?Rj(r[1],e):0}},aQ=new Set(["x","y","z"]),oQ=nh.filter(e=>!aQ.has(e));function lQ(e){const t=[];return oQ.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Nf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Oj(4,13),y:Oj(5,14)};Nf.translateX=Nf.x;Nf.translateY=Nf.y;const tu=new Set;let xS=!1,ES=!1;function GP(){if(ES){const e=Array.from(tu).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=lQ(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,a])=>{var l;(l=s.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}ES=!1,xS=!1,tu.forEach(e=>e.complete()),tu.clear()}function KP(){tu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ES=!0)})}function cQ(){KP(),GP()}class Uk{constructor(t,n,s,i,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(tu.add(this),xS||(xS=!0,ns.read(KP),ns.resolveKeyframes(GP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function dQ(e){const t=uQ.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function YP(e,t,n=1){const[s,i]=dQ(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const a=r.trim();return qP(a)?parseFloat(a):a}return Ek(i)?YP(i,t,n+1):i}const WP=e=>t=>t.test(e),fQ={test:e=>e==="auto",parse:e=>e},XP=[sh,gt,uo,kl,lX,oX,fQ],Mj=e=>XP.find(WP(e));class QP extends Uk{constructor(t,n,s,i,r){super(t,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const Lj=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(uc.test(e)||e==="0")&&!e.startsWith("url("));function hQ(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function mx(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(mQ),r=t&&n!=="loop"&&t%2===1?0:i.length-1;return!r||s===void 0?i[r]:s}const gQ=40;class ZP{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=fo.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>gQ?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&cQ(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=fo.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!pQ(t,s,i,r))if(a)this.options.duration=0;else{c&&c(mx(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const vS=2e4;function JP(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t=vS?1/0:t}const ws=(e,t,n)=>e+(t-e)*n;function Bv(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function bQ({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,r=0,a=0;if(!t)i=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=Bv(c,l,e+1/3),r=Bv(c,l,e),a=Bv(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:s}}function Xy(e,t){return n=>n>0?t:e}const Uv=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},yQ=[bS,Gc,Ld],xQ=e=>yQ.find(t=>t.test(e));function Dj(e){const t=xQ(e);if(!t)return!1;let n=t.parse(e);return t===Ld&&(n=bQ(n)),n}const Pj=(e,t)=>{const n=Dj(e),s=Dj(t);if(!n||!s)return Xy(e,t);const i={...n};return r=>(i.red=Uv(n.red,s.red,r),i.green=Uv(n.green,s.green,r),i.blue=Uv(n.blue,s.blue,r),i.alpha=ws(n.alpha,s.alpha,r),Gc.transform(i))},EQ=(e,t)=>n=>t(e(n)),yg=(...e)=>e.reduce(EQ),wS=new Set(["none","hidden"]);function vQ(e,t){return wS.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function wQ(e,t){return n=>ws(e,t,n)}function Fk(e){return typeof e=="number"?wQ:typeof e=="string"?Ek(e)?Xy:Bi.test(e)?Pj:NQ:Array.isArray(e)?eB:typeof e=="object"?Bi.test(e)?Pj:_Q:Xy}function eB(e,t){const n=[...e],s=n.length,i=e.map((r,a)=>Fk(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in s)n[r]=s[r](i);return n}}function SQ(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;r{const n=uc.createTransformer(t),s=Am(e),i=Am(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?wS.has(e)&&!i.values.length||wS.has(t)&&!s.values.length?vQ(e,t):yg(eB(SQ(s,i),i.values),n):Xy(e,t)};function tB(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?ws(e,t,n):Fk(e)(e,t)}const TQ=5;function nB(e,t,n){const s=Math.max(t-TQ,0);return NP(n-e(s),t-s)}const Is={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Fv=.001;function kQ({duration:e=Is.duration,bounce:t=Is.bounce,velocity:n=Is.velocity,mass:s=Is.mass}){let i,r,a=1-t;a=cl(Is.minDamping,Is.maxDamping,a),e=cl(Is.minDuration,Is.maxDuration,el(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=_S(u,a),m=Math.exp(-f);return Fv-h/p*m},r=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),b=_S(Math.pow(u,2),a);return(-i(u)+Fv>0?-1:1)*((h-p)*m)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Fv+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=CQ(i,r,l);if(e=Jo(e),isNaN(c))return{stiffness:Is.stiffness,damping:Is.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:e}}}const AQ=12;function CQ(e,t,n){let s=n;for(let i=1;ie[n]!==void 0)}function RQ(e){let t={velocity:Is.velocity,stiffness:Is.stiffness,damping:Is.damping,mass:Is.mass,isResolvedFromDuration:!1,...e};if(!Bj(e,jQ)&&Bj(e,IQ))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*cl(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Is.mass,stiffness:i,damping:r}}else{const n=kQ(e);t={...t,...n,mass:Is.mass},t.isResolvedFromDuration=!0}return t}function sB(e=Is.visualDuration,t=Is.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=RQ({...n,velocity:-el(n.velocity||0)}),m=h||0,b=u/(2*Math.sqrt(c*d)),v=a-r,y=el(Math.sqrt(c/d)),x=Math.abs(v)<5;s||(s=x?Is.restSpeed.granular:Is.restSpeed.default),i||(i=x?Is.restDelta.granular:Is.restDelta.default);let E;if(b<1){const S=_S(y,b);E=_=>{const T=Math.exp(-b*y*_);return a-T*((m+b*y*v)/S*Math.sin(S*_)+v*Math.cos(S*_))}}else if(b===1)E=S=>a-Math.exp(-y*S)*(v+(m+y*v)*S);else{const S=y*Math.sqrt(b*b-1);E=_=>{const T=Math.exp(-b*y*_),k=Math.min(S*_,300);return a-T*((m+b*y*v)*Math.sinh(k)+S*v*Math.cosh(k))/S}}const w={calculatedDuration:p&&f||null,next:S=>{const _=E(S);if(p)l.done=S>=f;else{let T=0;b<1&&(T=S===0?Jo(m):nB(E,S,_));const k=Math.abs(T)<=s,A=Math.abs(a-_)<=i;l.done=k&&A}return l.value=l.done?a:_,l},toString:()=>{const S=Math.min(JP(w),vS),_=kP(T=>w.next(S*T).value,S,30);return S+"ms "+_}};return w}function Uj({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=k=>l!==void 0&&kc,m=k=>l===void 0?c:c===void 0||Math.abs(l-k)-b*Math.exp(-k/s),E=k=>y+x(k),w=k=>{const A=x(k),j=E(k);h.done=Math.abs(A)<=u,h.value=h.done?y:j};let S,_;const T=k=>{p(h.value)&&(S=k,_=sB({keyframes:[h.value,m(h.value)],velocity:nB(E,k,h.value),damping:i,stiffness:r,restDelta:u,restSpeed:d}))};return T(0),{calculatedDuration:null,next:k=>{let A=!1;return!_&&S===void 0&&(A=!0,w(k),T(k)),S!==void 0&&k>=S?_.next(k-S):(!A&&w(k),h)}}}const OQ=bg(.42,0,1,1),MQ=bg(0,0,.58,1),iB=bg(.42,0,.58,1),LQ=e=>Array.isArray(e)&&typeof e[0]!="number",DQ={linear:Ur,easeIn:OQ,easeInOut:iB,easeOut:MQ,circIn:Lk,circInOut:PP,circOut:DP,backIn:Mk,backInOut:MP,backOut:OP,anticipate:LP},Fj=e=>{if(Ok(e)){sP(e.length===4);const[t,n,s,i]=e;return bg(t,n,s,i)}else if(typeof e=="string")return DQ[e];return e};function PQ(e,t,n){const s=[],i=n||tB,r=e.length-1;for(let a=0;at[0];if(r===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=PQ(t,s,i),c=l.length,u=d=>{if(a&&d1)for(;fu(cl(e[0],e[r-1],d)):u}function UQ(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=Sf(0,t,s);e.push(ws(n,1,i))}}function FQ(e){const t=[0];return UQ(t,e.length-1),t}function $Q(e,t){return e.map(n=>n*t)}function HQ(e,t){return e.map(()=>t||iB).splice(0,e.length-1)}function Qy({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=LQ(s)?s.map(Fj):Fj(s),r={done:!1,value:t[0]},a=$Q(n&&n.length===t.length?n:FQ(t),e),l=BQ(a,t,{ease:Array.isArray(i)?i:HQ(t,i)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const zQ=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ns.update(t,!0),stop:()=>cc(t),now:()=>Ni.isProcessing?Ni.timestamp:fo.now()}},VQ={decay:Uj,inertia:Uj,tween:Qy,keyframes:Qy,spring:sB},GQ=e=>e/100;class $k extends ZP{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:r}=this.options,a=(i==null?void 0:i.KeyframeResolver)||Uk,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,s,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=this.options,l=Rk(n)?n:VQ[n]||Qy;let c,u;l!==Qy&&typeof t[0]!="number"&&(c=yg(GQ,tB(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});r==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=JP(d));const{calculatedDuration:f}=d,h=f+i,p=h*(s+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:s}=this;if(!s){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:i,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=s;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:b,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let E=this.currentTime,w=r;if(p){const k=Math.min(this.currentTime,d)/f;let A=Math.floor(k),j=k%1;!j&&k>=1&&(j=1),j===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(m==="reverse"?(j=1-j,b&&(j-=b/f)):m==="mirror"&&(w=a)),E=cl(0,1,j)*f}const S=x?{done:!1,value:c[0]}:w.next(E);l&&(S.value=l(S.value));let{done:_}=S;!x&&u!==null&&(_=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_);return T&&i!==void 0&&(S.value=mx(c,this.options,i)),v&&v(S.value),T&&this.finish(),S}get duration(){const{resolved:t}=this;return t?el(t.calculatedDuration):0}get time(){return el(this.currentTime)}set time(t){t=Jo(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=el(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=zQ,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const KQ=new Set(["opacity","clipPath","filter","transform"]);function qQ(e,t,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=CP(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:s,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const YQ=jk(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Zy=10,WQ=2e4;function XQ(e){return Rk(e.type)||e.type==="spring"||!AP(e.ease)}function QQ(e,t){const n=new $k({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let r=0;for(;!s.done&&rthis.onKeyframesResolved(a,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&Wy()&&ZQ(r)&&(r=rB[r]),XQ(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...b}=this.options,v=QQ(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,i=v.times,r=v.ease,a="keyframes"}const d=qQ(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Cj(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(mx(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:s,times:i,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return el(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return el(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=Jo(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Ur;const{animation:s}=n;Cj(s,t)}return Ur}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:s,duration:i,type:r,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new $k({...p,keyframes:s,duration:i,type:r,ease:a,times:l,isGenerator:!0}),b=Jo(this.time);u.setWithVelocity(m.sample(b-Zy).value,m.sample(b).value,Zy)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:s,repeatDelay:i,repeatType:r,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return YQ()&&s&&KQ.has(s)&&!c&&!u&&!i&&r!=="mirror"&&a!==0&&l!=="inertia"}}const JQ={type:"spring",stiffness:500,damping:25,restSpeed:10},eZ=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),tZ={type:"keyframes",duration:.8},nZ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sZ=(e,{keyframes:t})=>t.length>2?tZ:Ru.has(e)?e.startsWith("scale")?eZ(t[1]):JQ:nZ;function iZ({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Hk=(e,t,n,s={},i,r)=>a=>{const l=kk(s,e)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Jo(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:i};iZ(l)||(d={...d,...sZ(e,d)}),d.duration&&(d.duration=Jo(d.duration)),d.repeatDelay&&(d.repeatDelay=Jo(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!r&&t.get()!==void 0){const h=mx(d.keyframes,l);if(h!==void 0)return ns.update(()=>{d.onUpdate(h),d.onComplete()}),new DX([])}return!r&&$j.supports(d)?new $j(d):new $k(d)};function rZ({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function aB(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(a=s);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(r=e.latestValues[f])!==null&&r!==void 0?r:null),p=c[f];if(p===void 0||d&&rZ(d,f))continue;const m={delay:n,...kk(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=TP(e);if(y){const x=window.MotionHandoffAnimation(y,f,ns);x!==null&&(m.startTime=x,b=!0)}}mS(e,f),h.start(Hk(f,h,p,e.shouldReduceMotion&&SP.has(f)?{type:!1}:m,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{ns.update(()=>{l&&RX(e,l)})}),u}function SS(e,t,n={}){var s;const i=px(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const a=i?()=>Promise.all(aB(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return aZ(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=r;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function aZ(e,t,n=0,s=0,i=1,r){const a=[],l=(e.variantChildren.size-1)*s,c=i===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(e.variantChildren).sort(oZ).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(SS(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function oZ(e,t){return e.sortNodePosition(t)}function lZ(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(r=>SS(e,r,n));s=Promise.all(i)}else if(typeof t=="string")s=SS(e,t,n);else{const i=typeof t=="function"?px(e,t,n.custom):t;s=Promise.all(aB(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const cZ=mk.length;function oB(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?oB(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:s})=>lZ(e,n,s)))}function hZ(e){let t=fZ(e),n=Hj(),s=!0;const i=c=>(u,d)=>{var f;const h=px(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...b}=h;u={...u,...b,...m}}return u};function r(c){t=c(e)}function a(c){const{props:u}=e,d=oB(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,A=!1;const j=Array.isArray(E)?E:[E];let R=j.reduce(i(y),{});S===!1&&(R={});const{prevResolvedValues:B={}}=x,z={...B,...R},L=I=>{k=!0,h.has(I)&&(A=!0,h.delete(I)),x.needsAnimating[I]=!0;const D=e.getValue(I);D&&(D.liveStyle=!1)};for(const I in z){const D=R[I],$=B[I];if(p.hasOwnProperty(I))continue;let O=!1;pS(D)&&pS($)?O=!_P(D,$):O=D!==$,O?D!=null?L(I):h.add(I):D!==void 0&&h.has(I)?L(I):x.protectedKeys[I]=!0}x.prevProp=E,x.prevResolvedValues=R,x.isActive&&(p={...p,...R}),s&&e.blockInitialAnimation&&(k=!1),k&&(!(_&&T)||A)&&f.push(...j.map(I=>({animation:I,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),E=e.getValue(y);E&&(E.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),s=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=Hj(),s=!0}}}function pZ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!_P(t,e):!1}function Ac(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Hj(){return{animate:Ac(!0),whileInView:Ac(),whileHover:Ac(),whileTap:Ac(),whileDrag:Ac(),whileFocus:Ac(),exit:Ac()}}class bc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class mZ extends bc{constructor(t){super(t),t.animationState||(t.animationState=hZ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fx(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let gZ=0;class bZ extends bc{constructor(){super(...arguments),this.id=gZ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const yZ={animation:{Feature:mZ},exit:{Feature:bZ}},ka={x:!1,y:!1};function lB(){return ka.x||ka.y}function xZ(e){return e==="x"||e==="y"?ka[e]?null:(ka[e]=!0,()=>{ka[e]=!1}):ka.x||ka.y?null:(ka.x=ka.y=!0,()=>{ka.x=ka.y=!1})}const zk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Cm(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function xg(e){return{point:{x:e.pageX,y:e.pageY}}}const EZ=e=>t=>zk(t)&&e(t,xg(t));function zp(e,t,n,s){return Cm(e,t,EZ(n),s)}const zj=(e,t)=>Math.abs(e-t);function vZ(e,t){const n=zj(e.x,t.x),s=zj(e.y,t.y);return Math.sqrt(n**2+s**2)}class cB{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:r=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Hv(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=vZ(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:b}=Ni;this.history.push({...m,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=$v(h,this.transformPagePoint),ns.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Hv(f.type==="pointercancel"?this.lastMoveEventInfo:$v(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!zk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const a=xg(t),l=$v(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Ni;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Hv(l,this.history)),this.removeListeners=yg(zp(this.contextWindow,"pointermove",this.handlePointerMove),zp(this.contextWindow,"pointerup",this.handlePointerUp),zp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),cc(this.updatePoint)}}function $v(e,t){return t?{point:t(e.point)}:e}function Vj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hv({point:e},t){return{point:e,delta:Vj(e,uB(t)),offset:Vj(e,wZ(t)),velocity:_Z(t,.1)}}function wZ(e){return e[0]}function uB(e){return e[e.length-1]}function _Z(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=uB(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>Jo(t)));)n--;if(!s)return{x:0,y:0};const r=el(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const a={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const dB=1e-4,SZ=1-dB,NZ=1+dB,fB=.01,TZ=0-fB,kZ=0+fB;function zr(e){return e.max-e.min}function AZ(e,t,n){return Math.abs(e-t)<=n}function Gj(e,t,n,s=.5){e.origin=s,e.originPoint=ws(t.min,t.max,e.origin),e.scale=zr(n)/zr(t),e.translate=ws(n.min,n.max,e.origin)-e.originPoint,(e.scale>=SZ&&e.scale<=NZ||isNaN(e.scale))&&(e.scale=1),(e.translate>=TZ&&e.translate<=kZ||isNaN(e.translate))&&(e.translate=0)}function Vp(e,t,n,s){Gj(e.x,t.x,n.x,s?s.originX:void 0),Gj(e.y,t.y,n.y,s?s.originY:void 0)}function Kj(e,t,n){e.min=n.min+t.min,e.max=e.min+zr(t)}function CZ(e,t,n){Kj(e.x,t.x,n.x),Kj(e.y,t.y,n.y)}function qj(e,t,n){e.min=t.min-n.min,e.max=e.min+zr(t)}function Gp(e,t,n){qj(e.x,t.x,n.x),qj(e.y,t.y,n.y)}function IZ(e,{min:t,max:n},s){return t!==void 0&&en&&(e=s?ws(n,e,s.max):Math.min(e,n)),e}function Yj(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function jZ(e,{top:t,left:n,bottom:s,right:i}){return{x:Yj(e.x,n,i),y:Yj(e.y,t,s)}}function Wj(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.mins?n=Sf(t.min,t.max-s,e.min):s>i&&(n=Sf(e.min,e.max-i,t.min)),cl(0,1,n)}function MZ(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const NS=.35;function LZ(e=NS){return e===!1?e=0:e===!0&&(e=NS),{x:Xj(e,"left","right"),y:Xj(e,"top","bottom")}}function Xj(e,t,n){return{min:Qj(e,t),max:Qj(e,n)}}function Qj(e,t){return typeof e=="number"?e:e[t]||0}const Zj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Dd=()=>({x:Zj(),y:Zj()}),Jj=()=>({min:0,max:0}),Ds=()=>({x:Jj(),y:Jj()});function Qr(e){return[e("x"),e("y")]}function hB({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function DZ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function PZ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function zv(e){return e===void 0||e===1}function TS({scale:e,scaleX:t,scaleY:n}){return!zv(e)||!zv(t)||!zv(n)}function Dc(e){return TS(e)||pB(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function pB(e){return eR(e.x)||eR(e.y)}function eR(e){return e&&e!=="0%"}function Jy(e,t,n){const s=e-n,i=t*s;return n+i}function tR(e,t,n,s,i){return i!==void 0&&(e=Jy(e,i,s)),Jy(e,n,s)+t}function kS(e,t=0,n=1,s,i){e.min=tR(e.min,t,n,s,i),e.max=tR(e.max,t,n,s,i)}function mB(e,{x:t,y:n}){kS(e.x,t.translate,t.scale,t.originPoint),kS(e.y,n.translate,n.scale,n.originPoint)}const nR=.999999999999,sR=1.0000000000001;function BZ(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let r,a;for(let l=0;lnR&&(t.x=1),t.ynR&&(t.y=1)}function Pd(e,t){e.min=e.min+t,e.max=e.max+t}function iR(e,t,n,s,i=.5){const r=ws(e.min,e.max,i);kS(e,t,n,r,s)}function Bd(e,t){iR(e.x,t.x,t.scaleX,t.scale,t.originX),iR(e.y,t.y,t.scaleY,t.scale,t.originY)}function gB(e,t){return hB(PZ(e.getBoundingClientRect(),t))}function UZ(e,t,n){const s=gB(e,n),{scroll:i}=t;return i&&(Pd(s.x,i.offset.x),Pd(s.y,i.offset.y)),s}const bB=({current:e})=>e?e.ownerDocument.defaultView:null,FZ=new WeakMap;class $Z{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ds(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(xg(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xZ(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(uo.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=zr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&ns.postRender(()=>m(d,f)),mS(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(p&&this.currentDirection===null){this.currentDirection=HZ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Qr(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new cB(t,{onSessionStart:i,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:bB(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&ns.postRender(()=>r(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!H0(t,i,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(a=IZ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,r=this.constraints;n&&Md(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=jZ(i.layoutBox,n):this.constraints=!1,this.elastic=LZ(s),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Qr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=MZ(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Md(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=UZ(s,i.root,this.visualElement.getTransformPagePoint());let a=RZ(i.layout.layoutBox,r);if(n){const l=n(DZ(a));this.hasMutatedConstraints=!!l,l&&(a=hB(l))}return a}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Qr(d=>{if(!H0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:s?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return mS(this.visualElement,t),s.start(Hk(t,s,0,n,this.visualElement,!1))}stopAnimation(){Qr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Qr(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Qr(n=>{const{drag:s}=this.getProps();if(!H0(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];r.set(t[n]-ws(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Md(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Qr(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=OZ({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Qr(a=>{if(!H0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(ws(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;FZ.set(this.visualElement,this);const t=this.visualElement.current,n=zp(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Md(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ns.read(s);const a=Cm(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qr(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:a=NS,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function H0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function HZ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class zZ extends bc{constructor(t){super(t),this.removeGroupControls=Ur,this.removeListeners=Ur,this.controls=new $Z(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ur}unmount(){this.removeGroupControls(),this.removeListeners()}}const rR=e=>(t,n)=>{e&&ns.postRender(()=>e(t,n))};class VZ extends bc{constructor(){super(...arguments),this.removePointerDownListener=Ur}onPointerDown(t){this.session=new cB(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:bB(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:rR(t),onStart:rR(n),onMove:s,onEnd:(r,a)=>{delete this.session,i&&ns.postRender(()=>i(r,a))}}}mount(){this.removePointerDownListener=zp(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Kb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function aR(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Gh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(gt.test(e))e=parseFloat(e);else return e;const n=aR(e,t.target.x),s=aR(e,t.target.y);return`${n}% ${s}%`}},GZ={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=uc.parse(e);if(i.length>5)return s;const r=uc.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=ws(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),r(i)}};class KZ extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=t;yX(qZ),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Kb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,a=s.projection;return a&&(a.isPresent=r,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||ns.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),bk.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yB(e){const[t,n]=tP(),s=g.useContext(fk);return o.jsx(KZ,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(uP),isPresent:t,safeToRemove:n})}const qZ={borderRadius:{...Gh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Gh,borderTopRightRadius:Gh,borderBottomLeftRadius:Gh,borderBottomRightRadius:Gh,boxShadow:GZ};function YZ(e,t,n){const s=Ui(e)?e:km(e);return s.start(Hk("",s,t,n)),s.animation}function WZ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const XZ=(e,t)=>e.depth-t.depth;class QZ{constructor(){this.children=[],this.isDirty=!1}add(t){Ak(this.children,t),this.isDirty=!0}remove(t){Ck(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(XZ),this.isDirty=!1,this.children.forEach(t)}}function ZZ(e,t){const n=fo.now(),s=({timestamp:i})=>{const r=i-n;r>=t&&(cc(s),e(r-t))};return ns.read(s,!0),()=>cc(s)}const xB=["TopLeft","TopRight","BottomLeft","BottomRight"],JZ=xB.length,oR=e=>typeof e=="string"?parseFloat(e):e,lR=e=>typeof e=="number"||gt.test(e);function eJ(e,t,n,s,i,r){i?(e.opacity=ws(0,n.opacity!==void 0?n.opacity:1,tJ(s)),e.opacityExit=ws(t.opacity!==void 0?t.opacity:1,0,nJ(s))):r&&(e.opacity=ws(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let a=0;ast?1:n(Sf(e,t,s))}function uR(e,t){e.min=t.min,e.max=t.max}function Xr(e,t){uR(e.x,t.x),uR(e.y,t.y)}function dR(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function fR(e,t,n,s,i){return e-=t,e=Jy(e,1/n,s),i!==void 0&&(e=Jy(e,1/i,s)),e}function sJ(e,t=0,n=1,s=.5,i,r=e,a=e){if(uo.test(t)&&(t=parseFloat(t),t=ws(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=ws(r.min,r.max,s);e===r&&(l-=t),e.min=fR(e.min,t,n,l,i),e.max=fR(e.max,t,n,l,i)}function hR(e,t,[n,s,i],r,a){sJ(e,t[n],t[s],t[i],t.scale,r,a)}const iJ=["x","scaleX","originX"],rJ=["y","scaleY","originY"];function pR(e,t,n,s){hR(e.x,t,iJ,n?n.x:void 0,s?s.x:void 0),hR(e.y,t,rJ,n?n.y:void 0,s?s.y:void 0)}function mR(e){return e.translate===0&&e.scale===1}function vB(e){return mR(e.x)&&mR(e.y)}function gR(e,t){return e.min===t.min&&e.max===t.max}function aJ(e,t){return gR(e.x,t.x)&&gR(e.y,t.y)}function bR(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function wB(e,t){return bR(e.x,t.x)&&bR(e.y,t.y)}function yR(e){return zr(e.x)/zr(e.y)}function xR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class oJ{constructor(){this.members=[]}add(t){Ak(this.members,t),t.scheduleRender()}remove(t){if(Ck(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function lJ(e,t,n){let s="";const i=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||r||a)&&(s=`translate3d(${i}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),p&&(s+=`skewX(${p}deg) `),m&&(s+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Pc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},mp=typeof window<"u"&&window.MotionDebug!==void 0,Vv=["","X","Y","Z"],cJ={visibility:"hidden"},ER=1e3;let uJ=0;function Gv(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function _B(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=TP(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ns,!(i||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&_B(s)}function SB({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=uJ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mp&&(Pc.totalNodes=Pc.resolvedTargetDeltas=Pc.recalculatedProjection=0),this.nodes.forEach(hJ),this.nodes.forEach(yJ),this.nodes.forEach(xJ),this.nodes.forEach(pJ),mp&&window.MotionDebug.record(Pc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=ZZ(h,250),Kb.hasAnimatedSinceResize&&(Kb.hasAnimatedSinceResize=!1,this.nodes.forEach(wR))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||SJ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!wB(this.targetLayout,m)||p,E=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,E);const w={...kk(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||wR(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(EJ),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&_B(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const S=w/1e3;_R(f.x,a.x,S),_R(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Gp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),wJ(this.relativeTarget,this.relativeTargetOrigin,h,S),E&&aJ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Ds()),Xr(E,this.relativeTarget)),b&&(this.animationValues=d,eJ(d,u,this.latestValues,S,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ns.update(()=>{Kb.hasAnimatedSinceResize=!0,this.currentAnimation=YZ(0,ER,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ER),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&NB(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ds();const f=zr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=zr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Xr(l,c),Bd(l,d),Vp(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new oJ),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Gv("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(vR),this.root.sharedNodes.clear()}}}function dJ(e){e.updateLayout()}function fJ(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Qr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=zr(h);h.min=s[f].min,h.max=h.min+p}):NB(r,n.layoutBox,s)&&Qr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=zr(s[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Dd();Vp(l,s,n.layoutBox);const c=Dd();a?Vp(c,e.applyTransform(i,!0),n.measuredBox):Vp(c,s,n.layoutBox);const u=!vB(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=Ds();Gp(m,n.layoutBox,h.layoutBox);const b=Ds();Gp(b,s,p.layoutBox),wB(m,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function hJ(e){mp&&Pc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pJ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function mJ(e){e.clearSnapshot()}function vR(e){e.clearMeasurements()}function gJ(e){e.isLayoutDirty=!1}function bJ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function wR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function yJ(e){e.resolveTargetDelta()}function xJ(e){e.calcProjection()}function EJ(e){e.resetSkewAndRotation()}function vJ(e){e.removeLeadSnapshot()}function _R(e,t,n){e.translate=ws(t.translate,0,n),e.scale=ws(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function SR(e,t,n,s){e.min=ws(t.min,n.min,s),e.max=ws(t.max,n.max,s)}function wJ(e,t,n,s){SR(e.x,t.x,n.x,s),SR(e.y,t.y,n.y,s)}function _J(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const SJ={duration:.45,ease:[.4,0,.1,1]},NR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),TR=NR("applewebkit/")&&!NR("chrome/")?Math.round:Ur;function kR(e){e.min=TR(e.min),e.max=TR(e.max)}function NJ(e){kR(e.x),kR(e.y)}function NB(e,t,n){return e==="position"||e==="preserve-aspect"&&!AZ(yR(t),yR(n),.2)}function TJ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const kJ=SB({attachResizeListener:(e,t)=>Cm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Kv={current:void 0},TB=SB({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Kv.current){const e=new kJ({});e.mount(window),e.setOptions({layoutScroll:!0}),Kv.current=e}return Kv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),AJ={pan:{Feature:VZ},drag:{Feature:zZ,ProjectionNode:TB,MeasureLayout:yB}};function CJ(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const r=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function kB(e,t){const n=CJ(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function AR(e){return t=>{t.pointerType==="touch"||lB()||e(t)}}function IJ(e,t,n={}){const[s,i,r]=kB(e,n),a=AR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=AR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),r}function CR(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&ns.postRender(()=>r(t,xg(t)))}class jJ extends bc{mount(){const{current:t}=this.node;t&&(this.unmount=IJ(t,n=>(CR(this.node,n,"Start"),s=>CR(this.node,s,"End"))))}unmount(){}}class RJ extends bc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yg(Cm(this.node.current,"focus",()=>this.onFocus()),Cm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const AB=(e,t)=>t?e===t?!0:AB(e,t.parentElement):!1,OJ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function MJ(e){return OJ.has(e.tagName)||e.tabIndex!==-1}const gp=new WeakSet;function IR(e){return t=>{t.key==="Enter"&&e(t)}}function qv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const LJ=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=IR(()=>{if(gp.has(n))return;qv(n,"down");const i=IR(()=>{qv(n,"up")}),r=()=>qv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function jR(e){return zk(e)&&!lB()}function DJ(e,t,n={}){const[s,i,r]=kB(e,n),a=l=>{const c=l.currentTarget;if(!jR(l)||gp.has(c))return;gp.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!jR(p)||!gp.has(c))&&(gp.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||AB(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return s.forEach(l=>{!MJ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>LJ(u,i),i)}),r}function RR(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&ns.postRender(()=>r(t,xg(t)))}class PJ extends bc{mount(){const{current:t}=this.node;t&&(this.unmount=DJ(t,n=>(RR(this.node,n,"Start"),(s,{success:i})=>RR(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const AS=new WeakMap,Yv=new WeakMap,BJ=e=>{const t=AS.get(e.target);t&&t(e)},UJ=e=>{e.forEach(BJ)};function FJ({root:e,...t}){const n=e||document;Yv.has(n)||Yv.set(n,{});const s=Yv.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(UJ,{root:e,...t})),s[i]}function $J(e,t,n){const s=FJ(t);return AS.set(e,n),s.observe(e),()=>{AS.delete(e),s.unobserve(e)}}const HJ={some:0,all:1};class zJ extends bc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:HJ[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return $J(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(VJ(t,n))&&this.startObserver()}unmount(){}}function VJ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const GJ={inView:{Feature:zJ},tap:{Feature:PJ},focus:{Feature:RJ},hover:{Feature:jJ}},KJ={layout:{ProjectionNode:TB,MeasureLayout:yB}},CS={current:null},CB={current:!1};function qJ(){if(CB.current=!0,!!hk)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>CS.current=e.matches;e.addListener(t),t()}else CS.current=!1}const YJ=[...XP,Bi,uc],WJ=e=>YJ.find(WP(e)),OR=new WeakMap;function XJ(e,t,n){for(const s in t){const i=t[s],r=n[s];if(Ui(i))e.addValue(s,i);else if(Ui(r))e.addValue(s,km(i,{owner:e}));else if(r!==i)if(e.hasValue(s)){const a=e.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,km(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const MR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class QJ{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Uk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=fo.now();this.renderScheduledAtthis.bindToMotionValue(s,n)),CB.current||qJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:CS.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){OR.delete(this.current),this.projection&&this.projection.unmount(),cc(this.notifyUpdate),cc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Ru.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&ns.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),r(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in _f){const n=_f[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ds()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=km(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(qP(i)||BP(i))?i=parseFloat(i):!WJ(i)&&uc.test(n)&&(i=VP(t,n)),this.setBaseTarget(t,Ui(i)?i.get():i)),Ui(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const a=xk(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Ui(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ik),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class IB extends QJ{constructor(){super(...arguments),this.KeyframeResolver=QP}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ui(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZJ(e){return window.getComputedStyle(e)}class JJ extends IB{constructor(){super(...arguments),this.type="html",this.renderInstance=bP}readValueFromInstance(t,n){if(Ru.has(n)){const s=Bk(n);return s&&s.default||0}else{const s=ZJ(t),i=(pP(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return gB(t,n)}build(t,n,s){wk(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Tk(t,n,s)}}class eee extends IB{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ds}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ru.has(n)){const s=Bk(n);return s&&s.default||0}return n=yP.has(n)?n:gk(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return vP(t,n,s)}build(t,n,s){_k(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){xP(t,n,s,i)}mount(t){this.isSVGTag=Nk(t.tagName),super.mount(t)}}const tee=(e,t)=>yk(e)?new eee(t):new JJ(t,{allowProjection:e!==g.Fragment}),nee=kX({...yZ,...GJ,...AJ,...KJ},tee),es=HW(nee);function fi(){return fi=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?g.useEffect:g.useLayoutEffect;function md(e,t,n){var s=g.useRef(t);s.current=t,g.useEffect(function(){function i(r){s.current(r)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var see=["container"];function iee(e){var t=e.container,n=t===void 0?document.body:t,s=gx(e,see);return wi.createPortal(Pt.createElement("div",fi({},s)),n)}function ree(e){return Pt.createElement("svg",fi({width:"44",height:"44",viewBox:"0 0 768 768"},e),Pt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function aee(e){return Pt.createElement("svg",fi({width:"44",height:"44",viewBox:"0 0 768 768"},e),Pt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function oee(e){return Pt.createElement("svg",fi({width:"44",height:"44",viewBox:"0 0 768 768"},e),Pt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function lee(){return g.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function DR(e){var t=e.touches[0],n=t.clientX,s=t.clientY;if(e.touches.length>=2){var i=e.touches[1],r=i.clientX,a=i.clientY;return[(n+r)/2,(s+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-s,2))]}return[n,s,0]}var Rl=function(e,t,n,s){var i,r=n*t,a=(r-s)/2,l=e;return r<=s?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function Wv(e,t,n,s,i,r,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Rl(e,r,n,innerWidth)[0],f=Rl(t,r,s,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/i*(a-(h+e))-h+(s/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/i*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function RS(e,t,n){var s=e%180!=0;return s?[n,t,s]:[t,n,s]}function Xv(e,t,n){var s=RS(n,innerWidth,innerHeight),i=s[0],r=s[1],a=0,l=i,c=r,u=e/t*r,d=t/e*i;return e=r?l=u:e>=i&&ti/r?c=d:t/e>=3&&!s[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function V0(e,t){var n=t.leading,s=n!==void 0&&n,i=t.maxWait,r=t.wait,a=r===void 0?i||0:r,l=g.useRef(e);l.current=e;var c=g.useRef(0),u=g.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=g.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var b=c.current,v=p-b;if(b===0&&(s&&m(),c.current=p),i!==void 0){if(v>i)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var uee={T:0,L:0,W:0,H:0,FIT:void 0},RB=function(){var e=g.useRef(!1);return g.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},dee=["className"];function fee(e){var t=e.className,n=t===void 0?"":t,s=gx(e,dee);return Pt.createElement("div",fi({className:"PhotoView__Spinner "+n},s),Pt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Pt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),Pt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var hee=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function pee(e){var t=e.src,n=e.loaded,s=e.broken,i=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=gx(e,hee),u=RB();return t&&!s?Pt.createElement(Pt.Fragment,null,Pt.createElement("img",fi({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&r({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&r({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Pt.createElement("span",{className:"PhotoView__icon"},a):Pt.createElement(fee,{className:"PhotoView__icon"}))):l?Pt.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var mee={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function gee(e){var t=e.item,n=t.src,s=t.render,i=t.width,r=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,_=e.isActive,T=e.expose,k=e1(mee),A=k[0],j=k[1],R=g.useRef(0),B=RB(),z=A.naturalWidth,L=z===void 0?r:z,F=A.naturalHeight,C=F===void 0?l:F,I=A.width,D=I===void 0?r:I,$=A.height,O=$===void 0?l:$,ne=A.loaded,se=ne===void 0?!n:ne,P=A.broken,Z=A.x,te=A.y,V=A.touched,Q=A.stopRaf,K=A.maskTouched,ce=A.rotate,he=A.scale,ge=A.CX,ue=A.CY,ve=A.lastX,Me=A.lastY,Se=A.lastCX,ae=A.lastCY,me=A.lastScale,we=A.touchTime,et=A.touchLength,De=A.pause,Ue=A.reach,Ye=nu({onScale:function(be){return Ae(z0(be))},onRotate:function(be){ce!==be&&(T({rotate:be}),j(fi({rotate:be},Xv(L,C,be))))}});function Ae(be,We,Ge){he!==be&&(T({scale:be}),j(fi({scale:be},Wv(Z,te,D,O,he,be,We,Ge),be<=1&&{x:0,y:0})))}var ze=V0(function(be,We,Ge){if(Ge===void 0&&(Ge=0),(V||K)&&_){var ht=RS(ce,D,O),Gn=ht[0],dn=ht[1];if(Ge===0&&R.current===0){var zt=Math.abs(be-ge)<=20,rn=Math.abs(We-ue)<=20;if(zt&&rn)return void j({lastCX:be,lastCY:We});R.current=zt?We>ue?3:2:1}var Sn,Vt=be-Se,ot=We-ae;if(Ge===0){var Nn=Rl(Vt+ve,he,Gn,innerWidth)[0],mn=Rl(ot+Me,he,dn,innerHeight);Sn=function(ms,Rs,gs,Mn){return Rs&&ms===1||Mn==="x"?"x":gs&&ms>1||Mn==="y"?"y":void 0}(R.current,Nn,mn[0],Ue),Sn!==void 0&&E(Sn,be,We,he)}if(Sn==="x"||K)return void j({reach:"x"});var Ct=z0(he+(Ge-et)/100/2*he,L/D,.2);T({scale:Ct}),j(fi({touchLength:Ge,reach:Sn,scale:Ct},Wv(Z,te,D,O,he,Ct,be,We,Vt,ot)))}},{maxWait:8});function Be(be){return!Q&&!V&&(B.current&&j(fi({},be,{pause:u})),B.current)}var X,oe,J,xe,Oe,lt,Mt,ut,bn=(Oe=function(be){return Be({x:be})},lt=function(be){return Be({y:be})},Mt=function(be){return B.current&&(T({scale:be}),j({scale:be})),!V&&B.current},ut=nu({X:function(be){return Oe(be)},Y:function(be){return lt(be)},S:function(be){return Mt(be)}}),function(be,We,Ge,ht,Gn,dn,zt,rn,Sn,Vt,ot){var Nn=RS(Vt,Gn,dn),mn=Nn[0],Ct=Nn[1],ms=Rl(be,rn,mn,innerWidth),Rs=ms[0],gs=ms[1],Mn=Rl(We,rn,Ct,innerHeight),zs=Mn[0],is=Mn[1],Tn=Date.now()-ot;if(Tn>=200||rn!==zt||Math.abs(Sn-zt)>1){var rs=Wv(be,We,Gn,dn,zt,rn),bs=rs.x,_i=rs.y,kn=Rs?gs:bs!==be?bs:null,Vs=zs?is:_i!==We?_i:null;return kn!==null&&zc(be,kn,ut.X),Vs!==null&&zc(We,Vs,ut.Y),void(rn!==zt&&zc(zt,rn,ut.S))}var Ss=(be-Ge)/Tn,Fn=(We-ht)/Tn,$n=Math.sqrt(Math.pow(Ss,2)+Math.pow(Fn,2)),Gs=!1,Os=!1;(function(An,xn){var fn,Jt=An,an=0,on=0,ys=function(Pe){fn||(fn=Pe);var it=Pe-fn,Ze=Math.sign(An),xt=-.001*Ze,Ie=Math.sign(-Jt)*Math.pow(Jt,2)*2e-4,Kn=Jt*it+(xt+Ie)*Math.pow(it,2)/2;an+=Kn,fn=Pe,Ze*(Jt+=(xt+Ie)*it)<=0?Ce():xn(an)?de():Ce()};function de(){on=requestAnimationFrame(ys)}function Ce(){cancelAnimationFrame(on)}de()})($n,function(An){var xn=be+An*(Ss/$n),fn=We+An*(Fn/$n),Jt=Rl(xn,zt,mn,innerWidth),an=Jt[0],on=Jt[1],ys=Rl(fn,zt,Ct,innerHeight),de=ys[0],Ce=ys[1];if(an&&!Gs&&(Gs=!0,Rs?zc(xn,on,ut.X):PR(on,xn+(xn-on),ut.X)),de&&!Os&&(Os=!0,zs?zc(fn,Ce,ut.Y):PR(Ce,fn+(fn-Ce),ut.Y)),Gs&&Os)return!1;var Pe=Gs||ut.X(on),it=Os||ut.Y(Ce);return Pe&&it})}),wt=(X=y,oe=function(be,We){Ue||Ae(he!==1?1:Math.max(2,L/D),be,We)},J=g.useRef(0),xe=V0(function(){J.current=0,X.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var be=[].slice.call(arguments);J.current+=1,xe.apply(void 0,be),J.current>=2&&(xe.cancel(),J.current=0,oe.apply(void 0,be))});function _t(be,We){if(R.current=0,(V||K)&&_){j({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Ge=z0(he,L/D);if(bn(Z,te,ve,Me,D,O,he,Ge,me,ce,we),w(be,We),ge===be&&ue===We){if(V)return void wt(be,We);K&&x(be,We)}}}function yn(be,We,Ge){Ge===void 0&&(Ge=0),j({touched:!0,CX:be,CY:We,lastCX:be,lastCY:We,lastX:Z,lastY:te,lastScale:he,touchLength:Ge,touchTime:Date.now()})}function Ft(be){j({maskTouched:!0,CX:be.clientX,CY:be.clientY,lastX:Z,lastY:te})}md(Uo?void 0:"mousemove",function(be){be.preventDefault(),ze(be.clientX,be.clientY)}),md(Uo?void 0:"mouseup",function(be){_t(be.clientX,be.clientY)}),md(Uo?"touchmove":void 0,function(be){be.preventDefault();var We=DR(be);ze.apply(void 0,We)},{passive:!1}),md(Uo?"touchend":void 0,function(be){var We=be.changedTouches[0];_t(We.clientX,We.clientY)},{passive:!1}),md("resize",V0(function(){se&&!V&&(j(Xv(L,C,ce)),S())},{maxWait:8})),jS(function(){_&&T(fi({scale:he,rotate:ce},Ye))},[_]);var Bt=function(be,We,Ge,ht,Gn,dn,zt,rn,Sn,Vt){var ot=function(bs,_i,kn,Vs,Ss){var Fn=g.useRef(!1),$n=e1({lead:!0,scale:kn}),Gs=$n[0],Os=Gs.lead,An=Gs.scale,xn=$n[1],fn=V0(function(Jt){try{return Ss(!0),xn({lead:!1,scale:Jt}),Promise.resolve()}catch(an){return Promise.reject(an)}},{wait:Vs});return jS(function(){Fn.current?(Ss(!1),xn({lead:!0}),fn(kn)):Fn.current=!0},[kn]),Os?[bs*An,_i*An,kn/An]:[bs*kn,_i*kn,1]}(dn,zt,rn,Sn,Vt),Nn=ot[0],mn=ot[1],Ct=ot[2],ms=function(bs,_i,kn,Vs,Ss){var Fn=g.useState(uee),$n=Fn[0],Gs=Fn[1],Os=g.useState(0),An=Os[0],xn=Os[1],fn=g.useRef(),Jt=nu({OK:function(){return bs&&xn(4)}});function an(on){Ss(!1),xn(on)}return g.useEffect(function(){if(fn.current||(fn.current=Date.now()),kn){if(function(on,ys){var de=on&&on.current;if(de&&de.nodeType===1){var Ce=de.getBoundingClientRect();ys({T:Ce.top,L:Ce.left,W:Ce.width,H:Ce.height,FIT:de.tagName==="IMG"?getComputedStyle(de).objectFit:void 0})}}(_i,Gs),bs)return Date.now()-fn.current<250?(xn(1),requestAnimationFrame(function(){xn(2),requestAnimationFrame(function(){return an(3)})}),void setTimeout(Jt.OK,Vs)):void xn(4);an(5)}},[bs,kn]),[An,$n]}(be,We,Ge,Sn,Vt),Rs=ms[0],gs=ms[1],Mn=gs.W,zs=gs.FIT,is=innerWidth/2,Tn=innerHeight/2,rs=Rs<3||Rs>4;return[rs?Mn?gs.L:is:ht+(is-dn*rn/2),rs?Mn?gs.T:Tn:Gn+(Tn-zt*rn/2),Nn,rs&&zs?Nn*(gs.H/Mn):mn,Rs===0?Ct:rs?Mn/(dn*rn)||.01:Ct,rs?zs?1:0:1,Rs,zs]}(u,c,se,Z,te,D,O,he,d,function(be){return j({pause:be})}),at=Bt[4],ft=Bt[6],$e="transform "+d+"ms "+f,St={className:p,onMouseDown:Uo?void 0:function(be){be.stopPropagation(),be.button===0&&yn(be.clientX,be.clientY,0)},onTouchStart:Uo?function(be){be.stopPropagation(),yn.apply(void 0,DR(be))}:void 0,onWheel:function(be){if(!Ue){var We=z0(he-be.deltaY/100/2,L/D);j({stopRaf:!0}),Ae(We,be.clientX,be.clientY)}},style:{width:Bt[2]+"px",height:Bt[3]+"px",opacity:Bt[5],objectFit:ft===4?void 0:Bt[7],transform:ce?"rotate("+ce+"deg)":void 0,transition:ft>2?$e+", opacity "+d+"ms ease, height "+(ft<4?d/2:ft>4?d:0)+"ms "+f:void 0}};return Pt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Uo&&_?Ft:void 0,onTouchStart:Uo&&_?function(be){return Ft(be.touches[0])}:void 0},Pt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+at+", 0, 0, "+at+", "+Bt[0]+", "+Bt[1]+")",transition:V||De?void 0:$e,willChange:_?"transform":void 0}},n?Pt.createElement(pee,fi({src:n,loaded:se,broken:P},St,{onPhotoLoad:function(be){j(fi({},be,be.loaded&&Xv(be.naturalWidth||0,be.naturalHeight||0,ce)))},loadingElement:b,brokenElement:v})):s&&s({attrs:St,scale:at,rotate:ce})))}var BR={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function bee(e){var t=e.loop,n=t===void 0?3:t,s=e.speed,i=e.easing,r=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,_=e.images,T=e.index,k=T===void 0?0:T,A=e.onIndexChange,j=e.visible,R=e.onClose,B=e.afterClose,z=e.portalContainer,L=e1(BR),F=L[0],C=L[1],I=g.useState(0),D=I[0],$=I[1],O=F.x,ne=F.touched,se=F.pause,P=F.lastCX,Z=F.lastCY,te=F.bg,V=te===void 0?u:te,Q=F.lastBg,K=F.overlay,ce=F.minimal,he=F.scale,ge=F.rotate,ue=F.onScale,ve=F.onRotate,Me=e.hasOwnProperty("index"),Se=Me?k:D,ae=Me?A:$,me=g.useRef(Se),we=_.length,et=_[Se],De=typeof n=="boolean"?n:we>n,Ue=function(at,ft){var $e=g.useReducer(function(Ge){return!Ge},!1)[1],St=g.useRef(0),be=function(Ge){var ht=g.useRef(Ge);function Gn(dn){ht.current=dn}return g.useMemo(function(){(function(dn){at?(dn(at),St.current=1):St.current=2})(Gn)},[Ge]),[ht.current,Gn]}(at),We=be[1];return[be[0],St.current,function(){$e(),St.current===2&&(We(!1),ft&&ft()),St.current=0}]}(j,B),Ye=Ue[0],Ae=Ue[1],ze=Ue[2];jS(function(){if(Ye)return C({pause:!0,x:Se*-(innerWidth+ed)}),void(me.current=Se);C(BR)},[Ye]);var Be=nu({close:function(at){ve&&ve(0),C({overlay:!0,lastBg:V}),R(at)},changeIndex:function(at,ft){ft===void 0&&(ft=!1);var $e=De?me.current+(at-Se):at,St=we-1,be=IS($e,0,St),We=De?$e:be,Ge=innerWidth+ed;C({touched:!1,lastCX:void 0,lastCY:void 0,x:-Ge*We,pause:ft}),me.current=We,ae&&ae(De?at<0?St:at>St?0:at:be)}}),X=Be.close,oe=Be.changeIndex;function J(at){return at?X():C({overlay:!K})}function xe(){C({x:-(innerWidth+ed)*Se,lastCX:void 0,lastCY:void 0,pause:!0}),me.current=Se}function Oe(at,ft,$e,St){at==="x"?function(be){if(P!==void 0){var We=be-P,Ge=We;!De&&(Se===0&&We>0||Se===we-1&&We<0)&&(Ge=We/2),C({touched:!0,lastCX:P,x:-(innerWidth+ed)*me.current+Ge,pause:!1})}else C({touched:!0,lastCX:be,x:O,pause:!1})}(ft):at==="y"&&function(be,We){if(Z!==void 0){var Ge=u===null?null:IS(u,.01,u-Math.abs(be-Z)/100/4);C({touched:!0,lastCY:Z,bg:We===1?Ge:u,minimal:We===1})}else C({touched:!0,lastCY:be,bg:V,minimal:!0})}($e,St)}function lt(at,ft){var $e=at-(P??at),St=ft-(Z??ft),be=!1;if($e<-40)oe(Se+1);else if($e>40)oe(Se-1);else{var We=-(innerWidth+ed)*me.current;Math.abs(St)>100&&ce&&f&&(be=!0,X()),C({touched:!1,x:We,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!be||K})}}md("keydown",function(at){if(j)switch(at.key){case"ArrowLeft":oe(Se-1,!0);break;case"ArrowRight":oe(Se+1,!0);break;case"Escape":X()}});var Mt=function(at,ft,$e){return g.useMemo(function(){var St=at.length;return $e?at.concat(at).concat(at).slice(St+ft-1,St+ft+2):at.slice(Math.max(ft-1,0),Math.min(ft+2,St+1))},[at,ft,$e])}(_,Se,De);if(!Ye)return null;var ut=K&&!Ae,bn=j?V:Q,wt=ue&&ve&&{images:_,index:Se,visible:j,onClose:X,onIndexChange:oe,overlayVisible:ut,overlay:et&&et.overlay,scale:he,rotate:ge,onScale:ue,onRotate:ve},_t=s?s(Ae):400,yn=i?i(Ae):LR,Ft=s?s(3):600,Bt=i?i(3):LR;return Pt.createElement(iee,{className:"PhotoView-Portal"+(ut?"":" PhotoView-Slider__clean")+(j?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(at){return at.stopPropagation()},container:z},j&&Pt.createElement(lee,null),Pt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Ae===1?" PhotoView-Slider__fadeIn":Ae===2?" PhotoView-Slider__fadeOut":""),style:{background:bn?"rgba(0, 0, 0, "+bn+")":void 0,transitionTimingFunction:yn,transitionDuration:(ne?0:_t)+"ms",animationDuration:_t+"ms"},onAnimationEnd:ze}),p&&Pt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Pt.createElement("div",{className:"PhotoView-Slider__Counter"},Se+1," / ",we),Pt.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&wt&&b(wt),Pt.createElement(ree,{className:"PhotoView-Slider__toolbarIcon",onClick:X}))),Mt.map(function(at,ft){var $e=De||Se!==0?me.current-1+ft:Se+ft;return Pt.createElement(gee,{key:De?at.key+"/"+at.src+"/"+$e:at.key,item:at,speed:_t,easing:yn,visible:j,onReachMove:Oe,onReachUp:lt,onPhotoTap:function(){return J(r)},onMaskTap:function(){return J(l)},wrapClassName:E,className:x,style:{left:(innerWidth+ed)*$e+"px",transform:"translate3d("+O+"px, 0px, 0)",transition:ne||se?void 0:"transform "+Ft+"ms "+Bt},loadingElement:w,brokenElement:S,onPhotoResize:xe,isActive:me.current===$e,expose:C})}),!Uo&&p&&Pt.createElement(Pt.Fragment,null,(De||Se!==0)&&Pt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return oe(Se-1,!0)}},Pt.createElement(aee,null)),(De||Se+1-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),s&&s(!0,v,a)}}),p=nu({close:function(){l({visible:!1}),s&&s(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),m=g.useMemo(function(){return fi({},a,h)},[a,h]);return Pt.createElement(jB.Provider,{value:m},t,Pt.createElement(bee,fi({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var OB=function(e){var t,n,s=e.src,i=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=g.useContext(jB),h=(t=function(){return f.nextId()},(n=g.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=g.useRef(null);g.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),g.useEffect(function(){return function(){f.remove(h)}},[]);var m=nu({render:function(v){return i&&i(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),b=g.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return g.useEffect(function(){f.update({key:h,src:s,originRef:p,render:m.render,overlay:r,width:a,height:l})},[s]),d?g.Children.only(g.cloneElement(d,fi({},b,{ref:p}))):null};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -75,422 +75,422 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $e=(e,t)=>{const n=g.forwardRef(({className:s,...i},r)=>g.createElement(_ee,{ref:r,iconNode:t,className:MB(`lucide-${vee(e)}`,s),...i}));return n.displayName=`${e}`,n};/** + */const Fe=(e,t)=>{const n=g.forwardRef(({className:s,...i},r)=>g.createElement(_ee,{ref:r,iconNode:t,className:MB(`lucide-${vee(e)}`,s),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const See=$e("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"}]]);/** + */const See=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vk=$e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Vk=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LB=$e("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + */const LB=Fe("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Kp=$e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Kp=Fe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DB=$e("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const DB=Fe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PB=$e("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** + */const PB=Fe("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Nee=$e("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const Nee=Fe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pu=$e("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"}]]);/** + */const mu=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Tee=$e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const Tee=Fe("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kee=$e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const kee=Fe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Aee=$e("ChartColumn",[["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"}]]);/** + */const Aee=Fe("ChartColumn",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ha=$e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const za=Fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BB=$e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const BB=Fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uc=$e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const dc=Fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gk=$e("CircleAlert",[["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"}]]);/** + */const Gk=Fe("CircleAlert",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cee=$e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Cee=Fe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UR=$e("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + */const UR=Fe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Iee=$e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + */const Iee=Fe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Kk=$e("CodeXml",[["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"}]]);/** + */const Kk=Fe("CodeXml",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bx=$e("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"}]]);/** + */const bx=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jee=$e("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const jee=Fe("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ree=$e("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const Ree=Fe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qb=$e("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"}]]);/** + */const qb=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yx=$e("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const yx=Fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Oee=$e("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"}]]);/** + */const Oee=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Im=$e("ExternalLink",[["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"}]]);/** + */const Im=Fe("ExternalLink",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mee=$e("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"}]]);/** + */const Mee=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FR=$e("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** + */const FR=Fe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lee=$e("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + */const Lee=Fe("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Dee=$e("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** + */const Dee=Fe("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qk=$e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + */const qk=Fe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Pee=$e("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** + */const Pee=Fe("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UB=$e("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** + */const UB=Fe("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bee=$e("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** + */const Bee=Fe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Uee=$e("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const Uee=Fe("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fee=$e("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** + */const Fee=Fe("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yk=$e("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** + */const Yk=Fe("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FB=$e("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + */const FB=Fe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $ee=$e("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const $ee=Fe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hee=$e("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + */const Hee=Fe("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xx=$e("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const xx=Fe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zee=$e("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + */const zee=Fe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vee=$e("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** + */const Vee=Fe("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wk=$e("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + */const Wk=Fe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bc=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const yc=Fe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gee=$e("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"}]]);/** + */const Gee=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $B=$e("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const $B=Fe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Kee=$e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** + */const Kee=Fe("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HB=$e("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + */const HB=Fe("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yn=$e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const gn=Fe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qee=$e("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const qee=Fe("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yee=$e("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const Yee=Fe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nu=$e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const su=Fe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wee=$e("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const Wee=Fe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zB=$e("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + */const zB=Fe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xee=$e("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + */const Xee=Fe("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qee=$e("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** + */const Qee=Fe("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zee=$e("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const Zee=Fe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jee=$e("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const Jee=Fe("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ete=$e("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + */const ete=Fe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tte=$e("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** + */const tte=Fe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nte=$e("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** + */const nte=Fe("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ste=$e("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const ste=Fe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ite=$e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const ite=Fe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ji=$e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const Ri=Fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rte=$e("RefreshCw",[["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"}]]);/** + */const rte=Fe("RefreshCw",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xk=$e("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** + */const Xk=Fe("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ate=$e("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** + */const ate=Fe("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ote=$e("RotateCcw",[["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"}]]);/** + */const ote=Fe("RotateCcw",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t1=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const t1=Fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lte=$e("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"}]]);/** + */const lte=Fe("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cte=$e("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + */const cte=Fe("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $R=$e("ShieldCheck",[["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"}]]);/** + */const $R=Fe("ShieldCheck",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mu=$e("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const gu=Fe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ute=$e("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** + */const ute=Fe("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dc=$e("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const fc=Fe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dte=$e("TriangleAlert",[["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"}]]);/** + */const dte=Fe("TriangleAlert",[["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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fte=$e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + */const fte=Fe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hte=$e("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + */const hte=Fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pte=$e("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + */const pte=Fe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mte=$e("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** + */const mte=Fe("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VB=$e("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const VB=Fe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Oi=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),HR="veadk_auth_qs";let Kh=null;function gte(){if(Kh!==null)return Kh;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(HR,t),Kh=t):Kh=sessionStorage.getItem(HR)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),Kh}function Rn(e){const t=gte();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((s,i)=>{n.searchParams.has(i)||n.searchParams.set(i,s)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const yc=3e4,Eg=12e4,Qk=1e4;function Bn(e,t=yc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const n1="veadk_local_user",s1="veadk_local_user_tab",bte=/^[A-Za-z0-9]{1,16}$/;function GB(){try{const e=sessionStorage.getItem(s1);if(e)return e;const t=localStorage.getItem(n1);return t&&sessionStorage.setItem(s1,t),t}catch{try{return localStorage.getItem(n1)}catch{return null}}}function zR(e){try{sessionStorage.setItem(s1,e)}catch{}try{localStorage.setItem(n1,e)}catch{}}function yte(){try{sessionStorage.removeItem(s1)}catch{}try{localStorage.removeItem(n1)}catch{}}function Ex(e){const t=new Headers(e),n=GB();return n&&t.set("X-VeADK-Local-User",n),t}async function KB(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Bn(void 0,Qk)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function xte(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function Ete(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function vte(){const[e,t]=await Promise.all([OS(),KB()]);return e.status==="unauthenticated"&&t.length>0}function wte(){window.location.assign("/oauth2/logout")}async function OS(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Bn(void 0,Qk)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(i){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",i),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=GB();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function _te(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function Ste(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const MS="veadk:authentication-required";let qp=null,bp=null;function Nte(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function Tte(e){qp||(qp=new Promise(n=>{bp=n}),window.dispatchEvent(new Event(MS)));const t=qp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,s)=>{const i=()=>s(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},r=>{e.removeEventListener("abort",i),s(r)})}):t}function kte(){return qp!==null}function Ate(){bp==null||bp(),bp=null,qp=null}async function vx(e,t){var s;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((s=e.headers.get("content-type"))==null?void 0:s.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` + */const Mi=Fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),HR="veadk_auth_qs";let Kh=null;function gte(){if(Kh!==null)return Kh;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(HR,t),Kh=t):Kh=sessionStorage.getItem(HR)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),Kh}function jn(e){const t=gte();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((s,i)=>{n.searchParams.has(i)||n.searchParams.set(i,s)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const xc=3e4,Eg=12e4,Qk=1e4;function Pn(e,t=xc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const n1="veadk_local_user",s1="veadk_local_user_tab",bte=/^[A-Za-z0-9]{1,16}$/;function GB(){try{const e=sessionStorage.getItem(s1);if(e)return e;const t=localStorage.getItem(n1);return t&&sessionStorage.setItem(s1,t),t}catch{try{return localStorage.getItem(n1)}catch{return null}}}function zR(e){try{sessionStorage.setItem(s1,e)}catch{}try{localStorage.setItem(n1,e)}catch{}}function yte(){try{sessionStorage.removeItem(s1)}catch{}try{localStorage.removeItem(n1)}catch{}}function Ex(e){const t=new Headers(e),n=GB();return n&&t.set("X-VeADK-Local-User",n),t}async function KB(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Pn(void 0,Qk)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function xte(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function Ete(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function vte(){const[e,t]=await Promise.all([OS(),KB()]);return e.status==="unauthenticated"&&t.length>0}function wte(){window.location.assign("/oauth2/logout")}async function OS(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Pn(void 0,Qk)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(i){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",i),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=GB();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function _te(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function Ste(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const MS="veadk:authentication-required";let qp=null,bp=null;function Nte(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function Tte(e){qp||(qp=new Promise(n=>{bp=n}),window.dispatchEvent(new Event(MS)));const t=qp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,s)=>{const i=()=>s(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},r=>{e.removeEventListener("abort",i),s(r)})}):t}function kte(){return qp!==null}function Ate(){bp==null||bp(),bp=null,qp=null}async function vx(e,t){var s;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((s=e.headers.get("content-type"))==null?void 0:s.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` 响应:${r}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${i})${a}`)}}const Cte=/\brun_sse\s*failed\s*:\s*404\b/i,Ite=/session not found/i,jte=/(?:^|[::\s])not found\s*$/i,Rte=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,VR="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",GR="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",KR="提示:模型生成的工具参数格式不完整,请重新发送一次。";function G0(e){const t=String(e);return Rte.test(t)?t.includes(KR)?t:`${t} ${KR}`:Cte.test(t)?Ite.test(t)?t.includes(VR)?t:`${t} @@ -498,9 +498,9 @@ ${KR}`:Cte.test(t)?Ite.test(t)?t.includes(VR)?t:`${t} ${VR}`:jte.test(t)?t.includes(GR)?t:`${t} ${GR}`:t:t}async function*Zk(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let s="";try{for(;;){const{done:i,value:r}=await t.read();if(i)break;s+=n.decode(r,{stream:!0});let a=s.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const l=s.slice(0,a.index);s=s.slice(a.index+a[0].length);const c=l.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=s.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const Ote=255,Mte=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function Lte(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let s=0,i="";for(const r of t){if(!Mte.test(r))continue;const a=n.encode(r).byteLength;if(s+a>Ote)break;i+=r,s+=a}return i.replace(/ +/g," ").trimEnd()}const qR="ap-southeast-1",Jk="cn-beijing",qB="https://ark.ap-southeast.bytepluses.com/api/v3",e2="https://ark.cn-beijing.volces.com/api/v3/",YB="seed-2-0-lite-260228",t2="doubao-seed-2-1-pro-260628",Dte="skylark-embedding-vision-250615",Pte="doubao-embedding-vision-250615",Bte="seed-2-0-lite-260228",Ute="doubao-seed-2-0-lite-260428",WB=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],XB=[{value:qR,label:qR}];function wx(e){return e==="byteplus"?XB:WB}function Ti(e){var t;return((t=wx(e)[0])==null?void 0:t.value)||Jk}function Nf(e,t){var s;return((s=(t?wx(t):[...WB,...XB]).find(i=>i.value===e))==null?void 0:s.label)||e||"-"}function i1(e){return e==="byteplus"?YB:t2}function r1(e){return e==="byteplus"?qB:e2}function Fte(e){return e==="byteplus"?Dte:Pte}function $te(e){return e==="byteplus"?Bte:Ute}const n2="veadk.messageFeedback.v1";function s2(e,t,n,s){return[e,t,n,s].join(":")}function i2(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(n2)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function Hte(e,t,n){if(typeof window>"u")return;const s=i2();s[e]={...s[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(n2,JSON.stringify(s))}function QB(e){if(typeof window>"u")return;const t=s2(e.runtimeId,e.appName,e.userId,e.sessionId),n=i2(),s=n[t];if(s){for(const i of e.eventIds)delete s[`veadk_feedback:${i}`];Object.keys(s).length===0?delete n[t]:n[t]=s,localStorage.setItem(n2,JSON.stringify(n))}}const Yb="",r2=new Map;function ZB(e,t){r2.set(e,t)}function JB(){r2.clear()}function si(e){const t=r2.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function dt(e,t={},n={},s=yc){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...i?{method:"POST"}:{},headers:Ex(t.headers)},a=()=>{const u={...r,signal:Bn(t.signal,s)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(Rn(`${Yb}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(Rn(`${Yb}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(Rn(`${Yb}${e}`),u)},l=async u=>{if(Nte(u))return!0;if(u.status!==401)return!1;try{return await vte()}catch{return!1}};let c=await a();for(;await l(c);)await Tte(t.signal),c=await a();return c}function e8(e,t={},n=yc){return dt(e,t,{},n)}function zte(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const s=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",i=String(t.msg??"");return s?`${s}: ${i}`:i}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function $t(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const s=JSON.parse(n);return zte(s.detail??s.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function t8(){const e=await dt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class sh extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Or extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const n8="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",s8="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",YR=["cn-beijing","cn-shanghai"],Vte=3e4,_x=5*60*1e3,i8=60*1e3,Wb=new Map,Pc=new Map,Bc=new Map,Ca=new Map;function r8(e,t){return`${t}:${e}`}function ih(e){const t=e||Jk;return YR.includes(t)?[t,...YR.filter(n=>n!==t)]:[t]}function rh(...e){return e.map(t=>String(t??"")).join("")}function ah(e,t,n){const s=e.get(t);return s!=null&&s.value&&Date.now()-s.updatedAt<=n?s.value:null}function a2(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function a8(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Sx(e,t,n){const s=await dt("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await a8(s):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new sh;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new Or(n8);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new Or(s8);if(n!=null&&n.runtimeId&&s.status===404)throw new Or("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Or("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await $t(s,"读取 Agent 列表失败"));const r=await s.json();return n!=null&&n.runtimeId&&Wb.set(r8(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+Vte}),r}async function a1(e,t){const{app:n,ep:s}=si(e),i=await dt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},s);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await $t(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function o2(e,t){const{app:n,ep:s}=si(e),i=await dt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},s);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function o1(e,t,n){const{app:s,ep:i}=si(e),r=await dt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!r.ok){const l=await $t(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(i.runtimeId){const l=s2(i.runtimeId,s,t,n);a.state={...i2()[l]??{},...a.state??{}}}return a}async function o8(e){const{app:t,ep:n}=si(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const s=await dt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Eg);if(!s.ok)throw new Error(await $t(s,"提交反馈失败"));const i=await s.json(),r=s2(n.runtimeId,t,e.userId,e.sessionId);return Hte(r,e.eventId,i),i}async function Nx(e,t={}){const n=rh(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),s=ah(Ca,n,i8);if(!t.force&&s)return s;const i=Ca.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let r=null;const a=(async()=>{for(const l of ih(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await dt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return a2(Ca,n,await u.json());r=new Error(await $t(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();Ca.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=Ca.get(n);(l==null?void 0:l.promise)===a&&Ca.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function l8(e){let t=null;for(const n of ih(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await dt(`/web/evaluation/statuses?${s.toString()}`);if(i.ok)return i.json();t=new Error(await $t(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function c8(e){let t=null;for(const n of ih(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await dt(`/web/evaluation/optimizations?${s.toString()}`);if(i.ok)return i.json();t=new Error(await $t(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function u8(e){return ah(Ca,rh(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i8)}function LS(e){Nx(e).catch(()=>{})}function d8(e){Nx(e,{force:!0}).catch(()=>{})}function f8(e,t){return["good","bad"].map(n=>{const s=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(s==null?void 0:s.evaluationSetId)??null,evaluationSetName:(s==null?void 0:s.evaluationSetName)??null,workspaceId:(s==null?void 0:s.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function Xb(e){for(const[t,n]of Ca.entries()){const s=n.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const i=s.items.filter(a=>a.sessionId!==e.sessionId||a.messageId!==e.messageId),r=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:"",agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:""},...i]:i;Ca.set(t,{value:{...s,sets:f8(s.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function h8(e){let t=null;for(const n of ih(e.region)){const s=await dt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},Eg);if(s.ok){const i=await s.json(),r=new Set(e.itemIds);for(const[a,l]of Ca.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!r.has(d.id));Ca.set(a,{value:{...c,sets:f8(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await $t(s,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function DS(e,t,n){const{app:s,ep:i}=si(e),r=await dt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function Gte(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=window.atob(n),i=new Uint8Array(s.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function m8(e,t,n,s,i){const{app:r,ep:a}=si(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(s)}${l}`,u=await dt(c,{},a,Eg);if(!u.ok)throw new Error(await $t(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=Gte(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??s}}async function g8(e,t,n,s,i){const{blob:r}=await m8(e,t,n,s,i);return URL.createObjectURL(r)}async function Kte(e){const t=await dt("/web/media/capabilities");if(!t.ok)throw new Error(await $t(t,"media capabilities failed"));return t.json()}async function b8(e,t,n,s){const{app:i}=si(e),r=new FormData;r.set("app_name",i),r.set("user_id",t),r.set("session_id",n),r.set("file",s);const a=await dt("/web/media",{method:"POST",body:r},{},Eg);if(!a.ok)throw new Error(await $t(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function PS(e,t,n){const{app:s}=si(e),i=`/web/media/${encodeURIComponent(s)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await dt(i,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await $t(r,"media cleanup failed"))}function y8(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((s,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function Qb(e,t){const n=y8(t);if(!n)throw new Error("Invalid VeADK media URI");const s=await dt(`${n}/delete`,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await $t(s,"media cleanup failed"))}function x8(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=y8(t);if(!n)return t;const s=`${n}/content`;return Rn(`${Yb}${s}`)}async function l1(e,t,n){const{app:s,ep:i}=si(e);let r;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),r=await dt(`/web/runtime-trace?${c.toString()}`),r.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else r=await dt(`/dev/apps/${encodeURIComponent(s)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!r.ok)throw new Error(await $t(r,"加载调用链路失败"));const a=r.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await r.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function BS(e){const t=await dt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await $t(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function l2(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function c2(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function US(e,t,n){const{app:s,ep:i}=si(e),r=await dt(c2(s,t,n),{},i);if(!r.ok)throw new Error(await $t(r,"读取会话能力失败"));return l2(await r.json())}async function u2(e){const{ep:t}=si(e),n=await dt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await $t(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(i=>{var r;return((r=i.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function qte(e){const{ep:t}=si(e),n=await dt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await $t(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function Yte(e,t,n){const{ep:s}=si(e),i=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${i.toString()}`,a=await dt(r,{},s);if(!a.ok)throw new Error(await $t(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function E8(e,t,n=1,s=20){const{ep:i}=si(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(s)}),a=await dt(`/harness/skills/findskill?${r.toString()}`,{},i);if(!a.ok)throw new Error(await $t(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function FS(e,t,n,s,i){const{app:r,ep:a}=si(e),l=await dt(c2(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:s.kind,name:s.name,skill_source_id:s.skillSourceId,description:s.description,version:s.version,expected_revision:i})},a);if(!l.ok)throw new Error(await $t(l,"添加会话能力失败"));return l2(await l.json())}async function v8(e,t,n,s,i){const{app:r,ep:a}=si(e),l=`${c2(r,t,n)}/${encodeURIComponent(s)}?expected_revision=${i}`,c=await dt(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await $t(c,"移除会话能力失败"));return l2(await c.json())}async function w8(e,t,n=!0){const s=await dt(`/web/agent-info/${e}`,{},t);if(!s.ok)throw new Error(`agent-info failed: ${s.status}`);const i=await s.json();if(n&&!i.draft)try{const r=await dt(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function d2(e){const{app:t,ep:n}=si(e);return w8(t,n,!1)}async function Wte(e,t,n){let s=null;for(const i of ih(t)){const r={runtimeId:e,region:i};try{const a=r8(e,i),l=Wb.get(a);l&&l.expiresAt<=Date.now()&&Wb.delete(a);const c=Wb.get(a),u=n||(c==null?void 0:c.apps[0])||(await Sx("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return w8(u,r)}catch(a){if(a instanceof sh||a instanceof Or&&!a.unsupported)throw a;s=a instanceof Error?a:new Error(String(a))}}throw s??new Error("该 Runtime 未提供可预览的 Agent。")}async function c1(e,t,n={},s={}){const i=typeof n=="string"?n:void 0,r=typeof n=="string"?s:n,a=rh(e,t||"cn-beijing",i??""),l=ah(Pc,a,_x);if(!r.force&&l)return l;const c=Pc.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=Wte(e,t,i).then(d=>a2(Pc,a,d));Pc.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Pc.get(a);(d==null?void 0:d.promise)===u&&Pc.set(a,{value:d.value,updatedAt:d.updatedAt})}}function _8(e,t,n=""){return ah(Pc,rh(e,t||"cn-beijing",n),_x)}function S8(e,t,n=""){c1(e,t,n).catch(()=>{})}async function N8(e,t,n,s){const{app:i,ep:r}=si(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:s}),l=await dt(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await $t(l,"Agent 检索失败"));return l.json()}async function T8(e,t){const{app:n}=si(e),s=await dt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!s.ok)throw new Error(`web search failed: ${s.status}`);return s.json()}async function*jm({appName:e,userId:t,sessionId:n,text:s,attachments:i=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=si(e),f=i.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...s.trim()?[{text:s}]:[]];if(h&&p.length>0){const b=p[0],v=b.partMetadata;p[0]={...b,partMetadata:{...v,veadkInvocation:h}}}const m=await dt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:l},d,0);if(!m.ok){const b=await $t(m,"运行会话失败");throw new Error(G0(`run_sse failed: ${m.status}:${b}`))}for await(const b of Zk(m)){const v=b;typeof v.error=="string"&&(v.error=G0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=G0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=G0(v.error_message)),yield v}}async function k8(e){const t=await dt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await $t(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(s=>{if(!s||typeof s!="object"||typeof s.uid!="string"||typeof s.name!="string"||typeof s.domain!="string"||typeof s.region!="string"||typeof s.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return s})}const Yp=new Map;async function vg(e,t,n,s){var u,d,f;const i=s==null?void 0:s.taskId,r=i?new AbortController:void 0;i&&r&&Yp.set(i,r);const a=()=>{i&&Yp.get(i)===r&&Yp.delete(i)};let l;try{(u=s==null?void 0:s.onStage)==null||u.call(s,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await dt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:r==null?void 0:r.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:i,runtimeId:s==null?void 0:s.runtimeId,appName:s==null?void 0:s.appName,sessionStorage:s==null?void 0:s.sessionStorage,minInstance:s==null?void 0:s.minInstance,maxInstance:s==null?void 0:s.maxInstance,createEvaluationSets:s==null?void 0:s.createEvaluationSets,description:Lte((s==null?void 0:s.description)??""),authentication:s==null?void 0:s.authentication,im:s==null?void 0:s.im,envs:s==null?void 0:s.envs})},{},0),(d=s==null?void 0:s.onStage)==null||d.call(s,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await $t(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of Zk(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=s==null?void 0:s.onStage)==null||f.call(s,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function A8(e){var n;const t=await dt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const s=await t.text().catch(()=>"");throw new Error(s||`取消部署失败 (${t.status})`)}(n=Yp.get(e))==null||n.abort(),Yp.delete(e)}async function Xte(e=Jk){const t=await dt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Rm={title:"AgentKit Studio",logoUrl:""},Zb={enabled:!1},Qv={studio:!1,version:"",provider:"volcengine",branding:Rm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:Zb};function Qte(e){if(!e||typeof e!="object")return Zb;const t=e;if(!t.enabled)return Zb;const n=t.apmplus;if(!n||typeof n.aid!="number"||!Number.isFinite(n.aid)||typeof n.token!="string"||!n.token)return Zb;const s=t.studio??{};return{enabled:!0,provider:t.provider==="apmplus"?"apmplus":void 0,apmplus:{aid:n.aid,token:n.token,domain:typeof n.domain=="string"&&n.domain?n.domain:"apmplus.volces.com",env:typeof n.env=="string"&&n.env?n.env:"production"},studio:{deployId:typeof s.deployId=="string"?s.deployId:"",userPoolId:typeof s.userPoolId=="string"?s.userPoolId:"",applicationId:typeof s.applicationId=="string"?s.applicationId:"",functionId:typeof s.functionId=="string"?s.functionId:"",region:typeof s.region=="string"?s.region:"",project:typeof s.project=="string"?s.project:"",version:typeof s.version=="string"?s.version:""}}}async function C8(){var e,t;try{const n=await dt("/web/ui-config");if(!n.ok)return Qv;const s=await n.json(),i=typeof((e=s.branding)==null?void 0:e.logoUrl)=="string"?s.branding.logoUrl:Rm.logoUrl;return{studio:s.studio??!1,version:typeof s.version=="string"?s.version:"",provider:s.provider==="byteplus"?"byteplus":"volcengine",branding:{title:typeof((t=s.branding)==null?void 0:t.title)=="string"?s.branding.title:Rm.title,logoUrl:i?Rn(i):""},features:{...Qv.features,...s.features??{}},defaultView:s.defaultView??"chat",agentsSource:s.agentsSource==="cloud"?"cloud":"local",telemetry:Qte(s.telemetry)}}catch{return Qv}}const I8={role:"user",telemetry:{userId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function j8(){var n,s,i,r;const e=await dt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||typeof((s=t.capabilities)==null?void 0:s.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((r=t.capabilities)==null?void 0:r.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function R8(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const s=n.size?`?${n.toString()}`:"",i=await dt(`/web/studio-update${s}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function O8(e){const t=await dt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Eg);if(!t.ok){let n="";try{const s=await t.json();n=typeof s.detail=="string"?s.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function Tx(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await dt(`/web/runtimes?${t.toString()}`);if(!n.ok){const i=await $t(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(i===`加载 Runtime 失败 (${n.status})`?r:`${r}:${i}`)}const s=await n.json();return{runtimes:s.runtimes??[],nextToken:s.nextToken??""}}async function f2(e,t,n={}){try{const s={runtimeId:e,region:t};return n.retryProbe&&(s.retryProbe=!0),await Sx("","",s)}catch(s){if(s instanceof sh||s instanceof Or)throw s;return null}}async function M8(e,t,n={}){const s={runtimeId:e,region:t};n.retryProbe&&(s.retryProbe=!0);const i=await dt("/.well-known/agent-card.json",{},s),r=await a8(i);if(r==="runtime_access_denied")throw new sh;if(r==="runtime_private_endpoint_unreachable")throw new Or(n8);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new Or(s8);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Or("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await $t(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function L8(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),s=await dt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!s.ok)throw new Error(await $t(s,"读取 Runtime API Key 失败"));const i=await s.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function D8(e,t){const n=await dt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(s||`删除失败 (${n.status})`)}}async function P8({runtimeId:e,region:t,signal:n}){const s=new URLSearchParams({runtimeId:e,region:t}),i=await dt(`/web/runtime-update-capability?${s.toString()}`,{signal:n});if(!i.ok)throw new Error(await $t(i,"检查 Runtime 更新能力失败"));return await i.json()}async function Zte(e,t){let n=null;for(const s of ih(t)){const i=await dt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(s)}`);if(i.ok)return i.json();n=new Error(await $t(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function h2(e,t="cn-beijing",n={}){const s=rh(e,t||"cn-beijing"),i=ah(Bc,s,_x);if(!n.force&&i)return i;const r=Bc.get(s);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=Zte(e,t).then(l=>a2(Bc,s,l));Bc.set(s,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Bc.get(s);(l==null?void 0:l.promise)===a&&Bc.set(s,{value:l.value,updatedAt:l.updatedAt})}}function B8(e,t="cn-beijing"){return ah(Bc,rh(e,t||"cn-beijing"),_x)}function U8(e,t="cn-beijing"){h2(e,t).catch(()=>{})}async function kx(e){const t=await dt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await $t(t,"生成项目失败"));return t.json()}const Jte=19e4;async function F8(e){const t=await dt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},Jte);if(!t.ok)throw new Error(await $t(t,"生成 Agent 配置失败"));return vx(t,"生成 Agent 配置失败")}async function $8(e,t){const n=await dt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await $t(n,"创建调试运行失败"));return vx(n,"创建调试运行失败")}async function H8(e,t){const n=await dt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await $t(n,"创建调试会话失败"));return(await vx(n,"创建调试会话失败")).id}async function z8(e,t){const n=await dt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await $t(n,"加载调试调用链路失败"));const s=await vx(n,"加载调试调用链路失败");if(!Array.isArray(s))throw new Error("加载调试调用链路失败:返回格式无效");return s}async function*V8({runId:e,userId:t,sessionId:n,text:s,signal:i}){const r=s.trim()?[{text:s}]:[],a=await dt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:r},streaming:!0}),signal:i},{},0);if(!a.ok)throw new Error(await $t(a,"调试运行失败"));for await(const l of Zk(a))yield l}async function md(e){const t=await dt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await $t(t,"清理调试运行失败"))}const ene=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Rm,DEFAULT_STUDIO_ACCESS:I8,RuntimeAccessDeniedError:sh,RuntimeProbeError:Or,addSessionCapability:FS,cancelAgentkitDeployment:A8,clearMessageFeedbackCache:QB,clearRemoteApps:JB,componentSearch:N8,createGeneratedAgentTestRun:$8,createGeneratedAgentTestSession:H8,createSession:a1,deleteAgentFeedbackCases:h8,deleteGeneratedAgentTestRun:md,deleteMedia:Qb,deleteRuntime:D8,deleteSession:DS,deleteSessionMedia:PS,deployAgentkitProject:vg,downloadArtifact:p8,fetchRemoteApps:Sx,generateAgentDraftFromRequirement:F8,generateAgentProject:kx,getAgentFeedbackCases:Nx,getAgentInfo:d2,getAgentOptimizations:c8,getAutomaticEvaluationStatuses:l8,getCachedAgentFeedbackCases:u8,getCachedRuntimeAgentInfo:_8,getCachedRuntimeDetail:B8,getGeneratedAgentTestTrace:z8,getMediaCapabilities:Kte,getMyRuntimes:Xte,getRuntimeAgentInfo:c1,getRuntimeDetail:h2,getRuntimeUpdateCapability:P8,getRuntimes:Tx,getSession:o1,getSessionCapabilities:US,getSessionTrace:l1,getStudioAccess:j8,getStudioUpdateStatus:R8,getUiConfig:C8,listApps:t8,listIdentityUserPools:k8,listSessionBuiltinTools:u2,listSessionSkillSpaces:qte,listSessionSkillsInSpace:Yte,listSessions:o2,mediaContentUrl:x8,prefetchAgentFeedbackCases:LS,prefetchRuntimeAgentInfo:S8,prefetchRuntimeDetail:U8,previewArtifact:g8,probeRuntimeA2a:M8,probeRuntimeApps:f2,refreshAgentFeedbackCases:d8,registerRemoteApp:ZB,removeSessionCapability:v8,revealRuntimeApiKey:L8,runGeneratedAgentTestSSE:V8,runSSE:jm,searchSessionPublicSkills:E8,startStudioUpdate:O8,studioFetch:e8,submitIssueFeedback:BS,submitMessageFeedback:o8,uploadMedia:b8,upsertCachedAgentFeedbackCase:Xb,webSearch:T8},Symbol.toStringTag,{value:"Module"}));function WR(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function tne(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function nne(e,t){if(!t)return e;const n=new Set(e.filter(i=>tne(i)===t).map(i=>i.trace_id)),s=e.filter(i=>n.has(i.trace_id));return s.length>0?s:e}function Zv(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const sne="send_a2ui_json_to_client",ine="validated_a2ui_json",$S="adk_request_credential",XR="transfer_to_agent";function rne(e){var s,i,r,a;const t=e,n=((s=t==null?void 0:t.exchangedAuthCredential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.rawAuthCredential)==null?void 0:r.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function Oa(){return{blocks:[],liveStart:0}}const QR=e=>e.functionCall??e.function_call,HS=e=>e.functionResponse??e.function_response;function ane(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function one(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function G8(e){const t=[];for(const[n,s]of e.entries()){const i=s.partMetadata??s.part_metadata,r=i==null?void 0:i.veadkTransport;if((r==null?void 0:r.hidden)===!0)continue;const a=i==null?void 0:i.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const l=s.inlineData??s.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:one(l.data),name:l.displayName??l.display_name});continue}const c=s.fileData??s.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function zS(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const lne=new Set(["llm","sequential","parallel","loop","a2a"]);function cne(e){var t;for(const n of e){const s=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.skills)?i.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&lne.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(r.length>0||a)return{skills:r,targetAgent:a}}}function une(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function dne(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const s of t)n.files.some(i=>i.filename===s.filename&&i.version===s.version)||n.files.push(s);return}e.push({kind:"artifact",files:t})}function ZR(e,t,n){const s=e[e.length-1];s&&s.kind===t?s.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function K0(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function Tf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let s=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],r=i.some(p=>QR(p)||HS(p));if(t.partial&&!r){for(const p of i){const m=zS(p);typeof m=="string"&&m&&ZR(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:s}}n.length=s;for(const p of i){const m=QR(p),b=HS(p),v=G8([p]),y=zS(p);if(typeof y=="string"&&y)ZR(n,p.thought?"thinking":"text",y);else if(v.length)K0(n),une(n,v);else if(m)if(K0(n),m.name===XR){const x=ane(m.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(m.name===$S){const x=m.args??{},E=x.authConfig??x.auth_config??x,S=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:S,authUri:rne(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(b){if(K0(n),b.name===XR)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(b.name===$S)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="tool"&&!E.done&&E.name===b.name){E.done=!0,E.response=b.response;break}}if(b.name===sne){const x=((d=b.response)==null?void 0:d[ine])??[];if(x.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&dne(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),K0(n),s=n.length,{blocks:n,liveStart:s}}function fne(e,t={}){var i,r;const n=[];let s=Oa();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var m;return((m=HS(p))==null?void 0:m.name)===$S})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const b=n[p].blocks[m];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(zS).filter(p=>!!p).join(""),d=G8(c),f=cne(c);if(!u&&!d.length&&!f){s=Oa();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),s=Oa()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((r=u.meta)==null?void 0:r.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),s=Oa()),s=Tf(s,a),u.blocks=s.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const l=a.meta,c=l==null?void 0:l.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(l.feedback=u)}return n}function hne(e){var t,n;for(const s of e??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"新会话"}const pne=50,JR=48;function mne(e){return(e.events??[]).flatMap(t=>{var i,r;const s=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return s?[{text:s,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function gne(e){var t,n;for(const s of e.events??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"未命名会话"}function bne(e,t,n){const s=Math.max(0,t-JR),i=Math.min(e.length,t+n+JR);return(s>0?"…":"")+e.slice(s,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await o1(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of mne(l)){const f=c.toLowerCase().indexOf(s);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:gne(l),snippet:bne(c,f,s.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,pne)}async function xne(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await T8(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:s,results:i,error:r}=n;return s?r?{results:[],note:r}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Ene(e,t,n,s){if(!t||!s.trim())return{results:[]};const i=await N8(t,e,s.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const r=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function vne(e,t,n){return e==="session"?{results:await yne(n.userId,n.appId,t)}:e==="web"?xne(n.appId,t):Ene(e,n.appId,n.userId,t)}function K8({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function wne({open:e}){return o.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function _ne({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx(K8,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Sne(e,t,n){const s=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),r=a=>s?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:s,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:s&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:s&&i.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:s&&i.has("memory"),unavailableLabel:r("长期记忆")}]}function u1(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function eO(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function Nne({userId:e,appId:t,agentInfo:n,capabilitiesLoading:s,agentLabel:i,onOpenSession:r}){var F,C;const[a,l]=g.useState("session"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(!1),w=g.useRef(0),S=g.useRef(null),_=Sne(t,n,s),T=_.find(I=>I.id===a),k=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):a==="memory"?(C=n==null?void 0:n.components)==null?void 0:C.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;g.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),b(!1),E(!1)},[t]),g.useEffect(()=>{if(!x)return;function I(D){var $;($=S.current)!=null&&$.contains(D.target)||E(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[x]);async function A(I,D){var se;const $=I.trim();if(!$||!((se=_.find(P=>P.id===D))!=null&&se.ready))return;const O=++w.current;b(!0),y(!0);let te;try{te=await vne(D,$,{userId:e,appId:t})}catch(P){const Q=P instanceof Error?P.message:String(P);te={results:[],note:`搜索失败:${Q}`}}O===w.current&&(f(te.results),p(te.note),b(!1))}function j(I){w.current+=1,u(I),f([]),p(void 0),y(!1),b(!1)}function R(I){w.current+=1,l(I),E(!1),f([]),p(void 0),y(!1),b(!1)}const B=!!(T!=null&&T.ready),z=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(k==null?void 0:k.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(k==null?void 0:k.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=k!=null&&k.backend?u1(k.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:S,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(T==null?void 0:T.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>E(I=>!I),children:[o.jsx("span",{children:(T==null?void 0:T.label)??"搜索类型"}),L&&o.jsx("small",{children:L}),o.jsx(wne,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:_.map(I=>{var O,te;const D=I.id==="knowledge"?(O=n==null?void 0:n.components)==null?void 0:O.find(se=>se.source==="knowledgebase"||se.kind==="knowledgebase"):I.id==="memory"?(te=n==null?void 0:n.components)==null?void 0:te.find(se=>se.source==="long_term_memory"||se.kind==="memory"):void 0,$=D?[D.name,D.backend?u1(D.backend):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===I.id,disabled:!I.ready,onClick:()=>R(I.id),children:[o.jsx("span",{children:I.label}),$&&o.jsx("small",{children:$})]},I.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:I=>j(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A(c,a))},placeholder:z,disabled:!B,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(yn,{className:"icon spin"}):o.jsx(K8,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:B?v?m?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&v?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((I,D)=>o.jsx(Tne,{result:I,agentLabel:i,onOpen:r},D)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?s?"正在读取当前 Agent 的检索能力…":(T==null?void 0:T.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Tne({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(zB,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${eO(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(xx,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(Im,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(tO,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${u1(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(tO,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${u1(e.sourceType)}`:"",e.ts?` · ${eO(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function tO({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function su({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function kne({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Ane({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function q8(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const p2="/assets/logo-DCsNZy-k.svg",m2="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",nO="(max-width: 860px)";function Cne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Ine(e){let t=2166136261;for(const s of e)t^=s.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const jne={admin:"管理员",developer:"开发者",user:"普通用户"};function sO({role:e}){const t=jne[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Rne({version:e,onClose:t}){return g.useEffect(()=>{const n=s=>{s.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),wi.createPortal(o.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:o.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[o.jsxs("header",{className:"system-info-head",children:[o.jsx("h2",{id:"system-info-title",children:"系统信息"}),o.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:o.jsx(Oi,{className:"icon","aria-hidden":"true"})})]}),o.jsx("dl",{className:"system-info-meta",children:o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function One({access:e,userInfo:t,version:n,onLogout:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState("");if(!t)return null;const d=_te(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Ine(d||f||h),m=Ste(t),b=m===c?"":m;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>r(v=>!v),title:f?`${d} -${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:d}),o.jsx(sO,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>r(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:d}),o.jsx(sO,{role:e.role})]}),f&&f!==d&&o.jsx("div",{className:"account-sub",children:f})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),l(!0)},children:[o.jsx(bc,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),s()},children:[o.jsx(Yee,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(Rne,{version:n,onClose:()=>l(!1)}):null]})}function Mne({branding:e,cloudProvider:t,sessions:n,currentSessionId:s,activePage:i,features:r,access:a,streamingSids:l,evaluatingSids:c,onNewChat:u,onSearch:d,onQuickCreate:f,onSkillCenter:h,onAddAgent:p,onMyAgents:m,onApplications:b,onIssueFeedback:v,onPickSession:y,onDeleteSession:x,userInfo:E,version:w,onLogout:S}){const _=F=>(r==null?void 0:r[F])!==!1,[T,k]=g.useState(null),A=g.useRef(typeof window<"u"&&window.matchMedia(nO).matches),[j,R]=g.useState(A.current),B=[...n].sort((F,C)=>(C.lastUpdateTime??0)-(F.lastUpdateTime??0)),z=()=>{A.current=!1,R(F=>!F),k(null)};g.useEffect(()=>{const F=window.matchMedia(nO),C=I=>{I.matches?R(D=>D||(A.current=!0,!0)):A.current&&(A.current=!1,R(!1))};return F.addEventListener("change",C),()=>F.removeEventListener("change",C)},[]);const L=t==="byteplus"?m2:p2;return o.jsxs("aside",{className:`sidebar ${j?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:u,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||L,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:z,"aria-label":j?"展开侧边栏":"收起侧边栏",title:j?"展开侧边栏":"收起侧边栏",children:j?o.jsx(nte,{className:"icon"}):o.jsx(tte,{className:"icon"})})]}),_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:u,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(ji,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:m,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(su,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),_("search")&&o.jsx(_ne,{active:i==="search",onClick:d}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:b,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(Cne,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),o.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),_("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:u,"aria-label":"新建会话",title:"新建会话",children:o.jsx(ji,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[B.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),B.map(F=>{const C=hne(F.events),I=(l==null?void 0:l.has(F.id))===!0,D=!I&&(c==null?void 0:c.has(F.id))===!0;return o.jsxs("div",{className:`history-item ${F.id===s?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>y(F.id),"aria-current":F.id===s?"page":void 0,title:C,children:[I&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:C}),D&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>k($=>$===F.id?null:F.id),children:o.jsx(Oee,{className:"icon"})}),T===F.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>k(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{k(null),x(F.id)},children:[o.jsx(dc,{className:"icon"})," 删除"]})})]})]},F.id)})]})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsxs("button",{type:"button",className:`sidebar-feedback${i==="feedback"?" is-active":""}`,onClick:v,"aria-label":"问题反馈","aria-current":i==="feedback"?"page":void 0,title:"问题反馈",children:[o.jsx(q8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),o.jsx(One,{access:a,userInfo:E,version:w,onLogout:S})]})]})}function ii(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n{}};function Ax(){for(var e=0,t=arguments.length,n={},s;e=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Jb.prototype=Ax.prototype={constructor:Jb,on:function(e,t){var n=this._,s=Dne(e+"",n),i,r=-1,a=s.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),s=0,i,r;s=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),rO.hasOwnProperty(t)?{space:rO[t],local:e}:e}function Bne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===VS&&t.documentElement.namespaceURI===VS?t.createElement(e):t.createElementNS(n,e)}}function Une(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Y8(e){var t=Cx(e);return(t.local?Une:Bne)(t)}function Fne(){}function g2(e){return e==null?Fne:function(){return this.querySelector(e)}}function $ne(e){typeof e!="function"&&(e=g2(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i=E&&(E=x+1);!(S=v[E])&&++E=0;)(a=s[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function fse(e){e||(e=hse);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,s=n.length,i=new Array(s),r=0;rt?1:e>=t?0:NaN}function pse(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mse(){return Array.from(this)}function gse(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?kse:typeof t=="function"?Cse:Ase)(e,t,n??"")):kf(this.node(),e)}function kf(e,t){return e.style.getPropertyValue(t)||J8(e).getComputedStyle(e,null).getPropertyValue(t)}function jse(e){return function(){delete this[e]}}function Rse(e,t){return function(){this[e]=t}}function Ose(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Mse(e,t){return arguments.length>1?this.each((t==null?jse:typeof t=="function"?Ose:Rse)(e,t)):this.node()[e]}function e9(e){return e.trim().split(/^|\s+/)}function b2(e){return e.classList||new t9(e)}function t9(e){this._node=e,this._names=e9(e.getAttribute("class")||"")}t9.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function n9(e,t){for(var n=b2(e),s=-1,i=t.length;++s=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function lie(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,r;n()=>e;function GS(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:r,x:a,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}GS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yie(e){return!e.ctrlKey&&!e.button}function xie(){return this.parentNode}function Eie(e,t){return t??{x:e.x,y:e.y}}function vie(){return navigator.maxTouchPoints||"ontouchstart"in this}function l9(){var e=yie,t=xie,n=Eie,s=vie,i={},r=Ax("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(s).on("touchstart.drag",v).on("touchmove.drag",y,bie).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,S){if(!(d||!e.call(this,w,S))){var _=E(this,t.call(this,w,S),w,S,"mouse");_&&(jr(w.view).on("mousemove.drag",m,Om).on("mouseup.drag",b,Om),a9(w.view),Jv(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}function m(w){if(nf(w),!u){var S=w.clientX-l,_=w.clientY-c;u=S*S+_*_>f}i.mouse("drag",w)}function b(w){jr(w.view).on("mousemove.drag mouseup.drag",null),o9(w.view,u),nf(w),i.mouse("end",w)}function v(w,S){if(e.call(this,w,S)){var _=w.changedTouches,T=t.call(this,w,S),k=_.length,A,j;for(A=0;A>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Y0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Y0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_ie.exec(e))?new pr(t[1],t[2],t[3],1):(t=Sie.exec(e))?new pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nie.exec(e))?Y0(t[1],t[2],t[3],t[4]):(t=Tie.exec(e))?Y0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kie.exec(e))?fO(t[1],t[2]/100,t[3]/100,1):(t=Aie.exec(e))?fO(t[1],t[2]/100,t[3]/100,t[4]):aO.hasOwnProperty(e)?cO(aO[e]):e==="transparent"?new pr(NaN,NaN,NaN,0):null}function cO(e){return new pr(e>>16&255,e>>8&255,e&255,1)}function Y0(e,t,n,s){return s<=0&&(e=t=n=NaN),new pr(e,t,n,s)}function jie(e){return e instanceof _g||(e=gu(e)),e?(e=e.rgb(),new pr(e.r,e.g,e.b,e.opacity)):new pr}function KS(e,t,n,s){return arguments.length===1?jie(e):new pr(e,t,n,s??1)}function pr(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}y2(pr,KS,c9(_g,{brighter(e){return e=e==null?f1:Math.pow(f1,e),new pr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mm:Math.pow(Mm,e),new pr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pr(iu(this.r),iu(this.g),iu(this.b),h1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:uO,formatHex:uO,formatHex8:Rie,formatRgb:dO,toString:dO}));function uO(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}`}function Rie(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}${Gc((isNaN(this.opacity)?1:this.opacity)*255)}`}function dO(){const e=h1(this.opacity);return`${e===1?"rgb(":"rgba("}${iu(this.r)}, ${iu(this.g)}, ${iu(this.b)}${e===1?")":`, ${e})`}`}function h1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function iu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gc(e){return e=iu(e),(e<16?"0":"")+e.toString(16)}function fO(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ra(e,t,n,s)}function u9(e){if(e instanceof Ra)return new Ra(e.h,e.s,e.l,e.opacity);if(e instanceof _g||(e=gu(e)),!e)return new Ra;if(e instanceof Ra)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),r=Math.max(t,n,s),a=NaN,l=r-i,c=(r+i)/2;return l?(t===r?a=(n-s)/l+(n0&&c<1?0:a,new Ra(a,l,c,e.opacity)}function Oie(e,t,n,s){return arguments.length===1?u9(e):new Ra(e,t,n,s??1)}function Ra(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}y2(Ra,Oie,c9(_g,{brighter(e){return e=e==null?f1:Math.pow(f1,e),new Ra(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mm:Math.pow(Mm,e),new Ra(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new pr(ew(e>=240?e-240:e+120,i,s),ew(e,i,s),ew(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new Ra(hO(this.h),W0(this.s),W0(this.l),h1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=h1(this.opacity);return`${e===1?"hsl(":"hsla("}${hO(this.h)}, ${W0(this.s)*100}%, ${W0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hO(e){return e=(e||0)%360,e<0?e+360:e}function W0(e){return Math.max(0,Math.min(1,e||0))}function ew(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const x2=e=>()=>e;function Mie(e,t){return function(n){return e+n*t}}function Lie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function Die(e){return(e=+e)==1?d9:function(t,n){return n-t?Lie(t,n,e):x2(isNaN(t)?n:t)}}function d9(e,t){var n=t-e;return n?Mie(e,n):x2(isNaN(e)?t:e)}const p1=function e(t){var n=Die(t);function s(i,r){var a=n((i=KS(i)).r,(r=KS(r)).r),l=n(i.g,r.g),c=n(i.b,r.b),u=d9(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return s.gamma=e,s}(1);function Pie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(r){for(i=0;in&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(s=s[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:no(s,i)})),n=tw.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,s)-2,x:no(u,d)})):d&&f.push(i(f)+"rotate("+d+s)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,s)-2,x:no(u,d)}):d&&f.push(i(f)+"skewX("+d+s)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var b=p.push(i(p)+"scale(",null,",",null,")");m.push({i:b-4,x:no(u,f)},{i:b-2,x:no(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),r(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,b=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--Af}function gO(){bu=(g1=Dm.now())+Ix,Af=yp=0;try{Zie()}finally{Af=0,ere(),bu=0}}function Jie(){var e=Dm.now(),t=e-g1;t>m9&&(Ix-=t,g1=e)}function ere(){for(var e,t=m1,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:m1=n);xp=e,WS(s)}function WS(e){if(!Af){yp&&(yp=clearTimeout(yp));var t=e-bu;t>24?(e<1/0&&(yp=setTimeout(gO,e-Dm.now()-Ix)),qh&&(qh=clearInterval(qh))):(qh||(g1=Dm.now(),qh=setInterval(Jie,m9)),Af=1,g9(gO))}}function bO(e,t,n){var s=new b1;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var tre=Ax("start","end","cancel","interrupt"),nre=[],y9=0,yO=1,XS=2,ty=3,xO=4,QS=5,ny=6;function jx(e,t,n,s,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;sre(e,n,{name:t,index:s,group:i,on:tre,tween:nre,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:y9})}function v2(e,t){var n=za(e,t);if(n.state>y9)throw new Error("too late; already scheduled");return n}function bo(e,t){var n=za(e,t);if(n.state>ty)throw new Error("too late; already running");return n}function za(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function sre(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=b9(r,0,n.time);function r(u){n.state=yO,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==yO)return c();for(d in s)if(p=s[d],p.name===n.name){if(p.state===ty)return bO(a);p.state===xO?(p.state=ny,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete s[d]):+dXS&&s.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Ore(e,t,n){var s,i,r=Rre(t)?v2:bo;return function(){var a=r(this,e),l=a.on;l!==s&&(i=(s=l).copy()).on(t,n),a.on=i}}function Mre(e,t){var n=this._id;return arguments.length<2?za(this.node(),n).on.on(e):this.each(Ore(n,e,t))}function Lre(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Dre(){return this.on("end.remove",Lre(this._id))}function Pre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=g2(e));for(var s=this._groups,i=s.length,r=new Array(i),a=0;a()=>e;function lae(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function qo(e,t,n){this.k=e,this.x=t,this.y=n}qo.prototype={constructor:qo,scale:function(e){return e===1?this:new qo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Rx=new qo(1,0,0);w9.prototype=qo.prototype;function w9(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rx;return e.__zoom}function nw(e){e.stopImmediatePropagation()}function Yh(e){e.preventDefault(),e.stopImmediatePropagation()}function cae(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function uae(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function EO(){return this.__zoom||Rx}function dae(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fae(){return navigator.maxTouchPoints||"ontouchstart"in this}function hae(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function _9(){var e=cae,t=uae,n=hae,s=dae,i=fae,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ey,u=Ax("start","zoom","end"),d,f,h,p=500,m=150,b=0,v=10;function y(L){L.property("__zoom",EO).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",j).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(L,F,C,I){var D=L.selection?L.selection():L;D.property("__zoom",EO),L!==D?S(L,F,C,I):D.interrupt().each(function(){_(this,arguments).event(I).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(L,F,C,I){y.scaleTo(L,function(){var D=this.__zoom.k,$=typeof F=="function"?F.apply(this,arguments):F;return D*$},C,I)},y.scaleTo=function(L,F,C,I){y.transform(L,function(){var D=t.apply(this,arguments),$=this.__zoom,O=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,te=$.invert(O),se=typeof F=="function"?F.apply(this,arguments):F;return n(E(x($,se),O,te),D,a)},C,I)},y.translateBy=function(L,F,C,I){y.transform(L,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},y.translateTo=function(L,F,C,I,D){y.transform(L,function(){var $=t.apply(this,arguments),O=this.__zoom,te=I==null?w($):typeof I=="function"?I.apply(this,arguments):I;return n(Rx.translate(te[0],te[1]).scale(O.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof C=="function"?-C.apply(this,arguments):-C),$,a)},I,D)};function x(L,F){return F=Math.max(r[0],Math.min(r[1],F)),F===L.k?L:new qo(F,L.x,L.y)}function E(L,F,C){var I=F[0]-C[0]*L.k,D=F[1]-C[1]*L.k;return I===L.x&&D===L.y?L:new qo(L.k,I,D)}function w(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function S(L,F,C,I){L.on("start.zoom",function(){_(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(I).end()}).tween("zoom",function(){var D=this,$=arguments,O=_(D,$).event(I),te=t.apply(D,$),se=C==null?w(te):typeof C=="function"?C.apply(D,$):C,P=Math.max(te[1][0]-te[0][0],te[1][1]-te[0][1]),Q=D.__zoom,ee=typeof F=="function"?F.apply(D,$):F,V=c(Q.invert(se).concat(P/Q.k),ee.invert(se).concat(P/ee.k));return function(X){if(X===1)X=ee;else{var K=V(X),ce=P/K[2];X=new qo(ce,se[0]-K[0]*ce,se[1]-K[1]*ce)}O.zoom(null,X)}})}function _(L,F,C){return!C&&L.__zooming||new T(L,F)}function T(L,F){this.that=L,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,F),this.taps=0}T.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,F){return this.mouse&&L!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var F=jr(this.that).datum();u.call(L,this.that,new lae(L,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function k(L,...F){if(!e.apply(this,arguments))return;var C=_(this,F).event(L),I=this.__zoom,D=Math.max(r[0],Math.min(r[1],I.k*Math.pow(2,s.apply(this,arguments)))),$=Aa(L);if(C.wheel)(C.mouse[0][0]!==$[0]||C.mouse[0][1]!==$[1])&&(C.mouse[1]=I.invert(C.mouse[0]=$)),clearTimeout(C.wheel);else{if(I.k===D)return;C.mouse=[$,I.invert($)],sy(this),C.start()}Yh(L),C.wheel=setTimeout(O,m),C.zoom("mouse",n(E(x(I,D),C.mouse[0],C.mouse[1]),C.extent,a));function O(){C.wheel=null,C.end()}}function A(L,...F){if(h||!e.apply(this,arguments))return;var C=L.currentTarget,I=_(this,F,!0).event(L),D=jr(L.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",P,!0),$=Aa(L,C),O=L.clientX,te=L.clientY;a9(L.view),nw(L),I.mouse=[$,this.__zoom.invert($)],sy(this),I.start();function se(Q){if(Yh(Q),!I.moved){var ee=Q.clientX-O,V=Q.clientY-te;I.moved=ee*ee+V*V>b}I.event(Q).zoom("mouse",n(E(I.that.__zoom,I.mouse[0]=Aa(Q,C),I.mouse[1]),I.extent,a))}function P(Q){D.on("mousemove.zoom mouseup.zoom",null),o9(Q.view,I.moved),Yh(Q),I.event(Q).end()}}function j(L,...F){if(e.apply(this,arguments)){var C=this.__zoom,I=Aa(L.changedTouches?L.changedTouches[0]:L,this),D=C.invert(I),$=C.k*(L.shiftKey?.5:2),O=n(E(x(C,$),I,D),t.apply(this,F),a);Yh(L),l>0?jr(this).transition().duration(l).call(S,O,I,L):jr(this).call(y.transform,O,I,L)}}function R(L,...F){if(e.apply(this,arguments)){var C=L.touches,I=C.length,D=_(this,F,L.changedTouches.length===I).event(L),$,O,te,se;for(nw(L),O=0;O`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Pm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],S9=["Enter"," ","Escape"],N9={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Cf;(function(e){e.Strict="strict",e.Loose="loose"})(Cf||(Cf={}));var ru;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ru||(ru={}));var Bm;(function(e){e.Partial="partial",e.Full="full"})(Bm||(Bm={}));const T9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pl||(Pl={}));var If;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(If||(If={}));var Qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Qe||(Qe={}));const vO={[Qe.Left]:Qe.Right,[Qe.Right]:Qe.Left,[Qe.Top]:Qe.Bottom,[Qe.Bottom]:Qe.Top};function k9(e){return e===null?null:e?"valid":"invalid"}const A9=e=>"id"in e&&"source"in e&&"target"in e,pae=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),_2=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Sg=(e,t=[0,0])=>{const{width:n,height:s}=hl(e),i=e.origin??t,r=n*i[0],a=s*i[1];return{x:e.position.x-r,y:e.position.y-a}},mae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const r=typeof i=="string";let a=!t.nodeLookup&&!r?i:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(i):_2(i)?i:t.nodeLookup.get(i.id));const l=a?y1(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ox(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mx(n)},Ng=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Ox(n,y1(i)),s=!0)}),s?Mx(n):{x:0,y:0,width:0,height:0}},S2=(e,t,[n,s,i]=[0,0,1],r=!1,a=!1)=>{const l={...oh(t,[n,s,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,b=Um(l,Rf(u)),v=(p??0)*(m??0),y=r&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},gae=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function bae(e,t){const n=new Map,s=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!s||s.has(i.id))&&n.set(i.id,i)}),n}async function yae({nodes:e,width:t,height:n,panZoom:s,minZoom:i,maxZoom:r},a){if(e.size===0)return!0;const l=bae(e,a),c=Ng(l),u=T2(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await s.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function C9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:i,onError:r}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??s;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",Fa.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&xu(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=xu(f)?yu(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",Fa.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function xae({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:i}){const r=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=r.has(h.id),m=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),d=gae(a,c);for(const h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const jf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),yu=(e={x:0,y:0},t,n)=>({x:jf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:jf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function I9(e,t,n){const{width:s,height:i}=hl(n),{x:r,y:a}=n.internals.positionAbsolute;return yu(e,[[r,a],[r+s,a+i]],t)}const wO=(e,t,n)=>en?-jf(Math.abs(e-n),1,t)/t:0,N2=(e,t,n=15,s=40)=>{const i=wO(e.x,s,t.width-s)*n,r=wO(e.y,s,t.height-s)*n;return[i,r]},Ox=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),ZS=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Mx=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Rf=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=_2(e)?e.internals.positionAbsolute:Sg(e,t);return{x:n,y:s,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},y1=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=_2(e)?e.internals.positionAbsolute:Sg(e,t);return{x:n,y:s,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:s+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},j9=(e,t)=>Mx(Ox(ZS(e),ZS(t))),Um=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},_O=e=>Ma(e.width)&&Ma(e.height)&&Ma(e.x)&&Ma(e.y),Ma=e=>!isNaN(e)&&isFinite(e),R9=(e,t)=>(n,s)=>{},Tg=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),oh=({x:e,y:t},[n,s,i],r=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-s)/i};return r?Tg(l,a):l},Of=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s});function ed(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Eae(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=ed(e,n),i=ed(e,t);return{top:s,right:i,bottom:s,left:i,x:i*2,y:s*2}}if(typeof e=="object"){const s=ed(e.top??e.y??0,n),i=ed(e.bottom??e.y??0,n),r=ed(e.left??e.x??0,t),a=ed(e.right??e.x??0,t);return{top:s,right:a,bottom:i,left:r,x:r+a,y:s+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vae(e,t,n,s,i,r){const{x:a,y:l}=Of(e,[t,n,s]),{x:c,y:u}=Of({x:e.x+e.width,y:e.y+e.height},[t,n,s]),d=i-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const T2=(e,t,n,s,i,r)=>{const a=Eae(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=jf(u,s,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,b=vae(e,p,m,d,t,n),v={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:p-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},Fm=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function xu(e){return e!=null&&e!=="parent"}function hl(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function k2(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function O9(e,t={width:0,height:0},n,s,i){const r={...e},a=s.get(n);if(a){const l=a.origin||i;r.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],r.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return r}function SO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wae(){let e,t;return{promise:new Promise((s,i)=>{e=s,t=i}),resolve:e,reject:t}}function _ae(e){return{...N9,...e||{}}}function Xp(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:i}){const{x:r,y:a}=La(e),l=oh({x:r-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},s),{x:c,y:u}=n?Tg(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const A2=e=>({width:e.offsetWidth,height:e.offsetHeight}),M9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Sae=["INPUT","SELECT","TEXTAREA"];function L9(e){var s,i;const t=((i=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Sae.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const D9=e=>"clientX"in e,La=(e,t)=>{var r,a;const n=D9(e),s=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},NO=(e,t,n,s,i)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...A2(a)}})};function P9({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+s*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Z0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function TO({pos:e,x1:t,y1:n,x2:s,y2:i,c:r}){switch(e){case Qe.Left:return[t-Z0(t-s,r),n];case Qe.Right:return[t+Z0(s-t,r),n];case Qe.Top:return[t,n-Z0(n-i,r)];case Qe.Bottom:return[t,n+Z0(i-n,r)]}}function B9({sourceX:e,sourceY:t,sourcePosition:n=Qe.Bottom,targetX:s,targetY:i,targetPosition:r=Qe.Top,curvature:a=.25}){const[l,c]=TO({pos:n,x1:e,y1:t,x2:s,y2:i,c:a}),[u,d]=TO({pos:r,x1:s,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=P9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${s},${i}`,f,h,p,m]}function U9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,r=n0}const kae=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Aae=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Cae=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",Fa.error006()),t;const s=n.getEdgeId||kae;let i;return A9(e)?i={...e}:i={...e,id:s(e)},Aae(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function F9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,r,a,l]=U9({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,r,a,l]}const kO={[Qe.Left]:{x:-1,y:0},[Qe.Right]:{x:1,y:0},[Qe.Top]:{x:0,y:-1},[Qe.Bottom]:{x:0,y:1}},Iae=({source:e,sourcePosition:t=Qe.Bottom,target:n})=>t===Qe.Left||t===Qe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function jae({source:e,sourcePosition:t=Qe.Bottom,target:n,targetPosition:s=Qe.Top,center:i,offset:r,stepPosition:a}){const l=kO[t],c=kO[s],u={x:e.x+l.x*r,y:e.y+l.y*r},d={x:n.x+c.x*r,y:n.y+c.y*r},f=Iae({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=U9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,v=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,v=i.y??u.y+(d.y-u.y)*a);const k=[{x:b,y:u.y},{x:b,y:d.y}],A=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?k:A:m=h==="x"?A:k}else{const k=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?A:k:m=l.y===p?k:A,t===s){const L=Math.abs(e[h]-n[h]);if(L<=r){const F=Math.min(r-1,r-L);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==s){const L=h==="x"?"y":"x",F=l[h]===c[L],C=u[L]>d[L],I=u[L]=z?(b=(j.x+R.x)/2,v=m[0].y):(b=m[0].x,v=(j.y+R.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...S.x!==m[0].x||S.y!==m[0].y?[S]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],b,v,E,w]}function Rae(e,t,n,s){const i=Math.min(AO(e,t)/2,AO(t,n)/2,s),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function JS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Mae(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:i}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||s,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=JS(c,t);r.has(u)||(a.push({id:u,color:c.color||n,...c}),r.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const $9=1e3,Lae=10,C2={nodeOrigin:[0,0],nodeExtent:Pm,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Dae={...C2,checkEquality:!0};function I2(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Pae(e,t,n){const s=I2(C2,n);for(const i of e.values())if(i.parentId)R2(i,e,t,s);else{const r=Sg(i,s.nodeOrigin),a=xu(i.extent)?i.extent:s.nodeExtent,l=yu(r,a,hl(i));i.internals.positionAbsolute=l}}function Bae(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const i of e.handles){const r={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(r):i.type==="target"&&s.push(r)}return{source:n,target:s}}function j2(e){return e==="manual"}function eN(e,t,n,s={}){var d,f;const i=I2(Dae,s),r={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!j2(i.zIndexMode)?$9:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(i.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Sg(h,i.nodeOrigin),b=xu(h.extent)?h.extent:i.nodeExtent,v=yu(m,b,hl(h));p={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:v,handleBounds:Bae(h,p),z:H9(h,l,i.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&R2(p,t,n,s,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Uae(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function R2(e,t,n,s,i){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=I2(C2,s),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Uae(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Lae),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=r&&!j2(c)?$9:0,{x:h,y:p,z:m}=Fae(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||p!==b.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:b,z:m}})}function H9(e,t,n){const s=Ma(e.zIndex)?e.zIndex:0;return j2(n)?s:s+(e.selected?t:0)}function Fae(e,t,n,s,i,r){const{x:a,y:l}=t.internals.positionAbsolute,c=hl(e),u=Sg(e,n),d=xu(e.extent)?yu(u,e.extent,c):u;let f=yu({x:a+d.x,y:l+d.y},s,c);e.extent==="parent"&&(f=I9(f,c,t));const h=H9(e,i,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function O2(e,t,n,s=[0,0]){var a;const i=[],r=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=r.get(l.parentId))==null?void 0:a.expandedRect)??Rf(c),d=j9(u,l.rect);r.set(l.parentId,{expandedRect:d,parent:c})}return r.size>0&&r.forEach(({expandedRect:l,parent:c},u)=>{var E;const d=c.internals.positionAbsolute,f=hl(c),h=c.origin??s,p=l.x0||m>0||y||x)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+x}}),(E=n.get(u))==null||E.forEach(w=>{e.some(S=>S.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=O2(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function Hae({delta:e,panZoom:t,transform:n,translateExtent:s,width:i,height:r}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,r]],s);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function RO(e,t,n,s,i,r){let a=i;const l=s.get(a)||new Map;s.set(a,l.set(n,t)),a=`${i}-${e}`;const c=s.get(a)||new Map;if(s.set(a,c.set(n,t)),r){a=`${i}-${e}-${r}`;const u=s.get(a)||new Map;s.set(a,u.set(n,t))}}function z9(e,t,n){e.clear(),t.clear();for(const s of n){const{source:i,target:r,sourceHandle:a=null,targetHandle:l=null}=s,c={edgeId:s.id,source:i,target:r,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${r}-${l}`,d=`${r}-${l}--${i}-${a}`;RO("source",c,d,e,i,a),RO("target",c,u,e,r,l),t.set(s.id,s)}}function V9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:V9(n,t):!1}function OO(e,t,n){var i;let s=e;do{if((i=s==null?void 0:s.matches)!=null&&i.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function zae(e,t,n,s){const i=new Map;for(const[r,a]of e)if((a.selected||a.id===s)&&(!a.parentId||!V9(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&i.set(r,{id:r,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function sw({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var a,l,c;const i=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:s})}if(!e)return[i[0],i];const r=(l=n.get(e))==null?void 0:l.internals.userNode;return[r?{...r,position:((c=t.get(e))==null?void 0:c.position)||r.position,dragging:s}:i[0],i]}function Vae({dragItems:e,snapGrid:t,x:n,y:s}){const i=e.values().next().value;if(!i)return null;const r={x:n-i.distance.x,y:s-i.distance.y},a=Tg(r,t);return{x:a.x-r.x,y:a.y-r.y}}function Gae({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:i}){let r={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,b=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:S,nodeId:_,nodeClickDistance:T=0}){h=jr(w);function k({x:B,y:z}){const{nodeLookup:L,nodeExtent:F,snapGrid:C,snapToGrid:I,nodeOrigin:D,onNodeDrag:$,onSelectionDrag:O,onError:te,updateNodePositions:se}=t();r={x:B,y:z};let P=!1;const Q=l.size>1,ee=Q&&F?ZS(Ng(l)):null,V=Q&&I?Vae({dragItems:l,snapGrid:C,x:B,y:z}):null;for(const[X,K]of l){if(!L.has(X))continue;let ce={x:B-K.distance.x,y:z-K.distance.y};I&&(ce=V?{x:Math.round(ce.x+V.x),y:Math.round(ce.y+V.y)}:Tg(ce,C));let he=null;if(Q&&F&&!K.extent&&ee){const{positionAbsolute:we}=K.internals,Le=we.x-ee.x+F[0][0],Ne=we.x+K.measured.width-ee.x2+F[1][0],ae=we.y-ee.y+F[0][1],me=we.y+K.measured.height-ee.y2+F[1][1];he=[[Le,ae],[Ne,me]]}const{position:be,positionAbsolute:ue}=C9({nodeId:X,nextPosition:ce,nodeLookup:L,nodeExtent:he||F,nodeOrigin:D,onError:te});P=P||K.position.x!==be.x||K.position.y!==be.y,K.position=be,K.internals.positionAbsolute=ue}if(m=m||P,!!P&&(se(l,!0),b&&(s||$||!_&&O))){const[X,K]=sw({nodeId:_,dragItems:l,nodeLookup:L});s==null||s(b,l,X,K),$==null||$(b,X,K),_||O==null||O(b,K)}}async function A(){if(!d)return;const{transform:B,panBy:z,autoPanSpeed:L,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[C,I]=N2(u,d,L);(C!==0||I!==0)&&(r.x=(r.x??0)-C/B[2],r.y=(r.y??0)-I/B[2],await z({x:C,y:I})&&k(r)),a=requestAnimationFrame(A)}function j(B){var Q;const{nodeLookup:z,multiSelectionActive:L,nodesDraggable:F,transform:C,snapGrid:I,snapToGrid:D,selectNodesOnDrag:$,onNodeDragStart:O,onSelectionDragStart:te,unselectNodesAndEdges:se}=t();f=!0,(!$||!S)&&!L&&_&&((Q=z.get(_))!=null&&Q.selected||se()),S&&$&&_&&(e==null||e(_));const P=Xp(B.sourceEvent,{transform:C,snapGrid:I,snapToGrid:D,containerBounds:d});if(r=P,l=zae(z,F,P,_),l.size>0&&(n||O||!_&&te)){const[ee,V]=sw({nodeId:_,dragItems:l,nodeLookup:z});n==null||n(B.sourceEvent,l,ee,V),O==null||O(B.sourceEvent,ee,V),_||te==null||te(B.sourceEvent,V)}}const R=l9().clickDistance(T).on("start",B=>{const{domNode:z,nodeDragThreshold:L,transform:F,snapGrid:C,snapToGrid:I}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,m=!1,b=B.sourceEvent,L===0&&j(B),r=Xp(B.sourceEvent,{transform:F,snapGrid:C,snapToGrid:I,containerBounds:d}),u=La(B.sourceEvent,d)}).on("drag",B=>{const{autoPanOnNodeDrag:z,transform:L,snapGrid:F,snapToGrid:C,nodeDragThreshold:I,nodeLookup:D}=t(),$=Xp(B.sourceEvent,{transform:L,snapGrid:F,snapToGrid:C,containerBounds:d});if(b=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||_&&!D.has(_))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,A()),!f){const O=La(B.sourceEvent,d),te=O.x-u.x,se=O.y-u.y;Math.sqrt(te*te+se*se)>I&&j(B)}(r.x!==$.xSnapped||r.y!==$.ySnapped)&&l&&f&&(u=La(B.sourceEvent,d),k($))}}).on("end",B=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:z,updateNodePositions:L,onNodeDragStop:F,onSelectionDragStop:C}=t();if(m&&(L(l,!1),m=!1),i||F||!_&&C){const[I,D]=sw({nodeId:_,dragItems:l,nodeLookup:z,dragging:!1});i==null||i(B.sourceEvent,l,I,D),F==null||F(B.sourceEvent,I,D),_||C==null||C(B.sourceEvent,D)}}}).filter(B=>{const z=B.target;return!B.button&&(!x||!OO(z,`.${x}`,w))&&(!E||OO(z,E,w))});h.call(R)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function Kae(e,t,n){const s=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Um(i,Rf(r))>0&&s.push(r);return s}const qae=250;function Yae(e,t,n,s){var l,c;let i=[],r=1/0;const a=Kae(e,n,t+qae);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(s.nodeId===f.nodeId&&s.type===f.type&&s.id===f.id)continue;const{x:h,y:p}=Eu(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=s.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function G9(e,t,n,s,i,r=!1){var u,d,f;const a=s.get(e);if(!a)return null;const l=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&r?{...c,...Eu(a,c,c.position,!0)}:c}function K9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Wae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const q9=()=>!0;function Xae(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:i,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:b,onConnectEnd:v,isValidConnection:y=q9,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:S,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){const A=M9(e.target);let j=0,R;const{x:B,y:z}=La(e),L=K9(r,k),F=l==null?void 0:l.getBoundingClientRect();let C=!1;if(!F||!L)return;const I=G9(i,L,s,c,t);if(!I)return;let D=La(e,F),$=!1,O=null,te=!1,se=null;function P(){if(!d||!F)return;const[be,ue]=N2(D,F,_);h({x:be,y:ue}),j=requestAnimationFrame(P)}const Q={...I,nodeId:i,type:L,position:I.position},ee=c.get(i);let X={inProgress:!0,isValid:null,from:Eu(ee,Q,Qe.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:D,toHandle:null,toPosition:vO[Q.position],toNode:null,pointer:D};function K(){C=!0,E(X),m==null||m(e,{nodeId:i,handleId:s,handleType:L})}T===0&&K();function ce(be){if(!C){const{x:me,y:_e}=La(be),Je=me-B,Pe=_e-z;if(!(Je*Je+Pe*Pe>T*T))return;K()}if(!S()||!Q){he(be);return}const ue=w();D=La(be,F),R=Yae(oh(D,ue,!1,[1,1]),n,c,Q),$||(P(),$=!0);const we=Y9(be,{handle:R,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:a?"target":"source",isValidConnection:y,doc:A,lib:u,flowId:f,nodeLookup:c});se=we.handleDomNode,O=we.connection,te=Wae(!!R,we.isValid);const Le=c.get(i),Ne=Le?Eu(Le,Q,Qe.Left,!0):X.from,ae={...X,from:Ne,isValid:te,to:we.toHandle&&te?Of({x:we.toHandle.x,y:we.toHandle.y},ue):D,toHandle:we.toHandle,toPosition:te&&we.toHandle?we.toHandle.position:vO[Q.position],toNode:we.toHandle?c.get(we.toHandle.nodeId):null,pointer:D};E(ae),X=ae}function he(be){if(!("touches"in be&&be.touches.length>0)){if(C){(R||se)&&O&&te&&(b==null||b(O));const{inProgress:ue,...we}=X,Le={...we,toPosition:X.toHandle?X.toPosition:null};v==null||v(be,Le),r&&(x==null||x(be,Le))}p(),cancelAnimationFrame(j),$=!1,te=!1,O=null,se=null,A.removeEventListener("mousemove",ce),A.removeEventListener("mouseup",he),A.removeEventListener("touchmove",ce),A.removeEventListener("touchend",he)}}A.addEventListener("mousemove",ce),A.addEventListener("mouseup",he),A.addEventListener("touchmove",ce),A.addEventListener("touchend",he)}function Y9(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=q9,nodeLookup:d}){const f=r==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=La(e),b=a.elementFromPoint(p,m),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=K9(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),_=v.classList.contains("connectableend");if(!E||!x)return y;const T={source:f?E:s,sourceHandle:f?w:i,target:f?s:E,targetHandle:f?i:w};y.connection=T;const A=S&&_&&(n===Cf.Strict?f&&x==="source"||!f&&x==="target":E!==s||w!==i);y.isValid=A&&u(T),y.toHandle=G9(E,x,w,d,n,!0)}return y}const tN={onPointerDown:Xae,isValid:Y9};function Qae({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const i=jr(e);function r({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=E=>{if(E.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=E.sourceEvent.ctrlKey&&Fm()?10:1,_=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,T=w[2]*Math.pow(2,_*S);t.scaleTo(T)};let b=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(b=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},y=E=>{const w=n();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!t)return;const S=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],_=[S[0]-b[0],S[1]-b[1]];b=S;const T=s()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},A,l)},x=_9().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(x,{})}function a(){i.on("zoom",null)}return{update:r,destroy:a,pointer:Aa}}const Lx=e=>({x:e.x,y:e.y,zoom:e.k}),iw=({x:e,y:t,zoom:n})=>Rx.translate(e,t).scale(n),Bd=(e,t)=>e.target.closest(`.${t}`),W9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zae=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rw=(e,t=0,n=Zae,s=()=>{})=>{const i=typeof t=="number"&&t>0;return i||s(),i?e.transition().duration(t).ease(n).on("end",s):e},X9=e=>{const t=e.ctrlKey&&Fm()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jae({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:i,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Bd(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=Aa(d),y=X9(d),x=f*Math.pow(2,y);s.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=i===ru.Vertical?0:d.deltaX*h,m=i===ru.Horizontal?0:d.deltaY*h;!Fm()&&d.shiftKey&&i!==ru.Vertical&&(p=d.deltaY*h,m=0),s.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const b=Lx(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function eoe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,i){const r=s.type==="wheel",a=!t&&r&&!s.ctrlKey,l=Bd(s,e);if(s.ctrlKey&&r&&l&&s.preventDefault(),a||l)return null;s.preventDefault(),n.call(this,s,i)}}function toe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var r,a,l;if((r=s.sourceEvent)!=null&&r.internal)return;const i=Lx(s.transform);e.mouseButton=((a=s.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=s.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,i))}}function noe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:i}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&W9(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||s([r.transform.x,r.transform.y,r.transform.k]),i&&!((l=r.sourceEvent)!=null&&l.internal)&&(i==null||i(r.sourceEvent,Lx(r.transform)))}}function soe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:i,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&W9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,s(!1),i)){const c=Lx(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function ioe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:i,zoomOnDoubleClick:r,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Bd(f,`${u}-flow__node`)||Bd(f,`${u}-flow__edge`)))return!0;if(!s&&!h&&!i&&!r&&!n||a||d&&!m||Bd(f,l)&&m||Bd(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!s&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(s)&&!s.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&b}}function roe({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:i,onPanZoom:r,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=_9().scaleExtent([t,n]).translateExtent(s),h=jr(e).call(f);x({x:i.x,y:i.y,zoom:jf(i.zoom,t,n)},[[0,0],[d.width,d.height]],s);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(X9);async function b(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).transform(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}function v({noWheelClassName:R,noPanClassName:B,onPaneContextMenu:z,userSelectionActive:L,panOnScroll:F,panOnDrag:C,panOnScrollMode:I,panOnScrollSpeed:D,preventScrolling:$,zoomOnPinch:O,zoomOnScroll:te,zoomOnDoubleClick:se,zoomActivationKeyPressed:P,lib:Q,onTransformChange:ee,connectionInProgress:V,paneClickDistance:X,selectionOnDrag:K}){L&&!u.isZoomingOrPanning&&y();const ce=F&&!P&&!L;f.clickDistance(K?1/0:!Ma(X)||X<0?0:X);const he=ce?Jae({zoomPanValues:u,noWheelClassName:R,d3Selection:h,d3Zoom:f,panOnScrollMode:I,panOnScrollSpeed:D,zoomOnPinch:O,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):eoe({noWheelClassName:R,preventScrolling:$,d3ZoomHandler:p});h.on("wheel.zoom",he,{passive:!1});const be=toe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",be);const ue=noe({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!z,onPanZoom:r,onTransformChange:ee});f.on("zoom",ue);const we=soe({zoomPanValues:u,panOnDrag:C,panOnScroll:F,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",we);const Le=ioe({zoomActivationKeyPressed:P,panOnDrag:C,zoomOnScroll:te,panOnScroll:F,zoomOnDoubleClick:se,zoomOnPinch:O,userSelectionActive:L,noPanClassName:B,noWheelClassName:R,lib:Q,connectionInProgress:V});f.filter(Le),se?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(R,B,z){const L=iw(R),F=f==null?void 0:f.constrain()(L,B,z);return F&&await b(F),F}async function E(R,B){const z=iw(R);return await b(z,B),z}function w(R){if(h){const B=iw(R),z=h.property("__zoom");(z.k!==R.zoom||z.x!==R.x||z.y!==R.y)&&(f==null||f.transform(h,B,null,{sync:!0}))}}function S(){const R=h?w9(h.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}async function _(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).scaleTo(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}async function T(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).scaleBy(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}function k(R){f==null||f.scaleExtent(R)}function A(R){f==null||f.translateExtent(R)}function j(R){const B=!Ma(R)||R<0?0:R;f==null||f.clickDistance(B)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:S,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:A,syncViewport:w,setClickDistance:j}}var Mf;(function(e){e.Line="line",e.Handle="handle"})(Mf||(Mf={}));function aoe({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:i,affectsY:r}){const a=e-t,l=n-s,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function MO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:i}}function wl(e,t){return Math.max(0,t-e)}function _l(e,t){return Math.max(0,e-t)}function J0(e,t,n){return Math.max(0,t-e,e-n)}function LO(e,t){return e?!t:t}function ooe(e,t,n,s,i,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=s,{x:E,y:w,width:S,height:_,aspectRatio:T}=e;let k=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?m-e.pointerY:0);const j=S+(c?-k:k),R=_+(u?-A:A),B=-r[0]*S,z=-r[1]*_;let L=J0(j,b,v),F=J0(R,y,x);if(a){let D=0,$=0;c&&k<0?D=wl(E+k+B,a[0][0]):!c&&k>0&&(D=_l(E+j+B,a[1][0])),u&&A<0?$=wl(w+A+z,a[0][1]):!u&&A>0&&($=_l(w+R+z,a[1][1])),L=Math.max(L,D),F=Math.max(F,$)}if(l){let D=0,$=0;c&&k>0?D=_l(E+k,l[0][0]):!c&&k<0&&(D=wl(E+j,l[1][0])),u&&A>0?$=_l(w+A,l[0][1]):!u&&A<0&&($=wl(w+R,l[1][1])),L=Math.max(L,D),F=Math.max(F,$)}if(i){if(d){const D=J0(j/T,y,x)*T;if(L=Math.max(L,D),a){let $=0;!c&&!u||c&&!u&&h?$=_l(w+z+j/T,a[1][1])*T:$=wl(w+z+(c?k:-k)/T,a[0][1])*T,L=Math.max(L,$)}if(l){let $=0;!c&&!u||c&&!u&&h?$=wl(w+j/T,l[1][1])*T:$=_l(w+(c?k:-k)/T,l[0][1])*T,L=Math.max(L,$)}}if(f){const D=J0(R*T,b,v)/T;if(F=Math.max(F,D),a){let $=0;!c&&!u||u&&!c&&h?$=_l(E+R*T+B,a[1][0])/T:$=wl(E+(u?A:-A)*T+B,a[0][0])/T,F=Math.max(F,$)}if(l){let $=0;!c&&!u||u&&!c&&h?$=wl(E+R*T,l[1][0])/T:$=_l(E+(u?A:-A)*T,l[0][0])/T,F=Math.max(F,$)}}}A=A+(A<0?F:-F),k=k+(k<0?L:-L),i&&(h?j>R*T?A=(LO(c,u)?-k:k)/T:k=(LO(c,u)?-A:A)*T:d?(A=k/T,u=c):(k=A*T,c=u));const C=c?E+k:E,I=u?w+A:w;return{width:S+(c?-k:k),height:_+(u?-A:A),x:r[0]*k*(c?-1:1)+C,y:r[1]*A*(u?-1:1)+I}}const Q9={width:0,height:0,x:0,y:0},loe={...Q9,pointerX:0,pointerY:0,aspectRatio:1};function coe(e,t,n){const s=t.position.x+e.position.x,i=t.position.y+e.position.y,r=e.measured.width??0,a=e.measured.height??0,l=n[0]*r,c=n[1]*a;return[[s-l,i-c],[s+r-l,i+a-c]]}function uoe({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:i}){const r=jr(e);let a={controlDirection:MO("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:v}){let y={...Q9},x={...loe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:MO(u)};let E,w=null,S=[],_,T,k,A=!1;const j=l9().on("start",R=>{const{nodeLookup:B,transform:z,snapGrid:L,snapToGrid:F,nodeOrigin:C,paneDomNode:I}=n();if(E=B.get(t),!E)return;w=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:D,ySnapped:$}=Xp(R.sourceEvent,{transform:z,snapGrid:L,snapToGrid:F,containerBounds:w});y={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},x={...y,pointerX:D,pointerY:$,aspectRatio:y.width/y.height},_=void 0,T=xu(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(_=B.get(E.parentId)),_&&E.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),S=[],k=void 0;for(const[O,te]of B)if(te.parentId===t&&(S.push({id:O,position:{...te.position},extent:te.extent}),te.extent==="parent"||te.expandParent)){const se=coe(te,E,te.origin??C);k?k=[[Math.min(se[0][0],k[0][0]),Math.min(se[0][1],k[0][1])],[Math.max(se[1][0],k[1][0]),Math.max(se[1][1],k[1][1])]]:k=se}p==null||p(R,{...y})}).on("drag",R=>{const{transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F}=n(),C=Xp(R.sourceEvent,{transform:B,snapGrid:z,snapToGrid:L,containerBounds:w}),I=[];if(!E)return;const{x:D,y:$,width:O,height:te}=y,se={},P=E.origin??F,{width:Q,height:ee,x:V,y:X}=ooe(x,a.controlDirection,C,a.boundaries,a.keepAspectRatio,P,T,k),K=Q!==O,ce=ee!==te,he=V!==D&&K,be=X!==$&&ce;if(!he&&!be&&!K&&!ce)return;if((he||be||P[0]===1||P[1]===1)&&(se.x=he?V:y.x,se.y=be?X:y.y,y.x=se.x,y.y=se.y,S.length>0)){const Ne=V-D,ae=X-$;for(const me of S)me.position={x:me.position.x-Ne+P[0]*(Q-O),y:me.position.y-ae+P[1]*(ee-te)},I.push(me)}if((K||ce)&&(se.width=K&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Q:y.width,se.height=ce&&(!a.resizeDirection||a.resizeDirection==="vertical")?ee:y.height,y.width=se.width,y.height=se.height),_&&E.expandParent){const Ne=P[0]*(se.width??0);se.x&&se.x{A&&(b==null||b(R,{...y}),i==null||i({...y}),A=!1)});r.call(j)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var Z9={exports:{}},J9={},eU={exports:{}},tU={};/** +`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=s.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const Ote=255,Mte=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function Lte(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let s=0,i="";for(const r of t){if(!Mte.test(r))continue;const a=n.encode(r).byteLength;if(s+a>Ote)break;i+=r,s+=a}return i.replace(/ +/g," ").trimEnd()}const qR="ap-southeast-1",Jk="cn-beijing",qB="https://ark.ap-southeast.bytepluses.com/api/v3",e2="https://ark.cn-beijing.volces.com/api/v3/",YB="seed-2-0-lite-260228",t2="doubao-seed-2-1-pro-260628",Dte="skylark-embedding-vision-250615",Pte="doubao-embedding-vision-250615",Bte="seed-2-0-lite-260228",Ute="doubao-seed-2-0-lite-260428",WB=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],XB=[{value:qR,label:qR}];function wx(e){return e==="byteplus"?XB:WB}function ki(e){var t;return((t=wx(e)[0])==null?void 0:t.value)||Jk}function Tf(e,t){var s;return((s=(t?wx(t):[...WB,...XB]).find(i=>i.value===e))==null?void 0:s.label)||e||"-"}function i1(e){return e==="byteplus"?YB:t2}function r1(e){return e==="byteplus"?qB:e2}function Fte(e){return e==="byteplus"?Dte:Pte}function $te(e){return e==="byteplus"?Bte:Ute}const n2="veadk.messageFeedback.v1";function s2(e,t,n,s){return[e,t,n,s].join(":")}function i2(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(n2)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function Hte(e,t,n){if(typeof window>"u")return;const s=i2();s[e]={...s[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(n2,JSON.stringify(s))}function QB(e){if(typeof window>"u")return;const t=s2(e.runtimeId,e.appName,e.userId,e.sessionId),n=i2(),s=n[t];if(s){for(const i of e.eventIds)delete s[`veadk_feedback:${i}`];Object.keys(s).length===0?delete n[t]:n[t]=s,localStorage.setItem(n2,JSON.stringify(n))}}const Yb="",r2=new Map;function ZB(e,t){r2.set(e,t)}function JB(){r2.clear()}function ii(e){const t=r2.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function dt(e,t={},n={},s=xc){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...i?{method:"POST"}:{},headers:Ex(t.headers)},a=()=>{const u={...r,signal:Pn(t.signal,s)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(jn(`${Yb}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(jn(`${Yb}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(jn(`${Yb}${e}`),u)},l=async u=>{if(Nte(u))return!0;if(u.status!==401)return!1;try{return await vte()}catch{return!1}};let c=await a();for(;await l(c);)await Tte(t.signal),c=await a();return c}function e8(e,t={},n=xc){return dt(e,t,{},n)}function zte(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const s=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",i=String(t.msg??"");return s?`${s}: ${i}`:i}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Ht(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const s=JSON.parse(n);return zte(s.detail??s.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function t8(){const e=await dt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class ih extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Mr extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const n8="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",s8="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",YR=["cn-beijing","cn-shanghai"],Vte=3e4,_x=5*60*1e3,i8=60*1e3,Wb=new Map,Bc=new Map,Uc=new Map,Ia=new Map;function r8(e,t){return`${t}:${e}`}function rh(e){const t=e||Jk;return YR.includes(t)?[t,...YR.filter(n=>n!==t)]:[t]}function ah(...e){return e.map(t=>String(t??"")).join("")}function oh(e,t,n){const s=e.get(t);return s!=null&&s.value&&Date.now()-s.updatedAt<=n?s.value:null}function a2(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function a8(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Sx(e,t,n){const s=await dt("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await a8(s):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new ih;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new Mr(n8);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new Mr(s8);if(n!=null&&n.runtimeId&&s.status===404)throw new Mr("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Mr("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Ht(s,"读取 Agent 列表失败"));const r=await s.json();return n!=null&&n.runtimeId&&Wb.set(r8(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+Vte}),r}async function a1(e,t){const{app:n,ep:s}=ii(e),i=await dt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},s);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await Ht(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function o2(e,t){const{app:n,ep:s}=ii(e),i=await dt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},s);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function o1(e,t,n){const{app:s,ep:i}=ii(e),r=await dt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!r.ok){const l=await Ht(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(i.runtimeId){const l=s2(i.runtimeId,s,t,n);a.state={...i2()[l]??{},...a.state??{}}}return a}async function o8(e){const{app:t,ep:n}=ii(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const s=await dt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Eg);if(!s.ok)throw new Error(await Ht(s,"提交反馈失败"));const i=await s.json(),r=s2(n.runtimeId,t,e.userId,e.sessionId);return Hte(r,e.eventId,i),i}async function Nx(e,t={}){const n=ah(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),s=oh(Ia,n,i8);if(!t.force&&s)return s;const i=Ia.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let r=null;const a=(async()=>{for(const l of rh(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await dt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return a2(Ia,n,await u.json());r=new Error(await Ht(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();Ia.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=Ia.get(n);(l==null?void 0:l.promise)===a&&Ia.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function l8(e){let t=null;for(const n of rh(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await dt(`/web/evaluation/statuses?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Ht(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function c8(e){let t=null;for(const n of rh(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await dt(`/web/evaluation/optimizations?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Ht(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function u8(e){return oh(Ia,ah(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i8)}function LS(e){Nx(e).catch(()=>{})}function d8(e){Nx(e,{force:!0}).catch(()=>{})}function f8(e,t){return["good","bad"].map(n=>{const s=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(s==null?void 0:s.evaluationSetId)??null,evaluationSetName:(s==null?void 0:s.evaluationSetName)??null,workspaceId:(s==null?void 0:s.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function Xb(e){for(const[t,n]of Ia.entries()){const s=n.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const i=s.items.filter(a=>a.sessionId!==e.sessionId||a.messageId!==e.messageId),r=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:"",agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:""},...i]:i;Ia.set(t,{value:{...s,sets:f8(s.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function h8(e){let t=null;for(const n of rh(e.region)){const s=await dt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},Eg);if(s.ok){const i=await s.json(),r=new Set(e.itemIds);for(const[a,l]of Ia.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!r.has(d.id));Ia.set(a,{value:{...c,sets:f8(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await Ht(s,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function DS(e,t,n){const{app:s,ep:i}=ii(e),r=await dt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function Gte(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=window.atob(n),i=new Uint8Array(s.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function m8(e,t,n,s,i){const{app:r,ep:a}=ii(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(s)}${l}`,u=await dt(c,{},a,Eg);if(!u.ok)throw new Error(await Ht(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=Gte(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??s}}async function g8(e,t,n,s,i){const{blob:r}=await m8(e,t,n,s,i);return URL.createObjectURL(r)}async function Kte(e){const t=await dt("/web/media/capabilities");if(!t.ok)throw new Error(await Ht(t,"media capabilities failed"));return t.json()}async function b8(e,t,n,s){const{app:i}=ii(e),r=new FormData;r.set("app_name",i),r.set("user_id",t),r.set("session_id",n),r.set("file",s);const a=await dt("/web/media",{method:"POST",body:r},{},Eg);if(!a.ok)throw new Error(await Ht(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function PS(e,t,n){const{app:s}=ii(e),i=`/web/media/${encodeURIComponent(s)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await dt(i,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Ht(r,"media cleanup failed"))}function y8(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((s,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function Qb(e,t){const n=y8(t);if(!n)throw new Error("Invalid VeADK media URI");const s=await dt(`${n}/delete`,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await Ht(s,"media cleanup failed"))}function x8(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=y8(t);if(!n)return t;const s=`${n}/content`;return jn(`${Yb}${s}`)}async function l1(e,t,n){const{app:s,ep:i}=ii(e);let r;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),r=await dt(`/web/runtime-trace?${c.toString()}`),r.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else r=await dt(`/dev/apps/${encodeURIComponent(s)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!r.ok)throw new Error(await Ht(r,"加载调用链路失败"));const a=r.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await r.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function BS(e){const t=await dt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Ht(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function l2(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function c2(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function US(e,t,n){const{app:s,ep:i}=ii(e),r=await dt(c2(s,t,n),{},i);if(!r.ok)throw new Error(await Ht(r,"读取会话能力失败"));return l2(await r.json())}async function u2(e){const{ep:t}=ii(e),n=await dt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Ht(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(i=>{var r;return((r=i.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function qte(e){const{ep:t}=ii(e),n=await dt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Ht(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function Yte(e,t,n){const{ep:s}=ii(e),i=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${i.toString()}`,a=await dt(r,{},s);if(!a.ok)throw new Error(await Ht(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function E8(e,t,n=1,s=20){const{ep:i}=ii(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(s)}),a=await dt(`/harness/skills/findskill?${r.toString()}`,{},i);if(!a.ok)throw new Error(await Ht(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function FS(e,t,n,s,i){const{app:r,ep:a}=ii(e),l=await dt(c2(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:s.kind,name:s.name,skill_source_id:s.skillSourceId,description:s.description,version:s.version,expected_revision:i})},a);if(!l.ok)throw new Error(await Ht(l,"添加会话能力失败"));return l2(await l.json())}async function v8(e,t,n,s,i){const{app:r,ep:a}=ii(e),l=`${c2(r,t,n)}/${encodeURIComponent(s)}?expected_revision=${i}`,c=await dt(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await Ht(c,"移除会话能力失败"));return l2(await c.json())}async function w8(e,t,n=!0){const s=await dt(`/web/agent-info/${e}`,{},t);if(!s.ok)throw new Error(`agent-info failed: ${s.status}`);const i=await s.json();if(n&&!i.draft)try{const r=await dt(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function d2(e){const{app:t,ep:n}=ii(e);return w8(t,n,!1)}async function Wte(e,t,n){let s=null;for(const i of rh(t)){const r={runtimeId:e,region:i};try{const a=r8(e,i),l=Wb.get(a);l&&l.expiresAt<=Date.now()&&Wb.delete(a);const c=Wb.get(a),u=n||(c==null?void 0:c.apps[0])||(await Sx("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return w8(u,r)}catch(a){if(a instanceof ih||a instanceof Mr&&!a.unsupported)throw a;s=a instanceof Error?a:new Error(String(a))}}throw s??new Error("该 Runtime 未提供可预览的 Agent。")}async function c1(e,t,n={},s={}){const i=typeof n=="string"?n:void 0,r=typeof n=="string"?s:n,a=ah(e,t||"cn-beijing",i??""),l=oh(Bc,a,_x);if(!r.force&&l)return l;const c=Bc.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=Wte(e,t,i).then(d=>a2(Bc,a,d));Bc.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Bc.get(a);(d==null?void 0:d.promise)===u&&Bc.set(a,{value:d.value,updatedAt:d.updatedAt})}}function _8(e,t,n=""){return oh(Bc,ah(e,t||"cn-beijing",n),_x)}function S8(e,t,n=""){c1(e,t,n).catch(()=>{})}async function N8(e,t,n,s){const{app:i,ep:r}=ii(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:s}),l=await dt(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await Ht(l,"Agent 检索失败"));return l.json()}async function T8(e,t){const{app:n}=ii(e),s=await dt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!s.ok)throw new Error(`web search failed: ${s.status}`);return s.json()}async function*jm({appName:e,userId:t,sessionId:n,text:s,attachments:i=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=ii(e),f=i.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...s.trim()?[{text:s}]:[]];if(h&&p.length>0){const b=p[0],v=b.partMetadata;p[0]={...b,partMetadata:{...v,veadkInvocation:h}}}const m=await dt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:l},d,0);if(!m.ok){const b=await Ht(m,"运行会话失败");throw new Error(G0(`run_sse failed: ${m.status}:${b}`))}for await(const b of Zk(m)){const v=b;typeof v.error=="string"&&(v.error=G0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=G0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=G0(v.error_message)),yield v}}async function k8(e){const t=await dt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Ht(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(s=>{if(!s||typeof s!="object"||typeof s.uid!="string"||typeof s.name!="string"||typeof s.domain!="string"||typeof s.region!="string"||typeof s.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return s})}const Yp=new Map;async function vg(e,t,n,s){var u,d,f;const i=s==null?void 0:s.taskId,r=i?new AbortController:void 0;i&&r&&Yp.set(i,r);const a=()=>{i&&Yp.get(i)===r&&Yp.delete(i)};let l;try{(u=s==null?void 0:s.onStage)==null||u.call(s,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await dt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:r==null?void 0:r.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:i,runtimeId:s==null?void 0:s.runtimeId,appName:s==null?void 0:s.appName,sessionStorage:s==null?void 0:s.sessionStorage,minInstance:s==null?void 0:s.minInstance,maxInstance:s==null?void 0:s.maxInstance,createEvaluationSets:s==null?void 0:s.createEvaluationSets,description:Lte((s==null?void 0:s.description)??""),authentication:s==null?void 0:s.authentication,im:s==null?void 0:s.im,envs:s==null?void 0:s.envs})},{},0),(d=s==null?void 0:s.onStage)==null||d.call(s,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await Ht(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of Zk(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=s==null?void 0:s.onStage)==null||f.call(s,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function A8(e){var n;const t=await dt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const s=await t.text().catch(()=>"");throw new Error(s||`取消部署失败 (${t.status})`)}(n=Yp.get(e))==null||n.abort(),Yp.delete(e)}async function Xte(e=Jk){const t=await dt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Rm={title:"AgentKit Studio",logoUrl:""},Zb={enabled:!1},Qv={studio:!1,version:"",provider:"volcengine",branding:Rm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:Zb};function Qte(e){if(!e||typeof e!="object")return Zb;const t=e;if(!t.enabled)return Zb;const n=t.apmplus;if(!n||typeof n.aid!="number"||!Number.isFinite(n.aid)||typeof n.token!="string"||!n.token)return Zb;const s=t.studio??{};return{enabled:!0,provider:t.provider==="apmplus"?"apmplus":void 0,apmplus:{aid:n.aid,token:n.token,domain:typeof n.domain=="string"&&n.domain?n.domain:"apmplus.volces.com",env:typeof n.env=="string"&&n.env?n.env:"production"},studio:{deployId:typeof s.deployId=="string"?s.deployId:"",userPoolId:typeof s.userPoolId=="string"?s.userPoolId:"",applicationId:typeof s.applicationId=="string"?s.applicationId:"",functionId:typeof s.functionId=="string"?s.functionId:"",region:typeof s.region=="string"?s.region:"",project:typeof s.project=="string"?s.project:"",version:typeof s.version=="string"?s.version:""}}}async function C8(){var e,t;try{const n=await dt("/web/ui-config");if(!n.ok)return Qv;const s=await n.json(),i=typeof((e=s.branding)==null?void 0:e.logoUrl)=="string"?s.branding.logoUrl:Rm.logoUrl;return{studio:s.studio??!1,version:typeof s.version=="string"?s.version:"",provider:s.provider==="byteplus"?"byteplus":"volcengine",branding:{title:typeof((t=s.branding)==null?void 0:t.title)=="string"?s.branding.title:Rm.title,logoUrl:i?jn(i):""},features:{...Qv.features,...s.features??{}},defaultView:s.defaultView??"chat",agentsSource:s.agentsSource==="cloud"?"cloud":"local",telemetry:Qte(s.telemetry)}}catch{return Qv}}const I8={role:"user",telemetry:{userId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function j8(){var n,s,i,r;const e=await dt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||typeof((s=t.capabilities)==null?void 0:s.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((r=t.capabilities)==null?void 0:r.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function R8(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const s=n.size?`?${n.toString()}`:"",i=await dt(`/web/studio-update${s}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function O8(e){const t=await dt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Eg);if(!t.ok){let n="";try{const s=await t.json();n=typeof s.detail=="string"?s.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function Tx(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await dt(`/web/runtimes?${t.toString()}`);if(!n.ok){const i=await Ht(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(i===`加载 Runtime 失败 (${n.status})`?r:`${r}:${i}`)}const s=await n.json();return{runtimes:s.runtimes??[],nextToken:s.nextToken??""}}async function f2(e,t,n={}){try{const s={runtimeId:e,region:t};return n.retryProbe&&(s.retryProbe=!0),await Sx("","",s)}catch(s){if(s instanceof ih||s instanceof Mr)throw s;return null}}async function M8(e,t,n={}){const s={runtimeId:e,region:t};n.retryProbe&&(s.retryProbe=!0);const i=await dt("/.well-known/agent-card.json",{},s),r=await a8(i);if(r==="runtime_access_denied")throw new ih;if(r==="runtime_private_endpoint_unreachable")throw new Mr(n8);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new Mr(s8);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Mr("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Ht(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function L8(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),s=await dt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!s.ok)throw new Error(await Ht(s,"读取 Runtime API Key 失败"));const i=await s.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function D8(e,t){const n=await dt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(s||`删除失败 (${n.status})`)}}async function P8({runtimeId:e,region:t,signal:n}){const s=new URLSearchParams({runtimeId:e,region:t}),i=await dt(`/web/runtime-update-capability?${s.toString()}`,{signal:n});if(!i.ok)throw new Error(await Ht(i,"检查 Runtime 更新能力失败"));return await i.json()}async function Zte(e,t){let n=null;for(const s of rh(t)){const i=await dt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(s)}`);if(i.ok)return i.json();n=new Error(await Ht(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function h2(e,t="cn-beijing",n={}){const s=ah(e,t||"cn-beijing"),i=oh(Uc,s,_x);if(!n.force&&i)return i;const r=Uc.get(s);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=Zte(e,t).then(l=>a2(Uc,s,l));Uc.set(s,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Uc.get(s);(l==null?void 0:l.promise)===a&&Uc.set(s,{value:l.value,updatedAt:l.updatedAt})}}function B8(e,t="cn-beijing"){return oh(Uc,ah(e,t||"cn-beijing"),_x)}function U8(e,t="cn-beijing"){h2(e,t).catch(()=>{})}async function kx(e){const t=await dt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Ht(t,"生成项目失败"));return t.json()}const Jte=19e4;async function F8(e){const t=await dt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},Jte);if(!t.ok)throw new Error(await Ht(t,"生成 Agent 配置失败"));return vx(t,"生成 Agent 配置失败")}async function $8(e,t){const n=await dt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await Ht(n,"创建调试运行失败"));return vx(n,"创建调试运行失败")}async function H8(e,t){const n=await dt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await Ht(n,"创建调试会话失败"));return(await vx(n,"创建调试会话失败")).id}async function z8(e,t){const n=await dt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Ht(n,"加载调试调用链路失败"));const s=await vx(n,"加载调试调用链路失败");if(!Array.isArray(s))throw new Error("加载调试调用链路失败:返回格式无效");return s}async function*V8({runId:e,userId:t,sessionId:n,text:s,signal:i}){const r=s.trim()?[{text:s}]:[],a=await dt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:r},streaming:!0}),signal:i},{},0);if(!a.ok)throw new Error(await Ht(a,"调试运行失败"));for await(const l of Zk(a))yield l}async function gd(e){const t=await dt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Ht(t,"清理调试运行失败"))}const ene=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Rm,DEFAULT_STUDIO_ACCESS:I8,RuntimeAccessDeniedError:ih,RuntimeProbeError:Mr,addSessionCapability:FS,cancelAgentkitDeployment:A8,clearMessageFeedbackCache:QB,clearRemoteApps:JB,componentSearch:N8,createGeneratedAgentTestRun:$8,createGeneratedAgentTestSession:H8,createSession:a1,deleteAgentFeedbackCases:h8,deleteGeneratedAgentTestRun:gd,deleteMedia:Qb,deleteRuntime:D8,deleteSession:DS,deleteSessionMedia:PS,deployAgentkitProject:vg,downloadArtifact:p8,fetchRemoteApps:Sx,generateAgentDraftFromRequirement:F8,generateAgentProject:kx,getAgentFeedbackCases:Nx,getAgentInfo:d2,getAgentOptimizations:c8,getAutomaticEvaluationStatuses:l8,getCachedAgentFeedbackCases:u8,getCachedRuntimeAgentInfo:_8,getCachedRuntimeDetail:B8,getGeneratedAgentTestTrace:z8,getMediaCapabilities:Kte,getMyRuntimes:Xte,getRuntimeAgentInfo:c1,getRuntimeDetail:h2,getRuntimeUpdateCapability:P8,getRuntimes:Tx,getSession:o1,getSessionCapabilities:US,getSessionTrace:l1,getStudioAccess:j8,getStudioUpdateStatus:R8,getUiConfig:C8,listApps:t8,listIdentityUserPools:k8,listSessionBuiltinTools:u2,listSessionSkillSpaces:qte,listSessionSkillsInSpace:Yte,listSessions:o2,mediaContentUrl:x8,prefetchAgentFeedbackCases:LS,prefetchRuntimeAgentInfo:S8,prefetchRuntimeDetail:U8,previewArtifact:g8,probeRuntimeA2a:M8,probeRuntimeApps:f2,refreshAgentFeedbackCases:d8,registerRemoteApp:ZB,removeSessionCapability:v8,revealRuntimeApiKey:L8,runGeneratedAgentTestSSE:V8,runSSE:jm,searchSessionPublicSkills:E8,startStudioUpdate:O8,studioFetch:e8,submitIssueFeedback:BS,submitMessageFeedback:o8,uploadMedia:b8,upsertCachedAgentFeedbackCase:Xb,webSearch:T8},Symbol.toStringTag,{value:"Module"}));function WR(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function tne(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function nne(e,t){if(!t)return e;const n=new Set(e.filter(i=>tne(i)===t).map(i=>i.trace_id)),s=e.filter(i=>n.has(i.trace_id));return s.length>0?s:e}function Zv(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const sne="send_a2ui_json_to_client",ine="validated_a2ui_json",$S="adk_request_credential",XR="transfer_to_agent";function rne(e){var s,i,r,a;const t=e,n=((s=t==null?void 0:t.exchangedAuthCredential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.rawAuthCredential)==null?void 0:r.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function Ma(){return{blocks:[],liveStart:0}}const QR=e=>e.functionCall??e.function_call,HS=e=>e.functionResponse??e.function_response;function ane(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function one(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function G8(e){const t=[];for(const[n,s]of e.entries()){const i=s.partMetadata??s.part_metadata,r=i==null?void 0:i.veadkTransport;if((r==null?void 0:r.hidden)===!0)continue;const a=i==null?void 0:i.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const l=s.inlineData??s.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:one(l.data),name:l.displayName??l.display_name});continue}const c=s.fileData??s.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function zS(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const lne=new Set(["llm","sequential","parallel","loop","a2a"]);function cne(e){var t;for(const n of e){const s=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.skills)?i.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&lne.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(r.length>0||a)return{skills:r,targetAgent:a}}}function une(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function dne(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const s of t)n.files.some(i=>i.filename===s.filename&&i.version===s.version)||n.files.push(s);return}e.push({kind:"artifact",files:t})}function ZR(e,t,n){const s=e[e.length-1];s&&s.kind===t?s.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function K0(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function kf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let s=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],r=i.some(p=>QR(p)||HS(p));if(t.partial&&!r){for(const p of i){const m=zS(p);typeof m=="string"&&m&&ZR(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:s}}n.length=s;for(const p of i){const m=QR(p),b=HS(p),v=G8([p]),y=zS(p);if(typeof y=="string"&&y)ZR(n,p.thought?"thinking":"text",y);else if(v.length)K0(n),une(n,v);else if(m)if(K0(n),m.name===XR){const x=ane(m.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(m.name===$S){const x=m.args??{},E=x.authConfig??x.auth_config??x,S=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:S,authUri:rne(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(b){if(K0(n),b.name===XR)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(b.name===$S)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="tool"&&!E.done&&E.name===b.name){E.done=!0,E.response=b.response;break}}if(b.name===sne){const x=((d=b.response)==null?void 0:d[ine])??[];if(x.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&dne(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),K0(n),s=n.length,{blocks:n,liveStart:s}}function fne(e,t={}){var i,r;const n=[];let s=Ma();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var m;return((m=HS(p))==null?void 0:m.name)===$S})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const b=n[p].blocks[m];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(zS).filter(p=>!!p).join(""),d=G8(c),f=cne(c);if(!u&&!d.length&&!f){s=Ma();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),s=Ma()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((r=u.meta)==null?void 0:r.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),s=Ma()),s=kf(s,a),u.blocks=s.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const l=a.meta,c=l==null?void 0:l.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(l.feedback=u)}return n}function hne(e){var t,n;for(const s of e??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"新会话"}const pne=50,JR=48;function mne(e){return(e.events??[]).flatMap(t=>{var i,r;const s=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return s?[{text:s,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function gne(e){var t,n;for(const s of e.events??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"未命名会话"}function bne(e,t,n){const s=Math.max(0,t-JR),i=Math.min(e.length,t+n+JR);return(s>0?"…":"")+e.slice(s,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await o1(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of mne(l)){const f=c.toLowerCase().indexOf(s);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:gne(l),snippet:bne(c,f,s.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,pne)}async function xne(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await T8(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:s,results:i,error:r}=n;return s?r?{results:[],note:r}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Ene(e,t,n,s){if(!t||!s.trim())return{results:[]};const i=await N8(t,e,s.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const r=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function vne(e,t,n){return e==="session"?{results:await yne(n.userId,n.appId,t)}:e==="web"?xne(n.appId,t):Ene(e,n.appId,n.userId,t)}function K8({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function wne({open:e}){return o.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function _ne({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx(K8,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Sne(e,t,n){const s=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),r=a=>s?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:s,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:s&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:s&&i.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:s&&i.has("memory"),unavailableLabel:r("长期记忆")}]}function u1(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function eO(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function Nne({userId:e,appId:t,agentInfo:n,capabilitiesLoading:s,agentLabel:i,onOpenSession:r}){var F,C;const[a,l]=g.useState("session"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(!1),w=g.useRef(0),S=g.useRef(null),_=Sne(t,n,s),T=_.find(I=>I.id===a),k=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):a==="memory"?(C=n==null?void 0:n.components)==null?void 0:C.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;g.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),b(!1),E(!1)},[t]),g.useEffect(()=>{if(!x)return;function I(D){var $;($=S.current)!=null&&$.contains(D.target)||E(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[x]);async function A(I,D){var se;const $=I.trim();if(!$||!((se=_.find(P=>P.id===D))!=null&&se.ready))return;const O=++w.current;b(!0),y(!0);let ne;try{ne=await vne(D,$,{userId:e,appId:t})}catch(P){const Z=P instanceof Error?P.message:String(P);ne={results:[],note:`搜索失败:${Z}`}}O===w.current&&(f(ne.results),p(ne.note),b(!1))}function j(I){w.current+=1,u(I),f([]),p(void 0),y(!1),b(!1)}function R(I){w.current+=1,l(I),E(!1),f([]),p(void 0),y(!1),b(!1)}const B=!!(T!=null&&T.ready),z=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(k==null?void 0:k.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(k==null?void 0:k.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=k!=null&&k.backend?u1(k.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:S,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(T==null?void 0:T.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>E(I=>!I),children:[o.jsx("span",{children:(T==null?void 0:T.label)??"搜索类型"}),L&&o.jsx("small",{children:L}),o.jsx(wne,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:_.map(I=>{var O,ne;const D=I.id==="knowledge"?(O=n==null?void 0:n.components)==null?void 0:O.find(se=>se.source==="knowledgebase"||se.kind==="knowledgebase"):I.id==="memory"?(ne=n==null?void 0:n.components)==null?void 0:ne.find(se=>se.source==="long_term_memory"||se.kind==="memory"):void 0,$=D?[D.name,D.backend?u1(D.backend):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===I.id,disabled:!I.ready,onClick:()=>R(I.id),children:[o.jsx("span",{children:I.label}),$&&o.jsx("small",{children:$})]},I.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:I=>j(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A(c,a))},placeholder:z,disabled:!B,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(gn,{className:"icon spin"}):o.jsx(K8,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:B?v?m?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&v?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((I,D)=>o.jsx(Tne,{result:I,agentLabel:i,onOpen:r},D)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?s?"正在读取当前 Agent 的检索能力…":(T==null?void 0:T.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Tne({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(zB,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${eO(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(xx,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(Im,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(tO,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${u1(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(tO,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${u1(e.sourceType)}`:"",e.ts?` · ${eO(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function tO({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function iu({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function kne({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Ane({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function q8(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const p2="/assets/logo-DCsNZy-k.svg",m2="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",nO="(max-width: 860px)";function Cne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Ine(e){let t=2166136261;for(const s of e)t^=s.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const jne={admin:"管理员",developer:"开发者",user:"普通用户"};function sO({role:e}){const t=jne[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Rne({version:e,onClose:t}){return g.useEffect(()=>{const n=s=>{s.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),wi.createPortal(o.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:o.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[o.jsxs("header",{className:"system-info-head",children:[o.jsx("h2",{id:"system-info-title",children:"系统信息"}),o.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:o.jsx(Mi,{className:"icon","aria-hidden":"true"})})]}),o.jsx("dl",{className:"system-info-meta",children:o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function One({access:e,userInfo:t,version:n,onLogout:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState("");if(!t)return null;const d=_te(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Ine(d||f||h),m=Ste(t),b=m===c?"":m;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>r(v=>!v),title:f?`${d} +${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:d}),o.jsx(sO,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>r(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:d}),o.jsx(sO,{role:e.role})]}),f&&f!==d&&o.jsx("div",{className:"account-sub",children:f})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),l(!0)},children:[o.jsx(yc,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),s()},children:[o.jsx(Yee,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(Rne,{version:n,onClose:()=>l(!1)}):null]})}function Mne({branding:e,cloudProvider:t,sessions:n,currentSessionId:s,activePage:i,features:r,access:a,streamingSids:l,evaluatingSids:c,onNewChat:u,onSearch:d,onQuickCreate:f,onSkillCenter:h,onAddAgent:p,onMyAgents:m,onApplications:b,onIssueFeedback:v,onPickSession:y,onDeleteSession:x,userInfo:E,version:w,onLogout:S}){const _=F=>(r==null?void 0:r[F])!==!1,[T,k]=g.useState(null),A=g.useRef(typeof window<"u"&&window.matchMedia(nO).matches),[j,R]=g.useState(A.current),B=[...n].sort((F,C)=>(C.lastUpdateTime??0)-(F.lastUpdateTime??0)),z=()=>{A.current=!1,R(F=>!F),k(null)};g.useEffect(()=>{const F=window.matchMedia(nO),C=I=>{I.matches?R(D=>D||(A.current=!0,!0)):A.current&&(A.current=!1,R(!1))};return F.addEventListener("change",C),()=>F.removeEventListener("change",C)},[]);const L=t==="byteplus"?m2:p2;return o.jsxs("aside",{className:`sidebar ${j?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:u,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||L,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:z,"aria-label":j?"展开侧边栏":"收起侧边栏",title:j?"展开侧边栏":"收起侧边栏",children:j?o.jsx(nte,{className:"icon"}):o.jsx(tte,{className:"icon"})})]}),_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:u,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(Ri,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:m,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(iu,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),_("search")&&o.jsx(_ne,{active:i==="search",onClick:d}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:b,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(Cne,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),o.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),_("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:u,"aria-label":"新建会话",title:"新建会话",children:o.jsx(Ri,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[B.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),B.map(F=>{const C=hne(F.events),I=(l==null?void 0:l.has(F.id))===!0,D=!I&&(c==null?void 0:c.has(F.id))===!0;return o.jsxs("div",{className:`history-item ${F.id===s?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>y(F.id),"aria-current":F.id===s?"page":void 0,title:C,children:[I&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:C}),D&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>k($=>$===F.id?null:F.id),children:o.jsx(Oee,{className:"icon"})}),T===F.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>k(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{k(null),x(F.id)},children:[o.jsx(fc,{className:"icon"})," 删除"]})})]})]},F.id)})]})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsxs("button",{type:"button",className:`sidebar-feedback${i==="feedback"?" is-active":""}`,onClick:v,"aria-label":"问题反馈","aria-current":i==="feedback"?"page":void 0,title:"问题反馈",children:[o.jsx(q8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),o.jsx(One,{access:a,userInfo:E,version:w,onLogout:S})]})]})}function ri(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n{}};function Ax(){for(var e=0,t=arguments.length,n={},s;e=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Jb.prototype=Ax.prototype={constructor:Jb,on:function(e,t){var n=this._,s=Dne(e+"",n),i,r=-1,a=s.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),s=0,i,r;s=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),rO.hasOwnProperty(t)?{space:rO[t],local:e}:e}function Bne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===VS&&t.documentElement.namespaceURI===VS?t.createElement(e):t.createElementNS(n,e)}}function Une(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Y8(e){var t=Cx(e);return(t.local?Une:Bne)(t)}function Fne(){}function g2(e){return e==null?Fne:function(){return this.querySelector(e)}}function $ne(e){typeof e!="function"&&(e=g2(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i=E&&(E=x+1);!(S=v[E])&&++E=0;)(a=s[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function fse(e){e||(e=hse);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,s=n.length,i=new Array(s),r=0;rt?1:e>=t?0:NaN}function pse(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mse(){return Array.from(this)}function gse(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?kse:typeof t=="function"?Cse:Ase)(e,t,n??"")):Af(this.node(),e)}function Af(e,t){return e.style.getPropertyValue(t)||J8(e).getComputedStyle(e,null).getPropertyValue(t)}function jse(e){return function(){delete this[e]}}function Rse(e,t){return function(){this[e]=t}}function Ose(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Mse(e,t){return arguments.length>1?this.each((t==null?jse:typeof t=="function"?Ose:Rse)(e,t)):this.node()[e]}function e9(e){return e.trim().split(/^|\s+/)}function b2(e){return e.classList||new t9(e)}function t9(e){this._node=e,this._names=e9(e.getAttribute("class")||"")}t9.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function n9(e,t){for(var n=b2(e),s=-1,i=t.length;++s=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function lie(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,r;n()=>e;function GS(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:r,x:a,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}GS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yie(e){return!e.ctrlKey&&!e.button}function xie(){return this.parentNode}function Eie(e,t){return t??{x:e.x,y:e.y}}function vie(){return navigator.maxTouchPoints||"ontouchstart"in this}function l9(){var e=yie,t=xie,n=Eie,s=vie,i={},r=Ax("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(s).on("touchstart.drag",v).on("touchmove.drag",y,bie).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,S){if(!(d||!e.call(this,w,S))){var _=E(this,t.call(this,w,S),w,S,"mouse");_&&(Rr(w.view).on("mousemove.drag",m,Om).on("mouseup.drag",b,Om),a9(w.view),Jv(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}function m(w){if(sf(w),!u){var S=w.clientX-l,_=w.clientY-c;u=S*S+_*_>f}i.mouse("drag",w)}function b(w){Rr(w.view).on("mousemove.drag mouseup.drag",null),o9(w.view,u),sf(w),i.mouse("end",w)}function v(w,S){if(e.call(this,w,S)){var _=w.changedTouches,T=t.call(this,w,S),k=_.length,A,j;for(A=0;A>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Y0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Y0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_ie.exec(e))?new mr(t[1],t[2],t[3],1):(t=Sie.exec(e))?new mr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nie.exec(e))?Y0(t[1],t[2],t[3],t[4]):(t=Tie.exec(e))?Y0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kie.exec(e))?fO(t[1],t[2]/100,t[3]/100,1):(t=Aie.exec(e))?fO(t[1],t[2]/100,t[3]/100,t[4]):aO.hasOwnProperty(e)?cO(aO[e]):e==="transparent"?new mr(NaN,NaN,NaN,0):null}function cO(e){return new mr(e>>16&255,e>>8&255,e&255,1)}function Y0(e,t,n,s){return s<=0&&(e=t=n=NaN),new mr(e,t,n,s)}function jie(e){return e instanceof _g||(e=bu(e)),e?(e=e.rgb(),new mr(e.r,e.g,e.b,e.opacity)):new mr}function KS(e,t,n,s){return arguments.length===1?jie(e):new mr(e,t,n,s??1)}function mr(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}y2(mr,KS,c9(_g,{brighter(e){return e=e==null?f1:Math.pow(f1,e),new mr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mm:Math.pow(Mm,e),new mr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mr(ru(this.r),ru(this.g),ru(this.b),h1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:uO,formatHex:uO,formatHex8:Rie,formatRgb:dO,toString:dO}));function uO(){return`#${Kc(this.r)}${Kc(this.g)}${Kc(this.b)}`}function Rie(){return`#${Kc(this.r)}${Kc(this.g)}${Kc(this.b)}${Kc((isNaN(this.opacity)?1:this.opacity)*255)}`}function dO(){const e=h1(this.opacity);return`${e===1?"rgb(":"rgba("}${ru(this.r)}, ${ru(this.g)}, ${ru(this.b)}${e===1?")":`, ${e})`}`}function h1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ru(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kc(e){return e=ru(e),(e<16?"0":"")+e.toString(16)}function fO(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Oa(e,t,n,s)}function u9(e){if(e instanceof Oa)return new Oa(e.h,e.s,e.l,e.opacity);if(e instanceof _g||(e=bu(e)),!e)return new Oa;if(e instanceof Oa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),r=Math.max(t,n,s),a=NaN,l=r-i,c=(r+i)/2;return l?(t===r?a=(n-s)/l+(n0&&c<1?0:a,new Oa(a,l,c,e.opacity)}function Oie(e,t,n,s){return arguments.length===1?u9(e):new Oa(e,t,n,s??1)}function Oa(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}y2(Oa,Oie,c9(_g,{brighter(e){return e=e==null?f1:Math.pow(f1,e),new Oa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mm:Math.pow(Mm,e),new Oa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new mr(ew(e>=240?e-240:e+120,i,s),ew(e,i,s),ew(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new Oa(hO(this.h),W0(this.s),W0(this.l),h1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=h1(this.opacity);return`${e===1?"hsl(":"hsla("}${hO(this.h)}, ${W0(this.s)*100}%, ${W0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hO(e){return e=(e||0)%360,e<0?e+360:e}function W0(e){return Math.max(0,Math.min(1,e||0))}function ew(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const x2=e=>()=>e;function Mie(e,t){return function(n){return e+n*t}}function Lie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function Die(e){return(e=+e)==1?d9:function(t,n){return n-t?Lie(t,n,e):x2(isNaN(t)?n:t)}}function d9(e,t){var n=t-e;return n?Mie(e,n):x2(isNaN(e)?t:e)}const p1=function e(t){var n=Die(t);function s(i,r){var a=n((i=KS(i)).r,(r=KS(r)).r),l=n(i.g,r.g),c=n(i.b,r.b),u=d9(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return s.gamma=e,s}(1);function Pie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(r){for(i=0;in&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(s=s[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:so(s,i)})),n=tw.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,s)-2,x:so(u,d)})):d&&f.push(i(f)+"rotate("+d+s)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,s)-2,x:so(u,d)}):d&&f.push(i(f)+"skewX("+d+s)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var b=p.push(i(p)+"scale(",null,",",null,")");m.push({i:b-4,x:so(u,f)},{i:b-2,x:so(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),r(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,b=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--Cf}function gO(){yu=(g1=Dm.now())+Ix,Cf=yp=0;try{Zie()}finally{Cf=0,ere(),yu=0}}function Jie(){var e=Dm.now(),t=e-g1;t>m9&&(Ix-=t,g1=e)}function ere(){for(var e,t=m1,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:m1=n);xp=e,WS(s)}function WS(e){if(!Cf){yp&&(yp=clearTimeout(yp));var t=e-yu;t>24?(e<1/0&&(yp=setTimeout(gO,e-Dm.now()-Ix)),qh&&(qh=clearInterval(qh))):(qh||(g1=Dm.now(),qh=setInterval(Jie,m9)),Cf=1,g9(gO))}}function bO(e,t,n){var s=new b1;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var tre=Ax("start","end","cancel","interrupt"),nre=[],y9=0,yO=1,XS=2,ty=3,xO=4,QS=5,ny=6;function jx(e,t,n,s,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;sre(e,n,{name:t,index:s,group:i,on:tre,tween:nre,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:y9})}function v2(e,t){var n=Va(e,t);if(n.state>y9)throw new Error("too late; already scheduled");return n}function yo(e,t){var n=Va(e,t);if(n.state>ty)throw new Error("too late; already running");return n}function Va(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function sre(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=b9(r,0,n.time);function r(u){n.state=yO,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==yO)return c();for(d in s)if(p=s[d],p.name===n.name){if(p.state===ty)return bO(a);p.state===xO?(p.state=ny,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete s[d]):+dXS&&s.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Ore(e,t,n){var s,i,r=Rre(t)?v2:yo;return function(){var a=r(this,e),l=a.on;l!==s&&(i=(s=l).copy()).on(t,n),a.on=i}}function Mre(e,t){var n=this._id;return arguments.length<2?Va(this.node(),n).on.on(e):this.each(Ore(n,e,t))}function Lre(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Dre(){return this.on("end.remove",Lre(this._id))}function Pre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=g2(e));for(var s=this._groups,i=s.length,r=new Array(i),a=0;a()=>e;function lae(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Yo(e,t,n){this.k=e,this.x=t,this.y=n}Yo.prototype={constructor:Yo,scale:function(e){return e===1?this:new Yo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Rx=new Yo(1,0,0);w9.prototype=Yo.prototype;function w9(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rx;return e.__zoom}function nw(e){e.stopImmediatePropagation()}function Yh(e){e.preventDefault(),e.stopImmediatePropagation()}function cae(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function uae(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function EO(){return this.__zoom||Rx}function dae(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fae(){return navigator.maxTouchPoints||"ontouchstart"in this}function hae(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function _9(){var e=cae,t=uae,n=hae,s=dae,i=fae,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ey,u=Ax("start","zoom","end"),d,f,h,p=500,m=150,b=0,v=10;function y(L){L.property("__zoom",EO).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",j).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(L,F,C,I){var D=L.selection?L.selection():L;D.property("__zoom",EO),L!==D?S(L,F,C,I):D.interrupt().each(function(){_(this,arguments).event(I).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(L,F,C,I){y.scaleTo(L,function(){var D=this.__zoom.k,$=typeof F=="function"?F.apply(this,arguments):F;return D*$},C,I)},y.scaleTo=function(L,F,C,I){y.transform(L,function(){var D=t.apply(this,arguments),$=this.__zoom,O=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,ne=$.invert(O),se=typeof F=="function"?F.apply(this,arguments):F;return n(E(x($,se),O,ne),D,a)},C,I)},y.translateBy=function(L,F,C,I){y.transform(L,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},y.translateTo=function(L,F,C,I,D){y.transform(L,function(){var $=t.apply(this,arguments),O=this.__zoom,ne=I==null?w($):typeof I=="function"?I.apply(this,arguments):I;return n(Rx.translate(ne[0],ne[1]).scale(O.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof C=="function"?-C.apply(this,arguments):-C),$,a)},I,D)};function x(L,F){return F=Math.max(r[0],Math.min(r[1],F)),F===L.k?L:new Yo(F,L.x,L.y)}function E(L,F,C){var I=F[0]-C[0]*L.k,D=F[1]-C[1]*L.k;return I===L.x&&D===L.y?L:new Yo(L.k,I,D)}function w(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function S(L,F,C,I){L.on("start.zoom",function(){_(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(I).end()}).tween("zoom",function(){var D=this,$=arguments,O=_(D,$).event(I),ne=t.apply(D,$),se=C==null?w(ne):typeof C=="function"?C.apply(D,$):C,P=Math.max(ne[1][0]-ne[0][0],ne[1][1]-ne[0][1]),Z=D.__zoom,te=typeof F=="function"?F.apply(D,$):F,V=c(Z.invert(se).concat(P/Z.k),te.invert(se).concat(P/te.k));return function(Q){if(Q===1)Q=te;else{var K=V(Q),ce=P/K[2];Q=new Yo(ce,se[0]-K[0]*ce,se[1]-K[1]*ce)}O.zoom(null,Q)}})}function _(L,F,C){return!C&&L.__zooming||new T(L,F)}function T(L,F){this.that=L,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,F),this.taps=0}T.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,F){return this.mouse&&L!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var F=Rr(this.that).datum();u.call(L,this.that,new lae(L,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function k(L,...F){if(!e.apply(this,arguments))return;var C=_(this,F).event(L),I=this.__zoom,D=Math.max(r[0],Math.min(r[1],I.k*Math.pow(2,s.apply(this,arguments)))),$=Ca(L);if(C.wheel)(C.mouse[0][0]!==$[0]||C.mouse[0][1]!==$[1])&&(C.mouse[1]=I.invert(C.mouse[0]=$)),clearTimeout(C.wheel);else{if(I.k===D)return;C.mouse=[$,I.invert($)],sy(this),C.start()}Yh(L),C.wheel=setTimeout(O,m),C.zoom("mouse",n(E(x(I,D),C.mouse[0],C.mouse[1]),C.extent,a));function O(){C.wheel=null,C.end()}}function A(L,...F){if(h||!e.apply(this,arguments))return;var C=L.currentTarget,I=_(this,F,!0).event(L),D=Rr(L.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",P,!0),$=Ca(L,C),O=L.clientX,ne=L.clientY;a9(L.view),nw(L),I.mouse=[$,this.__zoom.invert($)],sy(this),I.start();function se(Z){if(Yh(Z),!I.moved){var te=Z.clientX-O,V=Z.clientY-ne;I.moved=te*te+V*V>b}I.event(Z).zoom("mouse",n(E(I.that.__zoom,I.mouse[0]=Ca(Z,C),I.mouse[1]),I.extent,a))}function P(Z){D.on("mousemove.zoom mouseup.zoom",null),o9(Z.view,I.moved),Yh(Z),I.event(Z).end()}}function j(L,...F){if(e.apply(this,arguments)){var C=this.__zoom,I=Ca(L.changedTouches?L.changedTouches[0]:L,this),D=C.invert(I),$=C.k*(L.shiftKey?.5:2),O=n(E(x(C,$),I,D),t.apply(this,F),a);Yh(L),l>0?Rr(this).transition().duration(l).call(S,O,I,L):Rr(this).call(y.transform,O,I,L)}}function R(L,...F){if(e.apply(this,arguments)){var C=L.touches,I=C.length,D=_(this,F,L.changedTouches.length===I).event(L),$,O,ne,se;for(nw(L),O=0;O`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Pm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],S9=["Enter"," ","Escape"],N9={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var If;(function(e){e.Strict="strict",e.Loose="loose"})(If||(If={}));var au;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(au||(au={}));var Bm;(function(e){e.Partial="partial",e.Full="full"})(Bm||(Bm={}));const T9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Bl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Bl||(Bl={}));var jf;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(jf||(jf={}));var Qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Qe||(Qe={}));const vO={[Qe.Left]:Qe.Right,[Qe.Right]:Qe.Left,[Qe.Top]:Qe.Bottom,[Qe.Bottom]:Qe.Top};function k9(e){return e===null?null:e?"valid":"invalid"}const A9=e=>"id"in e&&"source"in e&&"target"in e,pae=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),_2=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Sg=(e,t=[0,0])=>{const{width:n,height:s}=pl(e),i=e.origin??t,r=n*i[0],a=s*i[1];return{x:e.position.x-r,y:e.position.y-a}},mae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const r=typeof i=="string";let a=!t.nodeLookup&&!r?i:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(i):_2(i)?i:t.nodeLookup.get(i.id));const l=a?y1(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ox(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mx(n)},Ng=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Ox(n,y1(i)),s=!0)}),s?Mx(n):{x:0,y:0,width:0,height:0}},S2=(e,t,[n,s,i]=[0,0,1],r=!1,a=!1)=>{const l={...lh(t,[n,s,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,b=Um(l,Of(u)),v=(p??0)*(m??0),y=r&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},gae=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function bae(e,t){const n=new Map,s=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!s||s.has(i.id))&&n.set(i.id,i)}),n}async function yae({nodes:e,width:t,height:n,panZoom:s,minZoom:i,maxZoom:r},a){if(e.size===0)return!0;const l=bae(e,a),c=Ng(l),u=T2(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await s.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function C9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:i,onError:r}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??s;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",$a.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&Eu(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Eu(f)?xu(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",$a.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function xae({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:i}){const r=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=r.has(h.id),m=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),d=gae(a,c);for(const h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Rf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xu=(e={x:0,y:0},t,n)=>({x:Rf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Rf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function I9(e,t,n){const{width:s,height:i}=pl(n),{x:r,y:a}=n.internals.positionAbsolute;return xu(e,[[r,a],[r+s,a+i]],t)}const wO=(e,t,n)=>en?-Rf(Math.abs(e-n),1,t)/t:0,N2=(e,t,n=15,s=40)=>{const i=wO(e.x,s,t.width-s)*n,r=wO(e.y,s,t.height-s)*n;return[i,r]},Ox=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),ZS=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Mx=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Of=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=_2(e)?e.internals.positionAbsolute:Sg(e,t);return{x:n,y:s,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},y1=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=_2(e)?e.internals.positionAbsolute:Sg(e,t);return{x:n,y:s,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:s+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},j9=(e,t)=>Mx(Ox(ZS(e),ZS(t))),Um=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},_O=e=>La(e.width)&&La(e.height)&&La(e.x)&&La(e.y),La=e=>!isNaN(e)&&isFinite(e),R9=(e,t)=>(n,s)=>{},Tg=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lh=({x:e,y:t},[n,s,i],r=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-s)/i};return r?Tg(l,a):l},Mf=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s});function td(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Eae(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=td(e,n),i=td(e,t);return{top:s,right:i,bottom:s,left:i,x:i*2,y:s*2}}if(typeof e=="object"){const s=td(e.top??e.y??0,n),i=td(e.bottom??e.y??0,n),r=td(e.left??e.x??0,t),a=td(e.right??e.x??0,t);return{top:s,right:a,bottom:i,left:r,x:r+a,y:s+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vae(e,t,n,s,i,r){const{x:a,y:l}=Mf(e,[t,n,s]),{x:c,y:u}=Mf({x:e.x+e.width,y:e.y+e.height},[t,n,s]),d=i-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const T2=(e,t,n,s,i,r)=>{const a=Eae(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=Rf(u,s,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,b=vae(e,p,m,d,t,n),v={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:p-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},Fm=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Eu(e){return e!=null&&e!=="parent"}function pl(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function k2(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function O9(e,t={width:0,height:0},n,s,i){const r={...e},a=s.get(n);if(a){const l=a.origin||i;r.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],r.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return r}function SO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wae(){let e,t;return{promise:new Promise((s,i)=>{e=s,t=i}),resolve:e,reject:t}}function _ae(e){return{...N9,...e||{}}}function Xp(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:i}){const{x:r,y:a}=Da(e),l=lh({x:r-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},s),{x:c,y:u}=n?Tg(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const A2=e=>({width:e.offsetWidth,height:e.offsetHeight}),M9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Sae=["INPUT","SELECT","TEXTAREA"];function L9(e){var s,i;const t=((i=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Sae.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const D9=e=>"clientX"in e,Da=(e,t)=>{var r,a;const n=D9(e),s=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},NO=(e,t,n,s,i)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...A2(a)}})};function P9({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+s*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Z0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function TO({pos:e,x1:t,y1:n,x2:s,y2:i,c:r}){switch(e){case Qe.Left:return[t-Z0(t-s,r),n];case Qe.Right:return[t+Z0(s-t,r),n];case Qe.Top:return[t,n-Z0(n-i,r)];case Qe.Bottom:return[t,n+Z0(i-n,r)]}}function B9({sourceX:e,sourceY:t,sourcePosition:n=Qe.Bottom,targetX:s,targetY:i,targetPosition:r=Qe.Top,curvature:a=.25}){const[l,c]=TO({pos:n,x1:e,y1:t,x2:s,y2:i,c:a}),[u,d]=TO({pos:r,x1:s,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=P9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${s},${i}`,f,h,p,m]}function U9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,r=n0}const kae=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Aae=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Cae=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",$a.error006()),t;const s=n.getEdgeId||kae;let i;return A9(e)?i={...e}:i={...e,id:s(e)},Aae(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function F9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,r,a,l]=U9({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,r,a,l]}const kO={[Qe.Left]:{x:-1,y:0},[Qe.Right]:{x:1,y:0},[Qe.Top]:{x:0,y:-1},[Qe.Bottom]:{x:0,y:1}},Iae=({source:e,sourcePosition:t=Qe.Bottom,target:n})=>t===Qe.Left||t===Qe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function jae({source:e,sourcePosition:t=Qe.Bottom,target:n,targetPosition:s=Qe.Top,center:i,offset:r,stepPosition:a}){const l=kO[t],c=kO[s],u={x:e.x+l.x*r,y:e.y+l.y*r},d={x:n.x+c.x*r,y:n.y+c.y*r},f=Iae({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=U9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,v=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,v=i.y??u.y+(d.y-u.y)*a);const k=[{x:b,y:u.y},{x:b,y:d.y}],A=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?k:A:m=h==="x"?A:k}else{const k=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?A:k:m=l.y===p?k:A,t===s){const L=Math.abs(e[h]-n[h]);if(L<=r){const F=Math.min(r-1,r-L);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==s){const L=h==="x"?"y":"x",F=l[h]===c[L],C=u[L]>d[L],I=u[L]=z?(b=(j.x+R.x)/2,v=m[0].y):(b=m[0].x,v=(j.y+R.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...S.x!==m[0].x||S.y!==m[0].y?[S]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],b,v,E,w]}function Rae(e,t,n,s){const i=Math.min(AO(e,t)/2,AO(t,n)/2,s),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function JS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Mae(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:i}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||s,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=JS(c,t);r.has(u)||(a.push({id:u,color:c.color||n,...c}),r.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const $9=1e3,Lae=10,C2={nodeOrigin:[0,0],nodeExtent:Pm,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Dae={...C2,checkEquality:!0};function I2(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Pae(e,t,n){const s=I2(C2,n);for(const i of e.values())if(i.parentId)R2(i,e,t,s);else{const r=Sg(i,s.nodeOrigin),a=Eu(i.extent)?i.extent:s.nodeExtent,l=xu(r,a,pl(i));i.internals.positionAbsolute=l}}function Bae(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const i of e.handles){const r={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(r):i.type==="target"&&s.push(r)}return{source:n,target:s}}function j2(e){return e==="manual"}function eN(e,t,n,s={}){var d,f;const i=I2(Dae,s),r={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!j2(i.zIndexMode)?$9:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(i.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Sg(h,i.nodeOrigin),b=Eu(h.extent)?h.extent:i.nodeExtent,v=xu(m,b,pl(h));p={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:v,handleBounds:Bae(h,p),z:H9(h,l,i.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&R2(p,t,n,s,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Uae(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function R2(e,t,n,s,i){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=I2(C2,s),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Uae(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Lae),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=r&&!j2(c)?$9:0,{x:h,y:p,z:m}=Fae(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||p!==b.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:b,z:m}})}function H9(e,t,n){const s=La(e.zIndex)?e.zIndex:0;return j2(n)?s:s+(e.selected?t:0)}function Fae(e,t,n,s,i,r){const{x:a,y:l}=t.internals.positionAbsolute,c=pl(e),u=Sg(e,n),d=Eu(e.extent)?xu(u,e.extent,c):u;let f=xu({x:a+d.x,y:l+d.y},s,c);e.extent==="parent"&&(f=I9(f,c,t));const h=H9(e,i,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function O2(e,t,n,s=[0,0]){var a;const i=[],r=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=r.get(l.parentId))==null?void 0:a.expandedRect)??Of(c),d=j9(u,l.rect);r.set(l.parentId,{expandedRect:d,parent:c})}return r.size>0&&r.forEach(({expandedRect:l,parent:c},u)=>{var E;const d=c.internals.positionAbsolute,f=pl(c),h=c.origin??s,p=l.x0||m>0||y||x)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+x}}),(E=n.get(u))==null||E.forEach(w=>{e.some(S=>S.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=O2(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function Hae({delta:e,panZoom:t,transform:n,translateExtent:s,width:i,height:r}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,r]],s);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function RO(e,t,n,s,i,r){let a=i;const l=s.get(a)||new Map;s.set(a,l.set(n,t)),a=`${i}-${e}`;const c=s.get(a)||new Map;if(s.set(a,c.set(n,t)),r){a=`${i}-${e}-${r}`;const u=s.get(a)||new Map;s.set(a,u.set(n,t))}}function z9(e,t,n){e.clear(),t.clear();for(const s of n){const{source:i,target:r,sourceHandle:a=null,targetHandle:l=null}=s,c={edgeId:s.id,source:i,target:r,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${r}-${l}`,d=`${r}-${l}--${i}-${a}`;RO("source",c,d,e,i,a),RO("target",c,u,e,r,l),t.set(s.id,s)}}function V9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:V9(n,t):!1}function OO(e,t,n){var i;let s=e;do{if((i=s==null?void 0:s.matches)!=null&&i.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function zae(e,t,n,s){const i=new Map;for(const[r,a]of e)if((a.selected||a.id===s)&&(!a.parentId||!V9(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&i.set(r,{id:r,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function sw({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var a,l,c;const i=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:s})}if(!e)return[i[0],i];const r=(l=n.get(e))==null?void 0:l.internals.userNode;return[r?{...r,position:((c=t.get(e))==null?void 0:c.position)||r.position,dragging:s}:i[0],i]}function Vae({dragItems:e,snapGrid:t,x:n,y:s}){const i=e.values().next().value;if(!i)return null;const r={x:n-i.distance.x,y:s-i.distance.y},a=Tg(r,t);return{x:a.x-r.x,y:a.y-r.y}}function Gae({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:i}){let r={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,b=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:S,nodeId:_,nodeClickDistance:T=0}){h=Rr(w);function k({x:B,y:z}){const{nodeLookup:L,nodeExtent:F,snapGrid:C,snapToGrid:I,nodeOrigin:D,onNodeDrag:$,onSelectionDrag:O,onError:ne,updateNodePositions:se}=t();r={x:B,y:z};let P=!1;const Z=l.size>1,te=Z&&F?ZS(Ng(l)):null,V=Z&&I?Vae({dragItems:l,snapGrid:C,x:B,y:z}):null;for(const[Q,K]of l){if(!L.has(Q))continue;let ce={x:B-K.distance.x,y:z-K.distance.y};I&&(ce=V?{x:Math.round(ce.x+V.x),y:Math.round(ce.y+V.y)}:Tg(ce,C));let he=null;if(Z&&F&&!K.extent&&te){const{positionAbsolute:ve}=K.internals,Me=ve.x-te.x+F[0][0],Se=ve.x+K.measured.width-te.x2+F[1][0],ae=ve.y-te.y+F[0][1],me=ve.y+K.measured.height-te.y2+F[1][1];he=[[Me,ae],[Se,me]]}const{position:ge,positionAbsolute:ue}=C9({nodeId:Q,nextPosition:ce,nodeLookup:L,nodeExtent:he||F,nodeOrigin:D,onError:ne});P=P||K.position.x!==ge.x||K.position.y!==ge.y,K.position=ge,K.internals.positionAbsolute=ue}if(m=m||P,!!P&&(se(l,!0),b&&(s||$||!_&&O))){const[Q,K]=sw({nodeId:_,dragItems:l,nodeLookup:L});s==null||s(b,l,Q,K),$==null||$(b,Q,K),_||O==null||O(b,K)}}async function A(){if(!d)return;const{transform:B,panBy:z,autoPanSpeed:L,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[C,I]=N2(u,d,L);(C!==0||I!==0)&&(r.x=(r.x??0)-C/B[2],r.y=(r.y??0)-I/B[2],await z({x:C,y:I})&&k(r)),a=requestAnimationFrame(A)}function j(B){var Z;const{nodeLookup:z,multiSelectionActive:L,nodesDraggable:F,transform:C,snapGrid:I,snapToGrid:D,selectNodesOnDrag:$,onNodeDragStart:O,onSelectionDragStart:ne,unselectNodesAndEdges:se}=t();f=!0,(!$||!S)&&!L&&_&&((Z=z.get(_))!=null&&Z.selected||se()),S&&$&&_&&(e==null||e(_));const P=Xp(B.sourceEvent,{transform:C,snapGrid:I,snapToGrid:D,containerBounds:d});if(r=P,l=zae(z,F,P,_),l.size>0&&(n||O||!_&&ne)){const[te,V]=sw({nodeId:_,dragItems:l,nodeLookup:z});n==null||n(B.sourceEvent,l,te,V),O==null||O(B.sourceEvent,te,V),_||ne==null||ne(B.sourceEvent,V)}}const R=l9().clickDistance(T).on("start",B=>{const{domNode:z,nodeDragThreshold:L,transform:F,snapGrid:C,snapToGrid:I}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,m=!1,b=B.sourceEvent,L===0&&j(B),r=Xp(B.sourceEvent,{transform:F,snapGrid:C,snapToGrid:I,containerBounds:d}),u=Da(B.sourceEvent,d)}).on("drag",B=>{const{autoPanOnNodeDrag:z,transform:L,snapGrid:F,snapToGrid:C,nodeDragThreshold:I,nodeLookup:D}=t(),$=Xp(B.sourceEvent,{transform:L,snapGrid:F,snapToGrid:C,containerBounds:d});if(b=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||_&&!D.has(_))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,A()),!f){const O=Da(B.sourceEvent,d),ne=O.x-u.x,se=O.y-u.y;Math.sqrt(ne*ne+se*se)>I&&j(B)}(r.x!==$.xSnapped||r.y!==$.ySnapped)&&l&&f&&(u=Da(B.sourceEvent,d),k($))}}).on("end",B=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:z,updateNodePositions:L,onNodeDragStop:F,onSelectionDragStop:C}=t();if(m&&(L(l,!1),m=!1),i||F||!_&&C){const[I,D]=sw({nodeId:_,dragItems:l,nodeLookup:z,dragging:!1});i==null||i(B.sourceEvent,l,I,D),F==null||F(B.sourceEvent,I,D),_||C==null||C(B.sourceEvent,D)}}}).filter(B=>{const z=B.target;return!B.button&&(!x||!OO(z,`.${x}`,w))&&(!E||OO(z,E,w))});h.call(R)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function Kae(e,t,n){const s=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Um(i,Of(r))>0&&s.push(r);return s}const qae=250;function Yae(e,t,n,s){var l,c;let i=[],r=1/0;const a=Kae(e,n,t+qae);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(s.nodeId===f.nodeId&&s.type===f.type&&s.id===f.id)continue;const{x:h,y:p}=vu(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=s.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function G9(e,t,n,s,i,r=!1){var u,d,f;const a=s.get(e);if(!a)return null;const l=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&r?{...c,...vu(a,c,c.position,!0)}:c}function K9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Wae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const q9=()=>!0;function Xae(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:i,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:b,onConnectEnd:v,isValidConnection:y=q9,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:S,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){const A=M9(e.target);let j=0,R;const{x:B,y:z}=Da(e),L=K9(r,k),F=l==null?void 0:l.getBoundingClientRect();let C=!1;if(!F||!L)return;const I=G9(i,L,s,c,t);if(!I)return;let D=Da(e,F),$=!1,O=null,ne=!1,se=null;function P(){if(!d||!F)return;const[ge,ue]=N2(D,F,_);h({x:ge,y:ue}),j=requestAnimationFrame(P)}const Z={...I,nodeId:i,type:L,position:I.position},te=c.get(i);let Q={inProgress:!0,isValid:null,from:vu(te,Z,Qe.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:te,to:D,toHandle:null,toPosition:vO[Z.position],toNode:null,pointer:D};function K(){C=!0,E(Q),m==null||m(e,{nodeId:i,handleId:s,handleType:L})}T===0&&K();function ce(ge){if(!C){const{x:me,y:we}=Da(ge),et=me-B,De=we-z;if(!(et*et+De*De>T*T))return;K()}if(!S()||!Z){he(ge);return}const ue=w();D=Da(ge,F),R=Yae(lh(D,ue,!1,[1,1]),n,c,Z),$||(P(),$=!0);const ve=Y9(ge,{handle:R,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:a?"target":"source",isValidConnection:y,doc:A,lib:u,flowId:f,nodeLookup:c});se=ve.handleDomNode,O=ve.connection,ne=Wae(!!R,ve.isValid);const Me=c.get(i),Se=Me?vu(Me,Z,Qe.Left,!0):Q.from,ae={...Q,from:Se,isValid:ne,to:ve.toHandle&&ne?Mf({x:ve.toHandle.x,y:ve.toHandle.y},ue):D,toHandle:ve.toHandle,toPosition:ne&&ve.toHandle?ve.toHandle.position:vO[Z.position],toNode:ve.toHandle?c.get(ve.toHandle.nodeId):null,pointer:D};E(ae),Q=ae}function he(ge){if(!("touches"in ge&&ge.touches.length>0)){if(C){(R||se)&&O&&ne&&(b==null||b(O));const{inProgress:ue,...ve}=Q,Me={...ve,toPosition:Q.toHandle?Q.toPosition:null};v==null||v(ge,Me),r&&(x==null||x(ge,Me))}p(),cancelAnimationFrame(j),$=!1,ne=!1,O=null,se=null,A.removeEventListener("mousemove",ce),A.removeEventListener("mouseup",he),A.removeEventListener("touchmove",ce),A.removeEventListener("touchend",he)}}A.addEventListener("mousemove",ce),A.addEventListener("mouseup",he),A.addEventListener("touchmove",ce),A.addEventListener("touchend",he)}function Y9(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=q9,nodeLookup:d}){const f=r==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=Da(e),b=a.elementFromPoint(p,m),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=K9(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),_=v.classList.contains("connectableend");if(!E||!x)return y;const T={source:f?E:s,sourceHandle:f?w:i,target:f?s:E,targetHandle:f?i:w};y.connection=T;const A=S&&_&&(n===If.Strict?f&&x==="source"||!f&&x==="target":E!==s||w!==i);y.isValid=A&&u(T),y.toHandle=G9(E,x,w,d,n,!0)}return y}const tN={onPointerDown:Xae,isValid:Y9};function Qae({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const i=Rr(e);function r({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=E=>{if(E.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=E.sourceEvent.ctrlKey&&Fm()?10:1,_=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,T=w[2]*Math.pow(2,_*S);t.scaleTo(T)};let b=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(b=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},y=E=>{const w=n();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!t)return;const S=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],_=[S[0]-b[0],S[1]-b[1]];b=S;const T=s()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},A,l)},x=_9().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(x,{})}function a(){i.on("zoom",null)}return{update:r,destroy:a,pointer:Ca}}const Lx=e=>({x:e.x,y:e.y,zoom:e.k}),iw=({x:e,y:t,zoom:n})=>Rx.translate(e,t).scale(n),Ud=(e,t)=>e.target.closest(`.${t}`),W9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zae=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rw=(e,t=0,n=Zae,s=()=>{})=>{const i=typeof t=="number"&&t>0;return i||s(),i?e.transition().duration(t).ease(n).on("end",s):e},X9=e=>{const t=e.ctrlKey&&Fm()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jae({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:i,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Ud(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=Ca(d),y=X9(d),x=f*Math.pow(2,y);s.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=i===au.Vertical?0:d.deltaX*h,m=i===au.Horizontal?0:d.deltaY*h;!Fm()&&d.shiftKey&&i!==au.Vertical&&(p=d.deltaY*h,m=0),s.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const b=Lx(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function eoe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,i){const r=s.type==="wheel",a=!t&&r&&!s.ctrlKey,l=Ud(s,e);if(s.ctrlKey&&r&&l&&s.preventDefault(),a||l)return null;s.preventDefault(),n.call(this,s,i)}}function toe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var r,a,l;if((r=s.sourceEvent)!=null&&r.internal)return;const i=Lx(s.transform);e.mouseButton=((a=s.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=s.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,i))}}function noe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:i}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&W9(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||s([r.transform.x,r.transform.y,r.transform.k]),i&&!((l=r.sourceEvent)!=null&&l.internal)&&(i==null||i(r.sourceEvent,Lx(r.transform)))}}function soe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:i,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&W9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,s(!1),i)){const c=Lx(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function ioe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:i,zoomOnDoubleClick:r,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ud(f,`${u}-flow__node`)||Ud(f,`${u}-flow__edge`)))return!0;if(!s&&!h&&!i&&!r&&!n||a||d&&!m||Ud(f,l)&&m||Ud(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!s&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(s)&&!s.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&b}}function roe({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:i,onPanZoom:r,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=_9().scaleExtent([t,n]).translateExtent(s),h=Rr(e).call(f);x({x:i.x,y:i.y,zoom:Rf(i.zoom,t,n)},[[0,0],[d.width,d.height]],s);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(X9);async function b(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).transform(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}function v({noWheelClassName:R,noPanClassName:B,onPaneContextMenu:z,userSelectionActive:L,panOnScroll:F,panOnDrag:C,panOnScrollMode:I,panOnScrollSpeed:D,preventScrolling:$,zoomOnPinch:O,zoomOnScroll:ne,zoomOnDoubleClick:se,zoomActivationKeyPressed:P,lib:Z,onTransformChange:te,connectionInProgress:V,paneClickDistance:Q,selectionOnDrag:K}){L&&!u.isZoomingOrPanning&&y();const ce=F&&!P&&!L;f.clickDistance(K?1/0:!La(Q)||Q<0?0:Q);const he=ce?Jae({zoomPanValues:u,noWheelClassName:R,d3Selection:h,d3Zoom:f,panOnScrollMode:I,panOnScrollSpeed:D,zoomOnPinch:O,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):eoe({noWheelClassName:R,preventScrolling:$,d3ZoomHandler:p});h.on("wheel.zoom",he,{passive:!1});const ge=toe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",ge);const ue=noe({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!z,onPanZoom:r,onTransformChange:te});f.on("zoom",ue);const ve=soe({zoomPanValues:u,panOnDrag:C,panOnScroll:F,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ve);const Me=ioe({zoomActivationKeyPressed:P,panOnDrag:C,zoomOnScroll:ne,panOnScroll:F,zoomOnDoubleClick:se,zoomOnPinch:O,userSelectionActive:L,noPanClassName:B,noWheelClassName:R,lib:Z,connectionInProgress:V});f.filter(Me),se?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(R,B,z){const L=iw(R),F=f==null?void 0:f.constrain()(L,B,z);return F&&await b(F),F}async function E(R,B){const z=iw(R);return await b(z,B),z}function w(R){if(h){const B=iw(R),z=h.property("__zoom");(z.k!==R.zoom||z.x!==R.x||z.y!==R.y)&&(f==null||f.transform(h,B,null,{sync:!0}))}}function S(){const R=h?w9(h.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}async function _(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).scaleTo(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}async function T(R,B){return h?new Promise(z=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?Wp:ey).scaleBy(rw(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>z(!0)),R)}):!1}function k(R){f==null||f.scaleExtent(R)}function A(R){f==null||f.translateExtent(R)}function j(R){const B=!La(R)||R<0?0:R;f==null||f.clickDistance(B)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:S,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:A,syncViewport:w,setClickDistance:j}}var Lf;(function(e){e.Line="line",e.Handle="handle"})(Lf||(Lf={}));function aoe({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:i,affectsY:r}){const a=e-t,l=n-s,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function MO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:i}}function _l(e,t){return Math.max(0,t-e)}function Sl(e,t){return Math.max(0,e-t)}function J0(e,t,n){return Math.max(0,t-e,e-n)}function LO(e,t){return e?!t:t}function ooe(e,t,n,s,i,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=s,{x:E,y:w,width:S,height:_,aspectRatio:T}=e;let k=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?m-e.pointerY:0);const j=S+(c?-k:k),R=_+(u?-A:A),B=-r[0]*S,z=-r[1]*_;let L=J0(j,b,v),F=J0(R,y,x);if(a){let D=0,$=0;c&&k<0?D=_l(E+k+B,a[0][0]):!c&&k>0&&(D=Sl(E+j+B,a[1][0])),u&&A<0?$=_l(w+A+z,a[0][1]):!u&&A>0&&($=Sl(w+R+z,a[1][1])),L=Math.max(L,D),F=Math.max(F,$)}if(l){let D=0,$=0;c&&k>0?D=Sl(E+k,l[0][0]):!c&&k<0&&(D=_l(E+j,l[1][0])),u&&A>0?$=Sl(w+A,l[0][1]):!u&&A<0&&($=_l(w+R,l[1][1])),L=Math.max(L,D),F=Math.max(F,$)}if(i){if(d){const D=J0(j/T,y,x)*T;if(L=Math.max(L,D),a){let $=0;!c&&!u||c&&!u&&h?$=Sl(w+z+j/T,a[1][1])*T:$=_l(w+z+(c?k:-k)/T,a[0][1])*T,L=Math.max(L,$)}if(l){let $=0;!c&&!u||c&&!u&&h?$=_l(w+j/T,l[1][1])*T:$=Sl(w+(c?k:-k)/T,l[0][1])*T,L=Math.max(L,$)}}if(f){const D=J0(R*T,b,v)/T;if(F=Math.max(F,D),a){let $=0;!c&&!u||u&&!c&&h?$=Sl(E+R*T+B,a[1][0])/T:$=_l(E+(u?A:-A)*T+B,a[0][0])/T,F=Math.max(F,$)}if(l){let $=0;!c&&!u||u&&!c&&h?$=_l(E+R*T,l[1][0])/T:$=Sl(E+(u?A:-A)*T,l[0][0])/T,F=Math.max(F,$)}}}A=A+(A<0?F:-F),k=k+(k<0?L:-L),i&&(h?j>R*T?A=(LO(c,u)?-k:k)/T:k=(LO(c,u)?-A:A)*T:d?(A=k/T,u=c):(k=A*T,c=u));const C=c?E+k:E,I=u?w+A:w;return{width:S+(c?-k:k),height:_+(u?-A:A),x:r[0]*k*(c?-1:1)+C,y:r[1]*A*(u?-1:1)+I}}const Q9={width:0,height:0,x:0,y:0},loe={...Q9,pointerX:0,pointerY:0,aspectRatio:1};function coe(e,t,n){const s=t.position.x+e.position.x,i=t.position.y+e.position.y,r=e.measured.width??0,a=e.measured.height??0,l=n[0]*r,c=n[1]*a;return[[s-l,i-c],[s+r-l,i+a-c]]}function uoe({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:i}){const r=Rr(e);let a={controlDirection:MO("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:v}){let y={...Q9},x={...loe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:MO(u)};let E,w=null,S=[],_,T,k,A=!1;const j=l9().on("start",R=>{const{nodeLookup:B,transform:z,snapGrid:L,snapToGrid:F,nodeOrigin:C,paneDomNode:I}=n();if(E=B.get(t),!E)return;w=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:D,ySnapped:$}=Xp(R.sourceEvent,{transform:z,snapGrid:L,snapToGrid:F,containerBounds:w});y={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},x={...y,pointerX:D,pointerY:$,aspectRatio:y.width/y.height},_=void 0,T=Eu(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(_=B.get(E.parentId)),_&&E.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),S=[],k=void 0;for(const[O,ne]of B)if(ne.parentId===t&&(S.push({id:O,position:{...ne.position},extent:ne.extent}),ne.extent==="parent"||ne.expandParent)){const se=coe(ne,E,ne.origin??C);k?k=[[Math.min(se[0][0],k[0][0]),Math.min(se[0][1],k[0][1])],[Math.max(se[1][0],k[1][0]),Math.max(se[1][1],k[1][1])]]:k=se}p==null||p(R,{...y})}).on("drag",R=>{const{transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F}=n(),C=Xp(R.sourceEvent,{transform:B,snapGrid:z,snapToGrid:L,containerBounds:w}),I=[];if(!E)return;const{x:D,y:$,width:O,height:ne}=y,se={},P=E.origin??F,{width:Z,height:te,x:V,y:Q}=ooe(x,a.controlDirection,C,a.boundaries,a.keepAspectRatio,P,T,k),K=Z!==O,ce=te!==ne,he=V!==D&&K,ge=Q!==$&&ce;if(!he&&!ge&&!K&&!ce)return;if((he||ge||P[0]===1||P[1]===1)&&(se.x=he?V:y.x,se.y=ge?Q:y.y,y.x=se.x,y.y=se.y,S.length>0)){const Se=V-D,ae=Q-$;for(const me of S)me.position={x:me.position.x-Se+P[0]*(Z-O),y:me.position.y-ae+P[1]*(te-ne)},I.push(me)}if((K||ce)&&(se.width=K&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Z:y.width,se.height=ce&&(!a.resizeDirection||a.resizeDirection==="vertical")?te:y.height,y.width=se.width,y.height=se.height),_&&E.expandParent){const Se=P[0]*(se.width??0);se.x&&se.x{A&&(b==null||b(R,{...y}),i==null||i({...y}),A=!1)});r.call(j)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var Z9={exports:{}},J9={},eU={exports:{}},tU={};/** * @license React * use-sync-external-store-shim.production.js * @@ -508,7 +508,7 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Lf=g;function doe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var foe=typeof Object.is=="function"?Object.is:doe,hoe=Lf.useState,poe=Lf.useEffect,moe=Lf.useLayoutEffect,goe=Lf.useDebugValue;function boe(e,t){var n=t(),s=hoe({inst:{value:n,getSnapshot:t}}),i=s[0].inst,r=s[1];return moe(function(){i.value=n,i.getSnapshot=t,aw(i)&&r({inst:i})},[e,n,t]),poe(function(){return aw(i)&&r({inst:i}),e(function(){aw(i)&&r({inst:i})})},[e]),goe(n),n}function aw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!foe(e,n)}catch{return!0}}function yoe(e,t){return t()}var xoe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yoe:boe;tU.useSyncExternalStore=Lf.useSyncExternalStore!==void 0?Lf.useSyncExternalStore:xoe;eU.exports=tU;var Eoe=eU.exports;/** + */var Df=g;function doe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var foe=typeof Object.is=="function"?Object.is:doe,hoe=Df.useState,poe=Df.useEffect,moe=Df.useLayoutEffect,goe=Df.useDebugValue;function boe(e,t){var n=t(),s=hoe({inst:{value:n,getSnapshot:t}}),i=s[0].inst,r=s[1];return moe(function(){i.value=n,i.getSnapshot=t,aw(i)&&r({inst:i})},[e,n,t]),poe(function(){return aw(i)&&r({inst:i}),e(function(){aw(i)&&r({inst:i})})},[e]),goe(n),n}function aw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!foe(e,n)}catch{return!0}}function yoe(e,t){return t()}var xoe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yoe:boe;tU.useSyncExternalStore=Df.useSyncExternalStore!==void 0?Df.useSyncExternalStore:xoe;eU.exports=tU;var Eoe=eU.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -516,67 +516,67 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Dx=g,voe=Eoe;function woe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _oe=typeof Object.is=="function"?Object.is:woe,Soe=voe.useSyncExternalStore,Noe=Dx.useRef,Toe=Dx.useEffect,koe=Dx.useMemo,Aoe=Dx.useDebugValue;J9.useSyncExternalStoreWithSelector=function(e,t,n,s,i){var r=Noe(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=koe(function(){function c(p){if(!u){if(u=!0,d=p,p=s(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,_oe(d,p))return m;var b=s(p);return i!==void 0&&i(m,b)?(d=p,m):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,s,i]);var l=Soe(e,r[0],r[1]);return Toe(function(){a.hasValue=!0,a.value=l},[l]),Aoe(l),l};Z9.exports=J9;var Coe=Z9.exports;const Ioe=Gf(Coe),joe={},DO=e=>{let t;const n=new Set,s=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},i=()=>t,c={setState:s,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(joe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(s,i,c);return c},Roe=e=>e?DO(e):DO,{useDebugValue:Ooe}=Lt,{useSyncExternalStoreWithSelector:Moe}=Ioe,Loe=e=>e;function nU(e,t=Loe,n){const s=Moe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ooe(s),s}const PO=(e,t)=>{const n=Roe(e),s=(i,r=t)=>nU(n,i,r);return Object.assign(s,n),s},Doe=(e,t)=>e?PO(e,t):PO;function ms(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const Px=g.createContext(null),Poe=Px.Provider,sU=Fa.error001("react");function Xt(e,t){const n=g.useContext(Px);if(n===null)throw new Error(sU);return nU(n,e,t)}function gs(){const e=g.useContext(Px);if(e===null)throw new Error(sU);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const BO={display:"none"},Boe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},iU="react-flow__node-desc",rU="react-flow__edge-desc",Uoe="react-flow__aria-live",Foe=e=>e.ariaLiveMessage,$oe=e=>e.ariaLabelConfig;function Hoe({rfId:e}){const t=Xt(Foe);return o.jsx("div",{id:`${Uoe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Boe,children:t})}function zoe({rfId:e,disableKeyboardA11y:t}){const n=Xt($oe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${iU}-${e}`,style:BO,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${rU}-${e}`,style:BO,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(Hoe,{rfId:e})]})}const Bx=g.forwardRef(({position:e="top-left",children:t,className:n,style:s,...i},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:ii(["react-flow__panel",n,...a]),style:s,ref:r,...i,children:t})});Bx.displayName="Panel";function Voe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Bx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Goe=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},eb=e=>e.id;function Koe(e,t){return ms(e.selectedNodes.map(eb),t.selectedNodes.map(eb))&&ms(e.selectedEdges.map(eb),t.selectedEdges.map(eb))}function qoe({onSelectionChange:e}){const t=gs(),{selectedNodes:n,selectedEdges:s}=Xt(Goe,Koe);return g.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(r=>r(i))},[n,s,e]),null}const Yoe=e=>!!e.onSelectionChangeHandlers;function Woe({onSelectionChange:e}){const t=Xt(Yoe);return e||t?o.jsx(qoe,{onSelectionChange:e}):null}const aU=[0,0],Xoe={x:0,y:0,zoom:1},Qoe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],UO=[...Qoe,"rfId"],Zoe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),FO={translateExtent:Pm,nodeOrigin:aU,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Joe(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:i,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Xt(Zoe,ms),u=gs();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=FO,l()}),[]);const d=g.useRef(FO);return g.useEffect(()=>{for(const f of UO){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?s(h):f==="maxZoom"?i(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:_ae(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},UO.map(f=>e[f])),null}function $O(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ele(e){var s;const[t,n]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){n(e);return}const i=$O(),r=()=>n(i!=null&&i.matches?"dark":"light");return r(),i==null||i.addEventListener("change",r),()=>{i==null||i.removeEventListener("change",r)}},[e]),t!==null?t:(s=$O())!=null&&s.matches?"dark":"light"}const HO=typeof document<"u"?document:null;function $m(e=null,t={target:HO,actInsideInputWithModifier:!0}){const[n,s]=g.useState(!1),i=g.useRef(!1),r=g.useRef(new Set([])),[a,l]=g.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var Dx=g,voe=Eoe;function woe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _oe=typeof Object.is=="function"?Object.is:woe,Soe=voe.useSyncExternalStore,Noe=Dx.useRef,Toe=Dx.useEffect,koe=Dx.useMemo,Aoe=Dx.useDebugValue;J9.useSyncExternalStoreWithSelector=function(e,t,n,s,i){var r=Noe(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=koe(function(){function c(p){if(!u){if(u=!0,d=p,p=s(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,_oe(d,p))return m;var b=s(p);return i!==void 0&&i(m,b)?(d=p,m):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,s,i]);var l=Soe(e,r[0],r[1]);return Toe(function(){a.hasValue=!0,a.value=l},[l]),Aoe(l),l};Z9.exports=J9;var Coe=Z9.exports;const Ioe=Kf(Coe),joe={},DO=e=>{let t;const n=new Set,s=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},i=()=>t,c={setState:s,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(joe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(s,i,c);return c},Roe=e=>e?DO(e):DO,{useDebugValue:Ooe}=Pt,{useSyncExternalStoreWithSelector:Moe}=Ioe,Loe=e=>e;function nU(e,t=Loe,n){const s=Moe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ooe(s),s}const PO=(e,t)=>{const n=Roe(e),s=(i,r=t)=>nU(n,i,r);return Object.assign(s,n),s},Doe=(e,t)=>e?PO(e,t):PO;function hs(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const Px=g.createContext(null),Poe=Px.Provider,sU=$a.error001("react");function Xt(e,t){const n=g.useContext(Px);if(n===null)throw new Error(sU);return nU(n,e,t)}function ps(){const e=g.useContext(Px);if(e===null)throw new Error(sU);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const BO={display:"none"},Boe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},iU="react-flow__node-desc",rU="react-flow__edge-desc",Uoe="react-flow__aria-live",Foe=e=>e.ariaLiveMessage,$oe=e=>e.ariaLabelConfig;function Hoe({rfId:e}){const t=Xt(Foe);return o.jsx("div",{id:`${Uoe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Boe,children:t})}function zoe({rfId:e,disableKeyboardA11y:t}){const n=Xt($oe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${iU}-${e}`,style:BO,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${rU}-${e}`,style:BO,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(Hoe,{rfId:e})]})}const Bx=g.forwardRef(({position:e="top-left",children:t,className:n,style:s,...i},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:ri(["react-flow__panel",n,...a]),style:s,ref:r,...i,children:t})});Bx.displayName="Panel";function Voe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Bx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Goe=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},eb=e=>e.id;function Koe(e,t){return hs(e.selectedNodes.map(eb),t.selectedNodes.map(eb))&&hs(e.selectedEdges.map(eb),t.selectedEdges.map(eb))}function qoe({onSelectionChange:e}){const t=ps(),{selectedNodes:n,selectedEdges:s}=Xt(Goe,Koe);return g.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(r=>r(i))},[n,s,e]),null}const Yoe=e=>!!e.onSelectionChangeHandlers;function Woe({onSelectionChange:e}){const t=Xt(Yoe);return e||t?o.jsx(qoe,{onSelectionChange:e}):null}const aU=[0,0],Xoe={x:0,y:0,zoom:1},Qoe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],UO=[...Qoe,"rfId"],Zoe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),FO={translateExtent:Pm,nodeOrigin:aU,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Joe(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:i,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Xt(Zoe,hs),u=ps();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=FO,l()}),[]);const d=g.useRef(FO);return g.useEffect(()=>{for(const f of UO){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?s(h):f==="maxZoom"?i(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:_ae(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},UO.map(f=>e[f])),null}function $O(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ele(e){var s;const[t,n]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){n(e);return}const i=$O(),r=()=>n(i!=null&&i.matches?"dark":"light");return r(),i==null||i.addEventListener("change",r),()=>{i==null||i.removeEventListener("change",r)}},[e]),t!==null?t:(s=$O())!=null&&s.matches?"dark":"light"}const HO=typeof document<"u"?document:null;function $m(e=null,t={target:HO,actInsideInputWithModifier:!0}){const[n,s]=g.useState(!1),i=g.useRef(!1),r=g.useRef(new Set([])),[a,l]=g.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return g.useEffect(()=>{const c=(t==null?void 0:t.target)??HO,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&L9(p))return!1;const b=VO(p.code,l);if(r.current.add(p[b]),zO(a,r.current,!1)){const x=((y=(v=p.composedPath)==null?void 0:v.call(p))==null?void 0:y[0])||p.target,E=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(i.current||!E)&&p.preventDefault(),s(!0)}},f=p=>{const m=VO(p.code,l);zO(a,r.current,!0)?(s(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),i.current=!1},h=()=>{r.current.clear(),s(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,s]),n}function zO(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function VO(e,t){return t.includes(e)?"code":"key"}const tle=()=>{const e=gs();return g.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,i,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??s,y:t.y??i,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:i,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=T2(t,s,i,r,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:s,snapGrid:i,snapToGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??r;return oh(u,s,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:i,y:r}=s.getBoundingClientRect(),a=Of(t,n);return{x:a.x+i,y:a.y+r}}}),[])};function oU(e,t){const n=[],s=new Map,i=[];for(const r of e)if(r.type==="add"){i.push(r);continue}else if(r.type==="remove"||r.type==="replace")s.set(r.id,[r]);else{const a=s.get(r.id);a?a.push(r):s.set(r.id,[r])}for(const r of t){const a=s.get(r.id);if(!a){n.push(r);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...r};for(const c of a)nle(c,l);n.push(l)}return i.length&&i.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function nle(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function lU(e,t){return oU(e,t)}function cU(e,t){return oU(e,t)}function Uc(e,t){return{id:e,type:"select",selected:t}}function Ud(e,t=new Set,n=!1){const s=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),s.push(Uc(r.id,a)))}return s}function GO({items:e=[],lookup:t}){var i;const n=[],s=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:r})}for(const[r]of t)s.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function KO(e){return{id:e.id,type:"remove"}}const sle=R9();function uU(e,t,n={}){return Cae(e,t,{...n,onError:n.onError??sle})}const qO=e=>pae(e),ile=e=>A9(e);function dU(e){return g.forwardRef(e)}const rle=typeof window<"u"?g.useLayoutEffect:g.useEffect;function YO(e){const[t,n]=g.useState(BigInt(0)),[s]=g.useState(()=>ale(()=>n(i=>i+BigInt(1))));return rle(()=>{const i=s.get();i.length&&(e(i),s.reset())},[t]),s}function ale(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const fU=g.createContext(null);function ole({children:e}){const t=gs(),n=g.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=GO({items:b,lookup:h});for(const y of m.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),s=YO(n),i=g.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of l)p=typeof m=="function"?m(p):m;d?u(p):f&&f(GO({items:p,lookup:h}))},[]),r=YO(i),a=g.useMemo(()=>({nodeQueue:s,edgeQueue:r}),[]);return o.jsx(fU.Provider,{value:a,children:e})}function lle(){const e=g.useContext(fU);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const cle=e=>!!e.panZoom;function Ux(){const e=tle(),t=gs(),n=lle(),s=Xt(cle),i=g.useMemo(()=>{const r=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=qO(f)?f:h.get(f.id),b=m.parentId?O9(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:b,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return Rf(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&qO(v)?v:{...b,...v}}return b}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&ile(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=r(f))==null?void 0:h.internals.userNode},getInternalNode:r,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,b,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:S,edges:_}=await xae({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),T=_.length>0,k=S.length>0;if(T){const A=_.map(KO);v==null||v(_),x(A)}if(k){const A=S.map(KO);b==null||b(S),y(A)}return(k||T)&&(E==null||E({nodes:S,edges:_})),{deletedNodes:S,deletedEdges:_}},getIntersectingNodes:(f,h=!0,p)=>{const m=_O(f),b=m?f:c(f),v=p!==void 0;return b?(p||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!m&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const E=Rf(v?y:x),w=Um(E,b);return h&&w>0||w>=E.width*E.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=_O(f)?f:c(f);if(!b)return!1;const v=Um(b,h);return p&&v>0||v>=h.width*h.height||v>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return mae(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??wae();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return g.useMemo(()=>({...i,...e,viewportInitialized:s}),[s])}const WO=e=>e.selected,ule=typeof window<"u"?window:void 0;function dle({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=gs(),{deleteElements:s}=Ux(),i=$m(e,{actInsideInputWithModifier:!1}),r=$m(t,{target:ule});g.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();s({nodes:l.filter(WO),edges:a.filter(WO)}),n.setState({nodesSelectionActive:!1})}},[i]),g.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function fle(e){const t=gs();g.useEffect(()=>{const n=()=>{var i,r,a,l;if(!e.current||!(((r=(i=e.current).checkVisibility)==null?void 0:r.call(i))??!0))return!1;const s=A2(e.current);(s.height===0||s.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Fa.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const Fx={position:"absolute",width:"100%",height:"100%",top:0,left:0},hle=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ple({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:i=.5,panOnScrollMode:r=ru.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const S=gs(),_=g.useRef(null),{userSelectionActive:T,lib:k,connectionInProgress:A}=Xt(hle,ms),j=$m(h),R=g.useRef();fle(_);const B=g.useCallback(z=>{y==null||y({x:z[0],y:z[1],zoom:z[2]}),x||S.setState({transform:z})},[y,x]);return g.useEffect(()=>{if(_.current){R.current=roe({domNode:_.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>S.setState(I=>I.paneDragging===C?I:{paneDragging:C}),onPanZoomStart:(C,I)=>{const{onViewportChangeStart:D,onMoveStart:$}=S.getState();$==null||$(C,I),D==null||D(I)},onPanZoom:(C,I)=>{const{onViewportChange:D,onMove:$}=S.getState();$==null||$(C,I),D==null||D(I)},onPanZoomEnd:(C,I)=>{const{onViewportChangeEnd:D,onMoveEnd:$}=S.getState();$==null||$(C,I),D==null||D(I)}});const{x:z,y:L,zoom:F}=R.current.getViewport();return S.setState({panZoom:R.current,transform:[z,L,F],domNode:_.current.closest(".react-flow")}),()=>{var C;(C=R.current)==null||C.destroy()}}},[]),g.useEffect(()=>{var z;(z=R.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:i,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:p,noPanClassName:v,userSelectionActive:T,noWheelClassName:b,lib:k,onTransformChange:B,connectionInProgress:A,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,s,i,r,a,l,j,p,v,T,b,k,B,A,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:_,style:Fx,children:m})}const mle=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function gle(){const{userSelectionActive:e,userSelectionRect:t}=Xt(mle,ms);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ow=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},ble=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function yle({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Bm.Full,panOnDrag:s,autoPanOnSelection:i,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:b}){const v=g.useRef(0),y=gs(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:S,panBy:_,autoPanSpeed:T}=Xt(ble,ms),k=E&&(e||x),A=g.useRef(null),j=g.useRef(),R=g.useRef(new Set),B=g.useRef(new Set),z=g.useRef(!1),L=g.useRef({x:0,y:0}),F=g.useRef(!1),C=K=>{if(z.current||S){z.current=!1;return}u==null||u(K),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},I=K=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){K.preventDefault();return}d==null||d(K)},D=f?K=>f(K):void 0,$=K=>{z.current&&(K.stopPropagation(),z.current=!1)},O=K=>{var me,_e;const{domNode:ce,transform:he}=y.getState();if(j.current=ce==null?void 0:ce.getBoundingClientRect(),!j.current)return;const be=K.target===A.current;if(!be&&!!K.target.closest(".nokey")||!e||!(a&&be||t)||K.button!==0||!K.isPrimary)return;(_e=(me=K.target)==null?void 0:me.setPointerCapture)==null||_e.call(me,K.pointerId),z.current=!1;const{x:Le,y:Ne}=La(K.nativeEvent,j.current),ae=oh({x:Le,y:Ne},he);y.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:Le,y:Ne}}),be||(K.stopPropagation(),K.preventDefault())};function te(K,ce){const{userSelectionRect:he}=y.getState();if(!he)return;const{transform:be,nodeLookup:ue,edgeLookup:we,connectionLookup:Le,triggerNodeChanges:Ne,triggerEdgeChanges:ae,defaultEdgeOptions:me}=y.getState(),_e={x:he.startX,y:he.startY},{x:Je,y:Pe}=Of(_e,be),Fe={startX:_e.x,startY:_e.y,x:KUe.id)),B.current=new Set;const Ve=(me==null?void 0:me.selectable)??!0;for(const Ue of R.current){const W=Le.get(Ue);if(W)for(const{edgeId:oe}of W.values()){const Z=we.get(oe);Z&&(Z.selectable??Ve)&&B.current.add(oe)}}if(!SO(Ye,R.current)){const Ue=Ud(ue,R.current,!0);Ne(Ue)}if(!SO(Ce,B.current)){const Ue=Ud(we,B.current);ae(Ue)}y.setState({userSelectionRect:Fe,userSelectionActive:!0,nodesSelectionActive:!1})}function se(){if(!i||!j.current)return;const[K,ce]=N2(L.current,j.current,T);_({x:K,y:ce}).then(he=>{if(!z.current||!he){v.current=requestAnimationFrame(se);return}const{x:be,y:ue}=L.current;te(be,ue),v.current=requestAnimationFrame(se)})}const P=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};g.useEffect(()=>()=>P(),[]);const Q=K=>{const{userSelectionRect:ce,transform:he,resetSelectedElements:be}=y.getState();if(!j.current||!ce)return;const{x:ue,y:we}=La(K.nativeEvent,j.current);L.current={x:ue,y:we};const Le=Of({x:ce.startX,y:ce.startY},he);if(!z.current){const Ne=t?0:r;if(Math.hypot(ue-Le.x,we-Le.y)<=Ne)return;be(),l==null||l(K)}z.current=!0,F.current||(se(),F.current=!0),te(ue,we)},ee=K=>{var ce,he;K.button===0&&((he=(ce=K.target)==null?void 0:ce.releasePointerCapture)==null||he.call(ce,K.pointerId),!x&&K.target===A.current&&y.getState().userSelectionRect&&(C==null||C(K)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(K),y.setState({nodesSelectionActive:R.current.size>0})),P())},V=K=>{var ce,he;(he=(ce=K.target)==null?void 0:ce.releasePointerCapture)==null||he.call(ce,K.pointerId),P()},X=s===!0||Array.isArray(s)&&s.includes(0);return o.jsxs("div",{className:ii(["react-flow__pane",{draggable:X,dragging:w,selection:e}]),onClick:k?void 0:ow(C,A),onContextMenu:ow(I,A),onWheel:ow(D,A),onPointerEnter:k?void 0:h,onPointerMove:k?Q:p,onPointerUp:k?ee:void 0,onPointerCancel:k?V:void 0,onPointerDownCapture:k?O:void 0,onClickCapture:k?$:void 0,onPointerLeave:m,ref:A,style:Fx,children:[b,o.jsx(gle,{})]})}function nN({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Fa.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=s==null?void 0:s.current)==null?void 0:d.blur()})):i([e])}function hU({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:r,nodeClickDistance:a}){const l=gs(),[c,u]=g.useState(!1),d=g.useRef();return g.useEffect(()=>{d.current=Gae({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{nN({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),g.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:r,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,s,t,r,e,i,a]),c}const xle=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function pU(){const e=gs();return g.useCallback(n=>{const{nodeExtent:s,snapToGrid:i,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=xle(a),p=i?r[0]:5,m=i?r[1]:5,b=n.direction.x*p*n.factor,v=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};i&&(x=Tg(x,r));const{position:E,positionAbsolute:w}=C9({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:s,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const M2=g.createContext(null),Ele=M2.Provider;M2.Consumer;const mU=()=>g.useContext(M2),vle=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),wle=(e,t,n)=>s=>{const{connectionClickStartHandle:i,connectionMode:r,connection:a}=s,{fromHandle:l,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:r===Cf.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function _le({type:e="source",position:t=Qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,C;const m=a||null,b=e==="target",v=gs(),y=mU(),{connectOnClick:x,noPanClassName:E,rfId:w}=Xt(vle,ms),{connectingFrom:S,connectingTo:_,clickConnecting:T,isPossibleEndHandle:k,connectionInProcess:A,clickConnectionInProcess:j,valid:R}=Xt(wle(y,m,e),ms);y||(C=(F=v.getState()).onError)==null||C.call(F,"010",Fa.error010());const B=I=>{const{defaultEdgeOptions:D,onConnect:$,hasDefaultEdges:O}=v.getState(),te={...D,...I};if(O){const{edges:se,setEdges:P,onError:Q}=v.getState();P(uU(te,se,{onError:Q}))}$==null||$(te),l==null||l(te)},z=I=>{if(!y)return;const D=D9(I.nativeEvent);if(i&&(D&&I.button===0||!D)){const $=v.getState();tN.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:b,handleId:m,nodeId:y,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...O)=>{var te,se;return(se=(te=v.getState()).onConnectEnd)==null?void 0:se.call(te,...O)},updateConnection:$.updateConnection,onConnect:B,isValidConnection:n||((...O)=>{var te,se;return((se=(te=v.getState()).isValidConnection)==null?void 0:se.call(te,...O))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}D?d==null||d(I):f==null||f(I)},L=I=>{const{onClickConnectStart:D,onClickConnectEnd:$,connectionClickStartHandle:O,connectionMode:te,isValidConnection:se,lib:P,rfId:Q,nodeLookup:ee,connection:V}=v.getState();if(!y||!O&&!i)return;if(!O){D==null||D(I.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const X=M9(I.target),K=n||se,{connection:ce,isValid:he}=tN.isValid(I.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:te,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:K,flowId:Q,doc:X,lib:P,nodeLookup:ee});he&&ce&&B(ce);const be=structuredClone(V);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,$==null||$(I,be),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:ii(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:r,clickconnecting:T,connectingfrom:S,connectingto:_,valid:R,connectionindicator:s&&(!A||k)&&(A||j?r:i)}]),onMouseDown:z,onTouchStart:z,onClick:x?L:void 0,ref:p,...h,children:c})}const Bi=g.memo(dU(_le));function Sle({data:e,isConnectable:t,sourcePosition:n=Qe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Bi,{type:"source",position:n,isConnectable:t})]})}function Nle({data:e,isConnectable:t,targetPosition:n=Qe.Top,sourcePosition:s=Qe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Bi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Bi,{type:"source",position:s,isConnectable:t})]})}function Tle(){return null}function kle({data:e,isConnectable:t,targetPosition:n=Qe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Bi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const E1={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},XO={input:Sle,default:Nle,output:kle,group:Tle};function Ale(e){var t,n,s,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const Cle=e=>{const{width:t,height:n,x:s,y:i}=Ng(e.nodeLookup,{filter:r=>!!r.selected});return{width:Ma(t)?t:null,height:Ma(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${i}px)`}};function Ile({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=gs(),{width:i,height:r,transformString:a,userSelectionActive:l}=Xt(Cle,ms),c=pU(),u=g.useRef(null);g.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&r!==null;if(hU({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=s.getState().nodes.filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(E1,p.key)&&(p.preventDefault(),c({direction:E1[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:ii(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:r}})})}const QO=typeof window<"u"?window:void 0,jle=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function gU({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:k,autoPanOnSelection:A,defaultViewport:j,translateExtent:R,minZoom:B,maxZoom:z,preventScrolling:L,onSelectionContextMenu:F,noWheelClassName:C,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:$,isControlledViewport:O}){const{nodesSelectionActive:te,userSelectionActive:se}=Xt(jle,ms),P=$m(u,{target:QO}),Q=$m(b,{target:QO}),ee=Q||k,V=Q||w,X=d&&ee!==!0,K=P||se||X;return dle({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(ple,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:!P&&ee,defaultViewport:j,translateExtent:R,minZoom:B,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:L,noWheelClassName:C,noPanClassName:I,onViewportChange:$,isControlledViewport:O,paneClickDistance:l,selectionOnDrag:X,children:o.jsxs(yle,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:ee,autoPanOnSelection:A,isSelecting:!!K,selectionMode:f,selectionKeyPressed:P,paneClickDistance:l,selectionOnDrag:X,children:[e,te&&o.jsx(Ile,{onSelectionContextMenu:F,noPanClassName:I,disableKeyboardA11y:D})]})})}gU.displayName="FlowRenderer";const Rle=g.memo(gU),Ole=e=>t=>e?S2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Mle(e){return Xt(g.useCallback(Ole(e),[e]),ms)}const Lle=e=>e.updateNodeInternals;function Dle(){const e=Xt(Lle),[t]=g.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(i=>{const r=i.target.getAttribute("data-id");s.set(r,{id:r,nodeElement:i.target,force:!0})}),e(s)}));return g.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Ple({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const i=gs(),r=g.useRef(null),a=g.useRef(null),l=g.useRef(e.sourcePosition),c=g.useRef(e.targetPosition),u=g.useRef(t),d=n&&!!e.internals.handleBounds;return g.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(s==null||s.unobserve(a.current)),s==null||s.observe(r.current),a.current=r.current)},[d,e.hidden]),g.useEffect(()=>()=>{a.current&&(s==null||s.unobserve(a.current),a.current=null)},[]),g.useEffect(()=>{if(r.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function Ble({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:i,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:S}=Xt(K=>{const ce=K.nodeLookup.get(e),he=K.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:he}},ms);let _=E.type||"default",T=(v==null?void 0:v[_])||XO[_];T===void 0&&(x==null||x("003",Fa.error003(_)),_="default",T=(v==null?void 0:v.default)||XO.default);const k=!!(E.draggable||l&&typeof E.draggable>"u"),A=!!(E.selectable||c&&typeof E.selectable>"u"),j=!!(E.connectable||u&&typeof E.connectable>"u"),R=!!(E.focusable||d&&typeof E.focusable>"u"),B=gs(),z=k2(E),L=Ple({node:E,nodeType:_,hasDimensions:z,resizeObserver:f}),F=hU({nodeRef:L,disabled:E.hidden||!k,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:y}),C=pU();if(E.hidden)return null;const I=hl(E),D=Ale(E),$=A||k||t||n||s||i,O=n?K=>n(K,{...w.userNode}):void 0,te=s?K=>s(K,{...w.userNode}):void 0,se=i?K=>i(K,{...w.userNode}):void 0,P=r?K=>r(K,{...w.userNode}):void 0,Q=a?K=>a(K,{...w.userNode}):void 0,ee=K=>{const{selectNodesOnDrag:ce,nodeDragThreshold:he}=B.getState();A&&(!ce||!k||he>0)&&nN({id:e,store:B,nodeRef:L}),t&&t(K,{...w.userNode})},V=K=>{if(!(L9(K.nativeEvent)||m)){if(S9.includes(K.key)&&A){const ce=K.key==="Escape";nN({id:e,store:B,unselect:ce,nodeRef:L})}else if(k&&E.selected&&Object.prototype.hasOwnProperty.call(E1,K.key)){K.preventDefault();const{ariaLabelConfig:ce}=B.getState();B.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),C({direction:E1[K.key],factor:K.shiftKey?4:1})}}},X=()=>{var Le;if(m||!((Le=L.current)!=null&&Le.matches(":focus-visible")))return;const{transform:K,width:ce,height:he,autoPanOnNodeFocus:be,setCenter:ue}=B.getState();if(!be)return;S2(new Map([[e,E]]),{x:0,y:0,width:ce,height:he},K,!0).length>0||ue(E.position.x+I.width/2,E.position.y+I.height/2,{zoom:K[2]})};return o.jsx("div",{className:ii(["react-flow__node",`react-flow__node-${_}`,{[p]:k},E.className,{selected:E.selected,selectable:A,parent:S,draggable:k,dragging:F}]),ref:L,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:z?"visible":"hidden",...E.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:te,onMouseLeave:se,onContextMenu:P,onClick:ee,onDoubleClick:Q,onKeyDown:R?V:void 0,tabIndex:R?0:void 0,onFocus:R?X:void 0,role:E.ariaRole??(R?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${iU}-${b}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(Ele,{value:e,children:o.jsx(T,{id:e,data:E.data,type:_,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:E.selected??!1,selectable:A,draggable:k,deletable:E.deletable??!0,isConnectable:j,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...I})})})}var Ule=g.memo(Ble);const Fle=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function bU(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,onError:r}=Xt(Fle,ms),a=Mle(e.onlyRenderVisibleElements),l=Dle();return o.jsx("div",{className:"react-flow__nodes",style:Fx,children:a.map(c=>o.jsx(Ule,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}bU.displayName="NodeRenderer";const $le=g.memo(bU);function Hle(e){return Xt(g.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const s=[];if(n.width&&n.height)for(const i of n.edges){const r=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);r&&a&&Tae({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&s.push(i.id)}return s},[e]),ms)}const zle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Vle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ZO={[If.Arrow]:zle,[If.ArrowClosed]:Vle};function Gle(e){const t=gs();return g.useMemo(()=>{var i,r;return Object.prototype.hasOwnProperty.call(ZO,e)?ZO[e]:((r=(i=t.getState()).onError)==null||r.call(i,"009",Fa.error009(e)),null)},[e])}const Kle=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=Gle(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},yU=({defaultColor:e,rfId:t})=>{const n=Xt(r=>r.edges),s=Xt(r=>r.defaultEdgeOptions),i=g.useMemo(()=>Mae(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(r=>o.jsx(Kle,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};yU.displayName="MarkerDefinitions";var qle=g.memo(yU);function xU({x:e,y:t,label:n,labelStyle:s,labelShowBg:i=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=g.useState({x:1,y:0,width:0,height:0}),p=ii(["react-flow__edge-textwrapper",u]),m=g.useRef(null);return g.useEffect(()=>{if(m.current){const b=m.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:r,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:s,children:n}),c]}):null}xU.displayName="EdgeText";const Yle=g.memo(xU);function kg({path:e,labelX:t,labelY:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:ii(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,s&&Ma(t)&&Ma(n)?o.jsx(Yle,{x:t,y:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function JO({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Qe.Left||e===Qe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function EU({sourceX:e,sourceY:t,sourcePosition:n=Qe.Bottom,targetX:s,targetY:i,targetPosition:r=Qe.Top}){const[a,l]=JO({pos:n,x1:e,y1:t,x2:s,y2:i}),[c,u]=JO({pos:r,x1:s,y1:i,x2:e,y2:t}),[d,f,h,p]=P9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${s},${i}`,d,f,h,p]}function vU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,E,w]=EU({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(kg,{id:S,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})})}const Wle=vU({isInternal:!1}),wU=vU({isInternal:!0});Wle.displayName="SimpleBezierEdge";wU.displayName="SimpleBezierEdgeInternal";function _U(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Qe.Bottom,targetPosition:m=Qe.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,S]=x1({sourceX:n,sourceY:s,sourcePosition:p,targetX:i,targetY:r,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),_=e.isInternal?void 0:t;return o.jsx(kg,{id:_,path:E,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const SU=_U({isInternal:!1}),NU=_U({isInternal:!0});SU.displayName="SmoothStepEdge";NU.displayName="SmoothStepEdgeInternal";function TU(e){return g.memo(({id:t,...n})=>{var i;const s=e.isInternal?void 0:t;return o.jsx(SU,{...n,id:s,pathOptions:g.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const Xle=TU({isInternal:!1}),kU=TU({isInternal:!0});Xle.displayName="StepEdge";kU.displayName="StepEdgeInternal";function AU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[v,y,x]=F9({sourceX:n,sourceY:s,targetX:i,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(kg,{id:E,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})})}const Qle=AU({isInternal:!1}),CU=AU({isInternal:!0});Qle.displayName="StraightEdge";CU.displayName="StraightEdgeInternal";function IU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a=Qe.Bottom,targetPosition:l=Qe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,S]=B9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),_=e.isInternal?void 0:t;return o.jsx(kg,{id:_,path:E,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:x})})}const Zle=IU({isInternal:!1}),jU=IU({isInternal:!0});Zle.displayName="BezierEdge";jU.displayName="BezierEdgeInternal";const eM={default:jU,straight:CU,step:kU,smoothstep:NU,simplebezier:wU},tM={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Jle=(e,t,n)=>n===Qe.Left?e-t:n===Qe.Right?e+t:e,ece=(e,t,n)=>n===Qe.Top?e-t:n===Qe.Bottom?e+t:e,nM="react-flow__edgeupdater";function sM({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:r,onMouseOut:a,className:ii([nM,`${nM}-${l}`]),cx:Jle(t,s,e),cy:ece(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function tce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:i,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=gs(),b=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:_,domNode:T,connectionMode:k,connectionRadius:A,lib:j,onConnectStart:R,cancelConnection:B,nodeLookup:z,rfId:L,panBy:F,updateConnection:C}=m.getState(),I=S.type==="target",D=(te,se)=>{h(!1),f==null||f(te,n,S.type,se)},$=te=>u==null?void 0:u(n,te),O=(te,se)=>{h(!0),d==null||d(w,n,S.type),R==null||R(te,se)};tN.onPointerDown(w.nativeEvent,{autoPanOnConnect:_,connectionMode:k,connectionRadius:A,domNode:T,handleId:S.id,nodeId:S.nodeId,nodeLookup:z,isTarget:I,edgeUpdaterType:S.type,lib:j,flowId:L,cancelConnection:B,panBy:F,isValidConnection:(...te)=>{var se,P;return((P=(se=m.getState()).isValidConnection)==null?void 0:P.call(se,...te))??!0},onConnect:$,onConnectStart:O,onConnectEnd:(...te)=>{var se,P;return(P=(se=m.getState()).onConnectEnd)==null?void 0:P.call(se,...te)},onReconnectEnd:D,updateConnection:C,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),E=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(sM,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(sM,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function nce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:i,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=Xt(ue=>ue.edgeLookup.get(e));const w=Xt(ue=>ue.defaultEdgeOptions);E=w?{...w,...E}:E;let S=E.type||"default",_=(b==null?void 0:b[S])||eM[S];_===void 0&&(y==null||y("011",Fa.error011(S)),S="default",_=(b==null?void 0:b.default)||eM.default);const T=!!(E.focusable||t&&typeof E.focusable>"u"),k=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),A=!!(E.selectable||s&&typeof E.selectable>"u"),j=g.useRef(null),[R,B]=g.useState(!1),[z,L]=g.useState(!1),F=gs(),{zIndex:C,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:te,targetPosition:se}=Xt(g.useCallback(ue=>{const we=ue.nodeLookup.get(E.source),Le=ue.nodeLookup.get(E.target);if(!we||!Le)return{zIndex:E.zIndex,...tM};const Ne=Oae({id:e,sourceNode:we,targetNode:Le,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:ue.connectionMode,onError:y});return{zIndex:Nae({selected:E.selected,zIndex:E.zIndex,sourceNode:we,targetNode:Le,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode}),...Ne||tM}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),ms),P=g.useMemo(()=>E.markerStart?`url('#${JS(E.markerStart,m)}')`:void 0,[E.markerStart,m]),Q=g.useMemo(()=>E.markerEnd?`url('#${JS(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||I===null||D===null||$===null||O===null)return null;const ee=ue=>{var ae;const{addSelectedEdges:we,unselectNodesAndEdges:Le,multiSelectionActive:Ne}=F.getState();A&&(F.setState({nodesSelectionActive:!1}),E.selected&&Ne?(Le({nodes:[],edges:[E]}),(ae=j.current)==null||ae.blur()):we([e])),i&&i(ue,E)},V=r?ue=>{r(ue,{...E})}:void 0,X=a?ue=>{a(ue,{...E})}:void 0,K=l?ue=>{l(ue,{...E})}:void 0,ce=c?ue=>{c(ue,{...E})}:void 0,he=u?ue=>{u(ue,{...E})}:void 0,be=ue=>{var we;if(!x&&S9.includes(ue.key)&&A){const{unselectNodesAndEdges:Le,addSelectedEdges:Ne}=F.getState();ue.key==="Escape"?((we=j.current)==null||we.blur(),Le({edges:[E]})):Ne([e])}};return o.jsx("svg",{style:{zIndex:C},children:o.jsxs("g",{className:ii(["react-flow__edge",`react-flow__edge-${S}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!A&&!i,updating:R,selectable:A}]),onClick:ee,onDoubleClick:V,onContextMenu:X,onMouseEnter:K,onMouseMove:ce,onMouseLeave:he,onKeyDown:T?be:void 0,tabIndex:T?0:void 0,role:E.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":T?`${rU}-${m}`:void 0,ref:j,...E.domAttributes,children:[!z&&o.jsx(_,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:A,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:te,targetPosition:se,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:P,markerEnd:Q,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),k&&o.jsx(tce,{edge:E,isReconnectable:k,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:te,targetPosition:se,setUpdateHover:B,setReconnecting:L})]})})}var sce=g.memo(nce);const ice=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function RU({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:i,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=Xt(ice,ms),w=Hle(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(qle,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(sce,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:i,onReconnect:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:E,edgeTypes:s,disableKeyboardA11y:b},S))]})}RU.displayName="EdgeRenderer";const rce=g.memo(RU),ace=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oce({children:e}){const t=Xt(ace);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function lce(e){const t=Ux(),n=g.useRef(!1);g.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const cce=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function uce(e){const t=Xt(cce),n=gs();return g.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function dce(e){return e.connection.inProgress?{...e.connection,to:oh(e.connection.to,e.transform)}:{...e.connection}}function fce(e){return dce}function hce(e){const t=fce();return Xt(t,ms)}const pce=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mce({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:i,width:r,height:a,isValid:l,inProgress:c}=Xt(pce,ms);return!(r&&i&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:ii(["react-flow__connection",k9(l)]),children:o.jsx(OU,{style:t,type:n,CustomComponent:s,isValid:l})})})}const OU=({style:e,type:t=Pl.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:i,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=hce();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:r.x,fromY:r.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:k9(s),toNode:d,toHandle:f,pointer:p});let m="";const b={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Pl.Bezier:[m]=B9(b);break;case Pl.SimpleBezier:[m]=EU(b);break;case Pl.Step:[m]=x1({...b,borderRadius:0});break;case Pl.SmoothStep:[m]=x1(b);break;default:[m]=F9(b)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};OU.displayName="ConnectionLine";const gce={};function iM(e=gce){g.useRef(e),gs(),g.useEffect(()=>{},[e])}function bce(){gs(),g.useRef(!1),g.useEffect(()=>{},[])}function MU({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:i,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:T,deleteKeyCode:k,onlyRenderVisibleElements:A,elementsSelectable:j,defaultViewport:R,translateExtent:B,minZoom:z,maxZoom:L,preventScrolling:F,defaultMarkerColor:C,zoomOnScroll:I,zoomOnPinch:D,panOnScroll:$,panOnScrollSpeed:O,panOnScrollMode:te,zoomOnDoubleClick:se,panOnDrag:P,autoPanOnSelection:Q,onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneScroll:ce,onPaneContextMenu:he,paneClickDistance:be,nodeClickDistance:ue,onEdgeContextMenu:we,onEdgeMouseEnter:Le,onEdgeMouseMove:Ne,onEdgeMouseLeave:ae,reconnectRadius:me,onReconnect:_e,onReconnectStart:Je,onReconnectEnd:Pe,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:Ce,disableKeyboardA11y:Ve,nodeExtent:Ue,rfId:W,viewport:oe,onViewportChange:Z}){return iM(e),iM(t),bce(),lce(n),uce(oe),o.jsx(Rle,{onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneContextMenu:he,onPaneScroll:ce,paneClickDistance:be,deleteKeyCode:k,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:T,elementsSelectable:j,zoomOnScroll:I,zoomOnPinch:D,zoomOnDoubleClick:se,panOnScroll:$,panOnScrollSpeed:O,panOnScrollMode:te,panOnDrag:P,autoPanOnSelection:Q,defaultViewport:R,translateExtent:B,minZoom:z,maxZoom:L,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:Ce,disableKeyboardA11y:Ve,onViewportChange:Z,isControlledViewport:!!oe,children:o.jsxs(oce,{children:[o.jsx(rce,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:_e,onReconnectStart:Je,onReconnectEnd:Pe,onlyRenderVisibleElements:A,onEdgeContextMenu:we,onEdgeMouseEnter:Le,onEdgeMouseMove:Ne,onEdgeMouseLeave:ae,reconnectRadius:me,defaultMarkerColor:C,noPanClassName:Ce,disableKeyboardA11y:Ve,rfId:W}),o.jsx(mce,{style:b,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx($le,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ue,onlyRenderVisibleElements:A,noPanClassName:Ce,noDragClassName:Fe,disableKeyboardA11y:Ve,nodeExtent:Ue,rfId:W}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}MU.displayName="GraphView";const yce=g.memo(MU),xce=R9(),rM=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,b=new Map,v=new Map,y=s??t??[],x=n??e??[],E=d??[0,0],w=f??Pm;z9(b,v,y);const{nodesInitialized:S}=eN(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let _=[0,0,1];if(a&&i&&r){const T=Ng(p,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:k,y:A,zoom:j}=T2(T,i,r,c,u,(l==null?void 0:l.padding)??.1);_=[k,A,j]}return{rfId:"1",width:i??0,height:r??0,transform:_,nodes:x,nodesInitialized:S,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Pm,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Cf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...T9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xce,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:N9,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ece=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>Doe((p,m)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:S,minZoom:_,maxZoom:T}=m();y&&(await yae({nodes:v,width:w,height:S,panZoom:y,minZoom:_,maxZoom:T},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...rM({nodes:e,edges:t,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:s,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:_,nodesSelectionActive:T}=m(),{nodesInitialized:k,hasSelectedNodes:A}=eN(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:_}),j=T&&A;S&&k?(b(),p({nodes:v,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:j})):p({nodes:v,nodesInitialized:k,nodesSelectionActive:j})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();z9(y,x,v),p({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=m();x(v),p({hasDefaultNodes:!0})}if(y){const{setEdges:x}=m();x(y),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:E,domNode:w,nodeOrigin:S,nodeExtent:_,debug:T,fitViewQueued:k,zIndexMode:A}=m(),{changes:j,updatedInternals:R}=$ae(v,x,E,w,S,_,A);R&&(Pae(x,E,{nodeOrigin:S,nodeExtent:_,zIndexMode:A}),k?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(j==null?void 0:j.length)>0&&(T&&console.log("React Flow: trigger node changes",j),y==null||y(j)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:S,connection:_,updateConnection:T,onNodesChangeMiddlewareMap:k}=m();for(const[A,j]of v){const R=w.get(A),B=!!(R!=null&&R.expandParent&&(R!=null&&R.parentId)&&(j!=null&&j.position)),z={id:A,type:"position",position:B?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:y};if(R&&_.inProgress&&_.fromNode.id===R.id){const L=Eu(R,_.fromHandle,Qe.Left,!0);T({..._,from:L})}B&&R.parentId&&x.push({id:A,parentId:R.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),E.push(z)}if(x.length>0){const{parentLookup:A,nodeOrigin:j}=m(),R=O2(x,w,A,j);E.push(...R)}for(const A of k.values())E=A(E);S(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:S}=m();if(v!=null&&v.length){if(w){const _=lU(v,E);x(_)}S&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:S}=m();if(v!=null&&v.length){if(w){const _=cU(v,E);x(_)}S&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:S}=m();if(y){const _=v.map(T=>Uc(T,!0));w(_);return}w(Ud(E,new Set([...v]),!0)),S(Ud(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:S}=m();if(y){const _=v.map(T=>Uc(T,!0));S(_);return}S(Ud(x,new Set([...v]))),w(Ud(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:_}=m(),T=v||E,k=y||x,A=[];for(const R of T){if(!R.selected)continue;const B=w.get(R.id);B&&(B.selected=!1),A.push(Uc(R.id,!1))}const j=[];for(const R of k)R.selected&&j.push(Uc(R.id,!1));S(A),_(j)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=m();y==null||y.setScaleExtent([v,x]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=m();y==null||y.setScaleExtent([x,v]),p({maxZoom:v})},setTranslateExtent:v=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:E,elementsSelectable:w}=m();if(!w)return;const S=y.reduce((T,k)=>k.selected?[...T,Uc(k.id,!1)]:T,[]),_=v.reduce((T,k)=>k.selected?[...T,Uc(k.id,!1)]:T,[]);x(S),E(_)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:_,zIndexMode:T}=m();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(eN(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:T}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:S}=m();return Hae({delta:v,panZoom:w,transform:y,translateExtent:S,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:S,panZoom:_}=m();if(!_)return!1;const T=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:S;return await _.setViewport({x:E/2-v*T,y:w/2-y*T,zoom:T},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...T9}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...rM()})}},Object.is);function L2({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:i,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=g.useState(()=>Ece({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(Poe,{value:m,children:o.jsx(ole,{children:p})})}function vce({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:i,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return g.useContext(Px)?o.jsx(o.Fragment,{children:e}):o.jsx(L2,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:i,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const wce={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function _ce({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:_,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:A,onNodesDelete:j,onEdgesDelete:R,onDelete:B,onSelectionChange:z,onSelectionDragStart:L,onSelectionDrag:F,onSelectionDragStop:C,onSelectionContextMenu:I,onSelectionStart:D,onSelectionEnd:$,onBeforeDelete:O,connectionMode:te,connectionLineType:se=Pl.Bezier,connectionLineStyle:P,connectionLineComponent:Q,connectionLineContainerStyle:ee,deleteKeyCode:V="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:K=!1,selectionMode:ce=Bm.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:be=Fm()?"Meta":"Control",zoomActivationKeyCode:ue=Fm()?"Meta":"Control",snapToGrid:we,snapGrid:Le,onlyRenderVisibleElements:Ne=!1,selectNodesOnDrag:ae,nodesDraggable:me,autoPanOnNodeFocus:_e,nodesConnectable:Je,nodesFocusable:Pe,nodeOrigin:Fe=aU,edgesFocusable:Ye,edgesReconnectable:Ce,elementsSelectable:Ve=!0,defaultViewport:Ue=Xoe,minZoom:W=.5,maxZoom:oe=2,translateExtent:Z=Pm,preventScrolling:Ee=!0,nodeExtent:Me,defaultMarkerColor:lt="#b1b1b7",zoomOnScroll:Ot=!0,zoomOnPinch:ut=!0,panOnScroll:xn=!1,panOnScrollSpeed:xt=.5,panOnScrollMode:wt=ru.Free,zoomOnDoubleClick:En=!0,panOnDrag:Ut=!0,onPaneClick:Pt,onPaneMouseEnter:at,onPaneMouseMove:ft,onPaneMouseLeave:He,onPaneScroll:_t,onPaneContextMenu:ye,paneClickDistance:We=1,nodeClickDistance:Ge=0,children:ht,onReconnect:Vn,onReconnectStart:un,onReconnectEnd:Ht,onEdgeContextMenu:sn,onEdgeDoubleClick:kn,onEdgeMouseEnter:zt,onEdgeMouseMove:ot,onEdgeMouseLeave:An,reconnectRadius:mn=10,onNodesChange:At,onEdgesChange:Os,noDragClassName:Ms="nodrag",noWheelClassName:bs="nowheel",noPanClassName:vn="nopan",fitView:Gn,fitViewOptions:ls,connectOnClick:Kn,attributionPosition:Ss,proOptions:Ns,defaultEdgeOptions:hi,elevateNodesOnSelect:Cn=!0,elevateEdgesOnSelect:Ks=!1,disableKeyboardA11y:cs=!1,autoPanOnConnect:qn,autoPanOnNodeDrag:Yn,autoPanOnSelection:Wn=!0,autoPanSpeed:Ls,connectionRadius:ys,isValidConnection:gn,onError:fn,style:dn,id:rn,nodeDragThreshold:an,connectionDragThreshold:xs,viewport:de,onViewportChange:Ie,width:Be,height:it,colorMode:et="light",debug:Et,onScroll:je,ariaLabelConfig:Ln,zIndexMode:us="basic",...pi},ri){const Xn=rn||"1",Jt=ele(et),vt=g.useCallback(Dn=>{Dn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),je==null||je(Dn)},[je]);return o.jsx("div",{"data-testid":"rf__wrapper",...pi,onScroll:vt,style:{...dn,...wce},ref:ri,className:ii(["react-flow",i,Jt]),id:rn,role:"application",children:o.jsxs(vce,{nodes:e,edges:t,width:Be,height:it,fitView:Gn,fitViewOptions:ls,minZoom:W,maxZoom:oe,nodeOrigin:Fe,nodeExtent:Me,zIndexMode:us,children:[o.jsx(Joe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:me,autoPanOnNodeFocus:_e,nodesConnectable:Je,nodesFocusable:Pe,edgesFocusable:Ye,edgesReconnectable:Ce,elementsSelectable:Ve,elevateNodesOnSelect:Cn,elevateEdgesOnSelect:Ks,minZoom:W,maxZoom:oe,nodeExtent:Me,onNodesChange:At,onEdgesChange:Os,snapToGrid:we,snapGrid:Le,connectionMode:te,translateExtent:Z,connectOnClick:Kn,defaultEdgeOptions:hi,fitView:Gn,fitViewOptions:ls,onNodesDelete:j,onEdgesDelete:R,onDelete:B,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:A,onSelectionDrag:F,onSelectionDragStart:L,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:vn,nodeOrigin:Fe,rfId:Xn,autoPanOnConnect:qn,autoPanOnNodeDrag:Yn,autoPanSpeed:Ls,onError:fn,connectionRadius:ys,isValidConnection:gn,selectNodesOnDrag:ae,nodeDragThreshold:an,connectionDragThreshold:xs,onBeforeDelete:O,debug:Et,ariaLabelConfig:Ln,zIndexMode:us}),o.jsx(yce,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:_,nodeTypes:r,edgeTypes:a,connectionLineType:se,connectionLineStyle:P,connectionLineComponent:Q,connectionLineContainerStyle:ee,selectionKeyCode:X,selectionOnDrag:K,selectionMode:ce,deleteKeyCode:V,multiSelectionKeyCode:be,panActivationKeyCode:he,zoomActivationKeyCode:ue,onlyRenderVisibleElements:Ne,defaultViewport:Ue,translateExtent:Z,minZoom:W,maxZoom:oe,preventScrolling:Ee,zoomOnScroll:Ot,zoomOnPinch:ut,zoomOnDoubleClick:En,panOnScroll:xn,panOnScrollSpeed:xt,panOnScrollMode:wt,panOnDrag:Ut,autoPanOnSelection:Wn,onPaneClick:Pt,onPaneMouseEnter:at,onPaneMouseMove:ft,onPaneMouseLeave:He,onPaneScroll:_t,onPaneContextMenu:ye,paneClickDistance:We,nodeClickDistance:Ge,onSelectionContextMenu:I,onSelectionStart:D,onSelectionEnd:$,onReconnect:Vn,onReconnectStart:un,onReconnectEnd:Ht,onEdgeContextMenu:sn,onEdgeDoubleClick:kn,onEdgeMouseEnter:zt,onEdgeMouseMove:ot,onEdgeMouseLeave:An,reconnectRadius:mn,defaultMarkerColor:lt,noDragClassName:Ms,noWheelClassName:bs,noPanClassName:vn,rfId:Xn,disableKeyboardA11y:cs,nodeExtent:Me,viewport:de,onViewportChange:Ie}),o.jsx(Woe,{onSelectionChange:z}),ht,o.jsx(Voe,{proOptions:Ns,position:Ss}),o.jsx(zoe,{rfId:Xn,disableKeyboardA11y:cs})]})})}var LU=dU(_ce);const Sce=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Nce({children:e}){const t=Xt(Sce);return t?wi.createPortal(e,t):null}function DU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>lU(i,r)),[]);return[t,n,s]}function PU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>cU(i,r)),[]);return[t,n,s]}const Tce=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!k2(n.userNode))return!1;return!0};function kce(e={includeHiddenNodes:!1}){return Xt(Tce(e))}function Ace({dimensions:e,lineWidth:t,variant:n,className:s}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ii(["react-flow__background-pattern",n,s])})}function Cce({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:ii(["react-flow__background-pattern","dots",t])})}var tc;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(tc||(tc={}));const Ice={[tc.Dots]:1,[tc.Lines]:1,[tc.Cross]:6},jce=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function BU({id:e,variant:t=tc.Dots,gap:n=20,size:s,lineWidth:i=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=g.useRef(null),{transform:h,patternId:p}=Xt(jce,ms),m=s||Ice[t],b=t===tc.Dots,v=t===tc.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],E=m*h[2],w=Array.isArray(r)?r:[r,r],S=v?[E,E]:x,_=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],T=`${p}${e||""}`;return o.jsxs("svg",{className:ii(["react-flow__background",u]),style:{...c,...Fx,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:T,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:b?o.jsx(Cce,{radius:E/2,className:d}):o.jsx(Ace,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}BU.displayName="Background";const UU=g.memo(BU);function Rce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Oce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Mce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Lce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Dce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function tb({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:ii(["react-flow__controls-button",t]),...n,children:e})}const Pce=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function FU({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=gs(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=Xt(Pce,ms),{zoomIn:E,zoomOut:w,fitView:S}=Ux(),_=()=>{E(),r==null||r()},T=()=>{w(),a==null||a()},k=()=>{S(i),l==null||l()},A=()=>{m.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},j=h==="horizontal"?"horizontal":"vertical";return o.jsxs(Bx,{className:ii(["react-flow__controls",j,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(tb,{onClick:_,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(Rce,{})}),o.jsx(tb,{onClick:T,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(Oce,{})})]}),n&&o.jsx(tb,{className:"react-flow__controls-fitview",onClick:k,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(Mce,{})}),s&&o.jsx(tb,{className:"react-flow__controls-interactive",onClick:A,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(Dce,{}):o.jsx(Lce,{})}),d]})}FU.displayName="Controls";const $U=g.memo(FU);function Bce({id:e,x:t,y:n,width:s,height:i,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:b}=r||{},v=a||m||b;return o.jsx("rect",{className:ii(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:s,height:i,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const Uce=g.memo(Bce),Fce=e=>e.nodes.map(t=>t.id),lw=e=>e instanceof Function?e:()=>e;function $ce({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r=Uce,onClick:a}){const l=Xt(Fce,ms),c=lw(t),u=lw(e),d=lw(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(zce,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:s,nodeStrokeWidth:i,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function Hce({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:i,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Xt(m=>{const b=m.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:E,height:w}=hl(v);return{node:v,x:y,y:x,width:E,height:w}},ms);return!u||u.hidden||!k2(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:s(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const zce=g.memo(Hce);var Vce=g.memo($ce);const Gce=200,Kce=150,qce=e=>!e.hidden,Yce=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?j9(Ng(e.nodeLookup,{filter:qce}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Wce="react-flow__minimap-desc";function HU({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const S=gs(),_=g.useRef(null),{boundingRect:T,viewBB:k,rfId:A,panZoom:j,translateExtent:R,flowWidth:B,flowHeight:z,ariaLabelConfig:L}=Xt(Yce,ms),F=(e==null?void 0:e.width)??Gce,C=(e==null?void 0:e.height)??Kce,I=T.width/F,D=T.height/C,$=Math.max(I,D),O=$*F,te=$*C,se=w*$,P=T.x-(O-T.width)/2-se,Q=T.y-(te-T.height)/2-se,ee=O+se*2,V=te+se*2,X=`${Wce}-${A}`,K=g.useRef(0),ce=g.useRef();K.current=$,g.useEffect(()=>{if(_.current&&j)return ce.current=Qae({domNode:_.current,panZoom:j,getTransform:()=>S.getState().transform,getViewScale:()=>K.current}),()=>{var we;(we=ce.current)==null||we.destroy()}},[j]),g.useEffect(()=>{var we;(we=ce.current)==null||we.update({translateExtent:R,width:B,height:z,inversePan:x,pannable:b,zoomStep:E,zoomable:v})},[b,v,x,E,R,B,z]);const he=p?we=>{var ae;const[Le,Ne]=((ae=ce.current)==null?void 0:ae.pointer(we))||[0,0];p(we,{x:Le,y:Ne})}:void 0,be=m?g.useCallback((we,Le)=>{const Ne=S.getState().nodeLookup.get(Le).internals.userNode;m(we,Ne)},[]):void 0,ue=y??L["minimap.ariaLabel"];return o.jsx(Bx,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*$:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:ii(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:C,viewBox:`${P} ${Q} ${ee} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:_,onClick:he,children:[ue&&o.jsx("title",{id:X,children:ue}),o.jsx(Vce,{onClick:be,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-se},${Q-se}h${ee+se*2}v${V+se*2}h${-ee-se*2}z - M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}HU.displayName="MiniMap";const Xce=g.memo(HU),Qce=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Zce={[Mf.Line]:"right",[Mf.Handle]:"bottom-right"};function Jce({nodeId:e,position:t,variant:n=Mf.Handle,className:s,style:i=void 0,children:r,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=mU(),E=typeof e=="string"?e:x,w=gs(),S=g.useRef(null),_=n===Mf.Handle,T=Xt(g.useCallback(Qce(_&&p),[_,p]),ms),k=g.useRef(null),A=t??Zce[n];g.useEffect(()=>{if(!(!S.current||!E))return k.current||(k.current=uoe({domNode:S.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:R,transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F,domNode:C}=w.getState();return{nodeLookup:R,transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F,paneDomNode:C}},onChange:(R,B)=>{const{triggerNodeChanges:z,nodeLookup:L,parentLookup:F,nodeOrigin:C}=w.getState(),I=[],D={x:R.x,y:R.y},$=L.get(E);if($&&$.expandParent&&$.parentId){const O=$.origin??C,te=R.width??$.measured.width??0,se=R.height??$.measured.height??0,P={id:$.id,parentId:$.parentId,rect:{width:te,height:se,...O9({x:R.x??$.position.x,y:R.y??$.position.y},{width:te,height:se},$.parentId,L,O)}},Q=O2([P],L,F,C);I.push(...Q),D.x=R.x?Math.max(O[0]*te,R.x):void 0,D.y=R.y?Math.max(O[1]*se,R.y):void 0}if(D.x!==void 0&&D.y!==void 0){const O={id:E,type:"position",position:{...D}};I.push(O)}if(R.width!==void 0&&R.height!==void 0){const te={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:R.width,height:R.height}};I.push(te)}for(const O of B){const te={...O,type:"position"};I.push(te)}z(I)},onEnd:({width:R,height:B})=>{const z={id:E,type:"dimensions",resizing:!1,dimensions:{width:R,height:B}};w.getState().triggerNodeChanges([z])}})),k.current.update({controlPosition:A,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var R;(R=k.current)==null||R.destroy()}},[A,l,c,u,d,f,b,v,y,m]);const j=A.split("-");return o.jsx("div",{className:ii(["react-flow__resize-control","nodrag",...j,n,s]),ref:S,style:{...i,scale:T,...a&&{[_?"backgroundColor":"borderColor"]:a}},children:r})}g.memo(Jce);var zU=Object.defineProperty,eue=(e,t,n)=>t in e?zU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tue=(e,t)=>{for(var n in t)zU(e,n,{get:t[n],enumerable:!0})},nue=(e,t,n)=>eue(e,t+"",n),VU={};tue(VU,{Graph:()=>ma,alg:()=>D2,json:()=>KU,version:()=>rue});var sue=Object.defineProperty,GU=(e,t)=>{for(var n in t)sue(e,n,{get:t[n],enumerable:!0})},ma=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(s=>{n!==void 0?this.setNode(s,n):this.setNode(s)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(s=>{this.setParent(s)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let s=n;s!==void 0;s=this.parent(s))if(s===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let s=new Set(n);for(let i of this.successors(t))s.add(i);return Array.from(s.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,a])=>{t(r)&&n.setNode(r,a)}),Object.values(this._edgeObjs).forEach(r=>{n.hasNode(r.v)&&n.hasNode(r.w)&&n.setEdge(r,this.edge(r))});let s={},i=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(s[r]=a??void 0,a??void 0):a in s?s[a]:i(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,i(r))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((s,i)=>(n!==void 0?this.setEdge(s,i,n):this.setEdge(s,i),i)),this}setEdge(t,n,s,i){let r,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(r=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(r=t,a=n,l=i,arguments.length>2&&(c=s,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=Ep(this._isDirected,r,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(r,a,l);let f=iue(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,aM(this._preds[a],r),aM(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,s){let i=arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s);return this._edgeLabels[i]}edgeAsObj(t,n,s){let i=arguments.length===1?this.edge(t):this.edge(t,n,s);return typeof i!="object"?{label:i}:i}hasEdge(t,n,s){return(arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s))in this._edgeLabels}removeEdge(t,n,s){let i=arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s),r=this._edgeObjs[i];if(r){let a=r.v,l=r.w;delete this._edgeLabels[i],delete this._edgeObjs[i],oM(this._preds[l],a),oM(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,s){if(!t)return;let i=Object.values(t);return s?i.filter(r=>r.v===n&&r.w===s||r.v===s&&r.w===n):i}};function aM(e,t){e[t]?e[t]++:e[t]=1}function oM(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Ep(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let a=i;i=r,r=a}return i+""+r+""+(s===void 0?"\0":s)}function iue(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let l=i;i=r,r=l}let a={v:i,w:r};return s&&(a.name=s),a}function cw(e,t){return Ep(e,t.v,t.w,t.name)}var rue="4.0.1",KU={};GU(KU,{read:()=>cue,write:()=>aue});function aue(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:oue(e),edges:lue(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function oue(e){return e.nodes().map(t=>{let n=e.node(t),s=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),s!==void 0&&(i.parent=s),i})}function lue(e){return e.edges().map(t=>{let n=e.edge(t),s={v:t.v,w:t.w};return t.name!==void 0&&(s.name=t.name),n!==void 0&&(s.value=n),s})}function cue(e){let t=new ma(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var D2={};GU(D2,{CycleException:()=>w1,bellmanFord:()=>qU,components:()=>fue,dijkstra:()=>v1,dijkstraAll:()=>mue,findCycles:()=>gue,floydWarshall:()=>yue,isAcyclic:()=>Eue,postorder:()=>wue,preorder:()=>_ue,prim:()=>Sue,shortestPaths:()=>Nue,tarjan:()=>WU,topsort:()=>XU});var uue=()=>1;function qU(e,t,n,s){return due(e,String(t),n||uue,s||function(i){return e.outEdges(i)})}function due(e,t,n,s){let i={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);i[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,s=String(e);if(!(s in n)){let i=this._arr,r=i.length;return n[s]=r,i.push({key:s,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let s=this._arr[n].priority;if(t>s)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${s} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,s=n+1,i=e;n>1,!(t[s].priority1;function v1(e,t,n,s){let i=function(r){return e.outEdges(r)};return pue(e,String(t),n||hue,s||i)}function pue(e,t,n,s){let i={},r=new YU,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=r.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)s(a).forEach(c);return i}function mue(e,t,n){return e.nodes().reduce(function(s,i){return s[i]=v1(e,i,t,n),s},{})}function WU(e){let t=0,n=[],s={},i=[];function r(a){let l=s[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in s?s[c].onStack&&(l.lowlink=Math.min(l.lowlink,s[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,s[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),s[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in s||r(a)}),i}function gue(e){return WU(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var bue=()=>1;function yue(e,t,n){return xue(e,t||bue,n||function(s){return e.outEdges(s)})}function xue(e,t,n){let s={},i=e.nodes();return i.forEach(function(r){s[r]={},s[r][r]={distance:0,predecessor:""},i.forEach(function(a){r!==a&&(s[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);s[r][l]={distance:c,predecessor:r}})}),i.forEach(function(r){let a=s[r];i.forEach(function(l){let c=s[l];i.forEach(function(u){let d=c[r],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=QU(e,l,n==="post",a,r,s,i)}),i}function QU(e,t,n,s,i,r,a){return t in s||(s[t]=!0,n||(a=r(a,t)),i(t).forEach(function(l){a=QU(e,l,n,s,i,r,a)}),n&&(a=r(a,t))),a}function ZU(e,t,n){return vue(e,t,n,function(s,i){return s.push(i),s},[])}function wue(e,t){return ZU(e,t,"post")}function _ue(e,t){return ZU(e,t,"pre")}function Sue(e,t){let n=new ma,s={},i=new YU,r;function a(c){let u=c.v===r?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=i.removeMin(),r in s)n.setEdge(r,s[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function Nue(e,t,n,s){return Tue(e,t,n,s??(i=>{let r=e.outEdges(i);return r??[]}))}function Tue(e,t,n,s){if(n===void 0)return v1(e,t,n,s);let i=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let s=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:s.weight+i.weight,minlen:Math.max(s.minlen,i.minlen)})}),t}function JU(e){let t=new ma({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function lM(e,t){let n=e.x,s=e.y,i=t.x-n,r=t.y-s,a=e.width/2,l=e.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(i)*l?(r<0&&(l=-l),c=l*i/r,u=l):(i<0&&(a=-a),c=a,u=a*r/i),{x:n+c,y:s+u}}function Ag(e){let t=Hm(t7(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let s=e.node(n),i=s.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][s.order]=n)}),t}function Aue(e){let t=e.nodes().map(s=>{let i=e.node(s).rank;return i===void 0?Number.MAX_VALUE:i}),n=oo(Math.min,t);e.nodes().forEach(s=>{let i=e.node(s);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function Cue(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=oo(Math.min,t),s=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;s[l]||(s[l]=[]),s[l].push(a)});let i=0,r=e.graph().nodeRankFactor;Array.from(s).forEach((a,l)=>{a===void 0&&l%r!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function cM(e,t,n,s){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=s),lh(e,"border",i,t)}function Iue(e,t=e7){let n=[];for(let s=0;se7){let n=Iue(t);return e(...n.map(s=>e(...s)))}else return e(...t)}function t7(e){let t=e.nodes().map(n=>{let s=e.node(n).rank;return s===void 0?Number.MIN_VALUE:s});return oo(Math.max,t)}function jue(e,t){let n={lhs:[],rhs:[]};return e.forEach(s=>{t(s)?n.lhs.push(s):n.rhs.push(s)}),n}function n7(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function s7(e,t){return t()}var Rue=0;function P2(e){let t=++Rue;return e+(""+t)}function Hm(e,t,n=1){t==null&&(t=e,e=0);let s=r=>rts[t]:n=t,Object.entries(e).reduce((s,[i,r])=>(s[i]=n(r,i),s),{})}function Oue(e,t){return e.reduce((n,s,i)=>(n[s]=t[i],n),{})}var Hx="\0",Mue="3.0.0",Lue=class{constructor(){nue(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return uM(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&uM(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Due)),n=n._prev;return"["+e.join(", ")+"]"}};function uM(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Due(e,t){if(e!=="_next"&&e!=="_prev")return t}var Pue=Lue,Bue=()=>1;function Uue(e,t){if(e.nodeCount()<=1)return[];let n=$ue(e,t||Bue);return Fue(n.graph,n.buckets,n.zeroIdx).flatMap(s=>e.outEdges(s.v,s.w)||[])}function Fue(e,t,n){var s;let i=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)uw(e,t,n,l);for(;l=r.dequeue();)uw(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(s=t[c])==null?void 0:s.dequeue(),l){i=i.concat(uw(e,t,n,l,!0)||[]);break}}}return i}function uw(e,t,n,s,i){let r=[],a=i?r:void 0;return(e.inEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&r.push({v:l.v,w:l.w}),u.out-=c,sN(t,n,u)}),(e.outEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,sN(t,n,d)}),e.removeNode(s.v),a}function $ue(e,t){let n=new ma,s=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),s=Math.max(s,h.in+=u)});let r=Hue(i+s+3).map(()=>new Pue),a=s+1;return n.nodes().forEach(l=>{sN(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function sN(e,t,n){var s,i,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(s=e[0])==null||s.enqueue(n)}function Hue(e){let t=[];for(let n=0;n{let s=e.edge(n);e.removeEdge(n),s.forwardName=n.name,s.reversed=!0,e.setEdge(n.w,n.v,s,P2("rev"))});function t(n){return s=>n.edge(s).weight}}function Vue(e){let t=[],n={},s={};function i(r){Object.hasOwn(s,r)||(s[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[r])}return e.nodes().forEach(i),t}function Gue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let s=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,s)}})}function Kue(e){e.graph().dummyChains=[],e.edges().forEach(t=>que(e,t))}function que(e,t){let n=t.v,s=e.node(n).rank,i=t.w,r=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===s+1)return;e.removeEdge(t);let u,d,f;for(f=0,++s;s{let n=e.node(t),s=n.edgeLabel,i;for(e.setEdge(n.edgeObj,s);n.dummy;)i=e.successors(t)[0],e.removeNode(t),s.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height),t=i,n=e.node(t)})}function B2(e){let t={};function n(s){let i=e.node(s);if(Object.hasOwn(t,s))return i.rank;t[s]=!0;let r=e.outEdges(s),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=oo(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Df(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var i7=Wue;function Wue(e){let t=new ma({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let s=n[0],i=e.nodeCount();t.setNode(s,{});let r,a;for(;Xue(t,e){let a=r.v,l=s===a?r.w:a;!e.hasNode(l)&&!Df(t,r)&&(e.setNode(l,{}),e.setEdge(s,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Que(e,t){return t.edges().reduce((n,s)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(s.v)!==e.hasNode(s.w)&&(i=Df(t,s)),it.node(s).rank+=n)}var{preorder:Jue,postorder:ede}=D2,tde=Ru;Ru.initLowLimValues=F2;Ru.initCutValues=U2;Ru.calcCutValue=r7;Ru.leaveEdge=o7;Ru.enterEdge=l7;Ru.exchangeEdges=c7;function Ru(e){e=kue(e),B2(e);let t=i7(e);F2(t),U2(t,e);let n,s;for(;n=o7(t);)s=l7(t,e,n),c7(t,e,n,s)}function U2(e,t){let n=ede(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(s=>nde(e,t,s))}function nde(e,t,n){let s=e.node(n).parent,i=e.edge(n,s);i.cutvalue=r7(e,t,n)}function r7(e,t,n){let s=e.node(n).parent,i=!0,r=t.edge(n,s),a=0;r||(i=!1,r=t.edge(s,n)),a=r.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==s){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,ide(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function F2(e,t){arguments.length<2&&(t=e.nodes()[0]),a7(e,{},1,t)}function a7(e,t,n,s,i){let r=n,a=e.node(s);t[s]=!0;let l=e.neighbors(s);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=a7(e,t,n,c,s))}),a.low=r,a.lim=n++,i?a.parent=i:delete a.parent,n}function o7(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function l7(e,t,n){let s=n.v,i=n.w;t.hasEdge(s,i)||(s=n.w,i=n.v);let r=e.node(s),a=e.node(i),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===dM(e,e.node(u.v),l)&&c!==dM(e,e.node(u.w),l)).reduce((u,d)=>Df(t,d)!e.node(i).parent);if(!n)return;let s=Jue(e,[n]);s=s.slice(1),s.forEach(i=>{let r=e.node(i).parent,a=t.edge(i,r),l=!1;a||(a=t.edge(r,i),l=!0),t.node(i).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function ide(e,t,n){return e.hasEdge(t,n)}function dM(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var rde=ade;function ade(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":fM(e);break;case"tight-tree":lde(e);break;case"longest-path":ode(e);break;case"none":break;default:fM(e)}}var ode=B2;function lde(e){B2(e),i7(e)}function fM(e){tde(e)}var cde=ude;function ude(e){let t=fde(e);e.graph().dummyChains.forEach(n=>{let s=e.node(n),i=s.edgeObj,r=dde(e,t,i.v,i.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(s=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=s;for(;(d=e.parent(d))!==u;)r.push(d);return{path:i.concat(r.reverse()),lca:u}}function fde(e){let t={},n=0;function s(i){let r=n;e.children(i).forEach(s),t[i]={low:r,lim:n++}}return e.children(Hx).forEach(s),t}function hde(e){let t=lh(e,"root",{},"_root"),n=pde(e),s=Object.values(n),i=oo(Math.max,s)-1,r=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=mde(e)+1;e.children(Hx).forEach(l=>u7(e,t,r,a,i,n,l)),e.graph().nodeRankFactor=r}function u7(e,t,n,s,i,r,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=cM(e,"_bt"),d=cM(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;u7(e,t,n,s,i,r,h);let m=e.node(h),b=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?s:2*s,x=b!==v?1:i-((p=r[a])!=null?p:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=r[a])!=null?l:0)})}function pde(e){let t={};function n(s,i){let r=e.children(s);r&&r.length&&r.forEach(a=>n(a,i+1)),t[s]=i}return e.children(Hx).forEach(s=>n(s,1)),t}function mde(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function gde(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var bde=yde;function yde(e){function t(n){let s=e.children(n),i=e.node(n);if(s.length&&s.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let r=i.minRank,a=i.maxRank+1;rpM(e.node(t))),e.edges().forEach(t=>pM(e.edge(t)))}function pM(e){let t=e.width;e.width=e.height,e.height=t}function vde(e){e.nodes().forEach(t=>dw(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(dw),Object.hasOwn(s,"y")&&dw(s)})}function dw(e){e.y=-e.y}function wde(e){e.nodes().forEach(t=>fw(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(fw),Object.hasOwn(s,"x")&&fw(s)})}function fw(e){let t=e.x;e.x=e.y,e.y=t}function _de(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),s=n.map(l=>e.node(l).rank),i=oo(Math.max,s),r=Hm(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);r[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),r}function Sde(e,t){let n=0;for(let s=1;sd)),i=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:s[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),r=1;for(;r{let d=u.pos+r;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Tde(e,t=[]){return t.map(n=>{let s=e.inEdges(n);if(!s||!s.length)return{v:n};{let i=s.reduce((r,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:r.sum+l.weight*c.order,weight:r.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function kde(e,t){let n={};e.forEach((i,r)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:r};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let r=n[i.v],a=n[i.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let s=Object.values(n).filter(i=>!i.indegree);return Ade(s)}function Ade(e){let t=[];function n(i){return r=>{r.merged||(r.barycenter===void 0||i.barycenter===void 0||r.barycenter>=i.barycenter)&&Cde(i,r)}}function s(i){return r=>{r.in.push(i),--r.indegree===0&&e.push(r)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(s(i))}return t.filter(i=>!i.merged).map(i=>_1(i,["vs","i","barycenter","weight"]))}function Cde(e,t){let n=0,s=0;e.weight&&(n+=e.barycenter*e.weight,s+=e.weight),t.weight&&(n+=t.barycenter*t.weight,s+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/s,e.weight=s,e.i=Math.min(t.i,e.i),t.merged=!0}function Ide(e,t){let n=jue(e,d=>Object.hasOwn(d,"barycenter")),s=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;s.sort(jde(!!t)),c=mM(r,i,c),s.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=mM(r,i,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function mM(e,t,n){let s;for(;t.length&&(s=t[t.length-1]).i<=n;)t.pop(),e.push(s.vs),n++;return n}function jde(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function f7(e,t,n,s){let i=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Tde(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=f7(e,h.v,n,s);c[h.v]=p,Object.hasOwn(p,"barycenter")&&Ode(h,p)}});let d=kde(u,n);Rde(d,c);let f=Ide(d,s);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(l),b=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+b.order)/(f.weight+2),f.weight+=2}}return f}function Rde(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(s=>t[s]?t[s].vs:s)})}function Ode(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Mde(e,t,n,s){s||(s=e.nodes());let i=Lde(e),r=new ma({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return s.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){r.setNode(a),r.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=r.edge(f,a),p=h!==void 0?h.weight:0;r.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&r.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),r}function Lde(e){let t;for(;e.hasNode(t=P2("_root")););return t}function Dde(e,t,n){let s={},i;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=s[l],s[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function h7(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,h7);return}let n=t7(e),s=gM(e,Hm(1,n+1),"inEdges"),i=gM(e,Hm(n-1,-1,-1),"outEdges"),r=_de(e);if(bM(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){Pde(u%2?s:i,u%4>=2,c),r=Ag(e);let f=Sde(e,r);f{s.has(r)||s.set(r,[]),s.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&i(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,r)}return t.map(function(r){return Mde(e,r,n,s.get(r)||[])})}function Pde(e,t,n){let s=new ma;e.forEach(function(i){n.forEach(l=>s.setEdge(l.left,l.right));let r=i.graph().root,a=f7(i,r,s,t);a.vs.forEach((l,c)=>i.node(l).order=c),Dde(i,s,a.vs)})}function bM(e,t){Object.values(t).forEach(n=>n.forEach((s,i)=>e.node(s).order=i))}function Bde(e,t){let n={};function s(i,r){let a=0,l=0,c=i.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=Fde(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let b=e.predecessors(m);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=r[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&p7(n,p,f)})}})}function i(r,a){let l=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,s(a,u,f,l,c),u=f,l=c}}s(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(i),n}function Fde(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(s=>e.node(s).dummy)}}function p7(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];s||(e[t]=s={}),s[n]=!0}function $de(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];return s!==void 0&&Object.hasOwn(s,n)}function Hde(e,t,n,s){let i={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=s(u);if(d&&d.length){let f=d.sort((p,m)=>{let b=a[p],v=a[m];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let b=f[p];if(b===void 0)continue;let v=a[b];if(v!==void 0&&r[u]===u&&c{var y;let x=(y=r[v.v])!=null?y:0,E=a.edge(v);return Math.max(b,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),b=Number.POSITIVE_INFINITY;m&&(b=m.reduce((y,x)=>{let E=r[x.w],w=a.edge(x);return Math.min(y,(E!==void 0?E:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let v=e.node(p);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,b))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(s).forEach(p=>{var m;let b=n[p];b!==void 0&&(r[p]=(m=r[b])!=null?m:0)}),r}function Vde(e,t,n,s){let i=new ma,r=e.graph(),a=Wde(r.nodesep,r.edgesep,s);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function Gde(e,t){return Object.values(t).reduce((n,s)=>{let i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(s).forEach(([l,c])=>{let u=Xde(e,l)/2;i=Math.max(c+u,i),r=Math.min(c-u,r)});let a=i-r;return a{["l","r"].forEach(a=>{let l=r+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=s-oo(Math.min,u);a!=="l"&&(d=i-oo(Math.max,u)),d&&(e[l]=$x(c,f=>f+d))})})}function qde(e,t=void 0){let n=e.ul;return n?$x(n,(s,i)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((r=l[1])!=null?r:0)+((a=l[2])!=null?a:0))/2}):{}}function Yde(e){let t=Ag(e),n=Object.assign(Bde(e,t),Ude(e,t)),s={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=Hde(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=zde(e,i,c.root,c.align,l==="r");l==="r"&&(u=$x(u,d=>-d)),s[a+l]=u})});let r=Gde(e,s);return Kde(s,r),qde(s,e.graph().align)}function Wde(e,t,n){return(s,i,r)=>{let a=s.node(i),l=s.node(r),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function Xde(e,t){return e.node(t).width}function Qde(e){e=JU(e),Zde(e),Object.entries(Yde(e)).forEach(([t,n])=>e.node(t).x=n)}function Zde(e){let t=Ag(e),n=e.graph(),s=n.ranksep,i=n.rankalign,r=0;t.forEach(a=>{let l=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);i==="top"?u.y=r+u.height/2:i==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+s})}function Jde(e,t={}){let n=t.debugTiming?n7:s7;return n("layout",()=>{let s=n(" buildLayoutGraph",()=>cfe(e));return n(" runLayout",()=>efe(s,n,t)),n(" updateInputGraph",()=>tfe(e,s)),s})}function efe(e,t,n){t(" makeSpaceForEdgeLabels",()=>ufe(e)),t(" removeSelfEdges",()=>xfe(e)),t(" acyclic",()=>zue(e)),t(" nestingGraph.run",()=>hde(e)),t(" rank",()=>rde(JU(e))),t(" injectEdgeLabelProxies",()=>dfe(e)),t(" removeEmptyRanks",()=>Cue(e)),t(" nestingGraph.cleanup",()=>gde(e)),t(" normalizeRanks",()=>Aue(e)),t(" assignRankMinMax",()=>ffe(e)),t(" removeEdgeLabelProxies",()=>hfe(e)),t(" normalize.run",()=>Kue(e)),t(" parentDummyChains",()=>cde(e)),t(" addBorderSegments",()=>bde(e)),t(" order",()=>h7(e,n)),t(" insertSelfEdges",()=>Efe(e)),t(" adjustCoordinateSystem",()=>xde(e)),t(" position",()=>Qde(e)),t(" positionSelfEdges",()=>vfe(e)),t(" removeBorderNodes",()=>yfe(e)),t(" normalize.undo",()=>Yue(e)),t(" fixupEdgeLabelCoords",()=>gfe(e)),t(" undoCoordinateSystem",()=>Ede(e)),t(" translateGraph",()=>pfe(e)),t(" assignNodeIntersects",()=>mfe(e)),t(" reversePoints",()=>bfe(e)),t(" acyclic.undo",()=>Gue(e))}function tfe(e,t){e.nodes().forEach(n=>{let s=e.node(n),i=t.node(n);s&&(s.x=i.x,s.y=i.y,s.order=i.order,s.rank=i.rank,t.children(n).length&&(s.width=i.width,s.height=i.height))}),e.edges().forEach(n=>{let s=e.edge(n),i=t.edge(n);s.points=i.points,Object.hasOwn(i,"x")&&(s.x=i.x,s.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var nfe=["nodesep","edgesep","ranksep","marginx","marginy"],sfe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},ife=["acyclicer","ranker","rankdir","align","rankalign"],rfe=["width","height","rank"],yM={width:0,height:0},afe=["minlen","weight","width","height","labeloffset"],ofe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lfe=["labelpos"];function cfe(e){let t=new ma({multigraph:!0,compound:!0}),n=pw(e.graph());return t.setGraph(Object.assign({},sfe,hw(n,nfe),_1(n,ife))),e.nodes().forEach(s=>{let i=pw(e.node(s)),r=hw(i,rfe);Object.keys(yM).forEach(l=>{r[l]===void 0&&(r[l]=yM[l])}),t.setNode(s,r);let a=e.parent(s);a!==void 0&&t.setParent(s,a)}),e.edges().forEach(s=>{let i=pw(e.edge(s));t.setEdge(s,Object.assign({},ofe,hw(i,afe),_1(i,lfe)))}),t}function ufe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let s=e.edge(n);s.minlen*=2,s.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?s.width+=s.labeloffset:s.height+=s.labeloffset)})}function dfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let s=e.node(t.v),i={rank:(e.node(t.w).rank-s.rank)/2+s.rank,e:t};lh(e,"edge-proxy",i,"_ep")}})}function ffe(e){let t=0;e.nodes().forEach(n=>{let s=e.node(n);s.borderTop&&(s.minRank=e.node(s.borderTop).rank,s.maxRank=e.node(s.borderBottom).rank,t=Math.max(t,s.maxRank))}),e.graph().maxRank=t}function hfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let s=n;e.edge(s.e).labelRank=n.rank,e.removeNode(t)}})}function pfe(e){let t=Number.POSITIVE_INFINITY,n=0,s=Number.POSITIVE_INFINITY,i=0,r=e.graph(),a=r.marginx||0,l=r.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),s=Math.min(s,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,s-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=s}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=s}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=s)}),r.width=n-t+a,r.height=i-s+l}function mfe(e){e.edges().forEach(t=>{let n=e.edge(t),s=e.node(t.v),i=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=i,a=s),n.points.unshift(lM(s,r)),n.points.push(lM(i,a))})}function gfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function bfe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function yfe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),s=e.node(n.borderTop),i=e.node(n.borderBottom),r=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-r.x),n.height=Math.abs(i.y-s.y),n.x=r.x+n.width/2,n.y=s.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function xfe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Efe(e){Ag(e).forEach(t=>{let n=0;t.forEach((s,i)=>{let r=e.node(s);r.order=i+n,(r.selfEdges||[]).forEach(a=>{lh(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function vfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let s=n,i=e.node(s.e.v),r=i.x+i.width/2,a=i.y,l=n.x-r,c=i.height/2;e.setEdge(s.e,s.label),e.removeNode(t),s.label.points=[{x:r+2*l/3,y:a-c},{x:r+5*l/6,y:a-c},{x:r+l,y:a},{x:r+5*l/6,y:a+c},{x:r+2*l/3,y:a+c}],s.label.x=n.x,s.label.y=n.y}})}function hw(e,t){return $x(_1(e,t),Number)}function pw(e){let t={};return e&&Object.entries(e).forEach(([n,s])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=s}),t}function wfe(e){let t=Ag(e),n=new ma({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(s=>{n.setNode(s,{label:s}),n.setParent(s,"layer"+e.node(s).rank)}),e.edges().forEach(s=>n.setEdge(s.v,s.w,{},s.name)),t.forEach((s,i)=>{let r="layer"+i;n.setNode(r,{rank:"same"}),s.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var _fe={graphlib:VU,version:Mue,layout:Jde,debug:wfe,util:{time:n7,notime:s7}},xM=_fe;/*! For license information please see dagre.esm.js.LEGAL.txt */const vp={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:pu},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:HB},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:LB},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Xk},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:xx}},iN=220,rN=88,EM=96,vM=34,Qp=64,mw=310,Fd=24,m7=56,aN=40,wM=40,Sfe=18,Nfe=58,Tfe=!1,kfe=e=>e==="sequential"||e==="parallel"||e==="loop";function oN(e,t){const n=e.agentType??"llm";return kfe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function lN(e,t=[],n="horizontal",s=!1){const i=e.agentType??"llm";if(!oN(e,t))return{width:iN,height:rN};if(s&&e.subAgents.length===0)return{width:mw,height:Qp};const r=e.subAgents.map((f,h)=>lN(f,[...t,h],n,s)),a=r.length?Math.max(...r.map(f=>f.width)):0,l=r.length?Math.max(...r.map(f=>f.height)):0,c=r.length&&i!=="parallel"?m7:Fd,u=n==="horizontal"?i!=="parallel":i==="parallel",d=r.length?i==="parallel"?Sfe+wM:i==="loop"?Nfe:0:wM;return u?{width:Math.max(mw,r.reduce((f,h)=>f+h.width,0)+aN*Math.max(0,r.length-1)+c*2),height:Qp+Fd+l+d+Fd}:{width:Math.max(mw,a+Fd*2),height:Qp+c+r.reduce((f,h)=>f+h.height,0)+aN*Math.max(0,r.length-1)+d+c}}function Wh(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Afe(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function _M(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Xh(e,t,n,s){const i=(s==null?void 0:s.tone)==="sequential"?"hsl(213 40% 40%)":(s==null?void 0:s.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${s!=null&&s.loop?"-loop":""}`,source:e,target:t,sourceHandle:s!=null&&s.loop?"loop-source":void 0,targetHandle:s!=null&&s.loop?"loop-target":void 0,label:n,type:"insertStep",data:s?{insert:s.insert,loop:s.loop,tone:s.tone}:void 0,animated:s==null?void 0:s.loop,markerEnd:{type:If.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function SM(e,t,n=!1){const s=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],i=[];function r(d,f,h,p,m){const b=d.agentType??"llm",v=Wh(f);return oN(d,f)?(a(d,f,h,p,m),v):(s.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||vp[b].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const b=d.agentType??"sequential",v=Wh(f),y=lN(d,f,t,n);s.push({id:v,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":vp[b].label),pattern:b,description:d.description.trim()||vp[b].description,childCount:d.subAgents.length,containedIn:m,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const x=d.subAgents.map((T,k)=>lN(T,[...f,k],t,n)),E=x.length&&b!=="parallel"?m7:Fd,w=t==="horizontal"?b!=="parallel":b==="parallel";let S=E;const _=d.subAgents.map((T,k)=>{const A=x[k],j=w?{x:S,y:Qp+Fd}:{x:(y.width-A.width)/2,y:Qp+S};return S+=(w?A.width:A.height)+aN,r(T,[...f,k],v,j,b)});if(b==="sequential"||b==="loop"){for(let T=0;T<_.length-1;T+=1)i.push(Xh(_[T],_[T+1],"然后",{tone:b,insert:{parentPath:f,index:T+1}}));b==="loop"&&_.length>1&&i.push(Xh(_[_.length-1],_[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=Wh(f);if(oN(d,f))return a(d,f),[p];if(s.push({id:p,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||vp[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((b,v)=>{const y=[...f,v],x=Wh(y);i.push(Xh(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(b,y))}),m},c=Wh([]),u=l(e,[]);return i.push(Xh("terminal-input",c)),u.forEach(d=>i.push(Xh(d,"terminal-output"))),Cfe(s,i,t)}function Cfe(e,t,n){const s=new xM.graphlib.Graph().setDefaultEdgeLabel(()=>({}));s.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(r=>!r.parentId).map(r=>r.id));return e.filter(r=>!r.parentId).forEach(r=>{const a=r.data.kind==="terminal";s.setNode(r.id,{width:a?EM:r.data.layoutWidth??iN,height:a?vM:r.data.layoutHeight??rN})}),t.filter(r=>i.has(r.source)&&i.has(r.target)).forEach(r=>s.setEdge(r.source,r.target)),xM.layout(s),{nodes:e.map(r=>{if(r.parentId)return r;const a=s.node(r.id),l=r.data.kind==="terminal",c=l?EM:r.data.layoutWidth??iN,u=l?vM:r.data.layoutHeight??rN;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const zx=g.createContext(null),Vx=g.createContext("horizontal");function Ife({id:e,sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=g.useContext(zx),[h,p]=g.useState(!1),[m,b,v]=x1({sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(kg,{id:e,path:m,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(Nce,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${v}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(ji,{})})]})})]})}function jfe({data:e,selected:t}){const n=g.useContext(zx),s=g.useContext(Vx),i=s==="vertical"?Qe.Top:Qe.Left,r=s==="vertical"?Qe.Bottom:Qe.Right,a=s==="vertical"?Qe.Right:Qe.Bottom,l=e.pattern??"llm",c=vp[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(Bi,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(dc,{})}),o.jsx(Bi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Bi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Bi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Rfe({data:e,selected:t}){const n=g.useContext(zx),s=g.useContext(Vx),i=s==="vertical"?Qe.Top:Qe.Left,r=s==="vertical"?Qe.Bottom:Qe.Right,a=s==="vertical"?Qe.Right:Qe.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(Bi,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(ji,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(ji,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(ji,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(ji,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(dc,{})}),o.jsx(Bi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Bi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Bi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Ofe({data:e}){const t=g.useContext(Vx);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Bi,{type:"target",position:t==="vertical"?Qe.Top:Qe.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Bi,{type:"source",position:t==="vertical"?Qe.Bottom:Qe.Right,className:"abc-handle"})]})}const Mfe={agent:jfe,group:Rfe,terminal:Ofe},Lfe={insertStep:Ife};function Dfe({draft:e,selectedPath:t,onSelect:n,onAdd:s,onInsert:i,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=g.useMemo(()=>SM(e,c,a),[]),[d,f,h]=DU(u.nodes),[p,m,b]=PU(u.edges),v=kce(),y=g.useRef(`${c}:${a?"readonly":"editable"}:${_M(e)}`),x=g.useRef(null),{fitView:E}=Ux(),w=g.useMemo(()=>SM(e,c,a),[c,e,a]),[S,_]=g.useState(()=>window.matchMedia("(max-width: 860px)").matches),T=g.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),k=g.useCallback((j=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const R=x.current;if(R&&(R.clientWidth===0||R.clientHeight===0)&&j<8){k(j+1);return}E(T)})})},[T,E]);g.useEffect(()=>{const j=window.matchMedia("(max-width: 860px)"),R=B=>_(B.matches);return j.addEventListener("change",R),()=>j.removeEventListener("change",R)},[]),g.useEffect(()=>{const j=`${c}:${a?"readonly":"editable"}:${_M(e)}`,R=j!==y.current;y.current=j,m(w.edges),f(B=>{const z=new Map(B.map(L=>[L.id,L]));return w.nodes.map(L=>{const F=z.get(L.id);return{...L,measured:!R&&F&&F.type===L.type?F.measured:void 0,position:!R&&F?F.position:L.position,selected:L.data.kind==="agent"&&!!L.data.path&&Afe(L.data.path,t)}})}),R&&k()},[w,e,k,t,m,f]),g.useEffect(()=>{k()},[S,k]),g.useEffect(()=>{v&&k()},[w,k,v]),g.useEffect(()=>{if(!a||!x.current)return;const j=new ResizeObserver(()=>k());return j.observe(x.current),k(),()=>j.disconnect()},[k,a]);const A=g.useMemo(()=>a?null:{onAdd:s,onInsert:i,onDelete:r},[s,r,i,a]);return o.jsx(Vx.Provider,{value:c,children:o.jsx(zx.Provider,{value:A,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:x,className:"abc-canvas",children:o.jsxs(LU,{nodes:d,edges:p,nodeTypes:Mfe,edgeTypes:Lfe,onNodesChange:h,onEdgesChange:b,onNodeClick:(j,R)=>{!a&&R.data.kind==="agent"&&R.data.path&&n(R.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:T,onInit:()=>k(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(UU,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx($U,{showInteractive:!1}),Tfe]})})})})})}function zm(e){return o.jsx(L2,{children:o.jsx(Dfe,{...e})})}const Pfe="https://ark.cn-beijing.volces.com/api/v3/",iy=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:Pfe}],Vm=[],NM={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},Bfe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},Ufe="https://api.vikingdb.cn-beijing.volces.com/openviking",Ffe=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return g.useEffect(()=>{const c=(t==null?void 0:t.target)??HO,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&L9(p))return!1;const b=VO(p.code,l);if(r.current.add(p[b]),zO(a,r.current,!1)){const x=((y=(v=p.composedPath)==null?void 0:v.call(p))==null?void 0:y[0])||p.target,E=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(i.current||!E)&&p.preventDefault(),s(!0)}},f=p=>{const m=VO(p.code,l);zO(a,r.current,!0)?(s(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),i.current=!1},h=()=>{r.current.clear(),s(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,s]),n}function zO(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function VO(e,t){return t.includes(e)?"code":"key"}const tle=()=>{const e=ps();return g.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,i,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??s,y:t.y??i,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:i,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=T2(t,s,i,r,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:s,snapGrid:i,snapToGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??r;return lh(u,s,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:i,y:r}=s.getBoundingClientRect(),a=Mf(t,n);return{x:a.x+i,y:a.y+r}}}),[])};function oU(e,t){const n=[],s=new Map,i=[];for(const r of e)if(r.type==="add"){i.push(r);continue}else if(r.type==="remove"||r.type==="replace")s.set(r.id,[r]);else{const a=s.get(r.id);a?a.push(r):s.set(r.id,[r])}for(const r of t){const a=s.get(r.id);if(!a){n.push(r);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...r};for(const c of a)nle(c,l);n.push(l)}return i.length&&i.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function nle(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function lU(e,t){return oU(e,t)}function cU(e,t){return oU(e,t)}function Fc(e,t){return{id:e,type:"select",selected:t}}function Fd(e,t=new Set,n=!1){const s=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),s.push(Fc(r.id,a)))}return s}function GO({items:e=[],lookup:t}){var i;const n=[],s=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:r})}for(const[r]of t)s.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function KO(e){return{id:e.id,type:"remove"}}const sle=R9();function uU(e,t,n={}){return Cae(e,t,{...n,onError:n.onError??sle})}const qO=e=>pae(e),ile=e=>A9(e);function dU(e){return g.forwardRef(e)}const rle=typeof window<"u"?g.useLayoutEffect:g.useEffect;function YO(e){const[t,n]=g.useState(BigInt(0)),[s]=g.useState(()=>ale(()=>n(i=>i+BigInt(1))));return rle(()=>{const i=s.get();i.length&&(e(i),s.reset())},[t]),s}function ale(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const fU=g.createContext(null);function ole({children:e}){const t=ps(),n=g.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=GO({items:b,lookup:h});for(const y of m.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),s=YO(n),i=g.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of l)p=typeof m=="function"?m(p):m;d?u(p):f&&f(GO({items:p,lookup:h}))},[]),r=YO(i),a=g.useMemo(()=>({nodeQueue:s,edgeQueue:r}),[]);return o.jsx(fU.Provider,{value:a,children:e})}function lle(){const e=g.useContext(fU);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const cle=e=>!!e.panZoom;function Ux(){const e=tle(),t=ps(),n=lle(),s=Xt(cle),i=g.useMemo(()=>{const r=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=qO(f)?f:h.get(f.id),b=m.parentId?O9(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:b,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return Of(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&qO(v)?v:{...b,...v}}return b}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&ile(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=r(f))==null?void 0:h.internals.userNode},getInternalNode:r,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,b,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:S,edges:_}=await xae({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),T=_.length>0,k=S.length>0;if(T){const A=_.map(KO);v==null||v(_),x(A)}if(k){const A=S.map(KO);b==null||b(S),y(A)}return(k||T)&&(E==null||E({nodes:S,edges:_})),{deletedNodes:S,deletedEdges:_}},getIntersectingNodes:(f,h=!0,p)=>{const m=_O(f),b=m?f:c(f),v=p!==void 0;return b?(p||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!m&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const E=Of(v?y:x),w=Um(E,b);return h&&w>0||w>=E.width*E.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=_O(f)?f:c(f);if(!b)return!1;const v=Um(b,h);return p&&v>0||v>=h.width*h.height||v>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return mae(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??wae();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return g.useMemo(()=>({...i,...e,viewportInitialized:s}),[s])}const WO=e=>e.selected,ule=typeof window<"u"?window:void 0;function dle({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ps(),{deleteElements:s}=Ux(),i=$m(e,{actInsideInputWithModifier:!1}),r=$m(t,{target:ule});g.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();s({nodes:l.filter(WO),edges:a.filter(WO)}),n.setState({nodesSelectionActive:!1})}},[i]),g.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function fle(e){const t=ps();g.useEffect(()=>{const n=()=>{var i,r,a,l;if(!e.current||!(((r=(i=e.current).checkVisibility)==null?void 0:r.call(i))??!0))return!1;const s=A2(e.current);(s.height===0||s.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",$a.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const Fx={position:"absolute",width:"100%",height:"100%",top:0,left:0},hle=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ple({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:i=.5,panOnScrollMode:r=au.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const S=ps(),_=g.useRef(null),{userSelectionActive:T,lib:k,connectionInProgress:A}=Xt(hle,hs),j=$m(h),R=g.useRef();fle(_);const B=g.useCallback(z=>{y==null||y({x:z[0],y:z[1],zoom:z[2]}),x||S.setState({transform:z})},[y,x]);return g.useEffect(()=>{if(_.current){R.current=roe({domNode:_.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>S.setState(I=>I.paneDragging===C?I:{paneDragging:C}),onPanZoomStart:(C,I)=>{const{onViewportChangeStart:D,onMoveStart:$}=S.getState();$==null||$(C,I),D==null||D(I)},onPanZoom:(C,I)=>{const{onViewportChange:D,onMove:$}=S.getState();$==null||$(C,I),D==null||D(I)},onPanZoomEnd:(C,I)=>{const{onViewportChangeEnd:D,onMoveEnd:$}=S.getState();$==null||$(C,I),D==null||D(I)}});const{x:z,y:L,zoom:F}=R.current.getViewport();return S.setState({panZoom:R.current,transform:[z,L,F],domNode:_.current.closest(".react-flow")}),()=>{var C;(C=R.current)==null||C.destroy()}}},[]),g.useEffect(()=>{var z;(z=R.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:i,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:p,noPanClassName:v,userSelectionActive:T,noWheelClassName:b,lib:k,onTransformChange:B,connectionInProgress:A,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,s,i,r,a,l,j,p,v,T,b,k,B,A,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:_,style:Fx,children:m})}const mle=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function gle(){const{userSelectionActive:e,userSelectionRect:t}=Xt(mle,hs);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ow=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},ble=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function yle({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Bm.Full,panOnDrag:s,autoPanOnSelection:i,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:b}){const v=g.useRef(0),y=ps(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:S,panBy:_,autoPanSpeed:T}=Xt(ble,hs),k=E&&(e||x),A=g.useRef(null),j=g.useRef(),R=g.useRef(new Set),B=g.useRef(new Set),z=g.useRef(!1),L=g.useRef({x:0,y:0}),F=g.useRef(!1),C=K=>{if(z.current||S){z.current=!1;return}u==null||u(K),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},I=K=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){K.preventDefault();return}d==null||d(K)},D=f?K=>f(K):void 0,$=K=>{z.current&&(K.stopPropagation(),z.current=!1)},O=K=>{var me,we;const{domNode:ce,transform:he}=y.getState();if(j.current=ce==null?void 0:ce.getBoundingClientRect(),!j.current)return;const ge=K.target===A.current;if(!ge&&!!K.target.closest(".nokey")||!e||!(a&&ge||t)||K.button!==0||!K.isPrimary)return;(we=(me=K.target)==null?void 0:me.setPointerCapture)==null||we.call(me,K.pointerId),z.current=!1;const{x:Me,y:Se}=Da(K.nativeEvent,j.current),ae=lh({x:Me,y:Se},he);y.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:Me,y:Se}}),ge||(K.stopPropagation(),K.preventDefault())};function ne(K,ce){const{userSelectionRect:he}=y.getState();if(!he)return;const{transform:ge,nodeLookup:ue,edgeLookup:ve,connectionLookup:Me,triggerNodeChanges:Se,triggerEdgeChanges:ae,defaultEdgeOptions:me}=y.getState(),we={x:he.startX,y:he.startY},{x:et,y:De}=Mf(we,ge),Ue={startX:we.x,startY:we.y,x:KBe.id)),B.current=new Set;const ze=(me==null?void 0:me.selectable)??!0;for(const Be of R.current){const X=Me.get(Be);if(X)for(const{edgeId:oe}of X.values()){const J=ve.get(oe);J&&(J.selectable??ze)&&B.current.add(oe)}}if(!SO(Ye,R.current)){const Be=Fd(ue,R.current,!0);Se(Be)}if(!SO(Ae,B.current)){const Be=Fd(ve,B.current);ae(Be)}y.setState({userSelectionRect:Ue,userSelectionActive:!0,nodesSelectionActive:!1})}function se(){if(!i||!j.current)return;const[K,ce]=N2(L.current,j.current,T);_({x:K,y:ce}).then(he=>{if(!z.current||!he){v.current=requestAnimationFrame(se);return}const{x:ge,y:ue}=L.current;ne(ge,ue),v.current=requestAnimationFrame(se)})}const P=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};g.useEffect(()=>()=>P(),[]);const Z=K=>{const{userSelectionRect:ce,transform:he,resetSelectedElements:ge}=y.getState();if(!j.current||!ce)return;const{x:ue,y:ve}=Da(K.nativeEvent,j.current);L.current={x:ue,y:ve};const Me=Mf({x:ce.startX,y:ce.startY},he);if(!z.current){const Se=t?0:r;if(Math.hypot(ue-Me.x,ve-Me.y)<=Se)return;ge(),l==null||l(K)}z.current=!0,F.current||(se(),F.current=!0),ne(ue,ve)},te=K=>{var ce,he;K.button===0&&((he=(ce=K.target)==null?void 0:ce.releasePointerCapture)==null||he.call(ce,K.pointerId),!x&&K.target===A.current&&y.getState().userSelectionRect&&(C==null||C(K)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(K),y.setState({nodesSelectionActive:R.current.size>0})),P())},V=K=>{var ce,he;(he=(ce=K.target)==null?void 0:ce.releasePointerCapture)==null||he.call(ce,K.pointerId),P()},Q=s===!0||Array.isArray(s)&&s.includes(0);return o.jsxs("div",{className:ri(["react-flow__pane",{draggable:Q,dragging:w,selection:e}]),onClick:k?void 0:ow(C,A),onContextMenu:ow(I,A),onWheel:ow(D,A),onPointerEnter:k?void 0:h,onPointerMove:k?Z:p,onPointerUp:k?te:void 0,onPointerCancel:k?V:void 0,onPointerDownCapture:k?O:void 0,onClickCapture:k?$:void 0,onPointerLeave:m,ref:A,style:Fx,children:[b,o.jsx(gle,{})]})}function nN({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",$a.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=s==null?void 0:s.current)==null?void 0:d.blur()})):i([e])}function hU({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:r,nodeClickDistance:a}){const l=ps(),[c,u]=g.useState(!1),d=g.useRef();return g.useEffect(()=>{d.current=Gae({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{nN({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),g.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:r,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,s,t,r,e,i,a]),c}const xle=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function pU(){const e=ps();return g.useCallback(n=>{const{nodeExtent:s,snapToGrid:i,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=xle(a),p=i?r[0]:5,m=i?r[1]:5,b=n.direction.x*p*n.factor,v=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};i&&(x=Tg(x,r));const{position:E,positionAbsolute:w}=C9({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:s,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const M2=g.createContext(null),Ele=M2.Provider;M2.Consumer;const mU=()=>g.useContext(M2),vle=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),wle=(e,t,n)=>s=>{const{connectionClickStartHandle:i,connectionMode:r,connection:a}=s,{fromHandle:l,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:r===If.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function _le({type:e="source",position:t=Qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,C;const m=a||null,b=e==="target",v=ps(),y=mU(),{connectOnClick:x,noPanClassName:E,rfId:w}=Xt(vle,hs),{connectingFrom:S,connectingTo:_,clickConnecting:T,isPossibleEndHandle:k,connectionInProcess:A,clickConnectionInProcess:j,valid:R}=Xt(wle(y,m,e),hs);y||(C=(F=v.getState()).onError)==null||C.call(F,"010",$a.error010());const B=I=>{const{defaultEdgeOptions:D,onConnect:$,hasDefaultEdges:O}=v.getState(),ne={...D,...I};if(O){const{edges:se,setEdges:P,onError:Z}=v.getState();P(uU(ne,se,{onError:Z}))}$==null||$(ne),l==null||l(ne)},z=I=>{if(!y)return;const D=D9(I.nativeEvent);if(i&&(D&&I.button===0||!D)){const $=v.getState();tN.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:b,handleId:m,nodeId:y,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...O)=>{var ne,se;return(se=(ne=v.getState()).onConnectEnd)==null?void 0:se.call(ne,...O)},updateConnection:$.updateConnection,onConnect:B,isValidConnection:n||((...O)=>{var ne,se;return((se=(ne=v.getState()).isValidConnection)==null?void 0:se.call(ne,...O))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}D?d==null||d(I):f==null||f(I)},L=I=>{const{onClickConnectStart:D,onClickConnectEnd:$,connectionClickStartHandle:O,connectionMode:ne,isValidConnection:se,lib:P,rfId:Z,nodeLookup:te,connection:V}=v.getState();if(!y||!O&&!i)return;if(!O){D==null||D(I.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const Q=M9(I.target),K=n||se,{connection:ce,isValid:he}=tN.isValid(I.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:ne,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:K,flowId:Z,doc:Q,lib:P,nodeLookup:te});he&&ce&&B(ce);const ge=structuredClone(V);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,$==null||$(I,ge),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:ri(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:r,clickconnecting:T,connectingfrom:S,connectingto:_,valid:R,connectionindicator:s&&(!A||k)&&(A||j?r:i)}]),onMouseDown:z,onTouchStart:z,onClick:x?L:void 0,ref:p,...h,children:c})}const Fi=g.memo(dU(_le));function Sle({data:e,isConnectable:t,sourcePosition:n=Qe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Fi,{type:"source",position:n,isConnectable:t})]})}function Nle({data:e,isConnectable:t,targetPosition:n=Qe.Top,sourcePosition:s=Qe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Fi,{type:"source",position:s,isConnectable:t})]})}function Tle(){return null}function kle({data:e,isConnectable:t,targetPosition:n=Qe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const E1={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},XO={input:Sle,default:Nle,output:kle,group:Tle};function Ale(e){var t,n,s,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const Cle=e=>{const{width:t,height:n,x:s,y:i}=Ng(e.nodeLookup,{filter:r=>!!r.selected});return{width:La(t)?t:null,height:La(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${i}px)`}};function Ile({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=ps(),{width:i,height:r,transformString:a,userSelectionActive:l}=Xt(Cle,hs),c=pU(),u=g.useRef(null);g.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&r!==null;if(hU({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=s.getState().nodes.filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(E1,p.key)&&(p.preventDefault(),c({direction:E1[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:ri(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:r}})})}const QO=typeof window<"u"?window:void 0,jle=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function gU({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:k,autoPanOnSelection:A,defaultViewport:j,translateExtent:R,minZoom:B,maxZoom:z,preventScrolling:L,onSelectionContextMenu:F,noWheelClassName:C,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:$,isControlledViewport:O}){const{nodesSelectionActive:ne,userSelectionActive:se}=Xt(jle,hs),P=$m(u,{target:QO}),Z=$m(b,{target:QO}),te=Z||k,V=Z||w,Q=d&&te!==!0,K=P||se||Q;return dle({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(ple,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:!P&&te,defaultViewport:j,translateExtent:R,minZoom:B,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:L,noWheelClassName:C,noPanClassName:I,onViewportChange:$,isControlledViewport:O,paneClickDistance:l,selectionOnDrag:Q,children:o.jsxs(yle,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:te,autoPanOnSelection:A,isSelecting:!!K,selectionMode:f,selectionKeyPressed:P,paneClickDistance:l,selectionOnDrag:Q,children:[e,ne&&o.jsx(Ile,{onSelectionContextMenu:F,noPanClassName:I,disableKeyboardA11y:D})]})})}gU.displayName="FlowRenderer";const Rle=g.memo(gU),Ole=e=>t=>e?S2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Mle(e){return Xt(g.useCallback(Ole(e),[e]),hs)}const Lle=e=>e.updateNodeInternals;function Dle(){const e=Xt(Lle),[t]=g.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(i=>{const r=i.target.getAttribute("data-id");s.set(r,{id:r,nodeElement:i.target,force:!0})}),e(s)}));return g.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Ple({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const i=ps(),r=g.useRef(null),a=g.useRef(null),l=g.useRef(e.sourcePosition),c=g.useRef(e.targetPosition),u=g.useRef(t),d=n&&!!e.internals.handleBounds;return g.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(s==null||s.unobserve(a.current)),s==null||s.observe(r.current),a.current=r.current)},[d,e.hidden]),g.useEffect(()=>()=>{a.current&&(s==null||s.unobserve(a.current),a.current=null)},[]),g.useEffect(()=>{if(r.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function Ble({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:i,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:S}=Xt(K=>{const ce=K.nodeLookup.get(e),he=K.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:he}},hs);let _=E.type||"default",T=(v==null?void 0:v[_])||XO[_];T===void 0&&(x==null||x("003",$a.error003(_)),_="default",T=(v==null?void 0:v.default)||XO.default);const k=!!(E.draggable||l&&typeof E.draggable>"u"),A=!!(E.selectable||c&&typeof E.selectable>"u"),j=!!(E.connectable||u&&typeof E.connectable>"u"),R=!!(E.focusable||d&&typeof E.focusable>"u"),B=ps(),z=k2(E),L=Ple({node:E,nodeType:_,hasDimensions:z,resizeObserver:f}),F=hU({nodeRef:L,disabled:E.hidden||!k,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:y}),C=pU();if(E.hidden)return null;const I=pl(E),D=Ale(E),$=A||k||t||n||s||i,O=n?K=>n(K,{...w.userNode}):void 0,ne=s?K=>s(K,{...w.userNode}):void 0,se=i?K=>i(K,{...w.userNode}):void 0,P=r?K=>r(K,{...w.userNode}):void 0,Z=a?K=>a(K,{...w.userNode}):void 0,te=K=>{const{selectNodesOnDrag:ce,nodeDragThreshold:he}=B.getState();A&&(!ce||!k||he>0)&&nN({id:e,store:B,nodeRef:L}),t&&t(K,{...w.userNode})},V=K=>{if(!(L9(K.nativeEvent)||m)){if(S9.includes(K.key)&&A){const ce=K.key==="Escape";nN({id:e,store:B,unselect:ce,nodeRef:L})}else if(k&&E.selected&&Object.prototype.hasOwnProperty.call(E1,K.key)){K.preventDefault();const{ariaLabelConfig:ce}=B.getState();B.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),C({direction:E1[K.key],factor:K.shiftKey?4:1})}}},Q=()=>{var Me;if(m||!((Me=L.current)!=null&&Me.matches(":focus-visible")))return;const{transform:K,width:ce,height:he,autoPanOnNodeFocus:ge,setCenter:ue}=B.getState();if(!ge)return;S2(new Map([[e,E]]),{x:0,y:0,width:ce,height:he},K,!0).length>0||ue(E.position.x+I.width/2,E.position.y+I.height/2,{zoom:K[2]})};return o.jsx("div",{className:ri(["react-flow__node",`react-flow__node-${_}`,{[p]:k},E.className,{selected:E.selected,selectable:A,parent:S,draggable:k,dragging:F}]),ref:L,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:z?"visible":"hidden",...E.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:ne,onMouseLeave:se,onContextMenu:P,onClick:te,onDoubleClick:Z,onKeyDown:R?V:void 0,tabIndex:R?0:void 0,onFocus:R?Q:void 0,role:E.ariaRole??(R?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${iU}-${b}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(Ele,{value:e,children:o.jsx(T,{id:e,data:E.data,type:_,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:E.selected??!1,selectable:A,draggable:k,deletable:E.deletable??!0,isConnectable:j,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...I})})})}var Ule=g.memo(Ble);const Fle=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function bU(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,onError:r}=Xt(Fle,hs),a=Mle(e.onlyRenderVisibleElements),l=Dle();return o.jsx("div",{className:"react-flow__nodes",style:Fx,children:a.map(c=>o.jsx(Ule,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}bU.displayName="NodeRenderer";const $le=g.memo(bU);function Hle(e){return Xt(g.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const s=[];if(n.width&&n.height)for(const i of n.edges){const r=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);r&&a&&Tae({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&s.push(i.id)}return s},[e]),hs)}const zle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Vle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ZO={[jf.Arrow]:zle,[jf.ArrowClosed]:Vle};function Gle(e){const t=ps();return g.useMemo(()=>{var i,r;return Object.prototype.hasOwnProperty.call(ZO,e)?ZO[e]:((r=(i=t.getState()).onError)==null||r.call(i,"009",$a.error009(e)),null)},[e])}const Kle=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=Gle(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},yU=({defaultColor:e,rfId:t})=>{const n=Xt(r=>r.edges),s=Xt(r=>r.defaultEdgeOptions),i=g.useMemo(()=>Mae(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(r=>o.jsx(Kle,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};yU.displayName="MarkerDefinitions";var qle=g.memo(yU);function xU({x:e,y:t,label:n,labelStyle:s,labelShowBg:i=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=g.useState({x:1,y:0,width:0,height:0}),p=ri(["react-flow__edge-textwrapper",u]),m=g.useRef(null);return g.useEffect(()=>{if(m.current){const b=m.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:r,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:s,children:n}),c]}):null}xU.displayName="EdgeText";const Yle=g.memo(xU);function kg({path:e,labelX:t,labelY:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:ri(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,s&&La(t)&&La(n)?o.jsx(Yle,{x:t,y:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function JO({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Qe.Left||e===Qe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function EU({sourceX:e,sourceY:t,sourcePosition:n=Qe.Bottom,targetX:s,targetY:i,targetPosition:r=Qe.Top}){const[a,l]=JO({pos:n,x1:e,y1:t,x2:s,y2:i}),[c,u]=JO({pos:r,x1:s,y1:i,x2:e,y2:t}),[d,f,h,p]=P9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${s},${i}`,d,f,h,p]}function vU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,E,w]=EU({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(kg,{id:S,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})})}const Wle=vU({isInternal:!1}),wU=vU({isInternal:!0});Wle.displayName="SimpleBezierEdge";wU.displayName="SimpleBezierEdgeInternal";function _U(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Qe.Bottom,targetPosition:m=Qe.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,S]=x1({sourceX:n,sourceY:s,sourcePosition:p,targetX:i,targetY:r,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),_=e.isInternal?void 0:t;return o.jsx(kg,{id:_,path:E,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const SU=_U({isInternal:!1}),NU=_U({isInternal:!0});SU.displayName="SmoothStepEdge";NU.displayName="SmoothStepEdgeInternal";function TU(e){return g.memo(({id:t,...n})=>{var i;const s=e.isInternal?void 0:t;return o.jsx(SU,{...n,id:s,pathOptions:g.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const Xle=TU({isInternal:!1}),kU=TU({isInternal:!0});Xle.displayName="StepEdge";kU.displayName="StepEdgeInternal";function AU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[v,y,x]=F9({sourceX:n,sourceY:s,targetX:i,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(kg,{id:E,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})})}const Qle=AU({isInternal:!1}),CU=AU({isInternal:!0});Qle.displayName="StraightEdge";CU.displayName="StraightEdgeInternal";function IU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a=Qe.Bottom,targetPosition:l=Qe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,S]=B9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),_=e.isInternal?void 0:t;return o.jsx(kg,{id:_,path:E,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:x})})}const Zle=IU({isInternal:!1}),jU=IU({isInternal:!0});Zle.displayName="BezierEdge";jU.displayName="BezierEdgeInternal";const eM={default:jU,straight:CU,step:kU,smoothstep:NU,simplebezier:wU},tM={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Jle=(e,t,n)=>n===Qe.Left?e-t:n===Qe.Right?e+t:e,ece=(e,t,n)=>n===Qe.Top?e-t:n===Qe.Bottom?e+t:e,nM="react-flow__edgeupdater";function sM({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:r,onMouseOut:a,className:ri([nM,`${nM}-${l}`]),cx:Jle(t,s,e),cy:ece(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function tce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:i,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=ps(),b=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:_,domNode:T,connectionMode:k,connectionRadius:A,lib:j,onConnectStart:R,cancelConnection:B,nodeLookup:z,rfId:L,panBy:F,updateConnection:C}=m.getState(),I=S.type==="target",D=(ne,se)=>{h(!1),f==null||f(ne,n,S.type,se)},$=ne=>u==null?void 0:u(n,ne),O=(ne,se)=>{h(!0),d==null||d(w,n,S.type),R==null||R(ne,se)};tN.onPointerDown(w.nativeEvent,{autoPanOnConnect:_,connectionMode:k,connectionRadius:A,domNode:T,handleId:S.id,nodeId:S.nodeId,nodeLookup:z,isTarget:I,edgeUpdaterType:S.type,lib:j,flowId:L,cancelConnection:B,panBy:F,isValidConnection:(...ne)=>{var se,P;return((P=(se=m.getState()).isValidConnection)==null?void 0:P.call(se,...ne))??!0},onConnect:$,onConnectStart:O,onConnectEnd:(...ne)=>{var se,P;return(P=(se=m.getState()).onConnectEnd)==null?void 0:P.call(se,...ne)},onReconnectEnd:D,updateConnection:C,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),E=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(sM,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(sM,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function nce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:i,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=Xt(ue=>ue.edgeLookup.get(e));const w=Xt(ue=>ue.defaultEdgeOptions);E=w?{...w,...E}:E;let S=E.type||"default",_=(b==null?void 0:b[S])||eM[S];_===void 0&&(y==null||y("011",$a.error011(S)),S="default",_=(b==null?void 0:b.default)||eM.default);const T=!!(E.focusable||t&&typeof E.focusable>"u"),k=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),A=!!(E.selectable||s&&typeof E.selectable>"u"),j=g.useRef(null),[R,B]=g.useState(!1),[z,L]=g.useState(!1),F=ps(),{zIndex:C,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:ne,targetPosition:se}=Xt(g.useCallback(ue=>{const ve=ue.nodeLookup.get(E.source),Me=ue.nodeLookup.get(E.target);if(!ve||!Me)return{zIndex:E.zIndex,...tM};const Se=Oae({id:e,sourceNode:ve,targetNode:Me,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:ue.connectionMode,onError:y});return{zIndex:Nae({selected:E.selected,zIndex:E.zIndex,sourceNode:ve,targetNode:Me,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode}),...Se||tM}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),hs),P=g.useMemo(()=>E.markerStart?`url('#${JS(E.markerStart,m)}')`:void 0,[E.markerStart,m]),Z=g.useMemo(()=>E.markerEnd?`url('#${JS(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||I===null||D===null||$===null||O===null)return null;const te=ue=>{var ae;const{addSelectedEdges:ve,unselectNodesAndEdges:Me,multiSelectionActive:Se}=F.getState();A&&(F.setState({nodesSelectionActive:!1}),E.selected&&Se?(Me({nodes:[],edges:[E]}),(ae=j.current)==null||ae.blur()):ve([e])),i&&i(ue,E)},V=r?ue=>{r(ue,{...E})}:void 0,Q=a?ue=>{a(ue,{...E})}:void 0,K=l?ue=>{l(ue,{...E})}:void 0,ce=c?ue=>{c(ue,{...E})}:void 0,he=u?ue=>{u(ue,{...E})}:void 0,ge=ue=>{var ve;if(!x&&S9.includes(ue.key)&&A){const{unselectNodesAndEdges:Me,addSelectedEdges:Se}=F.getState();ue.key==="Escape"?((ve=j.current)==null||ve.blur(),Me({edges:[E]})):Se([e])}};return o.jsx("svg",{style:{zIndex:C},children:o.jsxs("g",{className:ri(["react-flow__edge",`react-flow__edge-${S}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!A&&!i,updating:R,selectable:A}]),onClick:te,onDoubleClick:V,onContextMenu:Q,onMouseEnter:K,onMouseMove:ce,onMouseLeave:he,onKeyDown:T?ge:void 0,tabIndex:T?0:void 0,role:E.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":T?`${rU}-${m}`:void 0,ref:j,...E.domAttributes,children:[!z&&o.jsx(_,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:A,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:ne,targetPosition:se,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:P,markerEnd:Z,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),k&&o.jsx(tce,{edge:E,isReconnectable:k,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:I,sourceY:D,targetX:$,targetY:O,sourcePosition:ne,targetPosition:se,setUpdateHover:B,setReconnecting:L})]})})}var sce=g.memo(nce);const ice=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function RU({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:i,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=Xt(ice,hs),w=Hle(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(qle,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(sce,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:i,onReconnect:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:E,edgeTypes:s,disableKeyboardA11y:b},S))]})}RU.displayName="EdgeRenderer";const rce=g.memo(RU),ace=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oce({children:e}){const t=Xt(ace);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function lce(e){const t=Ux(),n=g.useRef(!1);g.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const cce=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function uce(e){const t=Xt(cce),n=ps();return g.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function dce(e){return e.connection.inProgress?{...e.connection,to:lh(e.connection.to,e.transform)}:{...e.connection}}function fce(e){return dce}function hce(e){const t=fce();return Xt(t,hs)}const pce=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mce({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:i,width:r,height:a,isValid:l,inProgress:c}=Xt(pce,hs);return!(r&&i&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:ri(["react-flow__connection",k9(l)]),children:o.jsx(OU,{style:t,type:n,CustomComponent:s,isValid:l})})})}const OU=({style:e,type:t=Bl.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:i,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=hce();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:r.x,fromY:r.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:k9(s),toNode:d,toHandle:f,pointer:p});let m="";const b={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Bl.Bezier:[m]=B9(b);break;case Bl.SimpleBezier:[m]=EU(b);break;case Bl.Step:[m]=x1({...b,borderRadius:0});break;case Bl.SmoothStep:[m]=x1(b);break;default:[m]=F9(b)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};OU.displayName="ConnectionLine";const gce={};function iM(e=gce){g.useRef(e),ps(),g.useEffect(()=>{},[e])}function bce(){ps(),g.useRef(!1),g.useEffect(()=>{},[])}function MU({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:i,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:T,deleteKeyCode:k,onlyRenderVisibleElements:A,elementsSelectable:j,defaultViewport:R,translateExtent:B,minZoom:z,maxZoom:L,preventScrolling:F,defaultMarkerColor:C,zoomOnScroll:I,zoomOnPinch:D,panOnScroll:$,panOnScrollSpeed:O,panOnScrollMode:ne,zoomOnDoubleClick:se,panOnDrag:P,autoPanOnSelection:Z,onPaneClick:te,onPaneMouseEnter:V,onPaneMouseMove:Q,onPaneMouseLeave:K,onPaneScroll:ce,onPaneContextMenu:he,paneClickDistance:ge,nodeClickDistance:ue,onEdgeContextMenu:ve,onEdgeMouseEnter:Me,onEdgeMouseMove:Se,onEdgeMouseLeave:ae,reconnectRadius:me,onReconnect:we,onReconnectStart:et,onReconnectEnd:De,noDragClassName:Ue,noWheelClassName:Ye,noPanClassName:Ae,disableKeyboardA11y:ze,nodeExtent:Be,rfId:X,viewport:oe,onViewportChange:J}){return iM(e),iM(t),bce(),lce(n),uce(oe),o.jsx(Rle,{onPaneClick:te,onPaneMouseEnter:V,onPaneMouseMove:Q,onPaneMouseLeave:K,onPaneContextMenu:he,onPaneScroll:ce,paneClickDistance:ge,deleteKeyCode:k,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:T,elementsSelectable:j,zoomOnScroll:I,zoomOnPinch:D,zoomOnDoubleClick:se,panOnScroll:$,panOnScrollSpeed:O,panOnScrollMode:ne,panOnDrag:P,autoPanOnSelection:Z,defaultViewport:R,translateExtent:B,minZoom:z,maxZoom:L,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:Ue,noWheelClassName:Ye,noPanClassName:Ae,disableKeyboardA11y:ze,onViewportChange:J,isControlledViewport:!!oe,children:o.jsxs(oce,{children:[o.jsx(rce,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:we,onReconnectStart:et,onReconnectEnd:De,onlyRenderVisibleElements:A,onEdgeContextMenu:ve,onEdgeMouseEnter:Me,onEdgeMouseMove:Se,onEdgeMouseLeave:ae,reconnectRadius:me,defaultMarkerColor:C,noPanClassName:Ae,disableKeyboardA11y:ze,rfId:X}),o.jsx(mce,{style:b,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx($le,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ue,onlyRenderVisibleElements:A,noPanClassName:Ae,noDragClassName:Ue,disableKeyboardA11y:ze,nodeExtent:Be,rfId:X}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}MU.displayName="GraphView";const yce=g.memo(MU),xce=R9(),rM=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,b=new Map,v=new Map,y=s??t??[],x=n??e??[],E=d??[0,0],w=f??Pm;z9(b,v,y);const{nodesInitialized:S}=eN(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let _=[0,0,1];if(a&&i&&r){const T=Ng(p,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:k,y:A,zoom:j}=T2(T,i,r,c,u,(l==null?void 0:l.padding)??.1);_=[k,A,j]}return{rfId:"1",width:i??0,height:r??0,transform:_,nodes:x,nodesInitialized:S,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Pm,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:If.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...T9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xce,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:N9,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ece=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>Doe((p,m)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:S,minZoom:_,maxZoom:T}=m();y&&(await yae({nodes:v,width:w,height:S,panZoom:y,minZoom:_,maxZoom:T},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...rM({nodes:e,edges:t,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:s,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:_,nodesSelectionActive:T}=m(),{nodesInitialized:k,hasSelectedNodes:A}=eN(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:_}),j=T&&A;S&&k?(b(),p({nodes:v,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:j})):p({nodes:v,nodesInitialized:k,nodesSelectionActive:j})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();z9(y,x,v),p({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=m();x(v),p({hasDefaultNodes:!0})}if(y){const{setEdges:x}=m();x(y),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:E,domNode:w,nodeOrigin:S,nodeExtent:_,debug:T,fitViewQueued:k,zIndexMode:A}=m(),{changes:j,updatedInternals:R}=$ae(v,x,E,w,S,_,A);R&&(Pae(x,E,{nodeOrigin:S,nodeExtent:_,zIndexMode:A}),k?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(j==null?void 0:j.length)>0&&(T&&console.log("React Flow: trigger node changes",j),y==null||y(j)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:S,connection:_,updateConnection:T,onNodesChangeMiddlewareMap:k}=m();for(const[A,j]of v){const R=w.get(A),B=!!(R!=null&&R.expandParent&&(R!=null&&R.parentId)&&(j!=null&&j.position)),z={id:A,type:"position",position:B?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:y};if(R&&_.inProgress&&_.fromNode.id===R.id){const L=vu(R,_.fromHandle,Qe.Left,!0);T({..._,from:L})}B&&R.parentId&&x.push({id:A,parentId:R.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),E.push(z)}if(x.length>0){const{parentLookup:A,nodeOrigin:j}=m(),R=O2(x,w,A,j);E.push(...R)}for(const A of k.values())E=A(E);S(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:S}=m();if(v!=null&&v.length){if(w){const _=lU(v,E);x(_)}S&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:S}=m();if(v!=null&&v.length){if(w){const _=cU(v,E);x(_)}S&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:S}=m();if(y){const _=v.map(T=>Fc(T,!0));w(_);return}w(Fd(E,new Set([...v]),!0)),S(Fd(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:S}=m();if(y){const _=v.map(T=>Fc(T,!0));S(_);return}S(Fd(x,new Set([...v]))),w(Fd(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:_}=m(),T=v||E,k=y||x,A=[];for(const R of T){if(!R.selected)continue;const B=w.get(R.id);B&&(B.selected=!1),A.push(Fc(R.id,!1))}const j=[];for(const R of k)R.selected&&j.push(Fc(R.id,!1));S(A),_(j)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=m();y==null||y.setScaleExtent([v,x]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=m();y==null||y.setScaleExtent([x,v]),p({maxZoom:v})},setTranslateExtent:v=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:E,elementsSelectable:w}=m();if(!w)return;const S=y.reduce((T,k)=>k.selected?[...T,Fc(k.id,!1)]:T,[]),_=v.reduce((T,k)=>k.selected?[...T,Fc(k.id,!1)]:T,[]);x(S),E(_)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:_,zIndexMode:T}=m();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(eN(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:T}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:S}=m();return Hae({delta:v,panZoom:w,transform:y,translateExtent:S,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:S,panZoom:_}=m();if(!_)return!1;const T=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:S;return await _.setViewport({x:E/2-v*T,y:w/2-y*T,zoom:T},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...T9}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...rM()})}},Object.is);function L2({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:i,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=g.useState(()=>Ece({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(Poe,{value:m,children:o.jsx(ole,{children:p})})}function vce({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:i,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return g.useContext(Px)?o.jsx(o.Fragment,{children:e}):o.jsx(L2,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:i,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const wce={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function _ce({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:_,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:A,onNodesDelete:j,onEdgesDelete:R,onDelete:B,onSelectionChange:z,onSelectionDragStart:L,onSelectionDrag:F,onSelectionDragStop:C,onSelectionContextMenu:I,onSelectionStart:D,onSelectionEnd:$,onBeforeDelete:O,connectionMode:ne,connectionLineType:se=Bl.Bezier,connectionLineStyle:P,connectionLineComponent:Z,connectionLineContainerStyle:te,deleteKeyCode:V="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:K=!1,selectionMode:ce=Bm.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:ge=Fm()?"Meta":"Control",zoomActivationKeyCode:ue=Fm()?"Meta":"Control",snapToGrid:ve,snapGrid:Me,onlyRenderVisibleElements:Se=!1,selectNodesOnDrag:ae,nodesDraggable:me,autoPanOnNodeFocus:we,nodesConnectable:et,nodesFocusable:De,nodeOrigin:Ue=aU,edgesFocusable:Ye,edgesReconnectable:Ae,elementsSelectable:ze=!0,defaultViewport:Be=Xoe,minZoom:X=.5,maxZoom:oe=2,translateExtent:J=Pm,preventScrolling:xe=!0,nodeExtent:Oe,defaultMarkerColor:lt="#b1b1b7",zoomOnScroll:Mt=!0,zoomOnPinch:ut=!0,panOnScroll:bn=!1,panOnScrollSpeed:wt=.5,panOnScrollMode:_t=au.Free,zoomOnDoubleClick:yn=!0,panOnDrag:Ft=!0,onPaneClick:Bt,onPaneMouseEnter:at,onPaneMouseMove:ft,onPaneMouseLeave:$e,onPaneScroll:St,onPaneContextMenu:be,paneClickDistance:We=1,nodeClickDistance:Ge=0,children:ht,onReconnect:Gn,onReconnectStart:dn,onReconnectEnd:zt,onEdgeContextMenu:rn,onEdgeDoubleClick:Sn,onEdgeMouseEnter:Vt,onEdgeMouseMove:ot,onEdgeMouseLeave:Nn,reconnectRadius:mn=10,onNodesChange:Ct,onEdgesChange:ms,noDragClassName:Rs="nodrag",noWheelClassName:gs="nowheel",noPanClassName:Mn="nopan",fitView:zs,fitViewOptions:is,connectOnClick:Tn,attributionPosition:rs,proOptions:bs,defaultEdgeOptions:_i,elevateNodesOnSelect:kn=!0,elevateEdgesOnSelect:Vs=!1,disableKeyboardA11y:Ss=!1,autoPanOnConnect:Fn,autoPanOnNodeDrag:$n,autoPanOnSelection:Gs=!0,autoPanSpeed:Os,connectionRadius:An,isValidConnection:xn,onError:fn,style:Jt,id:an,nodeDragThreshold:on,connectionDragThreshold:ys,viewport:de,onViewportChange:Ce,width:Pe,height:it,colorMode:Ze="light",debug:xt,onScroll:Ie,ariaLabelConfig:Kn,zIndexMode:as="basic",...Ks},ai){const qn=an||"1",en=ele(Ze),Lt=g.useCallback(Ms=>{Ms.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ie==null||Ie(Ms)},[Ie]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ks,onScroll:Lt,style:{...Jt,...wce},ref:ai,className:ri(["react-flow",i,en]),id:an,role:"application",children:o.jsxs(vce,{nodes:e,edges:t,width:Pe,height:it,fitView:zs,fitViewOptions:is,minZoom:X,maxZoom:oe,nodeOrigin:Ue,nodeExtent:Oe,zIndexMode:as,children:[o.jsx(Joe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:me,autoPanOnNodeFocus:we,nodesConnectable:et,nodesFocusable:De,edgesFocusable:Ye,edgesReconnectable:Ae,elementsSelectable:ze,elevateNodesOnSelect:kn,elevateEdgesOnSelect:Vs,minZoom:X,maxZoom:oe,nodeExtent:Oe,onNodesChange:Ct,onEdgesChange:ms,snapToGrid:ve,snapGrid:Me,connectionMode:ne,translateExtent:J,connectOnClick:Tn,defaultEdgeOptions:_i,fitView:zs,fitViewOptions:is,onNodesDelete:j,onEdgesDelete:R,onDelete:B,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:A,onSelectionDrag:F,onSelectionDragStart:L,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Mn,nodeOrigin:Ue,rfId:qn,autoPanOnConnect:Fn,autoPanOnNodeDrag:$n,autoPanSpeed:Os,onError:fn,connectionRadius:An,isValidConnection:xn,selectNodesOnDrag:ae,nodeDragThreshold:on,connectionDragThreshold:ys,onBeforeDelete:O,debug:xt,ariaLabelConfig:Kn,zIndexMode:as}),o.jsx(yce,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:_,nodeTypes:r,edgeTypes:a,connectionLineType:se,connectionLineStyle:P,connectionLineComponent:Z,connectionLineContainerStyle:te,selectionKeyCode:Q,selectionOnDrag:K,selectionMode:ce,deleteKeyCode:V,multiSelectionKeyCode:ge,panActivationKeyCode:he,zoomActivationKeyCode:ue,onlyRenderVisibleElements:Se,defaultViewport:Be,translateExtent:J,minZoom:X,maxZoom:oe,preventScrolling:xe,zoomOnScroll:Mt,zoomOnPinch:ut,zoomOnDoubleClick:yn,panOnScroll:bn,panOnScrollSpeed:wt,panOnScrollMode:_t,panOnDrag:Ft,autoPanOnSelection:Gs,onPaneClick:Bt,onPaneMouseEnter:at,onPaneMouseMove:ft,onPaneMouseLeave:$e,onPaneScroll:St,onPaneContextMenu:be,paneClickDistance:We,nodeClickDistance:Ge,onSelectionContextMenu:I,onSelectionStart:D,onSelectionEnd:$,onReconnect:Gn,onReconnectStart:dn,onReconnectEnd:zt,onEdgeContextMenu:rn,onEdgeDoubleClick:Sn,onEdgeMouseEnter:Vt,onEdgeMouseMove:ot,onEdgeMouseLeave:Nn,reconnectRadius:mn,defaultMarkerColor:lt,noDragClassName:Rs,noWheelClassName:gs,noPanClassName:Mn,rfId:qn,disableKeyboardA11y:Ss,nodeExtent:Oe,viewport:de,onViewportChange:Ce}),o.jsx(Woe,{onSelectionChange:z}),ht,o.jsx(Voe,{proOptions:bs,position:rs}),o.jsx(zoe,{rfId:qn,disableKeyboardA11y:Ss})]})})}var LU=dU(_ce);const Sce=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Nce({children:e}){const t=Xt(Sce);return t?wi.createPortal(e,t):null}function DU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>lU(i,r)),[]);return[t,n,s]}function PU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>cU(i,r)),[]);return[t,n,s]}const Tce=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!k2(n.userNode))return!1;return!0};function kce(e={includeHiddenNodes:!1}){return Xt(Tce(e))}function Ace({dimensions:e,lineWidth:t,variant:n,className:s}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ri(["react-flow__background-pattern",n,s])})}function Cce({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:ri(["react-flow__background-pattern","dots",t])})}var nc;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nc||(nc={}));const Ice={[nc.Dots]:1,[nc.Lines]:1,[nc.Cross]:6},jce=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function BU({id:e,variant:t=nc.Dots,gap:n=20,size:s,lineWidth:i=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=g.useRef(null),{transform:h,patternId:p}=Xt(jce,hs),m=s||Ice[t],b=t===nc.Dots,v=t===nc.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],E=m*h[2],w=Array.isArray(r)?r:[r,r],S=v?[E,E]:x,_=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],T=`${p}${e||""}`;return o.jsxs("svg",{className:ri(["react-flow__background",u]),style:{...c,...Fx,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:T,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:b?o.jsx(Cce,{radius:E/2,className:d}):o.jsx(Ace,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}BU.displayName="Background";const UU=g.memo(BU);function Rce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Oce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Mce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Lce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Dce(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function tb({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:ri(["react-flow__controls-button",t]),...n,children:e})}const Pce=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function FU({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=ps(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=Xt(Pce,hs),{zoomIn:E,zoomOut:w,fitView:S}=Ux(),_=()=>{E(),r==null||r()},T=()=>{w(),a==null||a()},k=()=>{S(i),l==null||l()},A=()=>{m.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},j=h==="horizontal"?"horizontal":"vertical";return o.jsxs(Bx,{className:ri(["react-flow__controls",j,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(tb,{onClick:_,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(Rce,{})}),o.jsx(tb,{onClick:T,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(Oce,{})})]}),n&&o.jsx(tb,{className:"react-flow__controls-fitview",onClick:k,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(Mce,{})}),s&&o.jsx(tb,{className:"react-flow__controls-interactive",onClick:A,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(Dce,{}):o.jsx(Lce,{})}),d]})}FU.displayName="Controls";const $U=g.memo(FU);function Bce({id:e,x:t,y:n,width:s,height:i,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:b}=r||{},v=a||m||b;return o.jsx("rect",{className:ri(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:s,height:i,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const Uce=g.memo(Bce),Fce=e=>e.nodes.map(t=>t.id),lw=e=>e instanceof Function?e:()=>e;function $ce({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r=Uce,onClick:a}){const l=Xt(Fce,hs),c=lw(t),u=lw(e),d=lw(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(zce,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:s,nodeStrokeWidth:i,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function Hce({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:i,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Xt(m=>{const b=m.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:E,height:w}=pl(v);return{node:v,x:y,y:x,width:E,height:w}},hs);return!u||u.hidden||!k2(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:s(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const zce=g.memo(Hce);var Vce=g.memo($ce);const Gce=200,Kce=150,qce=e=>!e.hidden,Yce=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?j9(Ng(e.nodeLookup,{filter:qce}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Wce="react-flow__minimap-desc";function HU({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const S=ps(),_=g.useRef(null),{boundingRect:T,viewBB:k,rfId:A,panZoom:j,translateExtent:R,flowWidth:B,flowHeight:z,ariaLabelConfig:L}=Xt(Yce,hs),F=(e==null?void 0:e.width)??Gce,C=(e==null?void 0:e.height)??Kce,I=T.width/F,D=T.height/C,$=Math.max(I,D),O=$*F,ne=$*C,se=w*$,P=T.x-(O-T.width)/2-se,Z=T.y-(ne-T.height)/2-se,te=O+se*2,V=ne+se*2,Q=`${Wce}-${A}`,K=g.useRef(0),ce=g.useRef();K.current=$,g.useEffect(()=>{if(_.current&&j)return ce.current=Qae({domNode:_.current,panZoom:j,getTransform:()=>S.getState().transform,getViewScale:()=>K.current}),()=>{var ve;(ve=ce.current)==null||ve.destroy()}},[j]),g.useEffect(()=>{var ve;(ve=ce.current)==null||ve.update({translateExtent:R,width:B,height:z,inversePan:x,pannable:b,zoomStep:E,zoomable:v})},[b,v,x,E,R,B,z]);const he=p?ve=>{var ae;const[Me,Se]=((ae=ce.current)==null?void 0:ae.pointer(ve))||[0,0];p(ve,{x:Me,y:Se})}:void 0,ge=m?g.useCallback((ve,Me)=>{const Se=S.getState().nodeLookup.get(Me).internals.userNode;m(ve,Se)},[]):void 0,ue=y??L["minimap.ariaLabel"];return o.jsx(Bx,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*$:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:ri(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:C,viewBox:`${P} ${Z} ${te} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:_,onClick:he,children:[ue&&o.jsx("title",{id:Q,children:ue}),o.jsx(Vce,{onClick:ge,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-se},${Z-se}h${te+se*2}v${V+se*2}h${-te-se*2}z + M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}HU.displayName="MiniMap";const Xce=g.memo(HU),Qce=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Zce={[Lf.Line]:"right",[Lf.Handle]:"bottom-right"};function Jce({nodeId:e,position:t,variant:n=Lf.Handle,className:s,style:i=void 0,children:r,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=mU(),E=typeof e=="string"?e:x,w=ps(),S=g.useRef(null),_=n===Lf.Handle,T=Xt(g.useCallback(Qce(_&&p),[_,p]),hs),k=g.useRef(null),A=t??Zce[n];g.useEffect(()=>{if(!(!S.current||!E))return k.current||(k.current=uoe({domNode:S.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:R,transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F,domNode:C}=w.getState();return{nodeLookup:R,transform:B,snapGrid:z,snapToGrid:L,nodeOrigin:F,paneDomNode:C}},onChange:(R,B)=>{const{triggerNodeChanges:z,nodeLookup:L,parentLookup:F,nodeOrigin:C}=w.getState(),I=[],D={x:R.x,y:R.y},$=L.get(E);if($&&$.expandParent&&$.parentId){const O=$.origin??C,ne=R.width??$.measured.width??0,se=R.height??$.measured.height??0,P={id:$.id,parentId:$.parentId,rect:{width:ne,height:se,...O9({x:R.x??$.position.x,y:R.y??$.position.y},{width:ne,height:se},$.parentId,L,O)}},Z=O2([P],L,F,C);I.push(...Z),D.x=R.x?Math.max(O[0]*ne,R.x):void 0,D.y=R.y?Math.max(O[1]*se,R.y):void 0}if(D.x!==void 0&&D.y!==void 0){const O={id:E,type:"position",position:{...D}};I.push(O)}if(R.width!==void 0&&R.height!==void 0){const ne={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:R.width,height:R.height}};I.push(ne)}for(const O of B){const ne={...O,type:"position"};I.push(ne)}z(I)},onEnd:({width:R,height:B})=>{const z={id:E,type:"dimensions",resizing:!1,dimensions:{width:R,height:B}};w.getState().triggerNodeChanges([z])}})),k.current.update({controlPosition:A,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var R;(R=k.current)==null||R.destroy()}},[A,l,c,u,d,f,b,v,y,m]);const j=A.split("-");return o.jsx("div",{className:ri(["react-flow__resize-control","nodrag",...j,n,s]),ref:S,style:{...i,scale:T,...a&&{[_?"backgroundColor":"borderColor"]:a}},children:r})}g.memo(Jce);var zU=Object.defineProperty,eue=(e,t,n)=>t in e?zU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tue=(e,t)=>{for(var n in t)zU(e,n,{get:t[n],enumerable:!0})},nue=(e,t,n)=>eue(e,t+"",n),VU={};tue(VU,{Graph:()=>ga,alg:()=>D2,json:()=>KU,version:()=>rue});var sue=Object.defineProperty,GU=(e,t)=>{for(var n in t)sue(e,n,{get:t[n],enumerable:!0})},ga=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(s=>{n!==void 0?this.setNode(s,n):this.setNode(s)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(s=>{this.setParent(s)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let s=n;s!==void 0;s=this.parent(s))if(s===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let s=new Set(n);for(let i of this.successors(t))s.add(i);return Array.from(s.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,a])=>{t(r)&&n.setNode(r,a)}),Object.values(this._edgeObjs).forEach(r=>{n.hasNode(r.v)&&n.hasNode(r.w)&&n.setEdge(r,this.edge(r))});let s={},i=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(s[r]=a??void 0,a??void 0):a in s?s[a]:i(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,i(r))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((s,i)=>(n!==void 0?this.setEdge(s,i,n):this.setEdge(s,i),i)),this}setEdge(t,n,s,i){let r,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(r=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(r=t,a=n,l=i,arguments.length>2&&(c=s,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=Ep(this._isDirected,r,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(r,a,l);let f=iue(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,aM(this._preds[a],r),aM(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,s){let i=arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s);return this._edgeLabels[i]}edgeAsObj(t,n,s){let i=arguments.length===1?this.edge(t):this.edge(t,n,s);return typeof i!="object"?{label:i}:i}hasEdge(t,n,s){return(arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s))in this._edgeLabels}removeEdge(t,n,s){let i=arguments.length===1?cw(this._isDirected,t):Ep(this._isDirected,t,n,s),r=this._edgeObjs[i];if(r){let a=r.v,l=r.w;delete this._edgeLabels[i],delete this._edgeObjs[i],oM(this._preds[l],a),oM(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,s){if(!t)return;let i=Object.values(t);return s?i.filter(r=>r.v===n&&r.w===s||r.v===s&&r.w===n):i}};function aM(e,t){e[t]?e[t]++:e[t]=1}function oM(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Ep(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let a=i;i=r,r=a}return i+""+r+""+(s===void 0?"\0":s)}function iue(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let l=i;i=r,r=l}let a={v:i,w:r};return s&&(a.name=s),a}function cw(e,t){return Ep(e,t.v,t.w,t.name)}var rue="4.0.1",KU={};GU(KU,{read:()=>cue,write:()=>aue});function aue(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:oue(e),edges:lue(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function oue(e){return e.nodes().map(t=>{let n=e.node(t),s=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),s!==void 0&&(i.parent=s),i})}function lue(e){return e.edges().map(t=>{let n=e.edge(t),s={v:t.v,w:t.w};return t.name!==void 0&&(s.name=t.name),n!==void 0&&(s.value=n),s})}function cue(e){let t=new ga(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var D2={};GU(D2,{CycleException:()=>w1,bellmanFord:()=>qU,components:()=>fue,dijkstra:()=>v1,dijkstraAll:()=>mue,findCycles:()=>gue,floydWarshall:()=>yue,isAcyclic:()=>Eue,postorder:()=>wue,preorder:()=>_ue,prim:()=>Sue,shortestPaths:()=>Nue,tarjan:()=>WU,topsort:()=>XU});var uue=()=>1;function qU(e,t,n,s){return due(e,String(t),n||uue,s||function(i){return e.outEdges(i)})}function due(e,t,n,s){let i={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);i[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,s=String(e);if(!(s in n)){let i=this._arr,r=i.length;return n[s]=r,i.push({key:s,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let s=this._arr[n].priority;if(t>s)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${s} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,s=n+1,i=e;n>1,!(t[s].priority1;function v1(e,t,n,s){let i=function(r){return e.outEdges(r)};return pue(e,String(t),n||hue,s||i)}function pue(e,t,n,s){let i={},r=new YU,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=r.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)s(a).forEach(c);return i}function mue(e,t,n){return e.nodes().reduce(function(s,i){return s[i]=v1(e,i,t,n),s},{})}function WU(e){let t=0,n=[],s={},i=[];function r(a){let l=s[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in s?s[c].onStack&&(l.lowlink=Math.min(l.lowlink,s[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,s[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),s[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in s||r(a)}),i}function gue(e){return WU(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var bue=()=>1;function yue(e,t,n){return xue(e,t||bue,n||function(s){return e.outEdges(s)})}function xue(e,t,n){let s={},i=e.nodes();return i.forEach(function(r){s[r]={},s[r][r]={distance:0,predecessor:""},i.forEach(function(a){r!==a&&(s[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);s[r][l]={distance:c,predecessor:r}})}),i.forEach(function(r){let a=s[r];i.forEach(function(l){let c=s[l];i.forEach(function(u){let d=c[r],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=QU(e,l,n==="post",a,r,s,i)}),i}function QU(e,t,n,s,i,r,a){return t in s||(s[t]=!0,n||(a=r(a,t)),i(t).forEach(function(l){a=QU(e,l,n,s,i,r,a)}),n&&(a=r(a,t))),a}function ZU(e,t,n){return vue(e,t,n,function(s,i){return s.push(i),s},[])}function wue(e,t){return ZU(e,t,"post")}function _ue(e,t){return ZU(e,t,"pre")}function Sue(e,t){let n=new ga,s={},i=new YU,r;function a(c){let u=c.v===r?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=i.removeMin(),r in s)n.setEdge(r,s[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function Nue(e,t,n,s){return Tue(e,t,n,s??(i=>{let r=e.outEdges(i);return r??[]}))}function Tue(e,t,n,s){if(n===void 0)return v1(e,t,n,s);let i=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let s=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:s.weight+i.weight,minlen:Math.max(s.minlen,i.minlen)})}),t}function JU(e){let t=new ga({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function lM(e,t){let n=e.x,s=e.y,i=t.x-n,r=t.y-s,a=e.width/2,l=e.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(i)*l?(r<0&&(l=-l),c=l*i/r,u=l):(i<0&&(a=-a),c=a,u=a*r/i),{x:n+c,y:s+u}}function Ag(e){let t=Hm(t7(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let s=e.node(n),i=s.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][s.order]=n)}),t}function Aue(e){let t=e.nodes().map(s=>{let i=e.node(s).rank;return i===void 0?Number.MAX_VALUE:i}),n=lo(Math.min,t);e.nodes().forEach(s=>{let i=e.node(s);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function Cue(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=lo(Math.min,t),s=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;s[l]||(s[l]=[]),s[l].push(a)});let i=0,r=e.graph().nodeRankFactor;Array.from(s).forEach((a,l)=>{a===void 0&&l%r!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function cM(e,t,n,s){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=s),ch(e,"border",i,t)}function Iue(e,t=e7){let n=[];for(let s=0;se7){let n=Iue(t);return e(...n.map(s=>e(...s)))}else return e(...t)}function t7(e){let t=e.nodes().map(n=>{let s=e.node(n).rank;return s===void 0?Number.MIN_VALUE:s});return lo(Math.max,t)}function jue(e,t){let n={lhs:[],rhs:[]};return e.forEach(s=>{t(s)?n.lhs.push(s):n.rhs.push(s)}),n}function n7(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function s7(e,t){return t()}var Rue=0;function P2(e){let t=++Rue;return e+(""+t)}function Hm(e,t,n=1){t==null&&(t=e,e=0);let s=r=>rts[t]:n=t,Object.entries(e).reduce((s,[i,r])=>(s[i]=n(r,i),s),{})}function Oue(e,t){return e.reduce((n,s,i)=>(n[s]=t[i],n),{})}var Hx="\0",Mue="3.0.0",Lue=class{constructor(){nue(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return uM(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&uM(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Due)),n=n._prev;return"["+e.join(", ")+"]"}};function uM(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Due(e,t){if(e!=="_next"&&e!=="_prev")return t}var Pue=Lue,Bue=()=>1;function Uue(e,t){if(e.nodeCount()<=1)return[];let n=$ue(e,t||Bue);return Fue(n.graph,n.buckets,n.zeroIdx).flatMap(s=>e.outEdges(s.v,s.w)||[])}function Fue(e,t,n){var s;let i=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)uw(e,t,n,l);for(;l=r.dequeue();)uw(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(s=t[c])==null?void 0:s.dequeue(),l){i=i.concat(uw(e,t,n,l,!0)||[]);break}}}return i}function uw(e,t,n,s,i){let r=[],a=i?r:void 0;return(e.inEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&r.push({v:l.v,w:l.w}),u.out-=c,sN(t,n,u)}),(e.outEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,sN(t,n,d)}),e.removeNode(s.v),a}function $ue(e,t){let n=new ga,s=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),s=Math.max(s,h.in+=u)});let r=Hue(i+s+3).map(()=>new Pue),a=s+1;return n.nodes().forEach(l=>{sN(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function sN(e,t,n){var s,i,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(s=e[0])==null||s.enqueue(n)}function Hue(e){let t=[];for(let n=0;n{let s=e.edge(n);e.removeEdge(n),s.forwardName=n.name,s.reversed=!0,e.setEdge(n.w,n.v,s,P2("rev"))});function t(n){return s=>n.edge(s).weight}}function Vue(e){let t=[],n={},s={};function i(r){Object.hasOwn(s,r)||(s[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[r])}return e.nodes().forEach(i),t}function Gue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let s=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,s)}})}function Kue(e){e.graph().dummyChains=[],e.edges().forEach(t=>que(e,t))}function que(e,t){let n=t.v,s=e.node(n).rank,i=t.w,r=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===s+1)return;e.removeEdge(t);let u,d,f;for(f=0,++s;s{let n=e.node(t),s=n.edgeLabel,i;for(e.setEdge(n.edgeObj,s);n.dummy;)i=e.successors(t)[0],e.removeNode(t),s.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height),t=i,n=e.node(t)})}function B2(e){let t={};function n(s){let i=e.node(s);if(Object.hasOwn(t,s))return i.rank;t[s]=!0;let r=e.outEdges(s),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=lo(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Pf(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var i7=Wue;function Wue(e){let t=new ga({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let s=n[0],i=e.nodeCount();t.setNode(s,{});let r,a;for(;Xue(t,e){let a=r.v,l=s===a?r.w:a;!e.hasNode(l)&&!Pf(t,r)&&(e.setNode(l,{}),e.setEdge(s,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Que(e,t){return t.edges().reduce((n,s)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(s.v)!==e.hasNode(s.w)&&(i=Pf(t,s)),it.node(s).rank+=n)}var{preorder:Jue,postorder:ede}=D2,tde=Ou;Ou.initLowLimValues=F2;Ou.initCutValues=U2;Ou.calcCutValue=r7;Ou.leaveEdge=o7;Ou.enterEdge=l7;Ou.exchangeEdges=c7;function Ou(e){e=kue(e),B2(e);let t=i7(e);F2(t),U2(t,e);let n,s;for(;n=o7(t);)s=l7(t,e,n),c7(t,e,n,s)}function U2(e,t){let n=ede(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(s=>nde(e,t,s))}function nde(e,t,n){let s=e.node(n).parent,i=e.edge(n,s);i.cutvalue=r7(e,t,n)}function r7(e,t,n){let s=e.node(n).parent,i=!0,r=t.edge(n,s),a=0;r||(i=!1,r=t.edge(s,n)),a=r.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==s){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,ide(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function F2(e,t){arguments.length<2&&(t=e.nodes()[0]),a7(e,{},1,t)}function a7(e,t,n,s,i){let r=n,a=e.node(s);t[s]=!0;let l=e.neighbors(s);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=a7(e,t,n,c,s))}),a.low=r,a.lim=n++,i?a.parent=i:delete a.parent,n}function o7(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function l7(e,t,n){let s=n.v,i=n.w;t.hasEdge(s,i)||(s=n.w,i=n.v);let r=e.node(s),a=e.node(i),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===dM(e,e.node(u.v),l)&&c!==dM(e,e.node(u.w),l)).reduce((u,d)=>Pf(t,d)!e.node(i).parent);if(!n)return;let s=Jue(e,[n]);s=s.slice(1),s.forEach(i=>{let r=e.node(i).parent,a=t.edge(i,r),l=!1;a||(a=t.edge(r,i),l=!0),t.node(i).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function ide(e,t,n){return e.hasEdge(t,n)}function dM(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var rde=ade;function ade(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":fM(e);break;case"tight-tree":lde(e);break;case"longest-path":ode(e);break;case"none":break;default:fM(e)}}var ode=B2;function lde(e){B2(e),i7(e)}function fM(e){tde(e)}var cde=ude;function ude(e){let t=fde(e);e.graph().dummyChains.forEach(n=>{let s=e.node(n),i=s.edgeObj,r=dde(e,t,i.v,i.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(s=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=s;for(;(d=e.parent(d))!==u;)r.push(d);return{path:i.concat(r.reverse()),lca:u}}function fde(e){let t={},n=0;function s(i){let r=n;e.children(i).forEach(s),t[i]={low:r,lim:n++}}return e.children(Hx).forEach(s),t}function hde(e){let t=ch(e,"root",{},"_root"),n=pde(e),s=Object.values(n),i=lo(Math.max,s)-1,r=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=mde(e)+1;e.children(Hx).forEach(l=>u7(e,t,r,a,i,n,l)),e.graph().nodeRankFactor=r}function u7(e,t,n,s,i,r,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=cM(e,"_bt"),d=cM(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;u7(e,t,n,s,i,r,h);let m=e.node(h),b=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?s:2*s,x=b!==v?1:i-((p=r[a])!=null?p:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=r[a])!=null?l:0)})}function pde(e){let t={};function n(s,i){let r=e.children(s);r&&r.length&&r.forEach(a=>n(a,i+1)),t[s]=i}return e.children(Hx).forEach(s=>n(s,1)),t}function mde(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function gde(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var bde=yde;function yde(e){function t(n){let s=e.children(n),i=e.node(n);if(s.length&&s.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let r=i.minRank,a=i.maxRank+1;rpM(e.node(t))),e.edges().forEach(t=>pM(e.edge(t)))}function pM(e){let t=e.width;e.width=e.height,e.height=t}function vde(e){e.nodes().forEach(t=>dw(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(dw),Object.hasOwn(s,"y")&&dw(s)})}function dw(e){e.y=-e.y}function wde(e){e.nodes().forEach(t=>fw(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(fw),Object.hasOwn(s,"x")&&fw(s)})}function fw(e){let t=e.x;e.x=e.y,e.y=t}function _de(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),s=n.map(l=>e.node(l).rank),i=lo(Math.max,s),r=Hm(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);r[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),r}function Sde(e,t){let n=0;for(let s=1;sd)),i=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:s[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),r=1;for(;r{let d=u.pos+r;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Tde(e,t=[]){return t.map(n=>{let s=e.inEdges(n);if(!s||!s.length)return{v:n};{let i=s.reduce((r,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:r.sum+l.weight*c.order,weight:r.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function kde(e,t){let n={};e.forEach((i,r)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:r};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let r=n[i.v],a=n[i.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let s=Object.values(n).filter(i=>!i.indegree);return Ade(s)}function Ade(e){let t=[];function n(i){return r=>{r.merged||(r.barycenter===void 0||i.barycenter===void 0||r.barycenter>=i.barycenter)&&Cde(i,r)}}function s(i){return r=>{r.in.push(i),--r.indegree===0&&e.push(r)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(s(i))}return t.filter(i=>!i.merged).map(i=>_1(i,["vs","i","barycenter","weight"]))}function Cde(e,t){let n=0,s=0;e.weight&&(n+=e.barycenter*e.weight,s+=e.weight),t.weight&&(n+=t.barycenter*t.weight,s+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/s,e.weight=s,e.i=Math.min(t.i,e.i),t.merged=!0}function Ide(e,t){let n=jue(e,d=>Object.hasOwn(d,"barycenter")),s=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;s.sort(jde(!!t)),c=mM(r,i,c),s.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=mM(r,i,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function mM(e,t,n){let s;for(;t.length&&(s=t[t.length-1]).i<=n;)t.pop(),e.push(s.vs),n++;return n}function jde(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function f7(e,t,n,s){let i=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Tde(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=f7(e,h.v,n,s);c[h.v]=p,Object.hasOwn(p,"barycenter")&&Ode(h,p)}});let d=kde(u,n);Rde(d,c);let f=Ide(d,s);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(l),b=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+b.order)/(f.weight+2),f.weight+=2}}return f}function Rde(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(s=>t[s]?t[s].vs:s)})}function Ode(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Mde(e,t,n,s){s||(s=e.nodes());let i=Lde(e),r=new ga({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return s.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){r.setNode(a),r.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=r.edge(f,a),p=h!==void 0?h.weight:0;r.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&r.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),r}function Lde(e){let t;for(;e.hasNode(t=P2("_root")););return t}function Dde(e,t,n){let s={},i;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=s[l],s[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function h7(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,h7);return}let n=t7(e),s=gM(e,Hm(1,n+1),"inEdges"),i=gM(e,Hm(n-1,-1,-1),"outEdges"),r=_de(e);if(bM(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){Pde(u%2?s:i,u%4>=2,c),r=Ag(e);let f=Sde(e,r);f{s.has(r)||s.set(r,[]),s.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&i(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,r)}return t.map(function(r){return Mde(e,r,n,s.get(r)||[])})}function Pde(e,t,n){let s=new ga;e.forEach(function(i){n.forEach(l=>s.setEdge(l.left,l.right));let r=i.graph().root,a=f7(i,r,s,t);a.vs.forEach((l,c)=>i.node(l).order=c),Dde(i,s,a.vs)})}function bM(e,t){Object.values(t).forEach(n=>n.forEach((s,i)=>e.node(s).order=i))}function Bde(e,t){let n={};function s(i,r){let a=0,l=0,c=i.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=Fde(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let b=e.predecessors(m);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=r[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&p7(n,p,f)})}})}function i(r,a){let l=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,s(a,u,f,l,c),u=f,l=c}}s(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(i),n}function Fde(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(s=>e.node(s).dummy)}}function p7(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];s||(e[t]=s={}),s[n]=!0}function $de(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];return s!==void 0&&Object.hasOwn(s,n)}function Hde(e,t,n,s){let i={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=s(u);if(d&&d.length){let f=d.sort((p,m)=>{let b=a[p],v=a[m];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let b=f[p];if(b===void 0)continue;let v=a[b];if(v!==void 0&&r[u]===u&&c{var y;let x=(y=r[v.v])!=null?y:0,E=a.edge(v);return Math.max(b,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),b=Number.POSITIVE_INFINITY;m&&(b=m.reduce((y,x)=>{let E=r[x.w],w=a.edge(x);return Math.min(y,(E!==void 0?E:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let v=e.node(p);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,b))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(s).forEach(p=>{var m;let b=n[p];b!==void 0&&(r[p]=(m=r[b])!=null?m:0)}),r}function Vde(e,t,n,s){let i=new ga,r=e.graph(),a=Wde(r.nodesep,r.edgesep,s);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function Gde(e,t){return Object.values(t).reduce((n,s)=>{let i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(s).forEach(([l,c])=>{let u=Xde(e,l)/2;i=Math.max(c+u,i),r=Math.min(c-u,r)});let a=i-r;return a{["l","r"].forEach(a=>{let l=r+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=s-lo(Math.min,u);a!=="l"&&(d=i-lo(Math.max,u)),d&&(e[l]=$x(c,f=>f+d))})})}function qde(e,t=void 0){let n=e.ul;return n?$x(n,(s,i)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((r=l[1])!=null?r:0)+((a=l[2])!=null?a:0))/2}):{}}function Yde(e){let t=Ag(e),n=Object.assign(Bde(e,t),Ude(e,t)),s={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=Hde(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=zde(e,i,c.root,c.align,l==="r");l==="r"&&(u=$x(u,d=>-d)),s[a+l]=u})});let r=Gde(e,s);return Kde(s,r),qde(s,e.graph().align)}function Wde(e,t,n){return(s,i,r)=>{let a=s.node(i),l=s.node(r),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function Xde(e,t){return e.node(t).width}function Qde(e){e=JU(e),Zde(e),Object.entries(Yde(e)).forEach(([t,n])=>e.node(t).x=n)}function Zde(e){let t=Ag(e),n=e.graph(),s=n.ranksep,i=n.rankalign,r=0;t.forEach(a=>{let l=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);i==="top"?u.y=r+u.height/2:i==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+s})}function Jde(e,t={}){let n=t.debugTiming?n7:s7;return n("layout",()=>{let s=n(" buildLayoutGraph",()=>cfe(e));return n(" runLayout",()=>efe(s,n,t)),n(" updateInputGraph",()=>tfe(e,s)),s})}function efe(e,t,n){t(" makeSpaceForEdgeLabels",()=>ufe(e)),t(" removeSelfEdges",()=>xfe(e)),t(" acyclic",()=>zue(e)),t(" nestingGraph.run",()=>hde(e)),t(" rank",()=>rde(JU(e))),t(" injectEdgeLabelProxies",()=>dfe(e)),t(" removeEmptyRanks",()=>Cue(e)),t(" nestingGraph.cleanup",()=>gde(e)),t(" normalizeRanks",()=>Aue(e)),t(" assignRankMinMax",()=>ffe(e)),t(" removeEdgeLabelProxies",()=>hfe(e)),t(" normalize.run",()=>Kue(e)),t(" parentDummyChains",()=>cde(e)),t(" addBorderSegments",()=>bde(e)),t(" order",()=>h7(e,n)),t(" insertSelfEdges",()=>Efe(e)),t(" adjustCoordinateSystem",()=>xde(e)),t(" position",()=>Qde(e)),t(" positionSelfEdges",()=>vfe(e)),t(" removeBorderNodes",()=>yfe(e)),t(" normalize.undo",()=>Yue(e)),t(" fixupEdgeLabelCoords",()=>gfe(e)),t(" undoCoordinateSystem",()=>Ede(e)),t(" translateGraph",()=>pfe(e)),t(" assignNodeIntersects",()=>mfe(e)),t(" reversePoints",()=>bfe(e)),t(" acyclic.undo",()=>Gue(e))}function tfe(e,t){e.nodes().forEach(n=>{let s=e.node(n),i=t.node(n);s&&(s.x=i.x,s.y=i.y,s.order=i.order,s.rank=i.rank,t.children(n).length&&(s.width=i.width,s.height=i.height))}),e.edges().forEach(n=>{let s=e.edge(n),i=t.edge(n);s.points=i.points,Object.hasOwn(i,"x")&&(s.x=i.x,s.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var nfe=["nodesep","edgesep","ranksep","marginx","marginy"],sfe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},ife=["acyclicer","ranker","rankdir","align","rankalign"],rfe=["width","height","rank"],yM={width:0,height:0},afe=["minlen","weight","width","height","labeloffset"],ofe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lfe=["labelpos"];function cfe(e){let t=new ga({multigraph:!0,compound:!0}),n=pw(e.graph());return t.setGraph(Object.assign({},sfe,hw(n,nfe),_1(n,ife))),e.nodes().forEach(s=>{let i=pw(e.node(s)),r=hw(i,rfe);Object.keys(yM).forEach(l=>{r[l]===void 0&&(r[l]=yM[l])}),t.setNode(s,r);let a=e.parent(s);a!==void 0&&t.setParent(s,a)}),e.edges().forEach(s=>{let i=pw(e.edge(s));t.setEdge(s,Object.assign({},ofe,hw(i,afe),_1(i,lfe)))}),t}function ufe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let s=e.edge(n);s.minlen*=2,s.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?s.width+=s.labeloffset:s.height+=s.labeloffset)})}function dfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let s=e.node(t.v),i={rank:(e.node(t.w).rank-s.rank)/2+s.rank,e:t};ch(e,"edge-proxy",i,"_ep")}})}function ffe(e){let t=0;e.nodes().forEach(n=>{let s=e.node(n);s.borderTop&&(s.minRank=e.node(s.borderTop).rank,s.maxRank=e.node(s.borderBottom).rank,t=Math.max(t,s.maxRank))}),e.graph().maxRank=t}function hfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let s=n;e.edge(s.e).labelRank=n.rank,e.removeNode(t)}})}function pfe(e){let t=Number.POSITIVE_INFINITY,n=0,s=Number.POSITIVE_INFINITY,i=0,r=e.graph(),a=r.marginx||0,l=r.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),s=Math.min(s,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,s-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=s}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=s}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=s)}),r.width=n-t+a,r.height=i-s+l}function mfe(e){e.edges().forEach(t=>{let n=e.edge(t),s=e.node(t.v),i=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=i,a=s),n.points.unshift(lM(s,r)),n.points.push(lM(i,a))})}function gfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function bfe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function yfe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),s=e.node(n.borderTop),i=e.node(n.borderBottom),r=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-r.x),n.height=Math.abs(i.y-s.y),n.x=r.x+n.width/2,n.y=s.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function xfe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Efe(e){Ag(e).forEach(t=>{let n=0;t.forEach((s,i)=>{let r=e.node(s);r.order=i+n,(r.selfEdges||[]).forEach(a=>{ch(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function vfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let s=n,i=e.node(s.e.v),r=i.x+i.width/2,a=i.y,l=n.x-r,c=i.height/2;e.setEdge(s.e,s.label),e.removeNode(t),s.label.points=[{x:r+2*l/3,y:a-c},{x:r+5*l/6,y:a-c},{x:r+l,y:a},{x:r+5*l/6,y:a+c},{x:r+2*l/3,y:a+c}],s.label.x=n.x,s.label.y=n.y}})}function hw(e,t){return $x(_1(e,t),Number)}function pw(e){let t={};return e&&Object.entries(e).forEach(([n,s])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=s}),t}function wfe(e){let t=Ag(e),n=new ga({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(s=>{n.setNode(s,{label:s}),n.setParent(s,"layer"+e.node(s).rank)}),e.edges().forEach(s=>n.setEdge(s.v,s.w,{},s.name)),t.forEach((s,i)=>{let r="layer"+i;n.setNode(r,{rank:"same"}),s.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var _fe={graphlib:VU,version:Mue,layout:Jde,debug:wfe,util:{time:n7,notime:s7}},xM=_fe;/*! For license information please see dagre.esm.js.LEGAL.txt */const vp={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:mu},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:HB},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:LB},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Xk},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:xx}},iN=220,rN=88,EM=96,vM=34,Qp=64,mw=310,$d=24,m7=56,aN=40,wM=40,Sfe=18,Nfe=58,Tfe=!1,kfe=e=>e==="sequential"||e==="parallel"||e==="loop";function oN(e,t){const n=e.agentType??"llm";return kfe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function lN(e,t=[],n="horizontal",s=!1){const i=e.agentType??"llm";if(!oN(e,t))return{width:iN,height:rN};if(s&&e.subAgents.length===0)return{width:mw,height:Qp};const r=e.subAgents.map((f,h)=>lN(f,[...t,h],n,s)),a=r.length?Math.max(...r.map(f=>f.width)):0,l=r.length?Math.max(...r.map(f=>f.height)):0,c=r.length&&i!=="parallel"?m7:$d,u=n==="horizontal"?i!=="parallel":i==="parallel",d=r.length?i==="parallel"?Sfe+wM:i==="loop"?Nfe:0:wM;return u?{width:Math.max(mw,r.reduce((f,h)=>f+h.width,0)+aN*Math.max(0,r.length-1)+c*2),height:Qp+$d+l+d+$d}:{width:Math.max(mw,a+$d*2),height:Qp+c+r.reduce((f,h)=>f+h.height,0)+aN*Math.max(0,r.length-1)+d+c}}function Wh(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Afe(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function _M(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Xh(e,t,n,s){const i=(s==null?void 0:s.tone)==="sequential"?"hsl(213 40% 40%)":(s==null?void 0:s.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${s!=null&&s.loop?"-loop":""}`,source:e,target:t,sourceHandle:s!=null&&s.loop?"loop-source":void 0,targetHandle:s!=null&&s.loop?"loop-target":void 0,label:n,type:"insertStep",data:s?{insert:s.insert,loop:s.loop,tone:s.tone}:void 0,animated:s==null?void 0:s.loop,markerEnd:{type:jf.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function SM(e,t,n=!1){const s=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],i=[];function r(d,f,h,p,m){const b=d.agentType??"llm",v=Wh(f);return oN(d,f)?(a(d,f,h,p,m),v):(s.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||vp[b].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const b=d.agentType??"sequential",v=Wh(f),y=lN(d,f,t,n);s.push({id:v,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":vp[b].label),pattern:b,description:d.description.trim()||vp[b].description,childCount:d.subAgents.length,containedIn:m,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const x=d.subAgents.map((T,k)=>lN(T,[...f,k],t,n)),E=x.length&&b!=="parallel"?m7:$d,w=t==="horizontal"?b!=="parallel":b==="parallel";let S=E;const _=d.subAgents.map((T,k)=>{const A=x[k],j=w?{x:S,y:Qp+$d}:{x:(y.width-A.width)/2,y:Qp+S};return S+=(w?A.width:A.height)+aN,r(T,[...f,k],v,j,b)});if(b==="sequential"||b==="loop"){for(let T=0;T<_.length-1;T+=1)i.push(Xh(_[T],_[T+1],"然后",{tone:b,insert:{parentPath:f,index:T+1}}));b==="loop"&&_.length>1&&i.push(Xh(_[_.length-1],_[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=Wh(f);if(oN(d,f))return a(d,f),[p];if(s.push({id:p,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||vp[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((b,v)=>{const y=[...f,v],x=Wh(y);i.push(Xh(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(b,y))}),m},c=Wh([]),u=l(e,[]);return i.push(Xh("terminal-input",c)),u.forEach(d=>i.push(Xh(d,"terminal-output"))),Cfe(s,i,t)}function Cfe(e,t,n){const s=new xM.graphlib.Graph().setDefaultEdgeLabel(()=>({}));s.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(r=>!r.parentId).map(r=>r.id));return e.filter(r=>!r.parentId).forEach(r=>{const a=r.data.kind==="terminal";s.setNode(r.id,{width:a?EM:r.data.layoutWidth??iN,height:a?vM:r.data.layoutHeight??rN})}),t.filter(r=>i.has(r.source)&&i.has(r.target)).forEach(r=>s.setEdge(r.source,r.target)),xM.layout(s),{nodes:e.map(r=>{if(r.parentId)return r;const a=s.node(r.id),l=r.data.kind==="terminal",c=l?EM:r.data.layoutWidth??iN,u=l?vM:r.data.layoutHeight??rN;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const zx=g.createContext(null),Vx=g.createContext("horizontal");function Ife({id:e,sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=g.useContext(zx),[h,p]=g.useState(!1),[m,b,v]=x1({sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(kg,{id:e,path:m,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(Nce,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${v}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(Ri,{})})]})})]})}function jfe({data:e,selected:t}){const n=g.useContext(zx),s=g.useContext(Vx),i=s==="vertical"?Qe.Top:Qe.Left,r=s==="vertical"?Qe.Bottom:Qe.Right,a=s==="vertical"?Qe.Right:Qe.Bottom,l=e.pattern??"llm",c=vp[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(Fi,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(fc,{})}),o.jsx(Fi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Fi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Fi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Rfe({data:e,selected:t}){const n=g.useContext(zx),s=g.useContext(Vx),i=s==="vertical"?Qe.Top:Qe.Left,r=s==="vertical"?Qe.Bottom:Qe.Right,a=s==="vertical"?Qe.Right:Qe.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(Fi,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(Ri,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(Ri,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(Ri,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(Ri,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(fc,{})}),o.jsx(Fi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Fi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Fi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Ofe({data:e}){const t=g.useContext(Vx);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Fi,{type:"target",position:t==="vertical"?Qe.Top:Qe.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Fi,{type:"source",position:t==="vertical"?Qe.Bottom:Qe.Right,className:"abc-handle"})]})}const Mfe={agent:jfe,group:Rfe,terminal:Ofe},Lfe={insertStep:Ife};function Dfe({draft:e,selectedPath:t,onSelect:n,onAdd:s,onInsert:i,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=g.useMemo(()=>SM(e,c,a),[]),[d,f,h]=DU(u.nodes),[p,m,b]=PU(u.edges),v=kce(),y=g.useRef(`${c}:${a?"readonly":"editable"}:${_M(e)}`),x=g.useRef(null),{fitView:E}=Ux(),w=g.useMemo(()=>SM(e,c,a),[c,e,a]),[S,_]=g.useState(()=>window.matchMedia("(max-width: 860px)").matches),T=g.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),k=g.useCallback((j=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const R=x.current;if(R&&(R.clientWidth===0||R.clientHeight===0)&&j<8){k(j+1);return}E(T)})})},[T,E]);g.useEffect(()=>{const j=window.matchMedia("(max-width: 860px)"),R=B=>_(B.matches);return j.addEventListener("change",R),()=>j.removeEventListener("change",R)},[]),g.useEffect(()=>{const j=`${c}:${a?"readonly":"editable"}:${_M(e)}`,R=j!==y.current;y.current=j,m(w.edges),f(B=>{const z=new Map(B.map(L=>[L.id,L]));return w.nodes.map(L=>{const F=z.get(L.id);return{...L,measured:!R&&F&&F.type===L.type?F.measured:void 0,position:!R&&F?F.position:L.position,selected:L.data.kind==="agent"&&!!L.data.path&&Afe(L.data.path,t)}})}),R&&k()},[w,e,k,t,m,f]),g.useEffect(()=>{k()},[S,k]),g.useEffect(()=>{v&&k()},[w,k,v]),g.useEffect(()=>{if(!a||!x.current)return;const j=new ResizeObserver(()=>k());return j.observe(x.current),k(),()=>j.disconnect()},[k,a]);const A=g.useMemo(()=>a?null:{onAdd:s,onInsert:i,onDelete:r},[s,r,i,a]);return o.jsx(Vx.Provider,{value:c,children:o.jsx(zx.Provider,{value:A,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:x,className:"abc-canvas",children:o.jsxs(LU,{nodes:d,edges:p,nodeTypes:Mfe,edgeTypes:Lfe,onNodesChange:h,onEdgesChange:b,onNodeClick:(j,R)=>{!a&&R.data.kind==="agent"&&R.data.path&&n(R.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:T,onInit:()=>k(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(UU,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx($U,{showInteractive:!1}),Tfe]})})})})})}function zm(e){return o.jsx(L2,{children:o.jsx(Dfe,{...e})})}const Pfe="https://ark.cn-beijing.volces.com/api/v3/",iy=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:Pfe}],Vm=[],NM={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},Bfe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},Ufe="https://api.vikingdb.cn-beijing.volces.com/openviking",Ffe=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,$fe=[{key:"DATABASE_VIKING_PROJECT",required:!1,placeholder:"default"},{key:"DATABASE_VIKING_REGION",required:!1},{key:"DATABASE_VIKING_COLLECTION_KIND",required:!1},{key:"DATABASE_VIKING_RESOURCE_ID",required:!1}],Qh=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],Da={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},g7=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:Da.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:Da.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:Da.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],Ou=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Vm},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Vm},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],Hfe=new Set(["web_scraper","text_to_speech","vesearch"]),b7=Ou.filter(e=>!Hfe.has(e.id)),cN=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],uN=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:iy,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:Vm},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:Ufe,comment:"OpenViking 服务地址",link:NM},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:NM},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:Ffe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:Bfe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],vu="viking",dN=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:$fe},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Vm,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],zfe=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...Vm,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Vfe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",Gfe=`你是一个专业、可靠的智能助手。 +}`,$fe=[{key:"DATABASE_VIKING_PROJECT",required:!1,placeholder:"default"},{key:"DATABASE_VIKING_REGION",required:!1},{key:"DATABASE_VIKING_COLLECTION_KIND",required:!1},{key:"DATABASE_VIKING_RESOURCE_ID",required:!1}],Qh=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],Pa={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},g7=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:Pa.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:Pa.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:Pa.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],Mu=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Vm},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Vm},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],Hfe=new Set(["web_scraper","text_to_speech","vesearch"]),zfe=new Set(["web_search","parallel_web_search"]),Vfe=Mu.filter(e=>!Hfe.has(e.id));function b7(e="volcengine"){const t=e==="byteplus"?zfe:new Set;return Vfe.filter(n=>!t.has(n.id))}const cN=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],uN=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:iy,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:Vm},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:Ufe,comment:"OpenViking 服务地址",link:NM},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:NM},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:Ffe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:Bfe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],wu="viking",dN=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:$fe},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iy],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Vm,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],Gfe=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...Vm,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Kfe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",qfe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function Ci(e="volcengine"){return{name:"",description:Vfe,instruction:Gfe,agentType:"llm",cloudProvider:e,maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:i1(e),modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:vu,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}async function Cg(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Bn(void 0,yc)});if(t.status===409)throw new Error("服务端未配置云厂商 AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function y7(){return(await Cg("/web/skill-spaces?region=all")).items||[]}async function Kfe(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),Cg(`/web/skill-spaces?${t.toString()}`)}async function x7(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await Cg(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function qfe(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),Cg(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function Yfe(e,t,n,s,i){const r=[];n&&r.push(`version=${encodeURIComponent(n)}`),s&&r.push(`region=${encodeURIComponent(s)}`),i&&r.push(`project=${encodeURIComponent(i)}`);const a=r.length>0?`?${r.join("&")}`:"";return Cg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function Wfe(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function Xfe(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function TM({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const Qfe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function fN(e){const t=Ou.find(n=>n.id===e||n.toolNames.includes(e));return Qfe[e]??(t==null?void 0:t.label)??e}function kM(e){const t=Ou.find(s=>s.id===e||s.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function Zfe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Jfe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function AM(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function E7({title:e,description:t,icon:n,wide:s=!1,onClose:i,children:r}){const a=g.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return g.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&i()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[i]),wi.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:i}),o.jsxs("section",{className:`session-capability-dialog${s?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[o.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&o.jsx("span",{className:"session-capability-dialog-mark",children:n}),o.jsxs("div",{children:[o.jsx("h2",{id:a.current,children:e}),o.jsx("p",{children:t})]}),o.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:i,children:o.jsx(Zfe,{})})]}),r]})]}),document.body)}function ry({value:e,placeholder:t,label:n,onChange:s,autoFocus:i=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(Jfe,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:i,onChange:r=>s(r.target.value)})]})}function ehe({agentName:e,tools:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState(""),[c,u]=g.useState(""),d=g.useMemo(()=>new Set(n),[n]),f=g.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${fN(m)} ${m} ${kM(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await i({kind:"tool",name:p});u(""),m&&r()};return o.jsx(E7,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(TM,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(ry,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:l,autoFocus:!0}),o.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),b=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(TM,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:fN(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:kM(p)})]}),o.jsx("button",{type:"button",disabled:m||s||!!c,onClick:()=>void h(p),children:m?"已添加":b?"添加中…":"添加"})]},p)})})]})})}function the({appName:e,agentName:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState("public"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(0),[m,b]=g.useState(!0),[v,y]=g.useState(""),[x,E]=g.useState([]),[w,S]=g.useState(null),[_,T]=g.useState([]),[k,A]=g.useState(""),[j,R]=g.useState(""),[B,z]=g.useState(!0),[L,F]=g.useState(!1),[C,I]=g.useState(""),[D,$]=g.useState(""),O=g.useMemo(()=>new Set(n),[n]);g.useEffect(()=>{if(a!=="public")return;let ee=!0;const V=window.setTimeout(()=>{b(!0),y(""),E8(e,c.trim()).then(X=>{ee&&(f(X.items),p(X.totalCount))}).catch(X=>{ee&&(f([]),p(0),y(X instanceof Error?X.message:"搜索 Skill Hub 失败"))}).finally(()=>{ee&&b(!1)})},250);return()=>{ee=!1,window.clearTimeout(V)}},[e,c,a]),g.useEffect(()=>{if(a!=="agentkit")return;let ee=!0;return z(!0),I(""),y7().then(V=>{ee&&(E(V),S(V[0]??null))}).catch(V=>{ee&&I(V instanceof Error?V.message:"读取 Skill Space 失败")}).finally(()=>{ee&&z(!1)}),()=>{ee=!1}},[a]),g.useEffect(()=>{if(a!=="agentkit")return;if(!w){T([]);return}let ee=!0;return F(!0),I(""),x7(w.id,w.region).then(V=>{ee&&T(V)}).catch(V=>{ee&&I(V instanceof Error?V.message:"读取技能失败")}).finally(()=>{ee&&F(!1)}),()=>{ee=!1}},[w,a]);const te=g.useMemo(()=>{const ee=k.trim().toLowerCase();return ee?x.filter(V=>`${V.name} ${V.id} ${V.description}`.toLowerCase().includes(ee)):x},[k,x]),se=g.useMemo(()=>{const ee=j.trim().toLowerCase();return ee?_.filter(V=>`${V.skillName} ${V.skillDescription}`.toLowerCase().includes(ee)):_},[j,_]),P=async ee=>{if(!w)return;$(ee.skillId);const V=await i({kind:"skill",name:ee.skillName,skillSourceId:w.id,description:ee.skillDescription,version:ee.version});$(""),V&&r()},Q=async ee=>{$(ee.slug);const V=await i({kind:"skill",name:ee.name,skillSourceId:`findskill:${ee.slug}`,description:ee.description,version:ee.version||ee.updatedAt});$(""),V&&r()};return o.jsx(E7,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:r,children:o.jsxs("div",{className:"session-skill-dialog-body",children:[o.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>l("public"),children:["Skill Hub",o.jsx("span",{children:"公域"})]}),o.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>l("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?o.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[o.jsxs("div",{className:"session-public-skill-head",children:[o.jsx(ry,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),o.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),o.jsx("div",{className:"session-public-skill-list",children:v?o.jsx("div",{className:"session-capability-error",children:v}):m?o.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(ee=>{const V=O.has(ee.name),X=D===ee.slug;return o.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:ee.name}),o.jsx("span",{children:ee.description||"暂无描述"}),o.jsxs("small",{children:[ee.sourceRepo||ee.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),ee.downloadCount.toLocaleString()," 次下载",ee.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),ee.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:V||s||!!D,onClick:()=>void Q(ee),children:V?"已添加":X?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(AM,{}),"添加"]})})]},ee.slug)})})]}):o.jsxs("div",{className:"session-skill-browser",children:[o.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Skill Space"}),o.jsx("span",{children:x.length})]}),o.jsx(ry,{value:k,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:A,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:B?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):te.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):te.map(ee=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===ee.id?" is-active":""}`,onClick:()=>{S(ee),R("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:ee.name||ee.id}),o.jsx("small",{children:ee.description||ee.id}),o.jsxs("em",{children:[ee.skillCount??0," 个技能"]})]})},`${ee.projectName??"default"}:${ee.id}`))})]}),o.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{title:w==null?void 0:w.name,children:(w==null?void 0:w.name)||"选择 Skill Space"}),o.jsx("span",{children:_.length})]}),o.jsx(ry,{value:j,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:R})]}),o.jsx("div",{className:"session-skill-pane-list",children:C?o.jsx("div",{className:"session-capability-error",children:C}):w?L?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):se.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):se.map(ee=>{const V=O.has(ee.skillName),X=D===ee.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:ee.skillName}),o.jsx("span",{children:ee.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",ee.version||"—"]})]}),o.jsx("button",{type:"button",disabled:V||s||!!D,onClick:()=>void P(ee),children:V?"已添加":X?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(AM,{}),"添加"]})})]},`${ee.skillId}:${ee.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function Pa({as:e="span",className:t="",duration:n=4,spread:s=20,children:i,style:r,...a}){const l=Math.min(Math.max(s,5),45);return o.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...r,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...a,children:i})}function v7(e){return 1+e.children.reduce((t,n)=>t+v7(n),0)}function w7(e){return e.id||e.name}function nhe(e,t){const n=w7(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const s=/^agent_sub_(\d+)$/.exec(n);return s?`子 Agent ${s[1]}`:e.name||n}function _7(e,t=!0){return{...e,id:w7(e),name:nhe(e,t),children:e.children.map(n=>_7(n,!1))}}function S7(e){const t=Ci();return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:e.model,tools:e.tools??[],skills:(e.skills??[]).map(n=>n.name),subAgents:e.children.map(S7)}}function she(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function ihe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function gw({title:e,count:t}){return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function rhe({appName:e,info:t,loading:n,variant:s="rail",capabilities:i=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=g.useState(null),[h,p]=g.useState(!1),m=g.useRef(null),b=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=m.current)==null?void 0:_.focus()})};if(g.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,T=k=>{k.key==="Escape"&&b()};return document.body.style.overflow="hidden",document.addEventListener("keydown",T),()=>{document.body.style.overflow=_,document.removeEventListener("keydown",T)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(Pa,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=_7(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),y=(i==null?void 0:i.tools)??she(t.tools).map(_=>({id:`base:tool:${_}`,kind:"tool",name:_,custom:!1})),x=(i==null?void 0:i.skills)??ihe(t.skills).map(_=>({id:`base:skill:${_.name}`,kind:"skill",name:_.name,description:_.description,custom:!1})),E=!!(i&&c&&u),w=S7(v),S=_=>o.jsx(zm,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[o.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&o.jsx("span",{title:t.model,children:t.model})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[o.jsx(gw,{title:"工具",count:y.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:y.length>0?o.jsx("div",{className:"topo-tool-list",children:y.map(_=>o.jsxs("div",{className:"topo-tool",title:_.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:fN(_.name)}),o.jsx("code",{children:_.name})]}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${_.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(_.id),children:"×"})]},_.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:r||a,onClick:()=>f("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加工具"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[o.jsx(gw,{title:"技能",count:t.skillsPreviewSupported?x.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?x.length>0?o.jsx("div",{className:"topo-skill-list",children:x.map(_=>o.jsxs("div",{className:"topo-skill",title:_.description||_.name,children:[o.jsxs("div",{className:"topo-skill-title",children:[o.jsx("span",{className:"topo-skill-name",children:_.name}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${_.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(_.id),children:"×"})]}),_.description&&o.jsx("span",{className:"topo-skill-description",children:_.description})]},`${_.name}:${_.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:r||a,onClick:()=>f("skill"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加技能"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(gw,{title:"结构拓扑",count:v7(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(nu,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:S(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(ehe,{agentName:t.name,tools:l,selectedNames:y.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(the,{appName:e,agentName:t.name,selectedNames:x.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&wi.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":"全屏 Agent 执行画布",children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Agent 执行画布"}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":"关闭全屏画布",title:"关闭",onClick:b,autoFocus:!0,children:o.jsx(Oi,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:S(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function sLe(){}function CM(e){const t=[],n=String(e||"");let s=n.indexOf(","),i=0,r=!1;for(;!r;){s===-1&&(s=n.length,r=!0);const a=n.slice(i,s).trim();(a||!r)&&t.push(a),i=s+1,s=n.indexOf(",",i)}return t}function N7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ahe=/[$_\p{ID_Start}]/u,ohe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,lhe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,che=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uhe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T7={};function iLe(e){return e?ahe.test(String.fromCodePoint(e)):!1}function rLe(e,t){const s=(t||T7).jsx?lhe:ohe;return e?s.test(String.fromCodePoint(e)):!1}function IM(e,t){return(T7.jsx?uhe:che).test(e)}const dhe=/[ \t\n\f\r]/g;function fhe(e){return typeof e=="object"?e.type==="text"?jM(e.value):!1:jM(e)}function jM(e){return e.replace(dhe,"")===""}let Ig=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};Ig.prototype.normal={};Ig.prototype.property={};Ig.prototype.space=void 0;function k7(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new Ig(n,s,t)}function Gm(e){return e.toLowerCase()}class Er{constructor(t,n){this.attribute=n,this.property=t}}Er.prototype.attribute="";Er.prototype.booleanish=!1;Er.prototype.boolean=!1;Er.prototype.commaOrSpaceSeparated=!1;Er.prototype.commaSeparated=!1;Er.prototype.defined=!1;Er.prototype.mustUseProperty=!1;Er.prototype.number=!1;Er.prototype.overloadedBoolean=!1;Er.prototype.property="";Er.prototype.spaceSeparated=!1;Er.prototype.space=void 0;let hhe=0;const Mt=Mu(),Zs=Mu(),hN=Mu(),De=Mu(),$n=Mu(),rf=Mu(),Tr=Mu();function Mu(){return 2**++hhe}const pN=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mt,booleanish:Zs,commaOrSpaceSeparated:Tr,commaSeparated:rf,number:De,overloadedBoolean:hN,spaceSeparated:$n},Symbol.toStringTag,{value:"Module"})),bw=Object.keys(pN);class $2 extends Er{constructor(t,n,s,i){let r=-1;if(super(t,n),RM(this,"space",i),typeof s=="number")for(;++r4&&n.slice(0,4)==="data"&&yhe.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(OM,Ehe);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!OM.test(r)){let a=r.replace(bhe,xhe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=$2}return new i(s,t)}function xhe(e){return"-"+e.toLowerCase()}function Ehe(e){return e.charAt(1).toUpperCase()}const jg=k7([A7,phe,j7,R7,O7],"html"),xc=k7([A7,mhe,j7,R7,O7],"svg");function MM(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function M7(e){return e.join(" ").trim()}var H2={},LM=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,vhe=/\n/g,whe=/^\s*/,_he=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,She=/^:\s*/,Nhe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,The=/^[;\s]*/,khe=/^\s+|\s+$/g,Ahe=` -`,DM="/",PM="*",zc="",Che="comment",Ihe="declaration";function jhe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function i(m){var b=m.match(vhe);b&&(n+=b.length);var v=m.lastIndexOf(Ahe);s=~v?m.length-v:s+m.length}function r(){var m={line:n,column:s};return function(b){return b.position=new a(m),u(),b}}function a(m){this.start=m,this.end={line:n,column:s},this.source=t.source}a.prototype.content=e;function l(m){var b=new Error(t.source+":"+n+":"+s+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(m){var b=m.exec(e);if(b){var v=b[0];return i(v),e=e.slice(v.length),b}}function u(){c(whe)}function d(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=r();if(!(DM!=e.charAt(0)||PM!=e.charAt(1))){for(var b=2;zc!=e.charAt(b)&&(PM!=e.charAt(b)||DM!=e.charAt(b+1));)++b;if(b+=2,zc===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return s+=2,i(v),e=e.slice(b),s+=2,m({type:Che,comment:v})}}function h(){var m=r(),b=c(_he);if(b){if(f(),!c(She))return l("property missing ':'");var v=c(Nhe),y=m({type:Ihe,property:BM(b[0].replace(LM,zc)),value:v?BM(v[0].replace(LM,zc)):zc});return c(The),y}}function p(){var m=[];d(m);for(var b;b=h();)b!==!1&&(m.push(b),d(m));return m}return u(),p()}function BM(e){return e?e.replace(khe,zc):zc}var Rhe=jhe,Ohe=Bl&&Bl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H2,"__esModule",{value:!0});H2.default=Lhe;const Mhe=Ohe(Rhe);function Lhe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Mhe.default)(e),i=typeof t=="function";return s.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;i?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.camelCase=void 0;var Dhe=/^--[a-zA-Z0-9_-]+$/,Phe=/-([a-z])/g,Bhe=/^[^-]+$/,Uhe=/^-(webkit|moz|ms|o|khtml)-/,Fhe=/^-(ms)-/,$he=function(e){return!e||Bhe.test(e)||Dhe.test(e)},Hhe=function(e,t){return t.toUpperCase()},UM=function(e,t){return"".concat(t,"-")},zhe=function(e,t){return t===void 0&&(t={}),$he(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Fhe,UM):e=e.replace(Uhe,UM),e.replace(Phe,Hhe))};Kx.camelCase=zhe;var Vhe=Bl&&Bl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Ghe=Vhe(H2),Khe=Kx;function mN(e,t){var n={};return!e||typeof e!="string"||(0,Ghe.default)(e,function(s,i){s&&i&&(n[(0,Khe.camelCase)(s,t)]=i)}),n}mN.default=mN;var qhe=mN;const Yhe=Gf(qhe),qx=L7("end"),yo=L7("start");function L7(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Whe(e){const t=yo(e),n=qx(e);if(t&&n)return{start:t,end:n}}function Zp(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?FM(e.position):"start"in e||"end"in e?FM(e):"line"in e||"column"in e?gN(e):""}function gN(e){return $M(e&&e.line)+":"+$M(e&&e.column)}function FM(e){return gN(e&&e.start)+"-"+gN(e&&e.end)}function $M(e){return e&&typeof e=="number"?e:1}class $i extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",r={},a=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof t=="string"?i=t:!r.cause&&t&&(a=!0,i=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?r.ruleId=s:(r.source=s.slice(0,c),r.ruleId=s.slice(c+1))}if(!r.place&&r.ancestors&&r.ancestors){const c=r.ancestors[r.ancestors.length-1];c&&(r.place=c.position)}const l=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Zp(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=a&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$i.prototype.file="";$i.prototype.name="";$i.prototype.reason="";$i.prototype.message="";$i.prototype.stack="";$i.prototype.column=void 0;$i.prototype.line=void 0;$i.prototype.ancestors=void 0;$i.prototype.cause=void 0;$i.prototype.fatal=void 0;$i.prototype.place=void 0;$i.prototype.ruleId=void 0;$i.prototype.source=void 0;const z2={}.hasOwnProperty,Xhe=new Map,Qhe=/[A-Z]/g,Zhe=new Set(["table","tbody","thead","tfoot","tr"]),Jhe=new Set(["td","th"]),D7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function epe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=lpe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=ope(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?xc:jg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=P7(i,e,void 0);return r&&typeof r!="string"?r:i.create(e,i.Fragment,{children:r||void 0},void 0)}function P7(e,t,n){if(t.type==="element")return tpe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return npe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ipe(e,t,n);if(t.type==="mdxjsEsm")return spe(e,t);if(t.type==="root")return rpe(e,t,n);if(t.type==="text")return ape(e,t)}function tpe(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=xc,e.schema=i),e.ancestors.push(t);const r=U7(e,t.tagName,!1),a=cpe(e,t);let l=G2(e,t);return Zhe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!fhe(c):!0})),B7(e,a,r,t),V2(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function npe(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Km(e,t.position)}function spe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Km(e,t.position)}function ipe(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=xc,e.schema=i),e.ancestors.push(t);const r=t.name===null?e.Fragment:U7(e,t.name,!0),a=upe(e,t),l=G2(e,t);return B7(e,a,r,t),V2(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function rpe(e,t,n){const s={};return V2(s,G2(e,t)),e.create(t,e.Fragment,s,n)}function ape(e,t){return t.value}function B7(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function V2(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ope(e,t,n){return s;function s(i,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function lpe(e,t){return n;function n(s,i,r,a){const l=Array.isArray(r.children),c=yo(s);return t(i,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function cpe(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&z2.call(t.properties,i)){const r=dpe(e,i,t.properties[i]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Jhe.has(t.tagName)?s=l:n[a]=l}}if(s){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function upe(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const r=s.data.estree.body[0];r.type;const a=r.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Km(e,t.position);else{const i=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Km(e,t.position);else r=s.value===null?!0:s.value;n[i]=r}return n}function G2(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:Xhe;for(;++si?0:i+t:t=t>i?i:t,n=n>0?n:0,s.length<1e4)a=Array.from(s),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Ur(e,e.length,0,t),e):t}const VM={}.hasOwnProperty;function $7(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ba(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qi=Ec(/[A-Za-z]/),Ui=Ec(/[\dA-Za-z]/),Epe=Ec(/[#-'*+\--9=?A-Z^-~]/);function S1(e){return e!==null&&(e<32||e===127)}const bN=Ec(/\d/),vpe=Ec(/[\dA-Fa-f]/),wpe=Ec(/[!-/:-@[-`{-~]/);function pt(e){return e!==null&&e<-2}function Fn(e){return e!==null&&(e<0||e===32)}function Kt(e){return e===-2||e===-1||e===32}const Yx=Ec(new RegExp("\\p{P}|\\p{S}","u")),wu=Ec(/\s/);function Ec(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function uh(e){const t=[];let n=-1,s=0,i=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),i=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(s,n),encodeURIComponent(a)),s=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function nn(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return Kt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Kt(c)&&r++a))return;const T=t.events.length;let k=T,A,j;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(A){j=t.events[k][1].end;break}A=!0}for(y(s),_=T;_E;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=E}function x(){i.write([null]),r=void 0,i=void 0,t.containerState._closeFlow=void 0}}function kpe(e,t,n){return nn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pf(e){if(e===null||Fn(e)||wu(e))return 1;if(Yx(e))return 2}function Wx(e,t,n){const s=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[s][1].end},h={...e[n][1].start};KM(f,-c),KM(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[s][1].end={...a.start},e[n][1].start={...l.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=ta(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=ta(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=ta(u,Wx(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=ta(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ta(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ur(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n0&&Kt(_)?nn(e,x,"linePrefix",r+1)(_):x(_)}function x(_){return _===null||pt(_)?e.check(qM,b,w)(_):(e.enter("codeFlowValue"),E(_))}function E(_){return _===null||pt(_)?(e.exit("codeFlowValue"),x(_)):(e.consume(_),E)}function w(_){return e.exit("codeFenced"),t(_)}function S(_,T,k){let A=0;return j;function j(F){return _.enter("lineEnding"),_.consume(F),_.exit("lineEnding"),R}function R(F){return _.enter("codeFencedFence"),Kt(F)?nn(_,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):B(F)}function B(F){return F===l?(_.enter("codeFencedFenceSequence"),z(F)):k(F)}function z(F){return F===l?(A++,_.consume(F),z):A>=a?(_.exit("codeFencedFenceSequence"),Kt(F)?nn(_,L,"whitespace")(F):L(F)):k(F)}function L(F){return F===null||pt(F)?(_.exit("codeFencedFence"),T(F)):k(F)}}}function Upe(e,t,n){const s=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}const xw={name:"codeIndented",tokenize:$pe},Fpe={partial:!0,tokenize:Hpe};function $pe(e,t,n){const s=this;return i;function i(u){return e.enter("codeIndented"),nn(e,r,"linePrefix",5)(u)}function r(u){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):pt(u)?e.attempt(Fpe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||pt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function Hpe(e,t,n){const s=this;return i;function i(a){return s.parser.lazy[s.now().line]?n(a):pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):nn(e,r,"linePrefix",5)(a)}function r(a){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):pt(a)?i(a):n(a)}}const zpe={name:"codeText",previous:Gpe,resolve:Vpe,tokenize:Kpe};function Vpe(e){let t=e.length-4,n=3,s,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const i=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&Zh(this.left,s),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Zh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Zh(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(s.parser.constructs.flow,n,t)(a)}}function q7(e,t,n,s,i,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(s),e.enter(i),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||S1(y)?n(y):(e.enter(s),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(i),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||pt(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||Fn(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(s),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(r),e.enter(i),e.consume(p),e.exit(i),e.exit(s),t):pt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||pt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Kt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function W7(e,t,n,s,i,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(s),t):(e.enter(r),u(h))}function u(h){return h===a?(e.exit(r),c(a)):h===null?n(h):pt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),nn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||pt(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Jp(e,t){let n;return s;function s(i){return pt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):Kt(i)?nn(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const eme={name:"definition",tokenize:nme},tme={partial:!0,tokenize:sme};function nme(e,t,n){const s=this;let i;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return Y7.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Ba(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Fn(p)?Jp(e,u)(p):u(p)}function u(p){return q7(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(tme,f,f)(p)}function f(p){return Kt(p)?nn(e,h,"whitespace")(p):h(p)}function h(p){return p===null||pt(p)?(e.exit("definition"),s.parser.defined.push(i),t(p)):n(p)}}function sme(e,t,n){return s;function s(l){return Fn(l)?Jp(e,i)(l):n(l)}function i(l){return W7(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return Kt(l)?nn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||pt(l)?t(l):n(l)}}const ime={name:"hardBreakEscape",tokenize:rme};function rme(e,t,n){return s;function s(r){return e.enter("hardBreakEscape"),e.consume(r),i}function i(r){return pt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const ame={name:"headingAtx",resolve:ome,tokenize:lme};function ome(e,t){let n=e.length-2,s=3,i,r;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},r={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Ur(e,s,n-s+1,[["enter",i,t],["enter",r,t],["exit",r,t],["exit",i,t]])),e}function lme(e,t,n){let s=0;return i;function i(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&s++<6?(e.consume(d),a):d===null||Fn(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||pt(d)?(e.exit("atxHeading"),t(d)):Kt(d)?nn(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Fn(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const cme=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],WM=["pre","script","style","textarea"],ume={concrete:!0,name:"htmlFlow",resolveTo:hme,tokenize:pme},dme={partial:!0,tokenize:gme},fme={partial:!0,tokenize:mme};function hme(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function pme(e,t,n){const s=this;let i,r,a,l,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),r=!0,b):P===63?(e.consume(P),i=3,s.interrupt?t:O):Qi(P)?(e.consume(P),a=String.fromCharCode(P),v):n(P)}function h(P){return P===45?(e.consume(P),i=2,p):P===91?(e.consume(P),i=5,l=0,m):Qi(P)?(e.consume(P),i=4,s.interrupt?t:O):n(P)}function p(P){return P===45?(e.consume(P),s.interrupt?t:O):n(P)}function m(P){const Q="CDATA[";return P===Q.charCodeAt(l++)?(e.consume(P),l===Q.length?s.interrupt?t:B:m):n(P)}function b(P){return Qi(P)?(e.consume(P),a=String.fromCharCode(P),v):n(P)}function v(P){if(P===null||P===47||P===62||Fn(P)){const Q=P===47,ee=a.toLowerCase();return!Q&&!r&&WM.includes(ee)?(i=1,s.interrupt?t(P):B(P)):cme.includes(a.toLowerCase())?(i=6,Q?(e.consume(P),y):s.interrupt?t(P):B(P)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(P):r?x(P):E(P))}return P===45||Ui(P)?(e.consume(P),a+=String.fromCharCode(P),v):n(P)}function y(P){return P===62?(e.consume(P),s.interrupt?t:B):n(P)}function x(P){return Kt(P)?(e.consume(P),x):j(P)}function E(P){return P===47?(e.consume(P),j):P===58||P===95||Qi(P)?(e.consume(P),w):Kt(P)?(e.consume(P),E):j(P)}function w(P){return P===45||P===46||P===58||P===95||Ui(P)?(e.consume(P),w):S(P)}function S(P){return P===61?(e.consume(P),_):Kt(P)?(e.consume(P),S):E(P)}function _(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,T):Kt(P)?(e.consume(P),_):k(P)}function T(P){return P===c?(e.consume(P),c=null,A):P===null||pt(P)?n(P):(e.consume(P),T)}function k(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Fn(P)?S(P):(e.consume(P),k)}function A(P){return P===47||P===62||Kt(P)?E(P):n(P)}function j(P){return P===62?(e.consume(P),R):n(P)}function R(P){return P===null||pt(P)?B(P):Kt(P)?(e.consume(P),R):n(P)}function B(P){return P===45&&i===2?(e.consume(P),C):P===60&&i===1?(e.consume(P),I):P===62&&i===4?(e.consume(P),te):P===63&&i===3?(e.consume(P),O):P===93&&i===5?(e.consume(P),$):pt(P)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(dme,se,z)(P)):P===null||pt(P)?(e.exit("htmlFlowData"),z(P)):(e.consume(P),B)}function z(P){return e.check(fme,L,se)(P)}function L(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),F}function F(P){return P===null||pt(P)?z(P):(e.enter("htmlFlowData"),B(P))}function C(P){return P===45?(e.consume(P),O):B(P)}function I(P){return P===47?(e.consume(P),a="",D):B(P)}function D(P){if(P===62){const Q=a.toLowerCase();return WM.includes(Q)?(e.consume(P),te):B(P)}return Qi(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),D):B(P)}function $(P){return P===93?(e.consume(P),O):B(P)}function O(P){return P===62?(e.consume(P),te):P===45&&i===2?(e.consume(P),O):B(P)}function te(P){return P===null||pt(P)?(e.exit("htmlFlowData"),se(P)):(e.consume(P),te)}function se(P){return e.exit("htmlFlow"),t(P)}}function mme(e,t,n){const s=this;return i;function i(a){return pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}function gme(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Rg,t,n)}}const bme={name:"htmlText",tokenize:yme};function yme(e,t,n){const s=this;let i,r,a;return l;function l(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),c}function c(O){return O===33?(e.consume(O),u):O===47?(e.consume(O),S):O===63?(e.consume(O),E):Qi(O)?(e.consume(O),k):n(O)}function u(O){return O===45?(e.consume(O),d):O===91?(e.consume(O),r=0,m):Qi(O)?(e.consume(O),x):n(O)}function d(O){return O===45?(e.consume(O),p):n(O)}function f(O){return O===null?n(O):O===45?(e.consume(O),h):pt(O)?(a=f,I(O)):(e.consume(O),f)}function h(O){return O===45?(e.consume(O),p):f(O)}function p(O){return O===62?C(O):O===45?h(O):f(O)}function m(O){const te="CDATA[";return O===te.charCodeAt(r++)?(e.consume(O),r===te.length?b:m):n(O)}function b(O){return O===null?n(O):O===93?(e.consume(O),v):pt(O)?(a=b,I(O)):(e.consume(O),b)}function v(O){return O===93?(e.consume(O),y):b(O)}function y(O){return O===62?C(O):O===93?(e.consume(O),y):b(O)}function x(O){return O===null||O===62?C(O):pt(O)?(a=x,I(O)):(e.consume(O),x)}function E(O){return O===null?n(O):O===63?(e.consume(O),w):pt(O)?(a=E,I(O)):(e.consume(O),E)}function w(O){return O===62?C(O):E(O)}function S(O){return Qi(O)?(e.consume(O),_):n(O)}function _(O){return O===45||Ui(O)?(e.consume(O),_):T(O)}function T(O){return pt(O)?(a=T,I(O)):Kt(O)?(e.consume(O),T):C(O)}function k(O){return O===45||Ui(O)?(e.consume(O),k):O===47||O===62||Fn(O)?A(O):n(O)}function A(O){return O===47?(e.consume(O),C):O===58||O===95||Qi(O)?(e.consume(O),j):pt(O)?(a=A,I(O)):Kt(O)?(e.consume(O),A):C(O)}function j(O){return O===45||O===46||O===58||O===95||Ui(O)?(e.consume(O),j):R(O)}function R(O){return O===61?(e.consume(O),B):pt(O)?(a=R,I(O)):Kt(O)?(e.consume(O),R):A(O)}function B(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),i=O,z):pt(O)?(a=B,I(O)):Kt(O)?(e.consume(O),B):(e.consume(O),L)}function z(O){return O===i?(e.consume(O),i=void 0,F):O===null?n(O):pt(O)?(a=z,I(O)):(e.consume(O),z)}function L(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||Fn(O)?A(O):(e.consume(O),L)}function F(O){return O===47||O===62||Fn(O)?A(O):n(O)}function C(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function I(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),D}function D(O){return Kt(O)?nn(e,$,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):$(O)}function $(O){return e.enter("htmlTextData"),a(O)}}const Y2={name:"labelEnd",resolveAll:wme,resolveTo:_me,tokenize:Sme},xme={tokenize:Nme},Eme={tokenize:Tme},vme={tokenize:kme};function wme(e){let t=-1;const n=[];for(;++t=3&&(u===null||pt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Kt(u)?nn(e,l,"whitespace")(u):l(u))}}const ur={continuation:{tokenize:Pme},exit:Ume,name:"list",tokenize:Dme},Mme={partial:!0,tokenize:Fme},Lme={partial:!0,tokenize:Bme};function Dme(e,t,n){const s=this,i=s.events[s.events.length-1];let r=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(p){const m=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:bN(p)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ay,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return bN(p)&&++a<10?(e.consume(p),c):(!s.interrupt||a<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check(Rg,s.interrupt?n:d,e.attempt(Mme,h,f))}function d(p){return s.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return Kt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=r+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Pme(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Rg,i,r);function i(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,nn(e,t,"listItemIndent",s.containerState.size+1)(l)}function r(l){return s.containerState.furtherBlankLines||!Kt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,a(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Lme,t,a)(l))}function a(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,nn(e,e.attempt(ur,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Bme(e,t,n){const s=this;return nn(e,i,"listItemIndent",s.containerState.size+1);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===s.containerState.size?t(r):n(r)}}function Ume(e){e.exit(this.containerState.type)}function Fme(e,t,n){const s=this;return nn(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(r){const a=s.events[s.events.length-1];return!Kt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const XM={name:"setextUnderline",resolveTo:$me,tokenize:Hme};function $me(e,t){let n=e.length,s,i,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!r&&e[n][1].type==="definition"&&(r=n);const a={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",r?(e.splice(i,0,["enter",a,t]),e.splice(r+1,0,["exit",e[s][1],t]),e[s][1].end={...e[r][1].end}):e[s][1]=a,e.push(["exit",a,t]),e}function Hme(e,t,n){const s=this;let i;return r;function r(u){let d=s.events.length,f;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){f=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Kt(u)?nn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||pt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const zme={tokenize:Vme};function Vme(e){const t=this,n=e.attempt(Rg,s,e.attempt(this.parser.constructs.flowInitial,i,nn(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Wpe,i)),"linePrefix")));return n;function s(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Gme={resolveAll:Q7()},Kme=X7("string"),qme=X7("text");function X7(e){return{resolveAll:Q7(e==="text"?Yme:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],r=n.attempt(i,a,l);return a;function a(d){return u(d)?r(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),r(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(s):a.shift()}r>0&&a.push(e[i].slice(0,r))}return a}function oge(e,t){let n=-1;const s=[];let i;for(;++n0?`?${r.join("&")}`:"";return Cg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function Qfe(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function Zfe(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function TM({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const Jfe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function fN(e){const t=Mu.find(n=>n.id===e||n.toolNames.includes(e));return Jfe[e]??(t==null?void 0:t.label)??e}function kM(e){const t=Mu.find(s=>s.id===e||s.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function ehe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function the(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function AM(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function E7({title:e,description:t,icon:n,wide:s=!1,onClose:i,children:r}){const a=g.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return g.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&i()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[i]),wi.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:i}),o.jsxs("section",{className:`session-capability-dialog${s?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[o.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&o.jsx("span",{className:"session-capability-dialog-mark",children:n}),o.jsxs("div",{children:[o.jsx("h2",{id:a.current,children:e}),o.jsx("p",{children:t})]}),o.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:i,children:o.jsx(ehe,{})})]}),r]})]}),document.body)}function ry({value:e,placeholder:t,label:n,onChange:s,autoFocus:i=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(the,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:i,onChange:r=>s(r.target.value)})]})}function nhe({agentName:e,tools:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState(""),[c,u]=g.useState(""),d=g.useMemo(()=>new Set(n),[n]),f=g.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${fN(m)} ${m} ${kM(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await i({kind:"tool",name:p});u(""),m&&r()};return o.jsx(E7,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(TM,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(ry,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:l,autoFocus:!0}),o.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),b=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(TM,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:fN(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:kM(p)})]}),o.jsx("button",{type:"button",disabled:m||s||!!c,onClick:()=>void h(p),children:m?"已添加":b?"添加中…":"添加"})]},p)})})]})})}function she({appName:e,agentName:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState("public"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(0),[m,b]=g.useState(!0),[v,y]=g.useState(""),[x,E]=g.useState([]),[w,S]=g.useState(null),[_,T]=g.useState([]),[k,A]=g.useState(""),[j,R]=g.useState(""),[B,z]=g.useState(!0),[L,F]=g.useState(!1),[C,I]=g.useState(""),[D,$]=g.useState(""),O=g.useMemo(()=>new Set(n),[n]);g.useEffect(()=>{if(a!=="public")return;let te=!0;const V=window.setTimeout(()=>{b(!0),y(""),E8(e,c.trim()).then(Q=>{te&&(f(Q.items),p(Q.totalCount))}).catch(Q=>{te&&(f([]),p(0),y(Q instanceof Error?Q.message:"搜索 Skill Hub 失败"))}).finally(()=>{te&&b(!1)})},250);return()=>{te=!1,window.clearTimeout(V)}},[e,c,a]),g.useEffect(()=>{if(a!=="agentkit")return;let te=!0;return z(!0),I(""),y7().then(V=>{te&&(E(V),S(V[0]??null))}).catch(V=>{te&&I(V instanceof Error?V.message:"读取 Skill Space 失败")}).finally(()=>{te&&z(!1)}),()=>{te=!1}},[a]),g.useEffect(()=>{if(a!=="agentkit")return;if(!w){T([]);return}let te=!0;return F(!0),I(""),x7(w.id,w.region).then(V=>{te&&T(V)}).catch(V=>{te&&I(V instanceof Error?V.message:"读取技能失败")}).finally(()=>{te&&F(!1)}),()=>{te=!1}},[w,a]);const ne=g.useMemo(()=>{const te=k.trim().toLowerCase();return te?x.filter(V=>`${V.name} ${V.id} ${V.description}`.toLowerCase().includes(te)):x},[k,x]),se=g.useMemo(()=>{const te=j.trim().toLowerCase();return te?_.filter(V=>`${V.skillName} ${V.skillDescription}`.toLowerCase().includes(te)):_},[j,_]),P=async te=>{if(!w)return;$(te.skillId);const V=await i({kind:"skill",name:te.skillName,skillSourceId:w.id,description:te.skillDescription,version:te.version});$(""),V&&r()},Z=async te=>{$(te.slug);const V=await i({kind:"skill",name:te.name,skillSourceId:`findskill:${te.slug}`,description:te.description,version:te.version||te.updatedAt});$(""),V&&r()};return o.jsx(E7,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:r,children:o.jsxs("div",{className:"session-skill-dialog-body",children:[o.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>l("public"),children:["Skill Hub",o.jsx("span",{children:"公域"})]}),o.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>l("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?o.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[o.jsxs("div",{className:"session-public-skill-head",children:[o.jsx(ry,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),o.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),o.jsx("div",{className:"session-public-skill-list",children:v?o.jsx("div",{className:"session-capability-error",children:v}):m?o.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(te=>{const V=O.has(te.name),Q=D===te.slug;return o.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:te.name}),o.jsx("span",{children:te.description||"暂无描述"}),o.jsxs("small",{children:[te.sourceRepo||te.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),te.downloadCount.toLocaleString()," 次下载",te.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),te.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:V||s||!!D,onClick:()=>void Z(te),children:V?"已添加":Q?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(AM,{}),"添加"]})})]},te.slug)})})]}):o.jsxs("div",{className:"session-skill-browser",children:[o.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Skill Space"}),o.jsx("span",{children:x.length})]}),o.jsx(ry,{value:k,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:A,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:B?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):ne.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):ne.map(te=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===te.id?" is-active":""}`,onClick:()=>{S(te),R("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:te.name||te.id}),o.jsx("small",{children:te.description||te.id}),o.jsxs("em",{children:[te.skillCount??0," 个技能"]})]})},`${te.projectName??"default"}:${te.id}`))})]}),o.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{title:w==null?void 0:w.name,children:(w==null?void 0:w.name)||"选择 Skill Space"}),o.jsx("span",{children:_.length})]}),o.jsx(ry,{value:j,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:R})]}),o.jsx("div",{className:"session-skill-pane-list",children:C?o.jsx("div",{className:"session-capability-error",children:C}):w?L?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):se.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):se.map(te=>{const V=O.has(te.skillName),Q=D===te.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:te.skillName}),o.jsx("span",{children:te.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",te.version||"—"]})]}),o.jsx("button",{type:"button",disabled:V||s||!!D,onClick:()=>void P(te),children:V?"已添加":Q?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(AM,{}),"添加"]})})]},`${te.skillId}:${te.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function Ba({as:e="span",className:t="",duration:n=4,spread:s=20,children:i,style:r,...a}){const l=Math.min(Math.max(s,5),45);return o.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...r,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...a,children:i})}function v7(e){return 1+e.children.reduce((t,n)=>t+v7(n),0)}function w7(e){return e.id||e.name}function ihe(e,t){const n=w7(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const s=/^agent_sub_(\d+)$/.exec(n);return s?`子 Agent ${s[1]}`:e.name||n}function _7(e,t=!0){return{...e,id:w7(e),name:ihe(e,t),children:e.children.map(n=>_7(n,!1))}}function S7(e){const t=Ii();return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:e.model,tools:e.tools??[],skills:(e.skills??[]).map(n=>n.name),subAgents:e.children.map(S7)}}function rhe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function ahe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function gw({title:e,count:t}){return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function ohe({appName:e,info:t,loading:n,variant:s="rail",capabilities:i=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=g.useState(null),[h,p]=g.useState(!1),m=g.useRef(null),b=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=m.current)==null?void 0:_.focus()})};if(g.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,T=k=>{k.key==="Escape"&&b()};return document.body.style.overflow="hidden",document.addEventListener("keydown",T),()=>{document.body.style.overflow=_,document.removeEventListener("keydown",T)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(Ba,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=_7(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),y=(i==null?void 0:i.tools)??rhe(t.tools).map(_=>({id:`base:tool:${_}`,kind:"tool",name:_,custom:!1})),x=(i==null?void 0:i.skills)??ahe(t.skills).map(_=>({id:`base:skill:${_.name}`,kind:"skill",name:_.name,description:_.description,custom:!1})),E=!!(i&&c&&u),w=S7(v),S=_=>o.jsx(zm,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[o.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&o.jsx("span",{title:t.model,children:t.model})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[o.jsx(gw,{title:"工具",count:y.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:y.length>0?o.jsx("div",{className:"topo-tool-list",children:y.map(_=>o.jsxs("div",{className:"topo-tool",title:_.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:fN(_.name)}),o.jsx("code",{children:_.name})]}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${_.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(_.id),children:"×"})]},_.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:r||a,onClick:()=>f("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加工具"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[o.jsx(gw,{title:"技能",count:t.skillsPreviewSupported?x.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?x.length>0?o.jsx("div",{className:"topo-skill-list",children:x.map(_=>o.jsxs("div",{className:"topo-skill",title:_.description||_.name,children:[o.jsxs("div",{className:"topo-skill-title",children:[o.jsx("span",{className:"topo-skill-name",children:_.name}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${_.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(_.id),children:"×"})]}),_.description&&o.jsx("span",{className:"topo-skill-description",children:_.description})]},`${_.name}:${_.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:r||a,onClick:()=>f("skill"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加技能"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(gw,{title:"结构拓扑",count:v7(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(su,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:S(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(nhe,{agentName:t.name,tools:l,selectedNames:y.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(she,{appName:e,agentName:t.name,selectedNames:x.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&wi.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":"全屏 Agent 执行画布",children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Agent 执行画布"}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":"关闭全屏画布",title:"关闭",onClick:b,autoFocus:!0,children:o.jsx(Mi,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:S(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function iLe(){}function CM(e){const t=[],n=String(e||"");let s=n.indexOf(","),i=0,r=!1;for(;!r;){s===-1&&(s=n.length,r=!0);const a=n.slice(i,s).trim();(a||!r)&&t.push(a),i=s+1,s=n.indexOf(",",i)}return t}function N7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const lhe=/[$_\p{ID_Start}]/u,che=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,uhe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,dhe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fhe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T7={};function rLe(e){return e?lhe.test(String.fromCodePoint(e)):!1}function aLe(e,t){const s=(t||T7).jsx?uhe:che;return e?s.test(String.fromCodePoint(e)):!1}function IM(e,t){return(T7.jsx?fhe:dhe).test(e)}const hhe=/[ \t\n\f\r]/g;function phe(e){return typeof e=="object"?e.type==="text"?jM(e.value):!1:jM(e)}function jM(e){return e.replace(hhe,"")===""}let Ig=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};Ig.prototype.normal={};Ig.prototype.property={};Ig.prototype.space=void 0;function k7(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new Ig(n,s,t)}function Gm(e){return e.toLowerCase()}class vr{constructor(t,n){this.attribute=n,this.property=t}}vr.prototype.attribute="";vr.prototype.booleanish=!1;vr.prototype.boolean=!1;vr.prototype.commaOrSpaceSeparated=!1;vr.prototype.commaSeparated=!1;vr.prototype.defined=!1;vr.prototype.mustUseProperty=!1;vr.prototype.number=!1;vr.prototype.overloadedBoolean=!1;vr.prototype.property="";vr.prototype.spaceSeparated=!1;vr.prototype.space=void 0;let mhe=0;const Dt=Lu(),Js=Lu(),hN=Lu(),Le=Lu(),Hn=Lu(),af=Lu(),kr=Lu();function Lu(){return 2**++mhe}const pN=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:Js,commaOrSpaceSeparated:kr,commaSeparated:af,number:Le,overloadedBoolean:hN,spaceSeparated:Hn},Symbol.toStringTag,{value:"Module"})),bw=Object.keys(pN);class $2 extends vr{constructor(t,n,s,i){let r=-1;if(super(t,n),RM(this,"space",i),typeof s=="number")for(;++r4&&n.slice(0,4)==="data"&&Ehe.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(OM,whe);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!OM.test(r)){let a=r.replace(xhe,vhe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=$2}return new i(s,t)}function vhe(e){return"-"+e.toLowerCase()}function whe(e){return e.charAt(1).toUpperCase()}const jg=k7([A7,ghe,j7,R7,O7],"html"),Ec=k7([A7,bhe,j7,R7,O7],"svg");function MM(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function M7(e){return e.join(" ").trim()}var H2={},LM=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,_he=/\n/g,She=/^\s*/,Nhe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,The=/^:\s*/,khe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ahe=/^[;\s]*/,Che=/^\s+|\s+$/g,Ihe=` +`,DM="/",PM="*",Vc="",jhe="comment",Rhe="declaration";function Ohe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function i(m){var b=m.match(_he);b&&(n+=b.length);var v=m.lastIndexOf(Ihe);s=~v?m.length-v:s+m.length}function r(){var m={line:n,column:s};return function(b){return b.position=new a(m),u(),b}}function a(m){this.start=m,this.end={line:n,column:s},this.source=t.source}a.prototype.content=e;function l(m){var b=new Error(t.source+":"+n+":"+s+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(m){var b=m.exec(e);if(b){var v=b[0];return i(v),e=e.slice(v.length),b}}function u(){c(She)}function d(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=r();if(!(DM!=e.charAt(0)||PM!=e.charAt(1))){for(var b=2;Vc!=e.charAt(b)&&(PM!=e.charAt(b)||DM!=e.charAt(b+1));)++b;if(b+=2,Vc===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return s+=2,i(v),e=e.slice(b),s+=2,m({type:jhe,comment:v})}}function h(){var m=r(),b=c(Nhe);if(b){if(f(),!c(The))return l("property missing ':'");var v=c(khe),y=m({type:Rhe,property:BM(b[0].replace(LM,Vc)),value:v?BM(v[0].replace(LM,Vc)):Vc});return c(Ahe),y}}function p(){var m=[];d(m);for(var b;b=h();)b!==!1&&(m.push(b),d(m));return m}return u(),p()}function BM(e){return e?e.replace(Che,Vc):Vc}var Mhe=Ohe,Lhe=Ul&&Ul.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H2,"__esModule",{value:!0});H2.default=Phe;const Dhe=Lhe(Mhe);function Phe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Dhe.default)(e),i=typeof t=="function";return s.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;i?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.camelCase=void 0;var Bhe=/^--[a-zA-Z0-9_-]+$/,Uhe=/-([a-z])/g,Fhe=/^[^-]+$/,$he=/^-(webkit|moz|ms|o|khtml)-/,Hhe=/^-(ms)-/,zhe=function(e){return!e||Fhe.test(e)||Bhe.test(e)},Vhe=function(e,t){return t.toUpperCase()},UM=function(e,t){return"".concat(t,"-")},Ghe=function(e,t){return t===void 0&&(t={}),zhe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Hhe,UM):e=e.replace($he,UM),e.replace(Uhe,Vhe))};Kx.camelCase=Ghe;var Khe=Ul&&Ul.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},qhe=Khe(H2),Yhe=Kx;function mN(e,t){var n={};return!e||typeof e!="string"||(0,qhe.default)(e,function(s,i){s&&i&&(n[(0,Yhe.camelCase)(s,t)]=i)}),n}mN.default=mN;var Whe=mN;const Xhe=Kf(Whe),qx=L7("end"),xo=L7("start");function L7(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Qhe(e){const t=xo(e),n=qx(e);if(t&&n)return{start:t,end:n}}function Zp(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?FM(e.position):"start"in e||"end"in e?FM(e):"line"in e||"column"in e?gN(e):""}function gN(e){return $M(e&&e.line)+":"+$M(e&&e.column)}function FM(e){return gN(e&&e.start)+"-"+gN(e&&e.end)}function $M(e){return e&&typeof e=="number"?e:1}class zi extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",r={},a=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof t=="string"?i=t:!r.cause&&t&&(a=!0,i=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?r.ruleId=s:(r.source=s.slice(0,c),r.ruleId=s.slice(c+1))}if(!r.place&&r.ancestors&&r.ancestors){const c=r.ancestors[r.ancestors.length-1];c&&(r.place=c.position)}const l=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Zp(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=a&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zi.prototype.file="";zi.prototype.name="";zi.prototype.reason="";zi.prototype.message="";zi.prototype.stack="";zi.prototype.column=void 0;zi.prototype.line=void 0;zi.prototype.ancestors=void 0;zi.prototype.cause=void 0;zi.prototype.fatal=void 0;zi.prototype.place=void 0;zi.prototype.ruleId=void 0;zi.prototype.source=void 0;const z2={}.hasOwnProperty,Zhe=new Map,Jhe=/[A-Z]/g,epe=new Set(["table","tbody","thead","tfoot","tr"]),tpe=new Set(["td","th"]),D7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function npe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=upe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=cpe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ec:jg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=P7(i,e,void 0);return r&&typeof r!="string"?r:i.create(e,i.Fragment,{children:r||void 0},void 0)}function P7(e,t,n){if(t.type==="element")return spe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ipe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ape(e,t,n);if(t.type==="mdxjsEsm")return rpe(e,t);if(t.type==="root")return ope(e,t,n);if(t.type==="text")return lpe(e,t)}function spe(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=Ec,e.schema=i),e.ancestors.push(t);const r=U7(e,t.tagName,!1),a=dpe(e,t);let l=G2(e,t);return epe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!phe(c):!0})),B7(e,a,r,t),V2(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function ipe(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Km(e,t.position)}function rpe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Km(e,t.position)}function ape(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=Ec,e.schema=i),e.ancestors.push(t);const r=t.name===null?e.Fragment:U7(e,t.name,!0),a=fpe(e,t),l=G2(e,t);return B7(e,a,r,t),V2(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function ope(e,t,n){const s={};return V2(s,G2(e,t)),e.create(t,e.Fragment,s,n)}function lpe(e,t){return t.value}function B7(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function V2(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function cpe(e,t,n){return s;function s(i,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function upe(e,t){return n;function n(s,i,r,a){const l=Array.isArray(r.children),c=xo(s);return t(i,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function dpe(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&z2.call(t.properties,i)){const r=hpe(e,i,t.properties[i]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&tpe.has(t.tagName)?s=l:n[a]=l}}if(s){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function fpe(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const r=s.data.estree.body[0];r.type;const a=r.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Km(e,t.position);else{const i=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Km(e,t.position);else r=s.value===null?!0:s.value;n[i]=r}return n}function G2(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:Zhe;for(;++si?0:i+t:t=t>i?i:t,n=n>0?n:0,s.length<1e4)a=Array.from(s),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Fr(e,e.length,0,t),e):t}const VM={}.hasOwnProperty;function $7(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ua(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const er=vc(/[A-Za-z]/),$i=vc(/[\dA-Za-z]/),wpe=vc(/[#-'*+\--9=?A-Z^-~]/);function S1(e){return e!==null&&(e<32||e===127)}const bN=vc(/\d/),_pe=vc(/[\dA-Fa-f]/),Spe=vc(/[!-/:-@[-`{-~]/);function pt(e){return e!==null&&e<-2}function Un(e){return e!==null&&(e<0||e===32)}function qt(e){return e===-2||e===-1||e===32}const Yx=vc(new RegExp("\\p{P}|\\p{S}","u")),_u=vc(/\s/);function vc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function dh(e){const t=[];let n=-1,s=0,i=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),i=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(s,n),encodeURIComponent(a)),s=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function sn(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return qt(c)?(e.enter(n),l(c)):t(c)}function l(c){return qt(c)&&r++a))return;const T=t.events.length;let k=T,A,j;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(A){j=t.events[k][1].end;break}A=!0}for(y(s),_=T;_E;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=E}function x(){i.write([null]),r=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Cpe(e,t,n){return sn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bf(e){if(e===null||Un(e)||_u(e))return 1;if(Yx(e))return 2}function Wx(e,t,n){const s=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[s][1].end},h={...e[n][1].start};KM(f,-c),KM(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[s][1].end={...a.start},e[n][1].start={...l.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=na(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=na(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=na(u,Wx(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=na(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=na(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Fr(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n0&&qt(_)?sn(e,x,"linePrefix",r+1)(_):x(_)}function x(_){return _===null||pt(_)?e.check(qM,b,w)(_):(e.enter("codeFlowValue"),E(_))}function E(_){return _===null||pt(_)?(e.exit("codeFlowValue"),x(_)):(e.consume(_),E)}function w(_){return e.exit("codeFenced"),t(_)}function S(_,T,k){let A=0;return j;function j(F){return _.enter("lineEnding"),_.consume(F),_.exit("lineEnding"),R}function R(F){return _.enter("codeFencedFence"),qt(F)?sn(_,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):B(F)}function B(F){return F===l?(_.enter("codeFencedFenceSequence"),z(F)):k(F)}function z(F){return F===l?(A++,_.consume(F),z):A>=a?(_.exit("codeFencedFenceSequence"),qt(F)?sn(_,L,"whitespace")(F):L(F)):k(F)}function L(F){return F===null||pt(F)?(_.exit("codeFencedFence"),T(F)):k(F)}}}function $pe(e,t,n){const s=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}const xw={name:"codeIndented",tokenize:zpe},Hpe={partial:!0,tokenize:Vpe};function zpe(e,t,n){const s=this;return i;function i(u){return e.enter("codeIndented"),sn(e,r,"linePrefix",5)(u)}function r(u){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):pt(u)?e.attempt(Hpe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||pt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function Vpe(e,t,n){const s=this;return i;function i(a){return s.parser.lazy[s.now().line]?n(a):pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):sn(e,r,"linePrefix",5)(a)}function r(a){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):pt(a)?i(a):n(a)}}const Gpe={name:"codeText",previous:qpe,resolve:Kpe,tokenize:Ype};function Kpe(e){let t=e.length-4,n=3,s,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const i=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&Zh(this.left,s),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Zh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Zh(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(s.parser.constructs.flow,n,t)(a)}}function q7(e,t,n,s,i,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(s),e.enter(i),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||S1(y)?n(y):(e.enter(s),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(i),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||pt(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||Un(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(s),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(r),e.enter(i),e.consume(p),e.exit(i),e.exit(s),t):pt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||pt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!qt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function W7(e,t,n,s,i,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(s),t):(e.enter(r),u(h))}function u(h){return h===a?(e.exit(r),c(a)):h===null?n(h):pt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),sn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||pt(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Jp(e,t){let n;return s;function s(i){return pt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):qt(i)?sn(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const nme={name:"definition",tokenize:ime},sme={partial:!0,tokenize:rme};function ime(e,t,n){const s=this;let i;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return Y7.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Ua(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Un(p)?Jp(e,u)(p):u(p)}function u(p){return q7(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(sme,f,f)(p)}function f(p){return qt(p)?sn(e,h,"whitespace")(p):h(p)}function h(p){return p===null||pt(p)?(e.exit("definition"),s.parser.defined.push(i),t(p)):n(p)}}function rme(e,t,n){return s;function s(l){return Un(l)?Jp(e,i)(l):n(l)}function i(l){return W7(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return qt(l)?sn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||pt(l)?t(l):n(l)}}const ame={name:"hardBreakEscape",tokenize:ome};function ome(e,t,n){return s;function s(r){return e.enter("hardBreakEscape"),e.consume(r),i}function i(r){return pt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const lme={name:"headingAtx",resolve:cme,tokenize:ume};function cme(e,t){let n=e.length-2,s=3,i,r;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},r={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Fr(e,s,n-s+1,[["enter",i,t],["enter",r,t],["exit",r,t],["exit",i,t]])),e}function ume(e,t,n){let s=0;return i;function i(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&s++<6?(e.consume(d),a):d===null||Un(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||pt(d)?(e.exit("atxHeading"),t(d)):qt(d)?sn(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Un(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const dme=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],WM=["pre","script","style","textarea"],fme={concrete:!0,name:"htmlFlow",resolveTo:mme,tokenize:gme},hme={partial:!0,tokenize:yme},pme={partial:!0,tokenize:bme};function mme(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function gme(e,t,n){const s=this;let i,r,a,l,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),r=!0,b):P===63?(e.consume(P),i=3,s.interrupt?t:O):er(P)?(e.consume(P),a=String.fromCharCode(P),v):n(P)}function h(P){return P===45?(e.consume(P),i=2,p):P===91?(e.consume(P),i=5,l=0,m):er(P)?(e.consume(P),i=4,s.interrupt?t:O):n(P)}function p(P){return P===45?(e.consume(P),s.interrupt?t:O):n(P)}function m(P){const Z="CDATA[";return P===Z.charCodeAt(l++)?(e.consume(P),l===Z.length?s.interrupt?t:B:m):n(P)}function b(P){return er(P)?(e.consume(P),a=String.fromCharCode(P),v):n(P)}function v(P){if(P===null||P===47||P===62||Un(P)){const Z=P===47,te=a.toLowerCase();return!Z&&!r&&WM.includes(te)?(i=1,s.interrupt?t(P):B(P)):dme.includes(a.toLowerCase())?(i=6,Z?(e.consume(P),y):s.interrupt?t(P):B(P)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(P):r?x(P):E(P))}return P===45||$i(P)?(e.consume(P),a+=String.fromCharCode(P),v):n(P)}function y(P){return P===62?(e.consume(P),s.interrupt?t:B):n(P)}function x(P){return qt(P)?(e.consume(P),x):j(P)}function E(P){return P===47?(e.consume(P),j):P===58||P===95||er(P)?(e.consume(P),w):qt(P)?(e.consume(P),E):j(P)}function w(P){return P===45||P===46||P===58||P===95||$i(P)?(e.consume(P),w):S(P)}function S(P){return P===61?(e.consume(P),_):qt(P)?(e.consume(P),S):E(P)}function _(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,T):qt(P)?(e.consume(P),_):k(P)}function T(P){return P===c?(e.consume(P),c=null,A):P===null||pt(P)?n(P):(e.consume(P),T)}function k(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Un(P)?S(P):(e.consume(P),k)}function A(P){return P===47||P===62||qt(P)?E(P):n(P)}function j(P){return P===62?(e.consume(P),R):n(P)}function R(P){return P===null||pt(P)?B(P):qt(P)?(e.consume(P),R):n(P)}function B(P){return P===45&&i===2?(e.consume(P),C):P===60&&i===1?(e.consume(P),I):P===62&&i===4?(e.consume(P),ne):P===63&&i===3?(e.consume(P),O):P===93&&i===5?(e.consume(P),$):pt(P)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(hme,se,z)(P)):P===null||pt(P)?(e.exit("htmlFlowData"),z(P)):(e.consume(P),B)}function z(P){return e.check(pme,L,se)(P)}function L(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),F}function F(P){return P===null||pt(P)?z(P):(e.enter("htmlFlowData"),B(P))}function C(P){return P===45?(e.consume(P),O):B(P)}function I(P){return P===47?(e.consume(P),a="",D):B(P)}function D(P){if(P===62){const Z=a.toLowerCase();return WM.includes(Z)?(e.consume(P),ne):B(P)}return er(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),D):B(P)}function $(P){return P===93?(e.consume(P),O):B(P)}function O(P){return P===62?(e.consume(P),ne):P===45&&i===2?(e.consume(P),O):B(P)}function ne(P){return P===null||pt(P)?(e.exit("htmlFlowData"),se(P)):(e.consume(P),ne)}function se(P){return e.exit("htmlFlow"),t(P)}}function bme(e,t,n){const s=this;return i;function i(a){return pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}function yme(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Rg,t,n)}}const xme={name:"htmlText",tokenize:Eme};function Eme(e,t,n){const s=this;let i,r,a;return l;function l(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),c}function c(O){return O===33?(e.consume(O),u):O===47?(e.consume(O),S):O===63?(e.consume(O),E):er(O)?(e.consume(O),k):n(O)}function u(O){return O===45?(e.consume(O),d):O===91?(e.consume(O),r=0,m):er(O)?(e.consume(O),x):n(O)}function d(O){return O===45?(e.consume(O),p):n(O)}function f(O){return O===null?n(O):O===45?(e.consume(O),h):pt(O)?(a=f,I(O)):(e.consume(O),f)}function h(O){return O===45?(e.consume(O),p):f(O)}function p(O){return O===62?C(O):O===45?h(O):f(O)}function m(O){const ne="CDATA[";return O===ne.charCodeAt(r++)?(e.consume(O),r===ne.length?b:m):n(O)}function b(O){return O===null?n(O):O===93?(e.consume(O),v):pt(O)?(a=b,I(O)):(e.consume(O),b)}function v(O){return O===93?(e.consume(O),y):b(O)}function y(O){return O===62?C(O):O===93?(e.consume(O),y):b(O)}function x(O){return O===null||O===62?C(O):pt(O)?(a=x,I(O)):(e.consume(O),x)}function E(O){return O===null?n(O):O===63?(e.consume(O),w):pt(O)?(a=E,I(O)):(e.consume(O),E)}function w(O){return O===62?C(O):E(O)}function S(O){return er(O)?(e.consume(O),_):n(O)}function _(O){return O===45||$i(O)?(e.consume(O),_):T(O)}function T(O){return pt(O)?(a=T,I(O)):qt(O)?(e.consume(O),T):C(O)}function k(O){return O===45||$i(O)?(e.consume(O),k):O===47||O===62||Un(O)?A(O):n(O)}function A(O){return O===47?(e.consume(O),C):O===58||O===95||er(O)?(e.consume(O),j):pt(O)?(a=A,I(O)):qt(O)?(e.consume(O),A):C(O)}function j(O){return O===45||O===46||O===58||O===95||$i(O)?(e.consume(O),j):R(O)}function R(O){return O===61?(e.consume(O),B):pt(O)?(a=R,I(O)):qt(O)?(e.consume(O),R):A(O)}function B(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),i=O,z):pt(O)?(a=B,I(O)):qt(O)?(e.consume(O),B):(e.consume(O),L)}function z(O){return O===i?(e.consume(O),i=void 0,F):O===null?n(O):pt(O)?(a=z,I(O)):(e.consume(O),z)}function L(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||Un(O)?A(O):(e.consume(O),L)}function F(O){return O===47||O===62||Un(O)?A(O):n(O)}function C(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function I(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),D}function D(O){return qt(O)?sn(e,$,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):$(O)}function $(O){return e.enter("htmlTextData"),a(O)}}const Y2={name:"labelEnd",resolveAll:Sme,resolveTo:Nme,tokenize:Tme},vme={tokenize:kme},wme={tokenize:Ame},_me={tokenize:Cme};function Sme(e){let t=-1;const n=[];for(;++t=3&&(u===null||pt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),qt(u)?sn(e,l,"whitespace")(u):l(u))}}const dr={continuation:{tokenize:Ume},exit:$me,name:"list",tokenize:Bme},Dme={partial:!0,tokenize:Hme},Pme={partial:!0,tokenize:Fme};function Bme(e,t,n){const s=this,i=s.events[s.events.length-1];let r=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(p){const m=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:bN(p)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ay,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return bN(p)&&++a<10?(e.consume(p),c):(!s.interrupt||a<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check(Rg,s.interrupt?n:d,e.attempt(Dme,h,f))}function d(p){return s.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return qt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=r+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Ume(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Rg,i,r);function i(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,sn(e,t,"listItemIndent",s.containerState.size+1)(l)}function r(l){return s.containerState.furtherBlankLines||!qt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,a(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Pme,t,a)(l))}function a(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,sn(e,e.attempt(dr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Fme(e,t,n){const s=this;return sn(e,i,"listItemIndent",s.containerState.size+1);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===s.containerState.size?t(r):n(r)}}function $me(e){e.exit(this.containerState.type)}function Hme(e,t,n){const s=this;return sn(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(r){const a=s.events[s.events.length-1];return!qt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const XM={name:"setextUnderline",resolveTo:zme,tokenize:Vme};function zme(e,t){let n=e.length,s,i,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!r&&e[n][1].type==="definition"&&(r=n);const a={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",r?(e.splice(i,0,["enter",a,t]),e.splice(r+1,0,["exit",e[s][1],t]),e[s][1].end={...e[r][1].end}):e[s][1]=a,e.push(["exit",a,t]),e}function Vme(e,t,n){const s=this;let i;return r;function r(u){let d=s.events.length,f;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){f=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),qt(u)?sn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||pt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Gme={tokenize:Kme};function Kme(e){const t=this,n=e.attempt(Rg,s,e.attempt(this.parser.constructs.flowInitial,i,sn(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Qpe,i)),"linePrefix")));return n;function s(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const qme={resolveAll:Q7()},Yme=X7("string"),Wme=X7("text");function X7(e){return{resolveAll:Q7(e==="text"?Xme:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],r=n.attempt(i,a,l);return a;function a(d){return u(d)?r(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),r(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(s):a.shift()}r>0&&a.push(e[i].slice(0,r))}return a}function cge(e,t){let n=-1;const s=[];let i;for(;++n0){const lt=Z.tokenStack[Z.tokenStack.length-1];(lt[1]||ZM).call(Z,void 0,lt[0])}for(oe.position={start:Sl(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Sl(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me0&&(s.className=["language-"+i[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r}function vge(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wge(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _ge(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=uh(s.toLowerCase()),r=e.footnoteOrder.indexOf(s);let a,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Sge(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nge(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function eF(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const i=e.all(t),r=i[0];r&&r.type==="text"?r.value="["+r.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=s:i.push({type:"text",value:s}),i}function Tge(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return eF(e,t);const i={src:uh(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function kge(e,t){const n={src:uh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Age(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function Cge(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return eF(e,t);const i={href:uh(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ige(e,t){const n={href:uh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function jge(e,t,n){const s=e.all(t),i=n?Rge(n):tF(t),r={},a=[];if(typeof t.checked=="boolean"){const d=s[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},s.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),r.className=["task-list-item"]}let l=-1;for(;++l0){const lt=J.tokenStack[J.tokenStack.length-1];(lt[1]||ZM).call(J,void 0,lt[0])}for(oe.position={start:Nl(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:Nl(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(s.className=["language-"+i[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r}function _ge(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Sge(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nge(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=dh(s.toLowerCase()),r=e.footnoteOrder.indexOf(s);let a,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Tge(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kge(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function eF(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const i=e.all(t),r=i[0];r&&r.type==="text"?r.value="["+r.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=s:i.push({type:"text",value:s}),i}function Age(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return eF(e,t);const i={src:dh(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function Cge(e,t){const n={src:dh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Ige(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function jge(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return eF(e,t);const i={href:dh(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Rge(e,t){const n={href:dh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Oge(e,t,n){const s=e.all(t),i=n?Mge(n):tF(t),r={},a=[];if(typeof t.checked=="boolean"){const d=s[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},s.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),r.className=["task-list-item"]}let l=-1;for(;++l1}function Oge(e,t){const n={},s=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=yo(t.children[1]),c=qx(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,r),e.applyData(t,r)}function Bge(e,t,n){const s=n?n.children:void 0,r=(s?s.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return r.push(tL(t.slice(i),i>0,!1)),r.join("")}function tL(e,t,n){let s=0,i=e.length;if(t){let r=e.codePointAt(s);for(;r===JM||r===eL;)s++,r=e.codePointAt(s)}if(n){let r=e.codePointAt(i-1);for(;r===JM||r===eL;)i--,r=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function $ge(e,t){const n={type:"text",value:Fge(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Hge(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const zge={blockquote:yge,break:xge,code:Ege,delete:vge,emphasis:wge,footnoteReference:_ge,heading:Sge,html:Nge,imageReference:Tge,image:kge,inlineCode:Age,linkReference:Cge,link:Ige,listItem:jge,list:Oge,paragraph:Mge,root:Lge,strong:Dge,table:Pge,tableCell:Uge,tableRow:Bge,text:$ge,thematicBreak:Hge,toml:nb,yaml:nb,definition:nb,footnoteDefinition:nb};function nb(){}const nF=-1,Xx=0,em=1,N1=2,W2=3,X2=4,Q2=5,Z2=6,sF=7,iF=8,Vge=typeof self=="object"?self:globalThis,nL=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Vge[e](t)},Gge=(e,t)=>{const n=(i,r)=>(e.set(r,i),i),s=i=>{if(e.has(i))return e.get(i);const[r,a]=t[i];switch(r){case Xx:case nF:return n(a,i);case em:{const l=n([],i);for(const c of a)l.push(s(c));return l}case N1:{const l=n({},i);for(const[c,u]of a)l[s(c)]=s(u);return l}case W2:return n(new Date(a),i);case X2:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case Q2:{const l=n(new Map,i);for(const[c,u]of a)l.set(s(c),s(u));return l}case Z2:{const l=n(new Set,i);for(const c of a)l.add(s(c));return l}case sF:{const{name:l,message:c}=a;return n(nL(l,c),i)}case iF:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(nL(r,a),i)};return s},sL=e=>Gge(new Map,e)(0),td="",{toString:Kge}={},{keys:qge}=Object,Jh=e=>{const t=typeof e;if(t!=="object"||!e)return[Xx,t];const n=Kge.call(e).slice(8,-1);switch(n){case"Array":return[em,td];case"Object":return[N1,td];case"Date":return[W2,td];case"RegExp":return[X2,td];case"Map":return[Q2,td];case"Set":return[Z2,td];case"DataView":return[em,n]}return n.includes("Array")?[em,n]:n.includes("Error")?[sF,n]:[N1,n]},sb=([e,t])=>e===Xx&&(t==="function"||t==="symbol"),Yge=(e,t,n,s)=>{const i=(a,l)=>{const c=s.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=Jh(a);switch(l){case Xx:{let d=a;switch(c){case"bigint":l=iF,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([nF],a)}return i([l,d],a)}case em:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(r(h));return f}case N1:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=i([l,d],a);for(const h of qge(a))(e||!sb(Jh(a[h])))&&d.push([r(h),r(a[h])]);return f}case W2:return i([l,a.toISOString()],a);case X2:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case Q2:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(sb(Jh(h))||sb(Jh(p))))&&d.push([r(h),r(p)]);return f}case Z2:{const d=[],f=i([l,d],a);for(const h of a)(e||!sb(Jh(h)))&&d.push(r(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return r},iL=(e,{json:t,lossy:n}={})=>{const s=[];return Yge(!(t||n),!!t,new Map,s)(e),s},Bf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?sL(iL(e,t)):structuredClone(e):(e,t)=>sL(iL(e,t));function Wge(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Xge(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Qge(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Wge,s=e.options.footnoteBackLabel||Xge,i=e.options.footnoteLabel||"Footnotes",r=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...Bf(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:r,children:a};return e.patch(t,u),e.applyData(t,u)}function Mge(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s1}function Lge(e,t){const n={},s=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=xo(t.children[1]),c=qx(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,r),e.applyData(t,r)}function Fge(e,t,n){const s=n?n.children:void 0,r=(s?s.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return r.push(tL(t.slice(i),i>0,!1)),r.join("")}function tL(e,t,n){let s=0,i=e.length;if(t){let r=e.codePointAt(s);for(;r===JM||r===eL;)s++,r=e.codePointAt(s)}if(n){let r=e.codePointAt(i-1);for(;r===JM||r===eL;)i--,r=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function zge(e,t){const n={type:"text",value:Hge(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Vge(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Gge={blockquote:Ege,break:vge,code:wge,delete:_ge,emphasis:Sge,footnoteReference:Nge,heading:Tge,html:kge,imageReference:Age,image:Cge,inlineCode:Ige,linkReference:jge,link:Rge,listItem:Oge,list:Lge,paragraph:Dge,root:Pge,strong:Bge,table:Uge,tableCell:$ge,tableRow:Fge,text:zge,thematicBreak:Vge,toml:nb,yaml:nb,definition:nb,footnoteDefinition:nb};function nb(){}const nF=-1,Xx=0,em=1,N1=2,W2=3,X2=4,Q2=5,Z2=6,sF=7,iF=8,Kge=typeof self=="object"?self:globalThis,nL=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Kge[e](t)},qge=(e,t)=>{const n=(i,r)=>(e.set(r,i),i),s=i=>{if(e.has(i))return e.get(i);const[r,a]=t[i];switch(r){case Xx:case nF:return n(a,i);case em:{const l=n([],i);for(const c of a)l.push(s(c));return l}case N1:{const l=n({},i);for(const[c,u]of a)l[s(c)]=s(u);return l}case W2:return n(new Date(a),i);case X2:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case Q2:{const l=n(new Map,i);for(const[c,u]of a)l.set(s(c),s(u));return l}case Z2:{const l=n(new Set,i);for(const c of a)l.add(s(c));return l}case sF:{const{name:l,message:c}=a;return n(nL(l,c),i)}case iF:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(nL(r,a),i)};return s},sL=e=>qge(new Map,e)(0),nd="",{toString:Yge}={},{keys:Wge}=Object,Jh=e=>{const t=typeof e;if(t!=="object"||!e)return[Xx,t];const n=Yge.call(e).slice(8,-1);switch(n){case"Array":return[em,nd];case"Object":return[N1,nd];case"Date":return[W2,nd];case"RegExp":return[X2,nd];case"Map":return[Q2,nd];case"Set":return[Z2,nd];case"DataView":return[em,n]}return n.includes("Array")?[em,n]:n.includes("Error")?[sF,n]:[N1,n]},sb=([e,t])=>e===Xx&&(t==="function"||t==="symbol"),Xge=(e,t,n,s)=>{const i=(a,l)=>{const c=s.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=Jh(a);switch(l){case Xx:{let d=a;switch(c){case"bigint":l=iF,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([nF],a)}return i([l,d],a)}case em:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(r(h));return f}case N1:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=i([l,d],a);for(const h of Wge(a))(e||!sb(Jh(a[h])))&&d.push([r(h),r(a[h])]);return f}case W2:return i([l,a.toISOString()],a);case X2:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case Q2:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(sb(Jh(h))||sb(Jh(p))))&&d.push([r(h),r(p)]);return f}case Z2:{const d=[],f=i([l,d],a);for(const h of a)(e||!sb(Jh(h)))&&d.push(r(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return r},iL=(e,{json:t,lossy:n}={})=>{const s=[];return Xge(!(t||n),!!t,new Map,s)(e),s},Uf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?sL(iL(e,t)):structuredClone(e):(e,t)=>sL(iL(e,t));function Qge(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Zge(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Jge(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Qge,s=e.options.footnoteBackLabel||Zge,i=e.options.footnoteLabel||"Footnotes",r=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...Uf(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const Og=function(e){if(e==null)return t0e;if(typeof e=="function")return Qx(e);if(typeof e=="object")return Array.isArray(e)?Zge(e):Jge(e);if(typeof e=="string")return e0e(e);throw new Error("Expected function, string, or object as test")};function Zge(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=rF,m,b,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=r0e(n(c,d)),p[0]===xN))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==i0e)for(b=(s?y.children.length:-1)+a,v=d.concat(y);b>-1&&b":""))+")"})}return h;function h(){let p=rF,m,b,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=o0e(n(c,d)),p[0]===xN))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==a0e)for(b=(s?y.children.length:-1)+a,v=d.concat(y);b>-1&&b0&&n.push({type:"text",value:` -`}),n}function rL(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function aL(e,t){const n=o0e(e,t),s=n.one(e,void 0),i=Qge(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&r.children.push({type:"text",value:` -`},i),r}function f0e(e,t){return e&&"run"in e?async function(n,s){const i=aL(n,{file:s,...t});await e.run(i,s)}:function(n,s){return aL(n,{file:s,...e||t})}}function oL(e){if(e)throw e}var oy=Object.prototype.hasOwnProperty,oF=Object.prototype.toString,lL=Object.defineProperty,cL=Object.getOwnPropertyDescriptor,uL=function(t){return typeof Array.isArray=="function"?Array.isArray(t):oF.call(t)==="[object Array]"},dL=function(t){if(!t||oF.call(t)!=="[object Object]")return!1;var n=oy.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&oy.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var i;for(i in t);return typeof i>"u"||oy.call(t,i)},fL=function(t,n){lL&&n.name==="__proto__"?lL(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},hL=function(t,n){if(n==="__proto__")if(oy.call(t,n)){if(cL)return cL(t,n).value}else return;return t[n]},h0e=function e(){var t,n,s,i,r,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,i):c instanceof Error?i(c):r(c))}function i(a,...l){n||(n=!0,t(a,...l))}function r(a){i(null,a)}}const to={basename:g0e,dirname:b0e,extname:y0e,join:x0e,sep:"/"};function g0e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lg(e);let n=0,s=-1,i=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else s<0&&(r=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(s=i):(l=-1,s=a));return n===s?s=a:s<0&&(s=e.length),e.slice(n,s)}function b0e(e){if(Lg(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function y0e(e){Lg(e);let t=e.length,n=-1,s=0,i=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){s=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:r!==1&&(r=1):i>-1&&(r=-1)}return i<0||n<0||r===0||r===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function x0e(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function v0e(e,t){let n="",s=0,i=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),i=a,r=0;continue}}else if(n.length>0){n="",s=0,i=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),s=a-i-1;i=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function Lg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const w0e={cwd:_0e};function _0e(){return"/"}function wN(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function S0e(e){if(typeof e=="string")e=new URL(e);else if(!wN(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return N0e(e)}function N0e(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const b=s[h][1];vN(b)&&vN(p)&&(p=vw(!0,b,p)),s[h]=[u,p,...m]}}}}const C0e=new J2().freeze();function Nw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Tw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kw(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mL(e){if(!vN(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function gL(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ib(e){return I0e(e)?e:new lF(e)}function I0e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function j0e(e){return typeof e=="string"||R0e(e)}function R0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const O0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bL=[],yL={allowDangerousHtml:!0},M0e=/^(https?|ircs?|mailto|xmpp)$/i,L0e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function D0e(e){const t=P0e(e),n=B0e(e);return U0e(t.runSync(t.parse(n),n),e)}function P0e(e){const t=e.rehypePlugins||bL,n=e.remarkPlugins||bL,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yL}:yL;return C0e().use(bge).use(n).use(f0e,s).use(t)}function B0e(e){const t=e.children||"",n=new lF;return typeof t=="string"&&(n.value=t),n}function U0e(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||F0e;for(const d of L0e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+O0e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Mg(e,u),epe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in yw)if(Object.hasOwn(yw,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],b=yw[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):r?r.includes(d.tagName):!1;if(!p&&s&&typeof f=="number"&&(p=!s(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function F0e(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||M0e.test(e.slice(0,t))?e:""}function xL(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,i=n.indexOf(t);for(;i!==-1;)s++,i=n.indexOf(t,i+t.length);return s}function $0e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function H0e(e,t,n){const i=Og((n||{}).ignore||[]),r=z0e(t);let a=-1;for(;++a0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=w+1:(m!==w&&x.push({type:"text",value:u.value.slice(m,w)}),Array.isArray(_)?x.push(..._):_&&x.push(_),m=w+E[0].length,y=!0),!h.global)break;E=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const i=xL(e,"(");let r=xL(e,")");for(;s!==-1&&i>r;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[e,n]}function cF(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wu(n)||Yx(n))&&(!t||n!==47)}uF.peek=fbe;function ibe(){this.buffer()}function rbe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function abe(){this.buffer()}function obe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function lbe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cbe(e){this.exit(e)}function ube(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function dbe(e){this.exit(e)}function fbe(){return"["}function uF(e,t,n,s){const i=n.createTracker(s);let r=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=i.move("]"),r}function hbe(){return{enter:{gfmFootnoteCallString:ibe,gfmFootnoteCall:rbe,gfmFootnoteDefinitionLabelString:abe,gfmFootnoteDefinition:obe},exit:{gfmFootnoteCallString:lbe,gfmFootnoteCall:cbe,gfmFootnoteDefinitionLabelString:ube,gfmFootnoteDefinition:dbe}}}function pbe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:uF},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,i,r,a){const l=r.createTracker(a);let c=l.move("[^");const u=r.enter("footnoteDefinition"),d=r.enter("label");return c+=l.move(r.safe(r.associationId(s),{before:c,after:"]"})),d(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+r.indentLines(r.containerFlow(s,l.current()),t?dF:mbe))),u(),c}}function mbe(e,t,n){return t===0?e:dF(e,t,n)}function dF(e,t,n){return(n?"":" ")+e}const gbe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fF.peek=vbe;function bbe(){return{canContainEols:["delete"],enter:{strikethrough:xbe},exit:{strikethrough:Ebe}}}function ybe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:gbe}],handlers:{delete:fF}}}function xbe(e){this.enter({type:"delete",children:[]},e)}function Ebe(e){this.exit(e)}function fF(e,t,n,s){const i=n.createTracker(s),r=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),r(),a}function vbe(){return"~"}function wbe(e){return e.length}function _be(e,t){const n=t||{},s=(n.align||[]).concat(),i=n.stringLength||wbe,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}b.push(x)}a[d]=b,l[d]=v}let f=-1;if(typeof s=="object"&&"length"in s)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=E}a.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d "),r.shift(2);const a=n.indentLines(n.containerFlow(e,r.current()),Tbe);return i(),a}function Tbe(e,t,n){return">"+(n?"":" ")+e}function kbe(e,t){return wL(e,t.inConstruct,!0)&&!wL(e,t.notInConstruct,!1)}function wL(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++sa&&(a=r):r=1,i=s+t.length,s=n.indexOf(t,i);return a}function Cbe(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Ibe(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function jbe(e,t,n,s){const i=Ibe(n),r=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Cbe(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,Rbe);return f(),h}const l=n.createTracker(s),c=i.repeat(Math.max(Abe(r,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` +`}),n}function rL(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function aL(e,t){const n=c0e(e,t),s=n.one(e,void 0),i=Jge(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&r.children.push({type:"text",value:` +`},i),r}function p0e(e,t){return e&&"run"in e?async function(n,s){const i=aL(n,{file:s,...t});await e.run(i,s)}:function(n,s){return aL(n,{file:s,...e||t})}}function oL(e){if(e)throw e}var oy=Object.prototype.hasOwnProperty,oF=Object.prototype.toString,lL=Object.defineProperty,cL=Object.getOwnPropertyDescriptor,uL=function(t){return typeof Array.isArray=="function"?Array.isArray(t):oF.call(t)==="[object Array]"},dL=function(t){if(!t||oF.call(t)!=="[object Object]")return!1;var n=oy.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&oy.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var i;for(i in t);return typeof i>"u"||oy.call(t,i)},fL=function(t,n){lL&&n.name==="__proto__"?lL(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},hL=function(t,n){if(n==="__proto__")if(oy.call(t,n)){if(cL)return cL(t,n).value}else return;return t[n]},m0e=function e(){var t,n,s,i,r,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,i):c instanceof Error?i(c):r(c))}function i(a,...l){n||(n=!0,t(a,...l))}function r(a){i(null,a)}}const no={basename:y0e,dirname:x0e,extname:E0e,join:v0e,sep:"/"};function y0e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lg(e);let n=0,s=-1,i=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else s<0&&(r=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(s=i):(l=-1,s=a));return n===s?s=a:s<0&&(s=e.length),e.slice(n,s)}function x0e(e){if(Lg(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function E0e(e){Lg(e);let t=e.length,n=-1,s=0,i=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){s=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:r!==1&&(r=1):i>-1&&(r=-1)}return i<0||n<0||r===0||r===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function v0e(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function _0e(e,t){let n="",s=0,i=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),i=a,r=0;continue}}else if(n.length>0){n="",s=0,i=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),s=a-i-1;i=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function Lg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const S0e={cwd:N0e};function N0e(){return"/"}function wN(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function T0e(e){if(typeof e=="string")e=new URL(e);else if(!wN(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return k0e(e)}function k0e(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const b=s[h][1];vN(b)&&vN(p)&&(p=vw(!0,b,p)),s[h]=[u,p,...m]}}}}const j0e=new J2().freeze();function Nw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Tw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kw(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mL(e){if(!vN(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function gL(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ib(e){return R0e(e)?e:new lF(e)}function R0e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function O0e(e){return typeof e=="string"||M0e(e)}function M0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const L0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bL=[],yL={allowDangerousHtml:!0},D0e=/^(https?|ircs?|mailto|xmpp)$/i,P0e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function B0e(e){const t=U0e(e),n=F0e(e);return $0e(t.runSync(t.parse(n),n),e)}function U0e(e){const t=e.rehypePlugins||bL,n=e.remarkPlugins||bL,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yL}:yL;return j0e().use(xge).use(n).use(p0e,s).use(t)}function F0e(e){const t=e.children||"",n=new lF;return typeof t=="string"&&(n.value=t),n}function $0e(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||H0e;for(const d of P0e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+L0e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Mg(e,u),npe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in yw)if(Object.hasOwn(yw,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],b=yw[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):r?r.includes(d.tagName):!1;if(!p&&s&&typeof f=="number"&&(p=!s(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function H0e(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||D0e.test(e.slice(0,t))?e:""}function xL(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,i=n.indexOf(t);for(;i!==-1;)s++,i=n.indexOf(t,i+t.length);return s}function z0e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function V0e(e,t,n){const i=Og((n||{}).ignore||[]),r=G0e(t);let a=-1;for(;++a0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=w+1:(m!==w&&x.push({type:"text",value:u.value.slice(m,w)}),Array.isArray(_)?x.push(..._):_&&x.push(_),m=w+E[0].length,y=!0),!h.global)break;E=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const i=xL(e,"(");let r=xL(e,")");for(;s!==-1&&i>r;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[e,n]}function cF(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||_u(n)||Yx(n))&&(!t||n!==47)}uF.peek=pbe;function abe(){this.buffer()}function obe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function lbe(){this.buffer()}function cbe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ube(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ua(this.sliceSerialize(e)).toLowerCase(),n.label=t}function dbe(e){this.exit(e)}function fbe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ua(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hbe(e){this.exit(e)}function pbe(){return"["}function uF(e,t,n,s){const i=n.createTracker(s);let r=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=i.move("]"),r}function mbe(){return{enter:{gfmFootnoteCallString:abe,gfmFootnoteCall:obe,gfmFootnoteDefinitionLabelString:lbe,gfmFootnoteDefinition:cbe},exit:{gfmFootnoteCallString:ube,gfmFootnoteCall:dbe,gfmFootnoteDefinitionLabelString:fbe,gfmFootnoteDefinition:hbe}}}function gbe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:uF},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,i,r,a){const l=r.createTracker(a);let c=l.move("[^");const u=r.enter("footnoteDefinition"),d=r.enter("label");return c+=l.move(r.safe(r.associationId(s),{before:c,after:"]"})),d(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+r.indentLines(r.containerFlow(s,l.current()),t?dF:bbe))),u(),c}}function bbe(e,t,n){return t===0?e:dF(e,t,n)}function dF(e,t,n){return(n?"":" ")+e}const ybe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fF.peek=_be;function xbe(){return{canContainEols:["delete"],enter:{strikethrough:vbe},exit:{strikethrough:wbe}}}function Ebe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ybe}],handlers:{delete:fF}}}function vbe(e){this.enter({type:"delete",children:[]},e)}function wbe(e){this.exit(e)}function fF(e,t,n,s){const i=n.createTracker(s),r=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),r(),a}function _be(){return"~"}function Sbe(e){return e.length}function Nbe(e,t){const n=t||{},s=(n.align||[]).concat(),i=n.stringLength||Sbe,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}b.push(x)}a[d]=b,l[d]=v}let f=-1;if(typeof s=="object"&&"length"in s)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=E}a.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d "),r.shift(2);const a=n.indentLines(n.containerFlow(e,r.current()),Abe);return i(),a}function Abe(e,t,n){return">"+(n?"":" ")+e}function Cbe(e,t){return wL(e,t.inConstruct,!0)&&!wL(e,t.notInConstruct,!1)}function wL(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++sa&&(a=r):r=1,i=s+t.length,s=n.indexOf(t,i);return a}function jbe(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Rbe(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Obe(e,t,n,s){const i=Rbe(n),r=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(jbe(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,Mbe);return f(),h}const l=n.createTracker(s),c=i.repeat(Math.max(Ibe(r,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...l.current()})),f()}return d+=l.move(` `),r&&(d+=l.move(r+` -`)),d+=l.move(c),u(),d}function Rbe(e,t,n){return(n?"":" ")+e}function eA(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Obe(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Mbe(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function qm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function T1(e,t,n){const s=Pf(e),i=Pf(t);return s===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}pF.peek=Lbe;function pF(e,t,n,s){const i=Mbe(n),r=n.enter("emphasis"),a=n.createTracker(s),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=T1(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=qm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=T1(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qm(f));const p=a.move(i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function Lbe(e,t,n){return n.options.emphasis||"*"}function Dbe(e,t){let n=!1;return Mg(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,xN}),!!((!e.depth||e.depth<3)&&K2(e)&&(t.options.setext||n))}function Pbe(e,t,n,s){const i=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(s);if(Dbe(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...r.current(),before:` +`)),d+=l.move(c),u(),d}function Mbe(e,t,n){return(n?"":" ")+e}function eA(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Lbe(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Dbe(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function qm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function T1(e,t,n){const s=Bf(e),i=Bf(t);return s===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}pF.peek=Pbe;function pF(e,t,n,s){const i=Dbe(n),r=n.enter("emphasis"),a=n.createTracker(s),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=T1(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=qm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=T1(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qm(f));const p=a.move(i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function Pbe(e,t,n){return n.options.emphasis||"*"}function Bbe(e,t){let n=!1;return Mg(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,xN}),!!((!e.depth||e.depth<3)&&K2(e)&&(t.options.setext||n))}function Ube(e,t,n,s){const i=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(s);if(Bbe(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...r.current(),before:` `,after:` `});return f(),d(),h+` `+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");r.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...r.current()});return/^[\t ]/.test(u)&&(u=qm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}mF.peek=Bbe;function mF(e){return e.value||""}function Bbe(){return"<"}gF.peek=Ube;function gF(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function Ube(){return"!"}bF.peek=Fbe;function bF(e,t,n,s){const i=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Fbe(){return"!"}yF.peek=$be;function yF(e,t,n){let s=e.value||"",i="`",r=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(s);)i+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r\u007F]/.test(e.url))}EF.peek=Hbe;function EF(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.createTracker(s);let l,c;if(xF(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${r}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function Hbe(e,t,n){return xF(e,n)?"<":"["}vF.peek=zbe;function vF(e,t,n,s){const i=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function zbe(){return"["}function tA(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Vbe(e){const t=tA(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Gbe(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function wF(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Kbe(e,t,n,s){const i=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?Gbe(n):tA(n);const l=e.ordered?a==="."?")":".":Vbe(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),wF(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+r);let a=r.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(s);l.move(r+" ".repeat(a-r.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?r:r+" ".repeat(a-r.length))+f}}function Wbe(e,t,n,s){const i=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,s);return r(),i(),a}const Xbe=Og(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Qbe(e,t,n,s){return(e.children.some(function(a){return Xbe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function Zbe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}_F.peek=Jbe;function _F(e,t,n,s){const i=Zbe(n),r=n.enter("strong"),a=n.createTracker(s),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=T1(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=qm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=T1(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qm(f));const p=a.move(i+i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function Jbe(e,t,n){return n.options.strong||"*"}function eye(e,t,n,s){return n.safe(e.value,s)}function tye(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nye(e,t,n){const s=(wF(n)+(n.options.ruleSpaces?" ":"")).repeat(tye(n));return n.options.ruleSpaces?s.slice(0,-1):s}const SF={blockquote:Nbe,break:_L,code:jbe,definition:Obe,emphasis:pF,hardBreak:_L,heading:Pbe,html:mF,image:gF,imageReference:bF,inlineCode:yF,link:EF,linkReference:vF,list:Kbe,listItem:Ybe,paragraph:Wbe,root:Qbe,strong:_F,text:eye,thematicBreak:nye};function sye(){return{enter:{table:iye,tableData:SL,tableHeader:SL,tableRow:aye},exit:{codeText:oye,table:rye,tableData:jw,tableHeader:jw,tableRow:jw}}}function iye(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function rye(e){this.exit(e),this.data.inTable=void 0}function aye(e){this.enter({type:"tableRow",children:[]},e)}function jw(e){this.exit(e)}function SL(e){this.enter({type:"tableCell",children:[]},e)}function oye(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,lye));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function lye(e,t){return t==="|"?t:e}function cye(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,i=t.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...r.current()});return/^[\t ]/.test(u)&&(u=qm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}mF.peek=Fbe;function mF(e){return e.value||""}function Fbe(){return"<"}gF.peek=$be;function gF(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function $be(){return"!"}bF.peek=Hbe;function bF(e,t,n,s){const i=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Hbe(){return"!"}yF.peek=zbe;function yF(e,t,n){let s=e.value||"",i="`",r=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(s);)i+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r\u007F]/.test(e.url))}EF.peek=Vbe;function EF(e,t,n,s){const i=eA(n),r=i==='"'?"Quote":"Apostrophe",a=n.createTracker(s);let l,c;if(xF(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${r}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function Vbe(e,t,n){return xF(e,n)?"<":"["}vF.peek=Gbe;function vF(e,t,n,s){const i=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Gbe(){return"["}function tA(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Kbe(e){const t=tA(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function qbe(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function wF(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ybe(e,t,n,s){const i=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?qbe(n):tA(n);const l=e.ordered?a==="."?")":".":Kbe(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),wF(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+r);let a=r.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(s);l.move(r+" ".repeat(a-r.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?r:r+" ".repeat(a-r.length))+f}}function Qbe(e,t,n,s){const i=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,s);return r(),i(),a}const Zbe=Og(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Jbe(e,t,n,s){return(e.children.some(function(a){return Zbe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function eye(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}_F.peek=tye;function _F(e,t,n,s){const i=eye(n),r=n.enter("strong"),a=n.createTracker(s),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=T1(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=qm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=T1(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qm(f));const p=a.move(i+i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function tye(e,t,n){return n.options.strong||"*"}function nye(e,t,n,s){return n.safe(e.value,s)}function sye(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function iye(e,t,n){const s=(wF(n)+(n.options.ruleSpaces?" ":"")).repeat(sye(n));return n.options.ruleSpaces?s.slice(0,-1):s}const SF={blockquote:kbe,break:_L,code:Obe,definition:Lbe,emphasis:pF,hardBreak:_L,heading:Ube,html:mF,image:gF,imageReference:bF,inlineCode:yF,link:EF,linkReference:vF,list:Ybe,listItem:Xbe,paragraph:Qbe,root:Jbe,strong:_F,text:nye,thematicBreak:iye};function rye(){return{enter:{table:aye,tableData:SL,tableHeader:SL,tableRow:lye},exit:{codeText:cye,table:oye,tableData:jw,tableHeader:jw,tableRow:jw}}}function aye(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function oye(e){this.exit(e),this.data.inTable=void 0}function lye(e){this.enter({type:"tableRow",children:[]},e)}function jw(e){this.exit(e)}function SL(e){this.enter({type:"tableCell",children:[]},e)}function cye(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,uye));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function uye(e,t){return t==="|"?t:e}function dye(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,i=t.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:c,tableRow:l}};function a(p,m,b,v){return u(d(p,b,v),p.align)}function l(p,m,b,v){const y=f(p,b,v),x=u([y]);return x.slice(0,x.indexOf(` -`))}function c(p,m,b,v){const y=b.enter("tableCell"),x=b.enter("phrasing"),E=b.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return _be(p,{align:m,alignDelimiters:s,padding:n,stringLength:i})}function d(p,m,b){const v=p.children;let y=-1;const x=[],E=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const kye={tokenize:Lye,partial:!0};function Aye(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Rye,continuation:{tokenize:Oye},exit:Mye}},text:{91:{name:"gfmFootnoteCall",tokenize:jye},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Cye,resolveTo:Iye}}}}function Cye(e,t,n){const s=this;let i=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let a;for(;i--;){const c=s.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=Ba(s.sliceSerialize({start:a.end,end:s.now()}));return u.codePointAt(0)!==94||!r.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Iye(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},l=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...l),e}function jye(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,a;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(r>999||f===93&&!a||f===null||f===91||Fn(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Ba(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Fn(f)||(a=!0),r++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),r++,u):u(f)}}function Rye(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,a=0,l;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!l||m===null||m===91||Fn(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return r=Ba(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Fn(m)||(l=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(r)||i.push(r),nn(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Oye(e,t,n){return e.check(Rg,t,e.attempt(kye,t,n))}function Mye(e){e.exit("gfmFootnoteDefinition")}function Lye(e,t,n){const s=this;return nn(e,i,"gfmFootnoteDefinitionIndent",5);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function Dye(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:i};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const v=a.exit("strikethroughSequenceTemporary"),y=Pf(m);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(m)}}}class Pye{constructor(){this.map=[]}add(t,n,s){Bye(this,t,n,s)}consume(t){if(this.map.sort(function(r,a){return r[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let i=s.pop();for(;i;){for(const r of i)t.push(r);i=s.pop()}this.map.length=0}}function Bye(e,t,n,s){let i=0;if(!(n===0&&s.length===0)){for(;i-1;){const L=s.events[R][1].type;if(L==="lineEnding"||L==="linePrefix")R--;else break}const B=R>-1?s.events[R][1].type:null,z=B==="tableHead"||B==="tableRow"?_:c;return z===_&&s.parser.lazy[s.now().line]?n(j):z(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),u(j)}function u(j){return j===124||(a=!0,r+=1),d(j)}function d(j){return j===null?n(j):pt(j)?r>1?(r=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):Kt(j)?nn(e,d,"whitespace")(j):(r+=1,a&&(a=!1,i+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(j)))}function f(j){return j===null||j===124||Fn(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?h:f)}function h(j){return j===92||j===124?(e.consume(j),f):f(j)}function p(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),a=!1,Kt(j)?nn(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?v(j):j===124?(a=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),b):S(j)}function b(j){return Kt(j)?nn(e,v,"whitespace")(j):v(j)}function v(j){return j===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),y):j===45?(r+=1,y(j)):j===null||pt(j)?w(j):S(j)}function y(j){return j===45?(e.enter("tableDelimiterFiller"),x(j)):S(j)}function x(j){return j===45?(e.consume(j),x):j===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(j))}function E(j){return Kt(j)?nn(e,w,"whitespace")(j):w(j)}function w(j){return j===124?m(j):j===null||pt(j)?!a||i!==r?S(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):S(j)}function S(j){return n(j)}function _(j){return e.enter("tableRow"),T(j)}function T(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),T):j===null||pt(j)?(e.exit("tableRow"),t(j)):Kt(j)?nn(e,T,"whitespace")(j):(e.enter("data"),k(j))}function k(j){return j===null||j===124||Fn(j)?(e.exit("data"),T(j)):(e.consume(j),j===92?A:k)}function A(j){return j===92||j===124?(e.consume(j),k):k(j)}}function Hye(e,t){let n=-1,s=!0,i=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new Pye;for(;++nn[2]+1){const m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(r.end=Object.assign({},gd(t.events,i)),e.add(i,0,[["exit",r,t]]),r=void 0),r}function TL(e,t,n,s,i){const r=[],a=gd(t.events,n);i&&(i.end=Object.assign({},a),r.push(["exit",i,t])),s.end=Object.assign({},a),r.push(["exit",s,t]),e.add(n+1,0,r)}function gd(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const zye={name:"tasklistCheck",tokenize:Gye};function Vye(){return{text:{91:zye}}}function Gye(e,t,n){const s=this;return i;function i(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return Fn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return pt(c)?t(c):Kt(c)?e.check({tokenize:Kye},t,n)(c):n(c)}}function Kye(e,t,n){return nn(e,s,"whitespace");function s(i){return i===null?n(i):t(i)}}function qye(e){return $7([yye(),Aye(),Dye(e),Fye(),Vye()])}const Yye={};function Wye(e){const t=this,n=e||Yye,s=t.data(),i=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),a=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);i.push(qye(n)),r.push(pye()),a.push(mye(n))}const kL=function(e,t,n){const s=Og(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` -`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function MF(e,t,n){return e.type==="element"?s1e(e,t,n):e.type==="text"?n.whitespace==="normal"?LF(e,n):i1e(e):[]}function s1e(e,t,n){const s=DF(e,n),i=e.children||[];let r=-1,a=[];if(t1e(e))return a;let l,c;for(SN(e)||jL(e)&&kL(t,e,jL)?c=` -`:e1e(e)?(l=2,c=2):OF(e)&&(l=1,c=1);++r]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:_.concat([{begin:/\(/,end:/\)/,keywords:w,contains:_.concat(["self"]),relevance:0}]),relevance:0},k={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function d1e(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=u1e(e),s=n.keywords;return s.type=[...s.type,...t.type],s.literal=[...s.literal,...t.literal],s.built_in=[...s.built_in,...t.built_in],s._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function PF(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:v,built_in:[...x,...E,"set","shopt",...w,...S]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function f1e(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",v={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:v,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function h1e(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:_.concat([{begin:/\(/,end:/\)/,keywords:w,contains:_.concat(["self"]),relevance:0}]),relevance:0},k={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function p1e(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],s=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],r=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:i.concat(r),built_in:t,literal:s},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const m1e=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),g1e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],b1e=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],y1e=[...g1e,...b1e],x1e=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),E1e=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),v1e=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),w1e=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _1e(e){const t=e.regex,n=m1e(e),s={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",r=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,s,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+E1e.join("|")+")"},{begin:":(:)?("+v1e.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+w1e.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:r},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:x1e.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+y1e.join("|")+")\\b"}]}}function S1e(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function N1e(e){const r={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:r,illegal:"UF(e,t,n-1))}function k1e(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",s=n+UF("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+s+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,RL,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},RL,u]}}const OL="[A-Za-z$_][0-9A-Za-z$_]*",A1e=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],C1e=["true","false","null","undefined","NaN","Infinity"],FF=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],$F=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],HF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],I1e=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],j1e=[].concat(HF,FF,$F);function zF(e){const t=e.regex,n=(D,{after:$})=>{const O="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(D,$)=>{const O=D[0].length+D.index,te=D.input[O];if(te==="<"||te===","){$.ignoreMatch();return}te===">"&&(n(D,{after:O})||$.ignoreMatch());let se;const P=D.input.substring(O);if(se=P.match(/^\s*=/)){$.ignoreMatch();return}if((se=P.match(/^\s+extends\s+/))&&se.index===0){$.ignoreMatch();return}}},l={$pattern:OL,keyword:A1e,literal:C1e,built_in:j1e,"variable.language":I1e},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},T={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},k={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...FF,...$F]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},R={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(D){return t.concat("(?!",D.join("|"),")")}const z={match:t.concat(/\b/,B([...HF,"super","import"].map(D=>`${D}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:s+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},z,R,T,F,{match:/\$[(.]/}]}}function VF(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],i={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var yd="[0-9](_*[0-9])*",lb=`\\.(${yd})`,cb="[0-9a-fA-F](_*[0-9a-fA-F])*",R1e={className:"number",variants:[{begin:`(\\b(${yd})((${lb})|\\.)?|(${lb}))[eE][+-]?(${yd})[fFdD]?\\b`},{begin:`\\b(${yd})((${lb})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${lb})[fFdD]?\\b`},{begin:`\\b(${yd})[fFdD]\\b`},{begin:`\\b0[xX]((${cb})\\.?|(${cb})?\\.(${cb}))[pP][+-]?(${yd})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cb})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function O1e(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},s={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},r={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[r,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,i]}]};i.contains.push(a);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=R1e,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,s,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const M1e=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),L1e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],D1e=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],P1e=[...L1e,...D1e],B1e=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),GF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),KF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),U1e=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),F1e=GF.concat(KF).sort().reverse();function $1e(e){const t=M1e(e),n=F1e,s="and or not only",i="[\\w-]+",r="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,S){return{className:E,begin:w,relevance:S}},d={$pattern:/[a-z-]+/,keyword:s,attribute:B1e.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+U1e.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+P1e.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",r,0),u("selector-id","#"+r),u("selector-class","\\."+r,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+GF.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+KF.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function H1e(e){const t="\\[=*\\[",n="\\]=*\\]",s={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[s],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[s],relevance:5}])}}function qF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},r={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,r,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,s,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function z1e(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function V1e(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],s=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,r,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,s)},p=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,s),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return r.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function G1e(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,s=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),r=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+s},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(L,F)=>{F.data._beginMatch=L[1]||L[2]},"on:end":(L,F)=>{F.data._beginMatch!==L[1]&&F.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ -]`,m={scope:"string",variants:[d,u,f,h]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],x=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],w={keyword:y,literal:(L=>{const F=[];return L.forEach(C=>{F.push(C),C.toLowerCase()===C?F.push(C.toUpperCase()):F.push(C.toLowerCase())}),F})(v),built_in:x},S=L=>L.map(F=>F.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",S(x).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(s,"\\b(?!\\()"),k={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:t.concat(s,t.lookahead(":"),t.lookahead(/(?!::)/))},j={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[A,a,k,e.C_BLOCK_COMMENT_MODE,m,b,_]},R={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(x).join("\\b|"),"\\b)"),s,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[j]};j.contains.push(R);const B=[A,k,e.C_BLOCK_COMMENT_MODE,m,b,_],z={begin:t.concat(/#\[\s*\\?/,t.either(i,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...B]},...B,{scope:"meta",variants:[{match:i},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[z,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},a,R,k,{match:[/const/,/\s/,s],scope:{1:"keyword",3:"variable.constant"}},_,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:w,contains:["self",z,a,k,e.C_BLOCK_COMMENT_MODE,m,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,b]}}function K1e(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function q1e(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function WF(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${s.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,y,f]}]}}function Y1e(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function W1e(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,s=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,s]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,s]},{scope:{1:"punctuation",2:"number"},match:[r,s]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,s]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function X1e(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(s,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},_=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:s,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=_,b.contains=_;const j=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:_}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(j).concat(u).concat(_)}}function Q1e(e){const t=e.regex,n=/(r#)?/,s=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),r={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},illegal:""},r]}}const Z1e=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),J1e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],exe=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],txe=[...J1e,...exe],nxe=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),sxe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ixe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rxe=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function axe(e){const t=Z1e(e),n=ixe,s=sxe,i="@[a-z-]+",r="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+txe.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+s.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rxe.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:nxe.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function oxe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function lxe(e){const t=e.regex,n=e.COMMENT("--","$"),s={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},r=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(S){return t.concat(/\b/,t.either(...S.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(S,{exceptions:_,when:T}={}){const k=T;return _=_||[],S.map(A=>A.match(/\|\d+$/)||_.includes(A)?A:k(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:S=>S.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,b,s,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function XF(e){return e?typeof e=="string"?e:e.source:null}function ep(e){return jn("(?=",e,")")}function jn(...e){return e.map(n=>XF(n)).join("")}function cxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Wi(...e){return"("+(cxe(e).capture?"":"?:")+e.map(s=>XF(s)).join("|")+")"}const iA=e=>jn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),uxe=["Protocol","Type"].map(iA),ML=["init","self"].map(iA),dxe=["Any","Self"],Rw=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],LL=["false","nil","true"],fxe=["assignment","associativity","higherThan","left","lowerThan","none","right"],hxe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],DL=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],QF=Wi(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ZF=Wi(QF,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ow=jn(QF,ZF,"*"),JF=Wi(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),k1=Wi(JF,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),eo=jn(JF,k1,"*"),ub=jn(/[A-Z]/,k1,"*"),pxe=["attached","autoclosure",jn(/convention\(/,Wi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",jn(/objc\(/,eo,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],mxe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function gxe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),s=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Wi(...uxe,...ML)],className:{2:"keyword"}},r={match:jn(/\./,Wi(...Rw)),relevance:0},a=Rw.filter(ae=>typeof ae=="string").concat(["_|0"]),l=Rw.filter(ae=>typeof ae!="string").concat(dxe).map(iA),c={variants:[{className:"keyword",match:Wi(...l,...ML)}]},u={$pattern:Wi(/\b\w+/,/#\w+/),keyword:a.concat(hxe),literal:LL},d=[i,r,c],f={match:jn(/\./,Wi(...DL)),relevance:0},h={className:"built_in",match:jn(/\b/,Wi(...DL),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:Ow},{match:`\\.(\\.|${ZF})+`}]},v=[m,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(ae="")=>({className:"subst",variants:[{match:jn(/\\/,ae,/[0\\tnr"']/)},{match:jn(/\\/,ae,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(ae="")=>({className:"subst",match:jn(/\\/,ae,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(ae="")=>({className:"subst",label:"interpol",begin:jn(/\\/,ae,/\(/),end:/\)/}),T=(ae="")=>({begin:jn(ae,/"""/),end:jn(/"""/,ae),contains:[w(ae),S(ae),_(ae)]}),k=(ae="")=>({begin:jn(ae,/"/),end:jn(/"/,ae),contains:[w(ae),_(ae)]}),A={className:"string",variants:[T(),T("#"),T("##"),T("###"),k(),k("#"),k("##"),k("###")]},j=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],R={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:j},B=ae=>{const me=jn(ae,/\//),_e=jn(/\//,ae);return{begin:me,end:_e,contains:[...j,{scope:"comment",begin:`#(?!.*${_e})`,end:/$/}]}},z={scope:"regexp",variants:[B("###"),B("##"),B("#"),R]},L={match:jn(/`/,eo,/`/)},F={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${k1}+`},I=[L,F,C],D={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:mxe,contains:[...v,E,A]}]}},$={scope:"keyword",match:jn(/@/,Wi(...pxe),ep(Wi(/\(/,/\s+/)))},O={scope:"meta",match:jn(/@/,eo)},te=[D,$,O],se={match:ep(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:jn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,k1,"+")},{className:"type",match:ub,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:jn(/\s+&\s+/,ep(ub)),relevance:0}]},P={begin://,keywords:u,contains:[...s,...d,...te,m,se]};se.contains.push(P);const Q={match:jn(eo,/\s*:/),keywords:"_|0",relevance:0},ee={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",Q,...s,z,...d,...p,...v,E,A,...I,...te,se]},V={begin://,keywords:"repeat each",contains:[...s,se]},X={begin:Wi(ep(jn(eo,/\s*:/)),ep(jn(eo,/\s+/,eo,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:eo}]},K={begin:/\(/,end:/\)/,keywords:u,contains:[X,...s,...d,...v,E,A,...te,se,ee],endsParent:!0,illegal:/["']/},ce={match:[/(func|macro)/,/\s+/,Wi(L.match,eo,Ow)],className:{1:"keyword",3:"title.function"},contains:[V,K,t],illegal:[/\[/,/%/]},he={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[V,K,t],illegal:/\[|%/},be={match:[/operator/,/\s+/,Ow],className:{1:"keyword",3:"title"}},ue={begin:[/precedencegroup/,/\s+/,ub],className:{1:"keyword",3:"title"},contains:[se],keywords:[...fxe,...LL],end:/}/},we={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Le={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,eo,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[V,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ub},...d],relevance:0}]};for(const ae of A.variants){const me=ae.contains.find(Je=>Je.label==="interpol");me.keywords=u;const _e=[...d,...p,...v,E,A,...I];me.contains=[..._e,{begin:/\(/,end:/\)/,contains:["self",..._e]}]}return{name:"Swift",keywords:u,contains:[...s,ce,he,we,Le,Ne,be,ue,{beginKeywords:"import",end:/$/,contains:[...s],relevance:0},z,...d,...p,...v,E,A,...I,...te,se,ee]}}const A1="[A-Za-z$_][0-9A-Za-z$_]*",e$=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],t$=["true","false","null","undefined","NaN","Infinity"],n$=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s$=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],i$=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],r$=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],a$=[].concat(i$,n$,s$);function bxe(e){const t=e.regex,n=(D,{after:$})=>{const O="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(D,$)=>{const O=D[0].length+D.index,te=D.input[O];if(te==="<"||te===","){$.ignoreMatch();return}te===">"&&(n(D,{after:O})||$.ignoreMatch());let se;const P=D.input.substring(O);if(se=P.match(/^\s*=/)){$.ignoreMatch();return}if((se=P.match(/^\s+extends\s+/))&&se.index===0){$.ignoreMatch();return}}},l={$pattern:A1,keyword:e$,literal:t$,built_in:a$,"variable.language":r$},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},T={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},k={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n$,...s$]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},R={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(D){return t.concat("(?!",D.join("|"),")")}const z={match:t.concat(/\b/,B([...i$,"super","import"].map(D=>`${D}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:s+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},z,R,T,F,{match:/\$[(.]/}]}}function o$(e){const t=e.regex,n=bxe(e),s=A1,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],r={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:A1,keyword:e$.concat(c),literal:t$,built_in:a$.concat(i),"variable.language":r$},d={className:"meta",begin:"@"+s},f=(b,v,y)=>{const x=b.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),p=Object.assign({},h,{match:t.concat(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,r,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const m=n.contains.find(b=>b.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function yxe(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},s={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,i),/ +/,t.either(a,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,s,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function xxe(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),s=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},r={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:s},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function Exe(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(r,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[r,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[r,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function l$(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},r={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},l=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},v=[s,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,b,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const vxe={arduino:d1e,bash:PF,c:f1e,cpp:h1e,csharp:p1e,css:_1e,diff:S1e,go:N1e,graphql:T1e,ini:BF,java:k1e,javascript:zF,json:VF,kotlin:O1e,less:$1e,lua:H1e,makefile:qF,markdown:YF,objectivec:z1e,perl:V1e,php:G1e,"php-template":K1e,plaintext:q1e,python:WF,"python-repl":Y1e,r:W1e,ruby:X1e,rust:Q1e,scss:axe,shell:oxe,sql:lxe,swift:gxe,typescript:o$,vbnet:yxe,wasm:xxe,xml:Exe,yaml:l$};function c$(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&c$(n)}),e}let PL=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function u$(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Vl(e,...t){const n=Object.create(null);for(const s in e)n[s]=e[s];return t.forEach(function(s){for(const i in s)n[i]=s[i]}),n}const wxe="",BL=e=>!!e.scope,_xe=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class Sxe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=u$(t)}openNode(t){if(!BL(t))return;const n=_xe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){BL(t)&&(this.buffer+=wxe)}value(){return this.buffer}span(t){this.buffer+=``}}const UL=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class rA{constructor(){this.rootNode=UL(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=UL({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(s=>this._walk(t,s)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{rA._collapse(n)}))}}class Nxe extends rA{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const s=t.root;n&&(s.scope=`language:${n}`),this.add(s)}toHTML(){return new Sxe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Ym(e){return e?typeof e=="string"?e:e.source:null}function d$(e){return Du("(?=",e,")")}function Txe(e){return Du("(?:",e,")*")}function kxe(e){return Du("(?:",e,")?")}function Du(...e){return e.map(n=>Ym(n)).join("")}function Axe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function aA(...e){return"("+(Axe(e).capture?"":"?:")+e.map(s=>Ym(s)).join("|")+")"}function f$(e){return new RegExp(e.toString()+"|").exec("").length-1}function Cxe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Ixe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function oA(e,{joinWith:t}){let n=0;return e.map(s=>{n+=1;const i=n;let r=Ym(s),a="";for(;r.length>0;){const l=Ixe.exec(r);if(!l){a+=r;break}a+=r.substring(0,l.index),r=r.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(s=>`(${s})`).join(t)}const jxe=/\b\B/,h$="[a-zA-Z]\\w*",lA="[a-zA-Z_]\\w*",p$="\\b\\d+(\\.\\d+)?",m$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",g$="\\b(0b[01]+)",Rxe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Oxe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Du(t,/.*\b/,e.binary,/\b.*/)),Vl({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,s)=>{n.index!==0&&s.ignoreMatch()}},e)},Wm={begin:"\\\\[\\s\\S]",relevance:0},Mxe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Wm]},Lxe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Wm]},Dxe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Zx=function(e,t,n={}){const s=Vl({scope:"comment",begin:e,end:t,contains:[]},n);s.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=aA("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return s.contains.push({begin:Du(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},Pxe=Zx("//","$"),Bxe=Zx("/\\*","\\*/"),Uxe=Zx("#","$"),Fxe={scope:"number",begin:p$,relevance:0},$xe={scope:"number",begin:m$,relevance:0},Hxe={scope:"number",begin:g$,relevance:0},zxe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Wm,{begin:/\[/,end:/\]/,relevance:0,contains:[Wm]}]},Vxe={scope:"title",begin:h$,relevance:0},Gxe={scope:"title",begin:lA,relevance:0},Kxe={begin:"\\.\\s*"+lA,relevance:0},qxe=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var db=Object.freeze({__proto__:null,APOS_STRING_MODE:Mxe,BACKSLASH_ESCAPE:Wm,BINARY_NUMBER_MODE:Hxe,BINARY_NUMBER_RE:g$,COMMENT:Zx,C_BLOCK_COMMENT_MODE:Bxe,C_LINE_COMMENT_MODE:Pxe,C_NUMBER_MODE:$xe,C_NUMBER_RE:m$,END_SAME_AS_BEGIN:qxe,HASH_COMMENT_MODE:Uxe,IDENT_RE:h$,MATCH_NOTHING_RE:jxe,METHOD_GUARD:Kxe,NUMBER_MODE:Fxe,NUMBER_RE:p$,PHRASAL_WORDS_MODE:Dxe,QUOTE_STRING_MODE:Lxe,REGEXP_MODE:zxe,RE_STARTERS_RE:Rxe,SHEBANG:Oxe,TITLE_MODE:Vxe,UNDERSCORE_IDENT_RE:lA,UNDERSCORE_TITLE_MODE:Gxe});function Yxe(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Wxe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Xxe(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Yxe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Qxe(e,t){Array.isArray(e.illegal)&&(e.illegal=aA(...e.illegal))}function Zxe(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Jxe(e,t){e.relevance===void 0&&(e.relevance=1)}const eEe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(s=>{delete e[s]}),e.keywords=n.keywords,e.begin=Du(n.beforeMatch,d$(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},tEe=["of","and","for","in","not","or","if","then","parent","list","value"],nEe="keyword";function b$(e,t,n=nEe){const s=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(r){Object.assign(s,b$(e[r],t,r))}),s;function i(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");s[c[0]]=[r,sEe(c[0],c[1])]})}}function sEe(e,t){return t?Number(t):iEe(e)?0:1}function iEe(e){return tEe.includes(e.toLowerCase())}const FL={},au=e=>{console.error(e)},$L=(e,...t)=>{console.log(`WARN: ${e}`,...t)},nd=(e,t)=>{FL[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),FL[`${e}/${t}`]=!0)},C1=new Error;function y$(e,t,{key:n}){let s=0;const i=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+s]=i[l],r[l+s]=!0,s+=f$(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function rEe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw au("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),C1;if(typeof e.beginScope!="object"||e.beginScope===null)throw au("beginScope must be object"),C1;y$(e,e.begin,{key:"beginScope"}),e.begin=oA(e.begin,{joinWith:""})}}function aEe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw au("skip, excludeEnd, returnEnd not compatible with endScope: {}"),C1;if(typeof e.endScope!="object"||e.endScope===null)throw au("endScope must be object"),C1;y$(e,e.end,{key:"endScope"}),e.end=oA(e.end,{joinWith:""})}}function oEe(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function lEe(e){oEe(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),rEe(e),aEe(e)}function cEe(e){function t(a,l){return new RegExp(Ym(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=f$(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(oA(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new s;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function r(a,l){const c=a;if(a.isCompiled)return c;[Wxe,Zxe,lEe,eEe].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[Xxe,Qxe,Jxe].forEach(d=>d(a,l)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=b$(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Ym(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return uEe(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=i(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Vl(e.classNameAliases||{}),r(e)}function x$(e){return e?e.endsWithParent||x$(e.starts):!1}function uEe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Vl(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:x$(e)?Vl(e,{starts:e.starts?Vl(e.starts):null}):Object.isFrozen(e)?Vl(e):e}var dEe="11.11.1";class fEe extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Mw=u$,HL=Vl,zL=Symbol("nomatch"),hEe=7,E$=function(e){const t=Object.create(null),n=Object.create(null),s=[];let i=!0;const r="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Nxe};function c(C){return l.noHighlightRe.test(C)}function u(C){let I=C.className+" ";I+=C.parentNode?C.parentNode.className:"";const D=l.languageDetectRe.exec(I);if(D){const $=k(D[1]);return $||($L(r.replace("{}",D[1])),$L("Falling back to no-highlight mode for this block.",C)),$?D[1]:"no-highlight"}return I.split(/\s+/).find($=>c($)||k($))}function d(C,I,D){let $="",O="";typeof I=="object"?($=C,D=I.ignoreIllegals,O=I.language):(nd("10.7.0","highlight(lang, code, ...args) has been deprecated."),nd("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),O=C,$=I),D===void 0&&(D=!0);const te={code:$,language:O};L("before:highlight",te);const se=te.result?te.result:f(te.language,te.code,D);return se.code=te.code,L("after:highlight",se),se}function f(C,I,D,$){const O=Object.create(null);function te(W,oe){return W.keywords[oe]}function se(){if(!_e.keywords){Pe.addText(Fe);return}let W=0;_e.keywordPatternRe.lastIndex=0;let oe=_e.keywordPatternRe.exec(Fe),Z="";for(;oe;){Z+=Fe.substring(W,oe.index);const Ee=Ne.case_insensitive?oe[0].toLowerCase():oe[0],Me=te(_e,Ee);if(Me){const[lt,Ot]=Me;if(Pe.addText(Z),Z="",O[Ee]=(O[Ee]||0)+1,O[Ee]<=hEe&&(Ye+=Ot),lt.startsWith("_"))Z+=oe[0];else{const ut=Ne.classNameAliases[lt]||lt;ee(oe[0],ut)}}else Z+=oe[0];W=_e.keywordPatternRe.lastIndex,oe=_e.keywordPatternRe.exec(Fe)}Z+=Fe.substring(W),Pe.addText(Z)}function P(){if(Fe==="")return;let W=null;if(typeof _e.subLanguage=="string"){if(!t[_e.subLanguage]){Pe.addText(Fe);return}W=f(_e.subLanguage,Fe,!0,Je[_e.subLanguage]),Je[_e.subLanguage]=W._top}else W=p(Fe,_e.subLanguage.length?_e.subLanguage:null);_e.relevance>0&&(Ye+=W.relevance),Pe.__addSublanguage(W._emitter,W.language)}function Q(){_e.subLanguage!=null?P():se(),Fe=""}function ee(W,oe){W!==""&&(Pe.startScope(oe),Pe.addText(W),Pe.endScope())}function V(W,oe){let Z=1;const Ee=oe.length-1;for(;Z<=Ee;){if(!W._emit[Z]){Z++;continue}const Me=Ne.classNameAliases[W[Z]]||W[Z],lt=oe[Z];Me?ee(lt,Me):(Fe=lt,se(),Fe=""),Z++}}function X(W,oe){return W.scope&&typeof W.scope=="string"&&Pe.openNode(Ne.classNameAliases[W.scope]||W.scope),W.beginScope&&(W.beginScope._wrap?(ee(Fe,Ne.classNameAliases[W.beginScope._wrap]||W.beginScope._wrap),Fe=""):W.beginScope._multi&&(V(W.beginScope,oe),Fe="")),_e=Object.create(W,{parent:{value:_e}}),_e}function K(W,oe,Z){let Ee=Cxe(W.endRe,Z);if(Ee){if(W["on:end"]){const Me=new PL(W);W["on:end"](oe,Me),Me.isMatchIgnored&&(Ee=!1)}if(Ee){for(;W.endsParent&&W.parent;)W=W.parent;return W}}if(W.endsWithParent)return K(W.parent,oe,Z)}function ce(W){return _e.matcher.regexIndex===0?(Fe+=W[0],1):(Ue=!0,0)}function he(W){const oe=W[0],Z=W.rule,Ee=new PL(Z),Me=[Z.__beforeBegin,Z["on:begin"]];for(const lt of Me)if(lt&&(lt(W,Ee),Ee.isMatchIgnored))return ce(oe);return Z.skip?Fe+=oe:(Z.excludeBegin&&(Fe+=oe),Q(),!Z.returnBegin&&!Z.excludeBegin&&(Fe=oe)),X(Z,W),Z.returnBegin?0:oe.length}function be(W){const oe=W[0],Z=I.substring(W.index),Ee=K(_e,W,Z);if(!Ee)return zL;const Me=_e;_e.endScope&&_e.endScope._wrap?(Q(),ee(oe,_e.endScope._wrap)):_e.endScope&&_e.endScope._multi?(Q(),V(_e.endScope,W)):Me.skip?Fe+=oe:(Me.returnEnd||Me.excludeEnd||(Fe+=oe),Q(),Me.excludeEnd&&(Fe=oe));do _e.scope&&Pe.closeNode(),!_e.skip&&!_e.subLanguage&&(Ye+=_e.relevance),_e=_e.parent;while(_e!==Ee.parent);return Ee.starts&&X(Ee.starts,W),Me.returnEnd?0:oe.length}function ue(){const W=[];for(let oe=_e;oe!==Ne;oe=oe.parent)oe.scope&&W.unshift(oe.scope);W.forEach(oe=>Pe.openNode(oe))}let we={};function Le(W,oe){const Z=oe&&oe[0];if(Fe+=W,Z==null)return Q(),0;if(we.type==="begin"&&oe.type==="end"&&we.index===oe.index&&Z===""){if(Fe+=I.slice(oe.index,oe.index+1),!i){const Ee=new Error(`0 width match regex (${C})`);throw Ee.languageName=C,Ee.badRule=we.rule,Ee}return 1}if(we=oe,oe.type==="begin")return he(oe);if(oe.type==="illegal"&&!D){const Ee=new Error('Illegal lexeme "'+Z+'" for mode "'+(_e.scope||"")+'"');throw Ee.mode=_e,Ee}else if(oe.type==="end"){const Ee=be(oe);if(Ee!==zL)return Ee}if(oe.type==="illegal"&&Z==="")return Fe+=` -`,1;if(Ve>1e5&&Ve>oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Fe+=Z,Z.length}const Ne=k(C);if(!Ne)throw au(r.replace("{}",C)),new Error('Unknown language: "'+C+'"');const ae=cEe(Ne);let me="",_e=$||ae;const Je={},Pe=new l.__emitter(l);ue();let Fe="",Ye=0,Ce=0,Ve=0,Ue=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(I,Pe);else{for(_e.matcher.considerAll();;){Ve++,Ue?Ue=!1:_e.matcher.considerAll(),_e.matcher.lastIndex=Ce;const W=_e.matcher.exec(I);if(!W)break;const oe=I.substring(Ce,W.index),Z=Le(oe,W);Ce=W.index+Z}Le(I.substring(Ce))}return Pe.finalize(),me=Pe.toHTML(),{language:C,value:me,relevance:Ye,illegal:!1,_emitter:Pe,_top:_e}}catch(W){if(W.message&&W.message.includes("Illegal"))return{language:C,value:Mw(I),illegal:!0,relevance:0,_illegalBy:{message:W.message,index:Ce,context:I.slice(Ce-100,Ce+100),mode:W.mode,resultSoFar:me},_emitter:Pe};if(i)return{language:C,value:Mw(I),illegal:!1,relevance:0,errorRaised:W,_emitter:Pe,_top:_e};throw W}}function h(C){const I={value:Mw(C),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return I._emitter.addText(C),I}function p(C,I){I=I||l.languages||Object.keys(t);const D=h(C),$=I.filter(k).filter(j).map(Q=>f(Q,C,!1));$.unshift(D);const O=$.sort((Q,ee)=>{if(Q.relevance!==ee.relevance)return ee.relevance-Q.relevance;if(Q.language&&ee.language){if(k(Q.language).supersetOf===ee.language)return 1;if(k(ee.language).supersetOf===Q.language)return-1}return 0}),[te,se]=O,P=te;return P.secondBest=se,P}function m(C,I,D){const $=I&&n[I]||D;C.classList.add("hljs"),C.classList.add(`language-${$}`)}function b(C){let I=null;const D=u(C);if(c(D))return;if(L("before:highlightElement",{el:C,language:D}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),l.throwUnescapedHTML))throw new fEe("One of your code blocks includes unescaped HTML.",C.innerHTML);I=C;const $=I.textContent,O=D?d($,{language:D,ignoreIllegals:!0}):p($);C.innerHTML=O.value,C.dataset.highlighted="yes",m(C,D,O.language),C.result={language:O.language,re:O.relevance,relevance:O.relevance},O.secondBest&&(C.secondBest={language:O.secondBest.language,relevance:O.secondBest.relevance}),L("after:highlightElement",{el:C,result:O,text:$})}function v(C){l=HL(l,C)}const y=()=>{w(),nd("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),nd("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function C(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",C,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(C,I){let D=null;try{D=I(e)}catch($){if(au("Language definition for '{}' could not be registered.".replace("{}",C)),i)au($);else throw $;D=a}D.name||(D.name=C),t[C]=D,D.rawDefinition=I.bind(null,e),D.aliases&&A(D.aliases,{languageName:C})}function _(C){delete t[C];for(const I of Object.keys(n))n[I]===C&&delete n[I]}function T(){return Object.keys(t)}function k(C){return C=(C||"").toLowerCase(),t[C]||t[n[C]]}function A(C,{languageName:I}){typeof C=="string"&&(C=[C]),C.forEach(D=>{n[D.toLowerCase()]=I})}function j(C){const I=k(C);return I&&!I.disableAutodetect}function R(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=I=>{C["before:highlightBlock"](Object.assign({block:I.el},I))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=I=>{C["after:highlightBlock"](Object.assign({block:I.el},I))})}function B(C){R(C),s.push(C)}function z(C){const I=s.indexOf(C);I!==-1&&s.splice(I,1)}function L(C,I){const D=C;s.forEach(function($){$[D]&&$[D](I)})}function F(C){return nd("10.7.0","highlightBlock will be removed entirely in v12.0"),nd("10.7.0","Please use highlightElement now."),b(C)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:b,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:S,unregisterLanguage:_,listLanguages:T,getLanguage:k,registerAliases:A,autoDetection:j,inherit:HL,addPlugin:B,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=dEe,e.regex={concat:Du,lookahead:d$,either:aA,optional:kxe,anyNumberOfTimes:Txe};for(const C in db)typeof db[C]=="object"&&c$(db[C]);return Object.assign(e,db),e},Uf=E$({});Uf.newInstance=()=>E$({});var pEe=Uf;Uf.HighlightJS=Uf;Uf.default=Uf;const gr=Gf(pEe),VL={},mEe="hljs-";function gEe(e){const t=gr.newInstance();return e&&r(e),{highlight:n,highlightAuto:s,listLanguages:i,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||VL,h=typeof f.prefix=="string"?f.prefix:mEe;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:bEe,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,b=m.data;return b.language=p.language,b.relevance=p.relevance,m}function s(c,u){const f=(u||VL).subset||i();let h=-1,p=0,m;for(;++hp&&(p=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function r(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class bEe{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],s=n.children[n.children.length-1];s&&s.type==="text"?s.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const s=this.stack[this.stack.length-1],i=t.root.children;n?s.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):s.children.push(...i)}openNode(t){const n=this,s=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:s},children:[]};i.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const yEe={};function GL(e){const t=e||yEe,n=t.aliases,s=t.detect||!1,i=t.languages||vxe,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=gEe(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){Mg(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const b=xEe(h);if(b===!1||!b&&!s||b&&r&&r.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=n1e(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(b&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function xEe(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let s;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=YL(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>r)return{line:a+1,column:r-(a>0?n[a-1]:0)+1,offset:r};a++}}}function i(r){if(r&&typeof r.line=="number"&&typeof r.column=="number"&&!Number.isNaN(r.line)&&!Number.isNaN(r.column)){for(;n.length1?n[r.line-2]:0)+r.column-1;if(a=55296&&e<=57343}function GEe(e){return e>=56320&&e<=57343}function KEe(e,t){return(e-55296)*1024+9216+t}function T$(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function k$(e){return e>=64976&&e<=65007||VEe.has(e)}var ve;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(ve||(ve={}));const qEe=65536;class YEe{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=qEe,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:s,col:i,offset:r}=this,a=i+n,l=r+n;return{code:t,startLine:s,endLine:s,startCol:a,endCol:a,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(GEe(n))return this.pos++,this._addGap(),KEe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(ve.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let s=0;s=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;const s=this.html.charCodeAt(n);return s===G.CARRIAGE_RETURN?G.LINE_FEED:s}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let t=this.html.charCodeAt(this.pos);return t===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):t===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,N$(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===G.LINE_FEED||t===G.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){T$(t)?this._err(ve.controlCharacterInInputStream):k$(t)&&this._err(ve.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const WEe=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),XEe=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function QEe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=XEe.get(e))!==null&&t!==void 0?t:e}var Ei;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Ei||(Ei={}));const ZEe=32;var Gl;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Gl||(Gl={}));function TN(e){return e>=Ei.ZERO&&e<=Ei.NINE}function JEe(e){return e>=Ei.UPPER_A&&e<=Ei.UPPER_F||e>=Ei.LOWER_A&&e<=Ei.LOWER_F}function eve(e){return e>=Ei.UPPER_A&&e<=Ei.UPPER_Z||e>=Ei.LOWER_A&&e<=Ei.LOWER_Z||TN(e)}function tve(e){return e===Ei.EQUALS||eve(e)}var gi;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(gi||(gi={}));var Ho;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ho||(Ho={}));class nve{constructor(t,n,s){this.decodeTree=t,this.emitCodePoint=n,this.errors=s,this.state=gi.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ho.Strict}startEntity(t){this.decodeMode=t,this.state=gi.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case gi.EntityStart:return t.charCodeAt(n)===Ei.NUM?(this.state=gi.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=gi.NamedEntity,this.stateNamedEntity(t,n));case gi.NumericStart:return this.stateNumericStart(t,n);case gi.NumericDecimal:return this.stateNumericDecimal(t,n);case gi.NumericHex:return this.stateNumericHex(t,n);case gi.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|ZEe)===Ei.LOWER_X?(this.state=gi.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=gi.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,s,i){if(n!==s){const r=s-n;this.result=this.result*Math.pow(i,r)+Number.parseInt(t.substr(n,r),i),this.consumed+=r}}stateNumericHex(t,n){const s=n;for(;n>14;for(;n>14,r!==0){if(a===Ei.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==Ho.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:s}=this,i=(s[n]&Gl.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,s){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Gl.VALUE_LENGTH:i[t+1],s),n===3&&this.emitCodePoint(i[t+2],s),s}end(){var t;switch(this.state){case gi.NamedEntity:return this.result!==0&&(this.decodeMode!==Ho.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case gi.NumericDecimal:return this.emitNumericEntity(0,2);case gi.NumericHex:return this.emitNumericEntity(0,3);case gi.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case gi.EntityStart:return 0}}}function sve(e,t,n,s){const i=(t&Gl.BRANCH_LENGTH)>>7,r=t&Gl.JUMP_TABLE;if(i===0)return r!==0&&s===r?n:-1;if(r){const c=s-r;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(us)l=c-1;else return e[c+i]}return-1}var Re;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(Re||(Re={}));var ou;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(ou||(ou={}));var na;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(na||(na={}));var pe;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(pe||(pe={}));var N;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(N||(N={}));const ive=new Map([[pe.A,N.A],[pe.ADDRESS,N.ADDRESS],[pe.ANNOTATION_XML,N.ANNOTATION_XML],[pe.APPLET,N.APPLET],[pe.AREA,N.AREA],[pe.ARTICLE,N.ARTICLE],[pe.ASIDE,N.ASIDE],[pe.B,N.B],[pe.BASE,N.BASE],[pe.BASEFONT,N.BASEFONT],[pe.BGSOUND,N.BGSOUND],[pe.BIG,N.BIG],[pe.BLOCKQUOTE,N.BLOCKQUOTE],[pe.BODY,N.BODY],[pe.BR,N.BR],[pe.BUTTON,N.BUTTON],[pe.CAPTION,N.CAPTION],[pe.CENTER,N.CENTER],[pe.CODE,N.CODE],[pe.COL,N.COL],[pe.COLGROUP,N.COLGROUP],[pe.DD,N.DD],[pe.DESC,N.DESC],[pe.DETAILS,N.DETAILS],[pe.DIALOG,N.DIALOG],[pe.DIR,N.DIR],[pe.DIV,N.DIV],[pe.DL,N.DL],[pe.DT,N.DT],[pe.EM,N.EM],[pe.EMBED,N.EMBED],[pe.FIELDSET,N.FIELDSET],[pe.FIGCAPTION,N.FIGCAPTION],[pe.FIGURE,N.FIGURE],[pe.FONT,N.FONT],[pe.FOOTER,N.FOOTER],[pe.FOREIGN_OBJECT,N.FOREIGN_OBJECT],[pe.FORM,N.FORM],[pe.FRAME,N.FRAME],[pe.FRAMESET,N.FRAMESET],[pe.H1,N.H1],[pe.H2,N.H2],[pe.H3,N.H3],[pe.H4,N.H4],[pe.H5,N.H5],[pe.H6,N.H6],[pe.HEAD,N.HEAD],[pe.HEADER,N.HEADER],[pe.HGROUP,N.HGROUP],[pe.HR,N.HR],[pe.HTML,N.HTML],[pe.I,N.I],[pe.IMG,N.IMG],[pe.IMAGE,N.IMAGE],[pe.INPUT,N.INPUT],[pe.IFRAME,N.IFRAME],[pe.KEYGEN,N.KEYGEN],[pe.LABEL,N.LABEL],[pe.LI,N.LI],[pe.LINK,N.LINK],[pe.LISTING,N.LISTING],[pe.MAIN,N.MAIN],[pe.MALIGNMARK,N.MALIGNMARK],[pe.MARQUEE,N.MARQUEE],[pe.MATH,N.MATH],[pe.MENU,N.MENU],[pe.META,N.META],[pe.MGLYPH,N.MGLYPH],[pe.MI,N.MI],[pe.MO,N.MO],[pe.MN,N.MN],[pe.MS,N.MS],[pe.MTEXT,N.MTEXT],[pe.NAV,N.NAV],[pe.NOBR,N.NOBR],[pe.NOFRAMES,N.NOFRAMES],[pe.NOEMBED,N.NOEMBED],[pe.NOSCRIPT,N.NOSCRIPT],[pe.OBJECT,N.OBJECT],[pe.OL,N.OL],[pe.OPTGROUP,N.OPTGROUP],[pe.OPTION,N.OPTION],[pe.P,N.P],[pe.PARAM,N.PARAM],[pe.PLAINTEXT,N.PLAINTEXT],[pe.PRE,N.PRE],[pe.RB,N.RB],[pe.RP,N.RP],[pe.RT,N.RT],[pe.RTC,N.RTC],[pe.RUBY,N.RUBY],[pe.S,N.S],[pe.SCRIPT,N.SCRIPT],[pe.SEARCH,N.SEARCH],[pe.SECTION,N.SECTION],[pe.SELECT,N.SELECT],[pe.SOURCE,N.SOURCE],[pe.SMALL,N.SMALL],[pe.SPAN,N.SPAN],[pe.STRIKE,N.STRIKE],[pe.STRONG,N.STRONG],[pe.STYLE,N.STYLE],[pe.SUB,N.SUB],[pe.SUMMARY,N.SUMMARY],[pe.SUP,N.SUP],[pe.TABLE,N.TABLE],[pe.TBODY,N.TBODY],[pe.TEMPLATE,N.TEMPLATE],[pe.TEXTAREA,N.TEXTAREA],[pe.TFOOT,N.TFOOT],[pe.TD,N.TD],[pe.TH,N.TH],[pe.THEAD,N.THEAD],[pe.TITLE,N.TITLE],[pe.TR,N.TR],[pe.TRACK,N.TRACK],[pe.TT,N.TT],[pe.U,N.U],[pe.UL,N.UL],[pe.SVG,N.SVG],[pe.VAR,N.VAR],[pe.WBR,N.WBR],[pe.XMP,N.XMP]]);function fh(e){var t;return(t=ive.get(e))!==null&&t!==void 0?t:N.UNKNOWN}const Oe=N,rve={[Re.HTML]:new Set([Oe.ADDRESS,Oe.APPLET,Oe.AREA,Oe.ARTICLE,Oe.ASIDE,Oe.BASE,Oe.BASEFONT,Oe.BGSOUND,Oe.BLOCKQUOTE,Oe.BODY,Oe.BR,Oe.BUTTON,Oe.CAPTION,Oe.CENTER,Oe.COL,Oe.COLGROUP,Oe.DD,Oe.DETAILS,Oe.DIR,Oe.DIV,Oe.DL,Oe.DT,Oe.EMBED,Oe.FIELDSET,Oe.FIGCAPTION,Oe.FIGURE,Oe.FOOTER,Oe.FORM,Oe.FRAME,Oe.FRAMESET,Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6,Oe.HEAD,Oe.HEADER,Oe.HGROUP,Oe.HR,Oe.HTML,Oe.IFRAME,Oe.IMG,Oe.INPUT,Oe.LI,Oe.LINK,Oe.LISTING,Oe.MAIN,Oe.MARQUEE,Oe.MENU,Oe.META,Oe.NAV,Oe.NOEMBED,Oe.NOFRAMES,Oe.NOSCRIPT,Oe.OBJECT,Oe.OL,Oe.P,Oe.PARAM,Oe.PLAINTEXT,Oe.PRE,Oe.SCRIPT,Oe.SECTION,Oe.SELECT,Oe.SOURCE,Oe.STYLE,Oe.SUMMARY,Oe.TABLE,Oe.TBODY,Oe.TD,Oe.TEMPLATE,Oe.TEXTAREA,Oe.TFOOT,Oe.TH,Oe.THEAD,Oe.TITLE,Oe.TR,Oe.TRACK,Oe.UL,Oe.WBR,Oe.XMP]),[Re.MATHML]:new Set([Oe.MI,Oe.MO,Oe.MN,Oe.MS,Oe.MTEXT,Oe.ANNOTATION_XML]),[Re.SVG]:new Set([Oe.TITLE,Oe.FOREIGN_OBJECT,Oe.DESC]),[Re.XLINK]:new Set,[Re.XML]:new Set,[Re.XMLNS]:new Set},kN=new Set([Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6]);pe.STYLE,pe.SCRIPT,pe.XMP,pe.IFRAME,pe.NOEMBED,pe.NOFRAMES,pe.PLAINTEXT;var q;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(q||(q={}));const $s={DATA:q.DATA,RCDATA:q.RCDATA,RAWTEXT:q.RAWTEXT,SCRIPT_DATA:q.SCRIPT_DATA,PLAINTEXT:q.PLAINTEXT,CDATA_SECTION:q.CDATA_SECTION};function ave(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function wp(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function ove(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function kl(e){return ove(e)||wp(e)}function XL(e){return kl(e)||ave(e)}function fb(e){return e+32}function C$(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function QL(e){return C$(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function lve(e){return e===G.NULL?ve.nullCharacterReference:e>1114111?ve.characterReferenceOutsideUnicodeRange:N$(e)?ve.surrogateCharacterReference:k$(e)?ve.noncharacterCharacterReference:T$(e)||e===G.CARRIAGE_RETURN?ve.controlCharacterReference:null}class cve{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=q.DATA,this.returnState=q.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new YEe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new nve(WEe,(s,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(s)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ve.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:s=>{this._err(ve.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+s)},validateNumericCharacterReference:s=>{const i=lve(s);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var s,i;(i=(s=this.handler).onParseError)===null||i===void 0||i.call(s,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,s){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||s==null||s()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(ve.endTagWithAttributes),t.selfClosing&&this._err(ve.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Ft.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Ft.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Ft.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Ft.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=C$(t)?Ft.WHITESPACE_CHARACTER:t===G.NULL?Ft.NULL_CHARACTER:Ft.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Ft.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=q.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ho.Attribute:Ho.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===q.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===q.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===q.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case q.DATA:{this._stateData(t);break}case q.RCDATA:{this._stateRcdata(t);break}case q.RAWTEXT:{this._stateRawtext(t);break}case q.SCRIPT_DATA:{this._stateScriptData(t);break}case q.PLAINTEXT:{this._statePlaintext(t);break}case q.TAG_OPEN:{this._stateTagOpen(t);break}case q.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case q.TAG_NAME:{this._stateTagName(t);break}case q.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case q.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case q.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case q.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case q.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case q.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case q.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case q.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case q.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case q.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case q.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case q.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case q.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case q.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case q.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case q.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case q.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case q.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case q.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case q.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case q.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case q.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case q.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case q.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case q.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case q.BOGUS_COMMENT:{this._stateBogusComment(t);break}case q.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case q.COMMENT_START:{this._stateCommentStart(t);break}case q.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case q.COMMENT:{this._stateComment(t);break}case q.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case q.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case q.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case q.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case q.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case q.COMMENT_END:{this._stateCommentEnd(t);break}case q.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case q.DOCTYPE:{this._stateDoctype(t);break}case q.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case q.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case q.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case q.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case q.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case q.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case q.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case q.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case q.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case q.CDATA_SECTION:{this._stateCdataSection(t);break}case q.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case q.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case q.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case q.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=q.TAG_OPEN;break}case G.AMPERSAND:{this._startCharacterReference();break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this._emitCodePoint(t);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case G.AMPERSAND:{this._startCharacterReference();break}case G.LESS_THAN_SIGN:{this.state=q.RCDATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case G.LESS_THAN_SIGN:{this.state=q.RAWTEXT_LESS_THAN_SIGN;break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=q.SCRIPT_DATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case G.NULL:{this._err(ve.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(kl(t))this._createStartTagToken(),this.state=q.TAG_NAME,this._stateTagName(t);else switch(t){case G.EXCLAMATION_MARK:{this.state=q.MARKUP_DECLARATION_OPEN;break}case G.SOLIDUS:{this.state=q.END_TAG_OPEN;break}case G.QUESTION_MARK:{this._err(ve.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=q.BOGUS_COMMENT,this._stateBogusComment(t);break}case G.EOF:{this._err(ve.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ve.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=q.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(kl(t))this._createEndTagToken(),this.state=q.TAG_NAME,this._stateTagName(t);else switch(t){case G.GREATER_THAN_SIGN:{this._err(ve.missingEndTagName),this.state=q.DATA;break}case G.EOF:{this._err(ve.eofBeforeTagName),this._emitChars("");break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this.state=q.SCRIPT_DATA_ESCAPED,this._emitChars(fs);break}case G.EOF:{this._err(ve.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=q.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===G.SOLIDUS?this.state=q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:kl(t)?(this._emitChars("<"),this.state=q.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){kl(t)?(this.state=q.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case G.NULL:{this._err(ve.unexpectedNullCharacter),this.state=q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(fs);break}case G.EOF:{this._err(ve.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===G.SOLIDUS?(this.state=q.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=q.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(cr.SCRIPT,!1)&&QL(this.preprocessor.peek(cr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const s=this._indexOf(t);this.items[s]=n,s===this.stackTop&&(this.current=n)}insertAfter(t,n,s){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,s),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==Re.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;s--)if(t.has(this.tagIDs[s])&&this.treeAdapter.getNamespaceURI(this.items[s])===n)return s;return-1}clearBackTo(t,n){const s=this._indexOfTagNames(t,n);this.shortenToLength(s+1)}clearBackToTableContext(){this.clearBackTo(pve,Re.HTML)}clearBackToTableBodyContext(){this.clearBackTo(hve,Re.HTML)}clearBackToTableRowContext(){this.clearBackTo(fve,Re.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===N.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===N.HTML}hasInDynamicScope(t,n){for(let s=this.stackTop;s>=0;s--){const i=this.tagIDs[s];switch(this.treeAdapter.getNamespaceURI(this.items[s])){case Re.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case Re.SVG:{if(e3.has(i))return!1;break}case Re.MATHML:{if(JL.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,I1)}hasInListItemScope(t){return this.hasInDynamicScope(t,uve)}hasInButtonScope(t){return this.hasInDynamicScope(t,dve)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Re.HTML:{if(kN.has(n))return!0;if(I1.has(n))return!1;break}case Re.SVG:{if(e3.has(n))return!1;break}case Re.MATHML:{if(JL.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Re.HTML)switch(this.tagIDs[n]){case t:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Re.HTML)switch(this.tagIDs[t]){case N.TBODY:case N.THEAD:case N.TFOOT:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Re.HTML)switch(this.tagIDs[n]){case t:return!0;case N.OPTION:case N.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&I$.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&ZL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&ZL.has(this.currentTagId);)this.pop()}}const Lw=3;var so;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(so||(so={}));const t3={type:so.Marker};class bve{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const s=[],i=n.length,r=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let r=0;for(let a=0;ai.get(c.name)===c.value)&&(r+=1,r>=Lw&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(t3)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:so.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const s=this.entries.indexOf(this.bookmark);this.entries.splice(s,0,{type:so.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(t3);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(s=>s.type===so.Marker||this.treeAdapter.getTagName(s.element)===t);return n&&n.type===so.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===so.Element&&n.element===t)}}const Al={createDocument(){return{nodeName:"#document",mode:na.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,s){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=s;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:s,parentNode:null};Al.appendChild(e,r)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Al.isTextNode(n)){n.value+=t;return}}Al.appendChild(e,Al.createTextNode(t))},insertTextBefore(e,t,n){const s=e.childNodes[e.childNodes.indexOf(n)-1];s&&Al.isTextNode(s)?s.value+=t:Al.insertBefore(e,Al.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(s=>s.name));for(let s=0;se.startsWith(n))}function _ve(e){return e.name===j$&&e.publicId===null&&(e.systemId===null||e.systemId===yve)}function Sve(e){if(e.name!==j$)return na.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===xve)return na.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),vve.has(n))return na.QUIRKS;let s=t===null?Eve:R$;if(n3(n,s))return na.QUIRKS;if(s=t===null?O$:wve,n3(n,s))return na.LIMITED_QUIRKS}return na.NO_QUIRKS}const s3={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Nve="definitionurl",Tve="definitionURL",kve=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Ave=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Re.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Re.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Re.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Re.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Re.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Re.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Re.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Re.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Re.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Re.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Re.XMLNS}]]),Cve=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Ive=new Set([N.B,N.BIG,N.BLOCKQUOTE,N.BODY,N.BR,N.CENTER,N.CODE,N.DD,N.DIV,N.DL,N.DT,N.EM,N.EMBED,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HR,N.I,N.IMG,N.LI,N.LISTING,N.MENU,N.META,N.NOBR,N.OL,N.P,N.PRE,N.RUBY,N.S,N.SMALL,N.SPAN,N.STRONG,N.STRIKE,N.SUB,N.SUP,N.TABLE,N.TT,N.U,N.UL,N.VAR]);function jve(e){const t=e.tagID;return t===N.FONT&&e.attrs.some(({name:s})=>s===ou.COLOR||s===ou.SIZE||s===ou.FACE)||Ive.has(t)}function M$(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var s,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(s=this.treeAdapter).onItemPop)===null||i===void 0||i.call(s,t,this.openElements.current),n){let r,a;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,a=this.fragmentContextID):{current:r,currentTagId:a}=this.openElements,this._setContextModes(r,a)}}_setContextModes(t,n){const s=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Re.HTML;this.currentNotInHTML=!s,this.tokenizer.inForeignNode=!s&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,Re.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=J.TEXT}switchToPlaintextParsing(){this.insertionMode=J.TEXT,this.originalInsertionMode=J.IN_BODY,this.tokenizer.state=$s.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===pe.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Re.HTML))switch(this.fragmentContextID){case N.TITLE:case N.TEXTAREA:{this.tokenizer.state=$s.RCDATA;break}case N.STYLE:case N.XMP:case N.IFRAME:case N.NOEMBED:case N.NOFRAMES:case N.NOSCRIPT:{this.tokenizer.state=$s.RAWTEXT;break}case N.SCRIPT:{this.tokenizer.state=$s.SCRIPT_DATA;break}case N.PLAINTEXT:{this.tokenizer.state=$s.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",s=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,s,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const s=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,s)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const s=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(s??this.document,t)}}_appendElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location)}_insertElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location),this.openElements.push(s,t.tagID)}_insertFakeElement(t,n){const s=this.treeAdapter.createElement(t,Re.HTML,[]);this._attachElementToTree(s,null),this.openElements.push(s,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,Re.HTML,t.attrs),s=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,s),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(pe.HTML,Re.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,N.HTML)}_appendCommentNode(t,n){const s=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,s),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_insertCharacters(t){let n,s;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:s}=this._findFosterParentingLocation(),s?this.treeAdapter.insertTextBefore(n,t.chars,s):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(n),r=s?i.lastIndexOf(s):i.length,a=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let s=this.treeAdapter.getFirstChild(t);s;s=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(s),this.treeAdapter.appendChild(n,s)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const s=n.location,i=this.treeAdapter.getTagName(t),r=n.type===Ft.END_TAG&&i===n.tagName?{endTag:{...s},endLine:s.endLine,endCol:s.endCol,endOffset:s.endOffset}:{endLine:s.startLine,endCol:s.startCol,endOffset:s.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,s;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,s=this.fragmentContextID):{current:n,currentTagId:s}=this.openElements,t.tagID===N.SVG&&this.treeAdapter.getTagName(n)===pe.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===Re.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===N.MGLYPH||t.tagID===N.MALIGNMARK)&&s!==void 0&&!this._isIntegrationPoint(s,n,Re.HTML)}_processToken(t){switch(t.type){case Ft.CHARACTER:{this.onCharacter(t);break}case Ft.NULL_CHARACTER:{this.onNullCharacter(t);break}case Ft.COMMENT:{this.onComment(t);break}case Ft.DOCTYPE:{this.onDoctype(t);break}case Ft.START_TAG:{this._processStartTag(t);break}case Ft.END_TAG:{this.onEndTag(t);break}case Ft.EOF:{this.onEof(t);break}case Ft.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,s){const i=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return Lve(t,i,r,s)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===so.Marker||this.openElements.contains(i.element)),s=n===-1?t-1:n-1;for(let i=s;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=J.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(N.P),this.openElements.popUntilTagNamePopped(N.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case N.TR:{this.insertionMode=J.IN_ROW;return}case N.TBODY:case N.THEAD:case N.TFOOT:{this.insertionMode=J.IN_TABLE_BODY;return}case N.CAPTION:{this.insertionMode=J.IN_CAPTION;return}case N.COLGROUP:{this.insertionMode=J.IN_COLUMN_GROUP;return}case N.TABLE:{this.insertionMode=J.IN_TABLE;return}case N.BODY:{this.insertionMode=J.IN_BODY;return}case N.FRAMESET:{this.insertionMode=J.IN_FRAMESET;return}case N.SELECT:{this._resetInsertionModeForSelect(t);return}case N.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case N.HTML:{this.insertionMode=this.headElement?J.AFTER_HEAD:J.BEFORE_HEAD;return}case N.TD:case N.TH:{if(t>0){this.insertionMode=J.IN_CELL;return}break}case N.HEAD:{if(t>0){this.insertionMode=J.IN_HEAD;return}break}}this.insertionMode=J.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const s=this.openElements.tagIDs[n];if(s===N.TEMPLATE)break;if(s===N.TABLE){this.insertionMode=J.IN_SELECT_IN_TABLE;return}}this.insertionMode=J.IN_SELECT}_isElementCausesFosterParenting(t){return D$.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case N.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===Re.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case N.TABLE:{const s=this.treeAdapter.getParentNode(n);return s?{parent:s,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const s=this.treeAdapter.getNamespaceURI(t);return rve[s].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){m_e(this,t);return}switch(this.insertionMode){case J.INITIAL:{tp(this,t);break}case J.BEFORE_HTML:{tm(this,t);break}case J.BEFORE_HEAD:{nm(this,t);break}case J.IN_HEAD:{sm(this,t);break}case J.IN_HEAD_NO_SCRIPT:{im(this,t);break}case J.AFTER_HEAD:{rm(this,t);break}case J.IN_BODY:case J.IN_CAPTION:case J.IN_CELL:case J.IN_TEMPLATE:{B$(this,t);break}case J.TEXT:case J.IN_SELECT:case J.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{Dw(this,t);break}case J.IN_TABLE_TEXT:{V$(this,t);break}case J.IN_COLUMN_GROUP:{j1(this,t);break}case J.AFTER_BODY:{R1(this,t);break}case J.AFTER_AFTER_BODY:{cy(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){p_e(this,t);return}switch(this.insertionMode){case J.INITIAL:{tp(this,t);break}case J.BEFORE_HTML:{tm(this,t);break}case J.BEFORE_HEAD:{nm(this,t);break}case J.IN_HEAD:{sm(this,t);break}case J.IN_HEAD_NO_SCRIPT:{im(this,t);break}case J.AFTER_HEAD:{rm(this,t);break}case J.TEXT:{this._insertCharacters(t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{Dw(this,t);break}case J.IN_COLUMN_GROUP:{j1(this,t);break}case J.AFTER_BODY:{R1(this,t);break}case J.AFTER_AFTER_BODY:{cy(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){AN(this,t);return}switch(this.insertionMode){case J.INITIAL:case J.BEFORE_HTML:case J.BEFORE_HEAD:case J.IN_HEAD:case J.IN_HEAD_NO_SCRIPT:case J.AFTER_HEAD:case J.IN_BODY:case J.IN_TABLE:case J.IN_CAPTION:case J.IN_COLUMN_GROUP:case J.IN_TABLE_BODY:case J.IN_ROW:case J.IN_CELL:case J.IN_SELECT:case J.IN_SELECT_IN_TABLE:case J.IN_TEMPLATE:case J.IN_FRAMESET:case J.AFTER_FRAMESET:{AN(this,t);break}case J.IN_TABLE_TEXT:{np(this,t);break}case J.AFTER_BODY:{Kve(this,t);break}case J.AFTER_AFTER_BODY:case J.AFTER_AFTER_FRAMESET:{qve(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case J.INITIAL:{Yve(this,t);break}case J.BEFORE_HEAD:case J.IN_HEAD:case J.IN_HEAD_NO_SCRIPT:case J.AFTER_HEAD:{this._err(t,ve.misplacedDoctype);break}case J.IN_TABLE_TEXT:{np(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ve.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?g_e(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{tp(this,t);break}case J.BEFORE_HTML:{Wve(this,t);break}case J.BEFORE_HEAD:{Qve(this,t);break}case J.IN_HEAD:{Va(this,t);break}case J.IN_HEAD_NO_SCRIPT:{ewe(this,t);break}case J.AFTER_HEAD:{nwe(this,t);break}case J.IN_BODY:{Hi(this,t);break}case J.IN_TABLE:{Ff(this,t);break}case J.IN_TABLE_TEXT:{np(this,t);break}case J.IN_CAPTION:{Zwe(this,t);break}case J.IN_COLUMN_GROUP:{pA(this,t);break}case J.IN_TABLE_BODY:{tE(this,t);break}case J.IN_ROW:{nE(this,t);break}case J.IN_CELL:{t_e(this,t);break}case J.IN_SELECT:{q$(this,t);break}case J.IN_SELECT_IN_TABLE:{s_e(this,t);break}case J.IN_TEMPLATE:{r_e(this,t);break}case J.AFTER_BODY:{o_e(this,t);break}case J.IN_FRAMESET:{l_e(this,t);break}case J.AFTER_FRAMESET:{u_e(this,t);break}case J.AFTER_AFTER_BODY:{f_e(this,t);break}case J.AFTER_AFTER_FRAMESET:{h_e(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?b_e(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{tp(this,t);break}case J.BEFORE_HTML:{Xve(this,t);break}case J.BEFORE_HEAD:{Zve(this,t);break}case J.IN_HEAD:{Jve(this,t);break}case J.IN_HEAD_NO_SCRIPT:{twe(this,t);break}case J.AFTER_HEAD:{swe(this,t);break}case J.IN_BODY:{eE(this,t);break}case J.TEXT:{Hwe(this,t);break}case J.IN_TABLE:{Xm(this,t);break}case J.IN_TABLE_TEXT:{np(this,t);break}case J.IN_CAPTION:{Jwe(this,t);break}case J.IN_COLUMN_GROUP:{e_e(this,t);break}case J.IN_TABLE_BODY:{CN(this,t);break}case J.IN_ROW:{K$(this,t);break}case J.IN_CELL:{n_e(this,t);break}case J.IN_SELECT:{Y$(this,t);break}case J.IN_SELECT_IN_TABLE:{i_e(this,t);break}case J.IN_TEMPLATE:{a_e(this,t);break}case J.AFTER_BODY:{X$(this,t);break}case J.IN_FRAMESET:{c_e(this,t);break}case J.AFTER_FRAMESET:{d_e(this,t);break}case J.AFTER_AFTER_BODY:{cy(this,t);break}}}onEof(t){switch(this.insertionMode){case J.INITIAL:{tp(this,t);break}case J.BEFORE_HTML:{tm(this,t);break}case J.BEFORE_HEAD:{nm(this,t);break}case J.IN_HEAD:{sm(this,t);break}case J.IN_HEAD_NO_SCRIPT:{im(this,t);break}case J.AFTER_HEAD:{rm(this,t);break}case J.IN_BODY:case J.IN_TABLE:case J.IN_CAPTION:case J.IN_COLUMN_GROUP:case J.IN_TABLE_BODY:case J.IN_ROW:case J.IN_CELL:case J.IN_SELECT:case J.IN_SELECT_IN_TABLE:{H$(this,t);break}case J.TEXT:{zwe(this,t);break}case J.IN_TABLE_TEXT:{np(this,t);break}case J.IN_TEMPLATE:{W$(this,t);break}case J.AFTER_BODY:case J.IN_FRAMESET:case J.AFTER_FRAMESET:case J.AFTER_AFTER_BODY:case J.AFTER_AFTER_FRAMESET:{hA(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===G.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case J.IN_HEAD:case J.IN_HEAD_NO_SCRIPT:case J.AFTER_HEAD:case J.TEXT:case J.IN_COLUMN_GROUP:case J.IN_SELECT:case J.IN_SELECT_IN_TABLE:case J.IN_FRAMESET:case J.AFTER_FRAMESET:{this._insertCharacters(t);break}case J.IN_BODY:case J.IN_CAPTION:case J.IN_CELL:case J.IN_TEMPLATE:case J.AFTER_BODY:case J.AFTER_AFTER_BODY:case J.AFTER_AFTER_FRAMESET:{P$(this,t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{Dw(this,t);break}case J.IN_TABLE_TEXT:{z$(this,t);break}}}};function Fve(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):$$(e,t),n}function $ve(e,t){let n=null,s=e.openElements.stackTop;for(;s>=0;s--){const i=e.openElements.items[s];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[s])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(s,0)),e.activeFormattingElements.removeEntry(t)),n}function Hve(e,t,n){let s=t,i=e.openElements.getCommonAncestor(t);for(let r=0,a=i;a!==n;r++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=Bve;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=zve(e,l),s===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(a,s),s=a)}return s}function zve(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function Vve(e,t,n){const s=e.treeAdapter.getTagName(t),i=fh(s);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);i===N.TEMPLATE&&r===Re.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Gve(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,r=e.treeAdapter.createElement(i.tagName,s,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,i.tagID)}function fA(e,t){for(let n=0;n=n;s--)e._setEndLocation(e.openElements.items[s],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const s=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(s);if(i&&!i.endTag&&(e._setEndLocation(s,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function Yve(e,t){e._setDocumentType(t);const n=t.forceQuirks?na.QUIRKS:Sve(t);_ve(t)||e._err(t,ve.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=J.BEFORE_HTML}function tp(e,t){e._err(t,ve.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,na.QUIRKS),e.insertionMode=J.BEFORE_HTML,e._processToken(t)}function Wve(e,t){t.tagID===N.HTML?(e._insertElement(t,Re.HTML),e.insertionMode=J.BEFORE_HEAD):tm(e,t)}function Xve(e,t){const n=t.tagID;(n===N.HTML||n===N.HEAD||n===N.BODY||n===N.BR)&&tm(e,t)}function tm(e,t){e._insertFakeRootElement(),e.insertionMode=J.BEFORE_HEAD,e._processToken(t)}function Qve(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.HEAD:{e._insertElement(t,Re.HTML),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD;break}default:nm(e,t)}}function Zve(e,t){const n=t.tagID;n===N.HEAD||n===N.BODY||n===N.HTML||n===N.BR?nm(e,t):e._err(t,ve.endTagWithoutMatchingOpenElement)}function nm(e,t){e._insertFakeElement(pe.HEAD,N.HEAD),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD,e._processToken(t)}function Va(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:{e._appendElement(t,Re.HTML),t.ackSelfClosing=!0;break}case N.TITLE:{e._switchToTextParsing(t,$s.RCDATA);break}case N.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,$s.RAWTEXT):(e._insertElement(t,Re.HTML),e.insertionMode=J.IN_HEAD_NO_SCRIPT);break}case N.NOFRAMES:case N.STYLE:{e._switchToTextParsing(t,$s.RAWTEXT);break}case N.SCRIPT:{e._switchToTextParsing(t,$s.SCRIPT_DATA);break}case N.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=J.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(J.IN_TEMPLATE);break}case N.HEAD:{e._err(t,ve.misplacedStartTagForHeadElement);break}default:sm(e,t)}}function Jve(e,t){switch(t.tagID){case N.HEAD:{e.openElements.pop(),e.insertionMode=J.AFTER_HEAD;break}case N.BODY:case N.BR:case N.HTML:{sm(e,t);break}case N.TEMPLATE:{Pu(e,t);break}default:e._err(t,ve.endTagWithoutMatchingOpenElement)}}function Pu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==N.TEMPLATE&&e._err(t,ve.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ve.endTagWithoutMatchingOpenElement)}function sm(e,t){e.openElements.pop(),e.insertionMode=J.AFTER_HEAD,e._processToken(t)}function ewe(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.BASEFONT:case N.BGSOUND:case N.HEAD:case N.LINK:case N.META:case N.NOFRAMES:case N.STYLE:{Va(e,t);break}case N.NOSCRIPT:{e._err(t,ve.nestedNoscriptInHead);break}default:im(e,t)}}function twe(e,t){switch(t.tagID){case N.NOSCRIPT:{e.openElements.pop(),e.insertionMode=J.IN_HEAD;break}case N.BR:{im(e,t);break}default:e._err(t,ve.endTagWithoutMatchingOpenElement)}}function im(e,t){const n=t.type===Ft.EOF?ve.openElementsLeftAfterEof:ve.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=J.IN_HEAD,e._processToken(t)}function nwe(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.BODY:{e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=J.IN_BODY;break}case N.FRAMESET:{e._insertElement(t,Re.HTML),e.insertionMode=J.IN_FRAMESET;break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{e._err(t,ve.abandonedHeadElementChild),e.openElements.push(e.headElement,N.HEAD),Va(e,t),e.openElements.remove(e.headElement);break}case N.HEAD:{e._err(t,ve.misplacedStartTagForHeadElement);break}default:rm(e,t)}}function swe(e,t){switch(t.tagID){case N.BODY:case N.HTML:case N.BR:{rm(e,t);break}case N.TEMPLATE:{Pu(e,t);break}default:e._err(t,ve.endTagWithoutMatchingOpenElement)}}function rm(e,t){e._insertFakeElement(pe.BODY,N.BODY),e.insertionMode=J.IN_BODY,Jx(e,t)}function Jx(e,t){switch(t.type){case Ft.CHARACTER:{B$(e,t);break}case Ft.WHITESPACE_CHARACTER:{P$(e,t);break}case Ft.COMMENT:{AN(e,t);break}case Ft.START_TAG:{Hi(e,t);break}case Ft.END_TAG:{eE(e,t);break}case Ft.EOF:{H$(e,t);break}}}function P$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function B$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function iwe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function rwe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function awe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Re.HTML),e.insertionMode=J.IN_FRAMESET)}function owe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML)}function lwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&kN.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Re.HTML)}function cwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function uwe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),n||(e.formElement=e.openElements.current))}function dwe(e,t){e.framesetOk=!1;const n=t.tagID;for(let s=e.openElements.stackTop;s>=0;s--){const i=e.openElements.tagIDs[s];if(n===N.LI&&i===N.LI||(n===N.DD||n===N.DT)&&(i===N.DD||i===N.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==N.ADDRESS&&i!==N.DIV&&i!==N.P&&e._isSpecialElement(e.openElements.items[s],i))break}e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML)}function fwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.tokenizer.state=$s.PLAINTEXT}function hwe(e,t){e.openElements.hasInScope(N.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(N.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.framesetOk=!1}function pwe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(pe.A);n&&(fA(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function mwe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function gwe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(N.NOBR)&&(fA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bwe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function ywe(e,t){e.treeAdapter.getDocumentMode(e.document)!==na.QUIRKS&&e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=J.IN_TABLE}function U$(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Re.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function F$(e){const t=A$(e,ou.TYPE);return t!=null&&t.toLowerCase()===Dve}function xwe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Re.HTML),F$(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Ewe(e,t){e._appendElement(t,Re.HTML),t.ackSelfClosing=!0}function vwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._appendElement(t,Re.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function wwe(e,t){t.tagName=pe.IMG,t.tagID=N.IMG,U$(e,t)}function _we(e,t){e._insertElement(t,Re.HTML),e.skipNextNewLine=!0,e.tokenizer.state=$s.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=J.TEXT}function Swe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,$s.RAWTEXT)}function Nwe(e,t){e.framesetOk=!1,e._switchToTextParsing(t,$s.RAWTEXT)}function a3(e,t){e._switchToTextParsing(t,$s.RAWTEXT)}function Twe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===J.IN_TABLE||e.insertionMode===J.IN_CAPTION||e.insertionMode===J.IN_TABLE_BODY||e.insertionMode===J.IN_ROW||e.insertionMode===J.IN_CELL?J.IN_SELECT_IN_TABLE:J.IN_SELECT}function kwe(e,t){e.openElements.currentTagId===N.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML)}function Awe(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Re.HTML)}function Cwe(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(N.RTC),e._insertElement(t,Re.HTML)}function Iwe(e,t){e._reconstructActiveFormattingElements(),M$(t),dA(t),t.selfClosing?e._appendElement(t,Re.MATHML):e._insertElement(t,Re.MATHML),t.ackSelfClosing=!0}function jwe(e,t){e._reconstructActiveFormattingElements(),L$(t),dA(t),t.selfClosing?e._appendElement(t,Re.SVG):e._insertElement(t,Re.SVG),t.ackSelfClosing=!0}function o3(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML)}function Hi(e,t){switch(t.tagID){case N.I:case N.S:case N.B:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.SMALL:case N.STRIKE:case N.STRONG:{mwe(e,t);break}case N.A:{pwe(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{lwe(e,t);break}case N.P:case N.DL:case N.OL:case N.UL:case N.DIV:case N.DIR:case N.NAV:case N.MAIN:case N.MENU:case N.ASIDE:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.DETAILS:case N.ADDRESS:case N.ARTICLE:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{owe(e,t);break}case N.LI:case N.DD:case N.DT:{dwe(e,t);break}case N.BR:case N.IMG:case N.WBR:case N.AREA:case N.EMBED:case N.KEYGEN:{U$(e,t);break}case N.HR:{vwe(e,t);break}case N.RB:case N.RTC:{Awe(e,t);break}case N.RT:case N.RP:{Cwe(e,t);break}case N.PRE:case N.LISTING:{cwe(e,t);break}case N.XMP:{Swe(e,t);break}case N.SVG:{jwe(e,t);break}case N.HTML:{iwe(e,t);break}case N.BASE:case N.LINK:case N.META:case N.STYLE:case N.TITLE:case N.SCRIPT:case N.BGSOUND:case N.BASEFONT:case N.TEMPLATE:{Va(e,t);break}case N.BODY:{rwe(e,t);break}case N.FORM:{uwe(e,t);break}case N.NOBR:{gwe(e,t);break}case N.MATH:{Iwe(e,t);break}case N.TABLE:{ywe(e,t);break}case N.INPUT:{xwe(e,t);break}case N.PARAM:case N.TRACK:case N.SOURCE:{Ewe(e,t);break}case N.IMAGE:{wwe(e,t);break}case N.BUTTON:{hwe(e,t);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{bwe(e,t);break}case N.IFRAME:{Nwe(e,t);break}case N.SELECT:{Twe(e,t);break}case N.OPTION:case N.OPTGROUP:{kwe(e,t);break}case N.NOEMBED:case N.NOFRAMES:{a3(e,t);break}case N.FRAMESET:{awe(e,t);break}case N.TEXTAREA:{_we(e,t);break}case N.NOSCRIPT:{e.options.scriptingEnabled?a3(e,t):o3(e,t);break}case N.PLAINTEXT:{fwe(e,t);break}case N.COL:case N.TH:case N.TD:case N.TR:case N.HEAD:case N.FRAME:case N.TBODY:case N.TFOOT:case N.THEAD:case N.CAPTION:case N.COLGROUP:break;default:o3(e,t)}}function Rwe(e,t){if(e.openElements.hasInScope(N.BODY)&&(e.insertionMode=J.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Owe(e,t){e.openElements.hasInScope(N.BODY)&&(e.insertionMode=J.AFTER_BODY,X$(e,t))}function Mwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Lwe(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(N.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(N.FORM):n&&e.openElements.remove(n))}function Dwe(e){e.openElements.hasInButtonScope(N.P)||e._insertFakeElement(pe.P,N.P),e._closePElement()}function Pwe(e){e.openElements.hasInListItemScope(N.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(N.LI),e.openElements.popUntilTagNamePopped(N.LI))}function Bwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Uwe(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Fwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function $we(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(pe.BR,N.BR),e.openElements.pop(),e.framesetOk=!1}function $$(e,t){const n=t.tagName,s=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],a=e.openElements.tagIDs[i];if(s===a&&(s!==N.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,a))break}}function eE(e,t){switch(t.tagID){case N.A:case N.B:case N.I:case N.S:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.NOBR:case N.SMALL:case N.STRIKE:case N.STRONG:{fA(e,t);break}case N.P:{Dwe(e);break}case N.DL:case N.UL:case N.OL:case N.DIR:case N.DIV:case N.NAV:case N.PRE:case N.MAIN:case N.MENU:case N.ASIDE:case N.BUTTON:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.ADDRESS:case N.ARTICLE:case N.DETAILS:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.LISTING:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{Mwe(e,t);break}case N.LI:{Pwe(e);break}case N.DD:case N.DT:{Bwe(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{Uwe(e);break}case N.BR:{$we(e);break}case N.BODY:{Rwe(e,t);break}case N.HTML:{Owe(e,t);break}case N.FORM:{Lwe(e);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{Fwe(e,t);break}case N.TEMPLATE:{Pu(e,t);break}default:$$(e,t)}}function H$(e,t){e.tmplInsertionModeStack.length>0?W$(e,t):hA(e,t)}function Hwe(e,t){var n;t.tagID===N.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function zwe(e,t){e._err(t,ve.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Dw(e,t){if(e.openElements.currentTagId!==void 0&&D$.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=J.IN_TABLE_TEXT,t.type){case Ft.CHARACTER:{V$(e,t);break}case Ft.WHITESPACE_CHARACTER:{z$(e,t);break}}else Dg(e,t)}function Vwe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Re.HTML),e.insertionMode=J.IN_CAPTION}function Gwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Re.HTML),e.insertionMode=J.IN_COLUMN_GROUP}function Kwe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(pe.COLGROUP,N.COLGROUP),e.insertionMode=J.IN_COLUMN_GROUP,pA(e,t)}function qwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Re.HTML),e.insertionMode=J.IN_TABLE_BODY}function Ywe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(pe.TBODY,N.TBODY),e.insertionMode=J.IN_TABLE_BODY,tE(e,t)}function Wwe(e,t){e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Xwe(e,t){F$(t)?e._appendElement(t,Re.HTML):Dg(e,t),t.ackSelfClosing=!0}function Qwe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Re.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Ff(e,t){switch(t.tagID){case N.TD:case N.TH:case N.TR:{Ywe(e,t);break}case N.STYLE:case N.SCRIPT:case N.TEMPLATE:{Va(e,t);break}case N.COL:{Kwe(e,t);break}case N.FORM:{Qwe(e,t);break}case N.TABLE:{Wwe(e,t);break}case N.TBODY:case N.TFOOT:case N.THEAD:{qwe(e,t);break}case N.INPUT:{Xwe(e,t);break}case N.CAPTION:{Vwe(e,t);break}case N.COLGROUP:{Gwe(e,t);break}default:Dg(e,t)}}function Xm(e,t){switch(t.tagID){case N.TABLE:{e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode());break}case N.TEMPLATE:{Pu(e,t);break}case N.BODY:case N.CAPTION:case N.COL:case N.COLGROUP:case N.HTML:case N.TBODY:case N.TD:case N.TFOOT:case N.TH:case N.THEAD:case N.TR:break;default:Dg(e,t)}}function Dg(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Jx(e,t),e.fosterParentingEnabled=n}function z$(e,t){e.pendingCharacterTokens.push(t)}function V$(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function np(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===N.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===N.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===N.OPTGROUP&&e.openElements.pop();break}case N.OPTION:{e.openElements.currentTagId===N.OPTION&&e.openElements.pop();break}case N.SELECT:{e.openElements.hasInSelectScope(N.SELECT)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode());break}case N.TEMPLATE:{Pu(e,t);break}}}function s_e(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e._processStartTag(t)):q$(e,t)}function i_e(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Y$(e,t)}function r_e(e,t){switch(t.tagID){case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{Va(e,t);break}case N.CAPTION:case N.COLGROUP:case N.TBODY:case N.TFOOT:case N.THEAD:{e.tmplInsertionModeStack[0]=J.IN_TABLE,e.insertionMode=J.IN_TABLE,Ff(e,t);break}case N.COL:{e.tmplInsertionModeStack[0]=J.IN_COLUMN_GROUP,e.insertionMode=J.IN_COLUMN_GROUP,pA(e,t);break}case N.TR:{e.tmplInsertionModeStack[0]=J.IN_TABLE_BODY,e.insertionMode=J.IN_TABLE_BODY,tE(e,t);break}case N.TD:case N.TH:{e.tmplInsertionModeStack[0]=J.IN_ROW,e.insertionMode=J.IN_ROW,nE(e,t);break}default:e.tmplInsertionModeStack[0]=J.IN_BODY,e.insertionMode=J.IN_BODY,Hi(e,t)}}function a_e(e,t){t.tagID===N.TEMPLATE&&Pu(e,t)}function W$(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):hA(e,t)}function o_e(e,t){t.tagID===N.HTML?Hi(e,t):R1(e,t)}function X$(e,t){var n;if(t.tagID===N.HTML){if(e.fragmentContext||(e.insertionMode=J.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===N.HTML){e._setEndLocation(e.openElements.items[0],t);const s=e.openElements.items[1];s&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(s))===null||n===void 0)&&n.endTag)&&e._setEndLocation(s,t)}}else R1(e,t)}function R1(e,t){e.insertionMode=J.IN_BODY,Jx(e,t)}function l_e(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.FRAMESET:{e._insertElement(t,Re.HTML);break}case N.FRAME:{e._appendElement(t,Re.HTML),t.ackSelfClosing=!0;break}case N.NOFRAMES:{Va(e,t);break}}}function c_e(e,t){t.tagID===N.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==N.FRAMESET&&(e.insertionMode=J.AFTER_FRAMESET))}function u_e(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.NOFRAMES:{Va(e,t);break}}}function d_e(e,t){t.tagID===N.HTML&&(e.insertionMode=J.AFTER_AFTER_FRAMESET)}function f_e(e,t){t.tagID===N.HTML?Hi(e,t):cy(e,t)}function cy(e,t){e.insertionMode=J.IN_BODY,Jx(e,t)}function h_e(e,t){switch(t.tagID){case N.HTML:{Hi(e,t);break}case N.NOFRAMES:{Va(e,t);break}}}function p_e(e,t){t.chars=fs,e._insertCharacters(t)}function m_e(e,t){e._insertCharacters(t),e.framesetOk=!1}function Q$(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Re.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function g_e(e,t){if(jve(t))Q$(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===Re.MATHML?M$(t):s===Re.SVG&&(Rve(t),L$(t)),dA(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0}}function b_e(e,t){if(t.tagID===N.P||t.tagID===N.BR){Q$(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===Re.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(s);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}pe.AREA,pe.BASE,pe.BASEFONT,pe.BGSOUND,pe.BR,pe.COL,pe.EMBED,pe.FRAME,pe.HR,pe.IMG,pe.INPUT,pe.KEYGEN,pe.LINK,pe.META,pe.PARAM,pe.SOURCE,pe.TRACK,pe.WBR;const y_e=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,x_e=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),l3={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Z$(e,t){const n=C_e(e),s=hF("type",{handlers:{root:E_e,element:v_e,text:w_e,comment:eH,doctype:__e,raw:N_e},unknown:T_e}),i={parser:n?new r3(l3):r3.getFragmentParser(void 0,l3),handle(l){s(l,i)},stitches:!1,options:t||{}};s(e,i),hh(i,yo());const r=n?i.parser.document:i.parser.getFragment(),a=IEe(r,{file:i.options.file});return i.stitches&&Mg(a,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function J$(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Ft.CHARACTER,chars:e.value,location:Pg(e)};hh(t,yo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function __e(e,t){const n={type:Ft.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Pg(e)};hh(t,yo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function S_e(e,t){t.stitches=!0;const n=I_e(e);if("children"in e&&"children"in n){const s=Z$({type:"root",children:e.children},t.options);n.children=s.children}eH({type:"comment",value:{stitch:n}},t)}function eH(e,t){const n=e.value,s={type:Ft.COMMENT,data:n,location:Pg(e)};hh(t,yo(e)),t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken)}function N_e(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,tH(t,yo(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(y_e,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function T_e(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))S_e(n,t);else{let s="";throw x_e.has(n.type)&&(s=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+s)}}function hh(e,t){tH(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=$s.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function tH(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function k_e(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===$s.PLAINTEXT)return;hh(t,yo(e));const s=t.parser.openElements.current;let i="namespaceURI"in s?s.namespaceURI:Kc.html;i===Kc.html&&n==="svg"&&(i=Kc.svg);const r=LEe({...e,children:[]},{space:i===Kc.svg?"svg":"html"}),a={type:Ft.START_TAG,tagName:n,tagID:fh(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:Pg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function A_e(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&zEe.includes(n)||t.parser.tokenizer.state===$s.PLAINTEXT)return;hh(t,qx(e));const s={type:Ft.END_TAG,tagName:n,tagID:fh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Pg(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===$s.RCDATA||t.parser.tokenizer.state===$s.RAWTEXT||t.parser.tokenizer.state===$s.SCRIPT_DATA)&&(t.parser.tokenizer.state=$s.DATA)}function C_e(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Pg(e){const t=yo(e)||{line:void 0,column:void 0,offset:void 0},n=qx(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function I_e(e){return"children"in e?Bf({...e,children:[]}):Bf(e)}function j_e(e){return function(t,n){return Z$(t,{...e,file:n})}}const nH=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function sH(e){if(!e)return!1;try{const t=e.toLowerCase();return nH.some(n=>t.includes(n))}catch{return!1}}function R_e(e){var s;const t=(s=e==null?void 0:e.properties)==null?void 0:s.href;if(!t)return!1;if(sH(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return nH.some(r=>i.includes(r))}return!1}function O_e({text:e,className:t,allowRawHtml:n=!0}){const[s,i]=g.useState(null),r=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const b=d(m);if(b)return b}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},l=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(D0e,{remarkPlugins:[Wye],rehypePlugins:n?[j_e,GL]:[GL],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(sH(d)||R_e(c))){const f=d,h=l(c==null?void 0:c.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>i({src:f,title:h}),children:[o.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(nu,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return o.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=o.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?o.jsx(OB,{src:u,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(nu,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=r({src:u},d);return h?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>i({src:h}),children:[o.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(nu,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>i(null),children:o.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||a(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:s.src,download:s.title||a(s.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(yx,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>i(null),children:o.jsx(Oi,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const ph=g.memo(O_e),c3=6,u3=7,M_e={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function IN(e){return M_e[(e||"").trim().toLowerCase()]||"未知"}function d3(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function L_e(e){if(!e)return"";const t=e.trim(),n=Number(t),s=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(s)}function D_e(e){const t=e.replace(/\r\n/g,` +`))}function c(p,m,b,v){const y=b.enter("tableCell"),x=b.enter("phrasing"),E=b.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return Nbe(p,{align:m,alignDelimiters:s,padding:n,stringLength:i})}function d(p,m,b){const v=p.children;let y=-1;const x=[],E=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Cye={tokenize:Pye,partial:!0};function Iye(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Mye,continuation:{tokenize:Lye},exit:Dye}},text:{91:{name:"gfmFootnoteCall",tokenize:Oye},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jye,resolveTo:Rye}}}}function jye(e,t,n){const s=this;let i=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let a;for(;i--;){const c=s.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=Ua(s.sliceSerialize({start:a.end,end:s.now()}));return u.codePointAt(0)!==94||!r.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Rye(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},l=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...l),e}function Oye(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,a;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(r>999||f===93&&!a||f===null||f===91||Un(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Ua(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Un(f)||(a=!0),r++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),r++,u):u(f)}}function Mye(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,a=0,l;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!l||m===null||m===91||Un(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return r=Ua(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Un(m)||(l=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(r)||i.push(r),sn(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Lye(e,t,n){return e.check(Rg,t,e.attempt(Cye,t,n))}function Dye(e){e.exit("gfmFootnoteDefinition")}function Pye(e,t,n){const s=this;return sn(e,i,"gfmFootnoteDefinitionIndent",5);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function Bye(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:i};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const v=a.exit("strikethroughSequenceTemporary"),y=Bf(m);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(m)}}}class Uye{constructor(){this.map=[]}add(t,n,s){Fye(this,t,n,s)}consume(t){if(this.map.sort(function(r,a){return r[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let i=s.pop();for(;i;){for(const r of i)t.push(r);i=s.pop()}this.map.length=0}}function Fye(e,t,n,s){let i=0;if(!(n===0&&s.length===0)){for(;i-1;){const L=s.events[R][1].type;if(L==="lineEnding"||L==="linePrefix")R--;else break}const B=R>-1?s.events[R][1].type:null,z=B==="tableHead"||B==="tableRow"?_:c;return z===_&&s.parser.lazy[s.now().line]?n(j):z(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),u(j)}function u(j){return j===124||(a=!0,r+=1),d(j)}function d(j){return j===null?n(j):pt(j)?r>1?(r=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):qt(j)?sn(e,d,"whitespace")(j):(r+=1,a&&(a=!1,i+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(j)))}function f(j){return j===null||j===124||Un(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?h:f)}function h(j){return j===92||j===124?(e.consume(j),f):f(j)}function p(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),a=!1,qt(j)?sn(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?v(j):j===124?(a=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),b):S(j)}function b(j){return qt(j)?sn(e,v,"whitespace")(j):v(j)}function v(j){return j===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),y):j===45?(r+=1,y(j)):j===null||pt(j)?w(j):S(j)}function y(j){return j===45?(e.enter("tableDelimiterFiller"),x(j)):S(j)}function x(j){return j===45?(e.consume(j),x):j===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(j))}function E(j){return qt(j)?sn(e,w,"whitespace")(j):w(j)}function w(j){return j===124?m(j):j===null||pt(j)?!a||i!==r?S(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):S(j)}function S(j){return n(j)}function _(j){return e.enter("tableRow"),T(j)}function T(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),T):j===null||pt(j)?(e.exit("tableRow"),t(j)):qt(j)?sn(e,T,"whitespace")(j):(e.enter("data"),k(j))}function k(j){return j===null||j===124||Un(j)?(e.exit("data"),T(j)):(e.consume(j),j===92?A:k)}function A(j){return j===92||j===124?(e.consume(j),k):k(j)}}function Vye(e,t){let n=-1,s=!0,i=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new Uye;for(;++nn[2]+1){const m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(r.end=Object.assign({},bd(t.events,i)),e.add(i,0,[["exit",r,t]]),r=void 0),r}function TL(e,t,n,s,i){const r=[],a=bd(t.events,n);i&&(i.end=Object.assign({},a),r.push(["exit",i,t])),s.end=Object.assign({},a),r.push(["exit",s,t]),e.add(n+1,0,r)}function bd(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const Gye={name:"tasklistCheck",tokenize:qye};function Kye(){return{text:{91:Gye}}}function qye(e,t,n){const s=this;return i;function i(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return Un(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return pt(c)?t(c):qt(c)?e.check({tokenize:Yye},t,n)(c):n(c)}}function Yye(e,t,n){return sn(e,s,"whitespace");function s(i){return i===null?n(i):t(i)}}function Wye(e){return $7([Eye(),Iye(),Bye(e),Hye(),Kye()])}const Xye={};function Qye(e){const t=this,n=e||Xye,s=t.data(),i=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),a=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);i.push(Wye(n)),r.push(gye()),a.push(bye(n))}const kL=function(e,t,n){const s=Og(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` +`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function MF(e,t,n){return e.type==="element"?r1e(e,t,n):e.type==="text"?n.whitespace==="normal"?LF(e,n):a1e(e):[]}function r1e(e,t,n){const s=DF(e,n),i=e.children||[];let r=-1,a=[];if(s1e(e))return a;let l,c;for(SN(e)||jL(e)&&kL(t,e,jL)?c=` +`:n1e(e)?(l=2,c=2):OF(e)&&(l=1,c=1);++r]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:_.concat([{begin:/\(/,end:/\)/,keywords:w,contains:_.concat(["self"]),relevance:0}]),relevance:0},k={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function h1e(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=f1e(e),s=n.keywords;return s.type=[...s.type,...t.type],s.literal=[...s.literal,...t.literal],s.built_in=[...s.built_in,...t.built_in],s._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function PF(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:v,built_in:[...x,...E,"set","shopt",...w,...S]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function p1e(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",v={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:v,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function m1e(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:_.concat([{begin:/\(/,end:/\)/,keywords:w,contains:_.concat(["self"]),relevance:0}]),relevance:0},k={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function g1e(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],s=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],r=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:i.concat(r),built_in:t,literal:s},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const b1e=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),y1e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],x1e=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],E1e=[...y1e,...x1e],v1e=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),w1e=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_1e=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),S1e=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function N1e(e){const t=e.regex,n=b1e(e),s={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",r=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,s,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+w1e.join("|")+")"},{begin:":(:)?("+_1e.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+S1e.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:r},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:v1e.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+E1e.join("|")+")\\b"}]}}function T1e(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function k1e(e){const r={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:r,illegal:"UF(e,t,n-1))}function C1e(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",s=n+UF("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+s+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,RL,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},RL,u]}}const OL="[A-Za-z$_][0-9A-Za-z$_]*",I1e=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],j1e=["true","false","null","undefined","NaN","Infinity"],FF=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],$F=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],HF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],R1e=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],O1e=[].concat(HF,FF,$F);function zF(e){const t=e.regex,n=(D,{after:$})=>{const O="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(D,$)=>{const O=D[0].length+D.index,ne=D.input[O];if(ne==="<"||ne===","){$.ignoreMatch();return}ne===">"&&(n(D,{after:O})||$.ignoreMatch());let se;const P=D.input.substring(O);if(se=P.match(/^\s*=/)){$.ignoreMatch();return}if((se=P.match(/^\s+extends\s+/))&&se.index===0){$.ignoreMatch();return}}},l={$pattern:OL,keyword:I1e,literal:j1e,built_in:O1e,"variable.language":R1e},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},T={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},k={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...FF,...$F]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},R={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(D){return t.concat("(?!",D.join("|"),")")}const z={match:t.concat(/\b/,B([...HF,"super","import"].map(D=>`${D}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:s+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},z,R,T,F,{match:/\$[(.]/}]}}function VF(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],i={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var xd="[0-9](_*[0-9])*",lb=`\\.(${xd})`,cb="[0-9a-fA-F](_*[0-9a-fA-F])*",M1e={className:"number",variants:[{begin:`(\\b(${xd})((${lb})|\\.)?|(${lb}))[eE][+-]?(${xd})[fFdD]?\\b`},{begin:`\\b(${xd})((${lb})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${lb})[fFdD]?\\b`},{begin:`\\b(${xd})[fFdD]\\b`},{begin:`\\b0[xX]((${cb})\\.?|(${cb})?\\.(${cb}))[pP][+-]?(${xd})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cb})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function L1e(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},s={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},r={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[r,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,i]}]};i.contains.push(a);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=M1e,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,s,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const D1e=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),P1e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],B1e=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],U1e=[...P1e,...B1e],F1e=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),GF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),KF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),$1e=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),H1e=GF.concat(KF).sort().reverse();function z1e(e){const t=D1e(e),n=H1e,s="and or not only",i="[\\w-]+",r="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,S){return{className:E,begin:w,relevance:S}},d={$pattern:/[a-z-]+/,keyword:s,attribute:F1e.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$1e.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+U1e.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",r,0),u("selector-id","#"+r),u("selector-class","\\."+r,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+GF.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+KF.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function V1e(e){const t="\\[=*\\[",n="\\]=*\\]",s={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[s],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[s],relevance:5}])}}function qF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},r={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,r,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,s,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function G1e(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function K1e(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],s=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,r,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,s)},p=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,s),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return r.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function q1e(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,s=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),r=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+s},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(L,F)=>{F.data._beginMatch=L[1]||L[2]},"on:end":(L,F)=>{F.data._beginMatch!==L[1]&&F.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,m={scope:"string",variants:[d,u,f,h]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],x=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],w={keyword:y,literal:(L=>{const F=[];return L.forEach(C=>{F.push(C),C.toLowerCase()===C?F.push(C.toUpperCase()):F.push(C.toLowerCase())}),F})(v),built_in:x},S=L=>L.map(F=>F.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",S(x).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(s,"\\b(?!\\()"),k={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:t.concat(s,t.lookahead(":"),t.lookahead(/(?!::)/))},j={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[A,a,k,e.C_BLOCK_COMMENT_MODE,m,b,_]},R={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(x).join("\\b|"),"\\b)"),s,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[j]};j.contains.push(R);const B=[A,k,e.C_BLOCK_COMMENT_MODE,m,b,_],z={begin:t.concat(/#\[\s*\\?/,t.either(i,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...B]},...B,{scope:"meta",variants:[{match:i},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[z,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},a,R,k,{match:[/const/,/\s/,s],scope:{1:"keyword",3:"variable.constant"}},_,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:w,contains:["self",z,a,k,e.C_BLOCK_COMMENT_MODE,m,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,b]}}function Y1e(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function W1e(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function WF(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${s.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,y,f]}]}}function X1e(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Q1e(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,s=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,s]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,s]},{scope:{1:"punctuation",2:"number"},match:[r,s]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,s]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Z1e(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(s,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},_=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:s,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=_,b.contains=_;const j=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:_}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(j).concat(u).concat(_)}}function J1e(e){const t=e.regex,n=/(r#)?/,s=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),r={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},illegal:""},r]}}const exe=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),txe=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],nxe=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],sxe=[...txe,...nxe],ixe=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),rxe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),axe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),oxe=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function lxe(e){const t=exe(e),n=axe,s=rxe,i="@[a-z-]+",r="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+sxe.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+s.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oxe.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:ixe.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function cxe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function uxe(e){const t=e.regex,n=e.COMMENT("--","$"),s={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},r=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(S){return t.concat(/\b/,t.either(...S.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(S,{exceptions:_,when:T}={}){const k=T;return _=_||[],S.map(A=>A.match(/\|\d+$/)||_.includes(A)?A:k(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:S=>S.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,b,s,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function XF(e){return e?typeof e=="string"?e:e.source:null}function ep(e){return In("(?=",e,")")}function In(...e){return e.map(n=>XF(n)).join("")}function dxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Zi(...e){return"("+(dxe(e).capture?"":"?:")+e.map(s=>XF(s)).join("|")+")"}const iA=e=>In(/\b/,e,/\w$/.test(e)?/\b/:/\B/),fxe=["Protocol","Type"].map(iA),ML=["init","self"].map(iA),hxe=["Any","Self"],Rw=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],LL=["false","nil","true"],pxe=["assignment","associativity","higherThan","left","lowerThan","none","right"],mxe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],DL=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],QF=Zi(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ZF=Zi(QF,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ow=In(QF,ZF,"*"),JF=Zi(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),k1=Zi(JF,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),to=In(JF,k1,"*"),ub=In(/[A-Z]/,k1,"*"),gxe=["attached","autoclosure",In(/convention\(/,Zi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",In(/objc\(/,to,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],bxe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function yxe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),s=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Zi(...fxe,...ML)],className:{2:"keyword"}},r={match:In(/\./,Zi(...Rw)),relevance:0},a=Rw.filter(ae=>typeof ae=="string").concat(["_|0"]),l=Rw.filter(ae=>typeof ae!="string").concat(hxe).map(iA),c={variants:[{className:"keyword",match:Zi(...l,...ML)}]},u={$pattern:Zi(/\b\w+/,/#\w+/),keyword:a.concat(mxe),literal:LL},d=[i,r,c],f={match:In(/\./,Zi(...DL)),relevance:0},h={className:"built_in",match:In(/\b/,Zi(...DL),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:Ow},{match:`\\.(\\.|${ZF})+`}]},v=[m,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(ae="")=>({className:"subst",variants:[{match:In(/\\/,ae,/[0\\tnr"']/)},{match:In(/\\/,ae,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(ae="")=>({className:"subst",match:In(/\\/,ae,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(ae="")=>({className:"subst",label:"interpol",begin:In(/\\/,ae,/\(/),end:/\)/}),T=(ae="")=>({begin:In(ae,/"""/),end:In(/"""/,ae),contains:[w(ae),S(ae),_(ae)]}),k=(ae="")=>({begin:In(ae,/"/),end:In(/"/,ae),contains:[w(ae),_(ae)]}),A={className:"string",variants:[T(),T("#"),T("##"),T("###"),k(),k("#"),k("##"),k("###")]},j=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],R={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:j},B=ae=>{const me=In(ae,/\//),we=In(/\//,ae);return{begin:me,end:we,contains:[...j,{scope:"comment",begin:`#(?!.*${we})`,end:/$/}]}},z={scope:"regexp",variants:[B("###"),B("##"),B("#"),R]},L={match:In(/`/,to,/`/)},F={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${k1}+`},I=[L,F,C],D={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:bxe,contains:[...v,E,A]}]}},$={scope:"keyword",match:In(/@/,Zi(...gxe),ep(Zi(/\(/,/\s+/)))},O={scope:"meta",match:In(/@/,to)},ne=[D,$,O],se={match:ep(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:In(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,k1,"+")},{className:"type",match:ub,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:In(/\s+&\s+/,ep(ub)),relevance:0}]},P={begin://,keywords:u,contains:[...s,...d,...ne,m,se]};se.contains.push(P);const Z={match:In(to,/\s*:/),keywords:"_|0",relevance:0},te={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",Z,...s,z,...d,...p,...v,E,A,...I,...ne,se]},V={begin://,keywords:"repeat each",contains:[...s,se]},Q={begin:Zi(ep(In(to,/\s*:/)),ep(In(to,/\s+/,to,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:to}]},K={begin:/\(/,end:/\)/,keywords:u,contains:[Q,...s,...d,...v,E,A,...ne,se,te],endsParent:!0,illegal:/["']/},ce={match:[/(func|macro)/,/\s+/,Zi(L.match,to,Ow)],className:{1:"keyword",3:"title.function"},contains:[V,K,t],illegal:[/\[/,/%/]},he={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[V,K,t],illegal:/\[|%/},ge={match:[/operator/,/\s+/,Ow],className:{1:"keyword",3:"title"}},ue={begin:[/precedencegroup/,/\s+/,ub],className:{1:"keyword",3:"title"},contains:[se],keywords:[...pxe,...LL],end:/}/},ve={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Se={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,to,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[V,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ub},...d],relevance:0}]};for(const ae of A.variants){const me=ae.contains.find(et=>et.label==="interpol");me.keywords=u;const we=[...d,...p,...v,E,A,...I];me.contains=[...we,{begin:/\(/,end:/\)/,contains:["self",...we]}]}return{name:"Swift",keywords:u,contains:[...s,ce,he,ve,Me,Se,ge,ue,{beginKeywords:"import",end:/$/,contains:[...s],relevance:0},z,...d,...p,...v,E,A,...I,...ne,se,te]}}const A1="[A-Za-z$_][0-9A-Za-z$_]*",e$=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],t$=["true","false","null","undefined","NaN","Infinity"],n$=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s$=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],i$=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],r$=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],a$=[].concat(i$,n$,s$);function xxe(e){const t=e.regex,n=(D,{after:$})=>{const O="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(D,$)=>{const O=D[0].length+D.index,ne=D.input[O];if(ne==="<"||ne===","){$.ignoreMatch();return}ne===">"&&(n(D,{after:O})||$.ignoreMatch());let se;const P=D.input.substring(O);if(se=P.match(/^\s*=/)){$.ignoreMatch();return}if((se=P.match(/^\s+extends\s+/))&&se.index===0){$.ignoreMatch();return}}},l={$pattern:A1,keyword:e$,literal:t$,built_in:a$,"variable.language":r$},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},T={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},k={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n$,...s$]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},R={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(D){return t.concat("(?!",D.join("|"),")")}const z={match:t.concat(/\b/,B([...i$,"super","import"].map(D=>`${D}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:s+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},z,R,T,F,{match:/\$[(.]/}]}}function o$(e){const t=e.regex,n=xxe(e),s=A1,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],r={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:A1,keyword:e$.concat(c),literal:t$,built_in:a$.concat(i),"variable.language":r$},d={className:"meta",begin:"@"+s},f=(b,v,y)=>{const x=b.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),p=Object.assign({},h,{match:t.concat(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,r,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const m=n.contains.find(b=>b.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Exe(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},s={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,i),/ +/,t.either(a,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,s,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function vxe(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),s=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},r={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:s},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function wxe(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(r,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[r,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[r,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function l$(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},r={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},l=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},v=[s,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,b,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const _xe={arduino:h1e,bash:PF,c:p1e,cpp:m1e,csharp:g1e,css:N1e,diff:T1e,go:k1e,graphql:A1e,ini:BF,java:C1e,javascript:zF,json:VF,kotlin:L1e,less:z1e,lua:V1e,makefile:qF,markdown:YF,objectivec:G1e,perl:K1e,php:q1e,"php-template":Y1e,plaintext:W1e,python:WF,"python-repl":X1e,r:Q1e,ruby:Z1e,rust:J1e,scss:lxe,shell:cxe,sql:uxe,swift:yxe,typescript:o$,vbnet:Exe,wasm:vxe,xml:wxe,yaml:l$};function c$(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&c$(n)}),e}let PL=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function u$(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Gl(e,...t){const n=Object.create(null);for(const s in e)n[s]=e[s];return t.forEach(function(s){for(const i in s)n[i]=s[i]}),n}const Sxe="",BL=e=>!!e.scope,Nxe=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class Txe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=u$(t)}openNode(t){if(!BL(t))return;const n=Nxe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){BL(t)&&(this.buffer+=Sxe)}value(){return this.buffer}span(t){this.buffer+=``}}const UL=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class rA{constructor(){this.rootNode=UL(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=UL({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(s=>this._walk(t,s)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{rA._collapse(n)}))}}class kxe extends rA{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const s=t.root;n&&(s.scope=`language:${n}`),this.add(s)}toHTML(){return new Txe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Ym(e){return e?typeof e=="string"?e:e.source:null}function d$(e){return Pu("(?=",e,")")}function Axe(e){return Pu("(?:",e,")*")}function Cxe(e){return Pu("(?:",e,")?")}function Pu(...e){return e.map(n=>Ym(n)).join("")}function Ixe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function aA(...e){return"("+(Ixe(e).capture?"":"?:")+e.map(s=>Ym(s)).join("|")+")"}function f$(e){return new RegExp(e.toString()+"|").exec("").length-1}function jxe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Rxe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function oA(e,{joinWith:t}){let n=0;return e.map(s=>{n+=1;const i=n;let r=Ym(s),a="";for(;r.length>0;){const l=Rxe.exec(r);if(!l){a+=r;break}a+=r.substring(0,l.index),r=r.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(s=>`(${s})`).join(t)}const Oxe=/\b\B/,h$="[a-zA-Z]\\w*",lA="[a-zA-Z_]\\w*",p$="\\b\\d+(\\.\\d+)?",m$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",g$="\\b(0b[01]+)",Mxe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Lxe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Pu(t,/.*\b/,e.binary,/\b.*/)),Gl({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,s)=>{n.index!==0&&s.ignoreMatch()}},e)},Wm={begin:"\\\\[\\s\\S]",relevance:0},Dxe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Wm]},Pxe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Wm]},Bxe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Zx=function(e,t,n={}){const s=Gl({scope:"comment",begin:e,end:t,contains:[]},n);s.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=aA("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return s.contains.push({begin:Pu(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},Uxe=Zx("//","$"),Fxe=Zx("/\\*","\\*/"),$xe=Zx("#","$"),Hxe={scope:"number",begin:p$,relevance:0},zxe={scope:"number",begin:m$,relevance:0},Vxe={scope:"number",begin:g$,relevance:0},Gxe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Wm,{begin:/\[/,end:/\]/,relevance:0,contains:[Wm]}]},Kxe={scope:"title",begin:h$,relevance:0},qxe={scope:"title",begin:lA,relevance:0},Yxe={begin:"\\.\\s*"+lA,relevance:0},Wxe=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var db=Object.freeze({__proto__:null,APOS_STRING_MODE:Dxe,BACKSLASH_ESCAPE:Wm,BINARY_NUMBER_MODE:Vxe,BINARY_NUMBER_RE:g$,COMMENT:Zx,C_BLOCK_COMMENT_MODE:Fxe,C_LINE_COMMENT_MODE:Uxe,C_NUMBER_MODE:zxe,C_NUMBER_RE:m$,END_SAME_AS_BEGIN:Wxe,HASH_COMMENT_MODE:$xe,IDENT_RE:h$,MATCH_NOTHING_RE:Oxe,METHOD_GUARD:Yxe,NUMBER_MODE:Hxe,NUMBER_RE:p$,PHRASAL_WORDS_MODE:Bxe,QUOTE_STRING_MODE:Pxe,REGEXP_MODE:Gxe,RE_STARTERS_RE:Mxe,SHEBANG:Lxe,TITLE_MODE:Kxe,UNDERSCORE_IDENT_RE:lA,UNDERSCORE_TITLE_MODE:qxe});function Xxe(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Qxe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Zxe(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Xxe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Jxe(e,t){Array.isArray(e.illegal)&&(e.illegal=aA(...e.illegal))}function eEe(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function tEe(e,t){e.relevance===void 0&&(e.relevance=1)}const nEe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(s=>{delete e[s]}),e.keywords=n.keywords,e.begin=Pu(n.beforeMatch,d$(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},sEe=["of","and","for","in","not","or","if","then","parent","list","value"],iEe="keyword";function b$(e,t,n=iEe){const s=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(r){Object.assign(s,b$(e[r],t,r))}),s;function i(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");s[c[0]]=[r,rEe(c[0],c[1])]})}}function rEe(e,t){return t?Number(t):aEe(e)?0:1}function aEe(e){return sEe.includes(e.toLowerCase())}const FL={},ou=e=>{console.error(e)},$L=(e,...t)=>{console.log(`WARN: ${e}`,...t)},sd=(e,t)=>{FL[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),FL[`${e}/${t}`]=!0)},C1=new Error;function y$(e,t,{key:n}){let s=0;const i=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+s]=i[l],r[l+s]=!0,s+=f$(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function oEe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ou("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),C1;if(typeof e.beginScope!="object"||e.beginScope===null)throw ou("beginScope must be object"),C1;y$(e,e.begin,{key:"beginScope"}),e.begin=oA(e.begin,{joinWith:""})}}function lEe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ou("skip, excludeEnd, returnEnd not compatible with endScope: {}"),C1;if(typeof e.endScope!="object"||e.endScope===null)throw ou("endScope must be object"),C1;y$(e,e.end,{key:"endScope"}),e.end=oA(e.end,{joinWith:""})}}function cEe(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function uEe(e){cEe(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),oEe(e),lEe(e)}function dEe(e){function t(a,l){return new RegExp(Ym(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=f$(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(oA(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new s;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function r(a,l){const c=a;if(a.isCompiled)return c;[Qxe,eEe,uEe,nEe].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[Zxe,Jxe,tEe].forEach(d=>d(a,l)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=b$(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Ym(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return fEe(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=i(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Gl(e.classNameAliases||{}),r(e)}function x$(e){return e?e.endsWithParent||x$(e.starts):!1}function fEe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Gl(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:x$(e)?Gl(e,{starts:e.starts?Gl(e.starts):null}):Object.isFrozen(e)?Gl(e):e}var hEe="11.11.1";class pEe extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Mw=u$,HL=Gl,zL=Symbol("nomatch"),mEe=7,E$=function(e){const t=Object.create(null),n=Object.create(null),s=[];let i=!0;const r="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:kxe};function c(C){return l.noHighlightRe.test(C)}function u(C){let I=C.className+" ";I+=C.parentNode?C.parentNode.className:"";const D=l.languageDetectRe.exec(I);if(D){const $=k(D[1]);return $||($L(r.replace("{}",D[1])),$L("Falling back to no-highlight mode for this block.",C)),$?D[1]:"no-highlight"}return I.split(/\s+/).find($=>c($)||k($))}function d(C,I,D){let $="",O="";typeof I=="object"?($=C,D=I.ignoreIllegals,O=I.language):(sd("10.7.0","highlight(lang, code, ...args) has been deprecated."),sd("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),O=C,$=I),D===void 0&&(D=!0);const ne={code:$,language:O};L("before:highlight",ne);const se=ne.result?ne.result:f(ne.language,ne.code,D);return se.code=ne.code,L("after:highlight",se),se}function f(C,I,D,$){const O=Object.create(null);function ne(X,oe){return X.keywords[oe]}function se(){if(!we.keywords){De.addText(Ue);return}let X=0;we.keywordPatternRe.lastIndex=0;let oe=we.keywordPatternRe.exec(Ue),J="";for(;oe;){J+=Ue.substring(X,oe.index);const xe=Se.case_insensitive?oe[0].toLowerCase():oe[0],Oe=ne(we,xe);if(Oe){const[lt,Mt]=Oe;if(De.addText(J),J="",O[xe]=(O[xe]||0)+1,O[xe]<=mEe&&(Ye+=Mt),lt.startsWith("_"))J+=oe[0];else{const ut=Se.classNameAliases[lt]||lt;te(oe[0],ut)}}else J+=oe[0];X=we.keywordPatternRe.lastIndex,oe=we.keywordPatternRe.exec(Ue)}J+=Ue.substring(X),De.addText(J)}function P(){if(Ue==="")return;let X=null;if(typeof we.subLanguage=="string"){if(!t[we.subLanguage]){De.addText(Ue);return}X=f(we.subLanguage,Ue,!0,et[we.subLanguage]),et[we.subLanguage]=X._top}else X=p(Ue,we.subLanguage.length?we.subLanguage:null);we.relevance>0&&(Ye+=X.relevance),De.__addSublanguage(X._emitter,X.language)}function Z(){we.subLanguage!=null?P():se(),Ue=""}function te(X,oe){X!==""&&(De.startScope(oe),De.addText(X),De.endScope())}function V(X,oe){let J=1;const xe=oe.length-1;for(;J<=xe;){if(!X._emit[J]){J++;continue}const Oe=Se.classNameAliases[X[J]]||X[J],lt=oe[J];Oe?te(lt,Oe):(Ue=lt,se(),Ue=""),J++}}function Q(X,oe){return X.scope&&typeof X.scope=="string"&&De.openNode(Se.classNameAliases[X.scope]||X.scope),X.beginScope&&(X.beginScope._wrap?(te(Ue,Se.classNameAliases[X.beginScope._wrap]||X.beginScope._wrap),Ue=""):X.beginScope._multi&&(V(X.beginScope,oe),Ue="")),we=Object.create(X,{parent:{value:we}}),we}function K(X,oe,J){let xe=jxe(X.endRe,J);if(xe){if(X["on:end"]){const Oe=new PL(X);X["on:end"](oe,Oe),Oe.isMatchIgnored&&(xe=!1)}if(xe){for(;X.endsParent&&X.parent;)X=X.parent;return X}}if(X.endsWithParent)return K(X.parent,oe,J)}function ce(X){return we.matcher.regexIndex===0?(Ue+=X[0],1):(Be=!0,0)}function he(X){const oe=X[0],J=X.rule,xe=new PL(J),Oe=[J.__beforeBegin,J["on:begin"]];for(const lt of Oe)if(lt&&(lt(X,xe),xe.isMatchIgnored))return ce(oe);return J.skip?Ue+=oe:(J.excludeBegin&&(Ue+=oe),Z(),!J.returnBegin&&!J.excludeBegin&&(Ue=oe)),Q(J,X),J.returnBegin?0:oe.length}function ge(X){const oe=X[0],J=I.substring(X.index),xe=K(we,X,J);if(!xe)return zL;const Oe=we;we.endScope&&we.endScope._wrap?(Z(),te(oe,we.endScope._wrap)):we.endScope&&we.endScope._multi?(Z(),V(we.endScope,X)):Oe.skip?Ue+=oe:(Oe.returnEnd||Oe.excludeEnd||(Ue+=oe),Z(),Oe.excludeEnd&&(Ue=oe));do we.scope&&De.closeNode(),!we.skip&&!we.subLanguage&&(Ye+=we.relevance),we=we.parent;while(we!==xe.parent);return xe.starts&&Q(xe.starts,X),Oe.returnEnd?0:oe.length}function ue(){const X=[];for(let oe=we;oe!==Se;oe=oe.parent)oe.scope&&X.unshift(oe.scope);X.forEach(oe=>De.openNode(oe))}let ve={};function Me(X,oe){const J=oe&&oe[0];if(Ue+=X,J==null)return Z(),0;if(ve.type==="begin"&&oe.type==="end"&&ve.index===oe.index&&J===""){if(Ue+=I.slice(oe.index,oe.index+1),!i){const xe=new Error(`0 width match regex (${C})`);throw xe.languageName=C,xe.badRule=ve.rule,xe}return 1}if(ve=oe,oe.type==="begin")return he(oe);if(oe.type==="illegal"&&!D){const xe=new Error('Illegal lexeme "'+J+'" for mode "'+(we.scope||"")+'"');throw xe.mode=we,xe}else if(oe.type==="end"){const xe=ge(oe);if(xe!==zL)return xe}if(oe.type==="illegal"&&J==="")return Ue+=` +`,1;if(ze>1e5&&ze>oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ue+=J,J.length}const Se=k(C);if(!Se)throw ou(r.replace("{}",C)),new Error('Unknown language: "'+C+'"');const ae=dEe(Se);let me="",we=$||ae;const et={},De=new l.__emitter(l);ue();let Ue="",Ye=0,Ae=0,ze=0,Be=!1;try{if(Se.__emitTokens)Se.__emitTokens(I,De);else{for(we.matcher.considerAll();;){ze++,Be?Be=!1:we.matcher.considerAll(),we.matcher.lastIndex=Ae;const X=we.matcher.exec(I);if(!X)break;const oe=I.substring(Ae,X.index),J=Me(oe,X);Ae=X.index+J}Me(I.substring(Ae))}return De.finalize(),me=De.toHTML(),{language:C,value:me,relevance:Ye,illegal:!1,_emitter:De,_top:we}}catch(X){if(X.message&&X.message.includes("Illegal"))return{language:C,value:Mw(I),illegal:!0,relevance:0,_illegalBy:{message:X.message,index:Ae,context:I.slice(Ae-100,Ae+100),mode:X.mode,resultSoFar:me},_emitter:De};if(i)return{language:C,value:Mw(I),illegal:!1,relevance:0,errorRaised:X,_emitter:De,_top:we};throw X}}function h(C){const I={value:Mw(C),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return I._emitter.addText(C),I}function p(C,I){I=I||l.languages||Object.keys(t);const D=h(C),$=I.filter(k).filter(j).map(Z=>f(Z,C,!1));$.unshift(D);const O=$.sort((Z,te)=>{if(Z.relevance!==te.relevance)return te.relevance-Z.relevance;if(Z.language&&te.language){if(k(Z.language).supersetOf===te.language)return 1;if(k(te.language).supersetOf===Z.language)return-1}return 0}),[ne,se]=O,P=ne;return P.secondBest=se,P}function m(C,I,D){const $=I&&n[I]||D;C.classList.add("hljs"),C.classList.add(`language-${$}`)}function b(C){let I=null;const D=u(C);if(c(D))return;if(L("before:highlightElement",{el:C,language:D}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),l.throwUnescapedHTML))throw new pEe("One of your code blocks includes unescaped HTML.",C.innerHTML);I=C;const $=I.textContent,O=D?d($,{language:D,ignoreIllegals:!0}):p($);C.innerHTML=O.value,C.dataset.highlighted="yes",m(C,D,O.language),C.result={language:O.language,re:O.relevance,relevance:O.relevance},O.secondBest&&(C.secondBest={language:O.secondBest.language,relevance:O.secondBest.relevance}),L("after:highlightElement",{el:C,result:O,text:$})}function v(C){l=HL(l,C)}const y=()=>{w(),sd("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),sd("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function C(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",C,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(C,I){let D=null;try{D=I(e)}catch($){if(ou("Language definition for '{}' could not be registered.".replace("{}",C)),i)ou($);else throw $;D=a}D.name||(D.name=C),t[C]=D,D.rawDefinition=I.bind(null,e),D.aliases&&A(D.aliases,{languageName:C})}function _(C){delete t[C];for(const I of Object.keys(n))n[I]===C&&delete n[I]}function T(){return Object.keys(t)}function k(C){return C=(C||"").toLowerCase(),t[C]||t[n[C]]}function A(C,{languageName:I}){typeof C=="string"&&(C=[C]),C.forEach(D=>{n[D.toLowerCase()]=I})}function j(C){const I=k(C);return I&&!I.disableAutodetect}function R(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=I=>{C["before:highlightBlock"](Object.assign({block:I.el},I))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=I=>{C["after:highlightBlock"](Object.assign({block:I.el},I))})}function B(C){R(C),s.push(C)}function z(C){const I=s.indexOf(C);I!==-1&&s.splice(I,1)}function L(C,I){const D=C;s.forEach(function($){$[D]&&$[D](I)})}function F(C){return sd("10.7.0","highlightBlock will be removed entirely in v12.0"),sd("10.7.0","Please use highlightElement now."),b(C)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:b,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:S,unregisterLanguage:_,listLanguages:T,getLanguage:k,registerAliases:A,autoDetection:j,inherit:HL,addPlugin:B,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=hEe,e.regex={concat:Pu,lookahead:d$,either:aA,optional:Cxe,anyNumberOfTimes:Axe};for(const C in db)typeof db[C]=="object"&&c$(db[C]);return Object.assign(e,db),e},Ff=E$({});Ff.newInstance=()=>E$({});var gEe=Ff;Ff.HighlightJS=Ff;Ff.default=Ff;const br=Kf(gEe),VL={},bEe="hljs-";function yEe(e){const t=br.newInstance();return e&&r(e),{highlight:n,highlightAuto:s,listLanguages:i,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||VL,h=typeof f.prefix=="string"?f.prefix:bEe;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:xEe,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,b=m.data;return b.language=p.language,b.relevance=p.relevance,m}function s(c,u){const f=(u||VL).subset||i();let h=-1,p=0,m;for(;++hp&&(p=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function r(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class xEe{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],s=n.children[n.children.length-1];s&&s.type==="text"?s.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const s=this.stack[this.stack.length-1],i=t.root.children;n?s.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):s.children.push(...i)}openNode(t){const n=this,s=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:s},children:[]};i.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const EEe={};function GL(e){const t=e||EEe,n=t.aliases,s=t.detect||!1,i=t.languages||_xe,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=yEe(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){Mg(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const b=vEe(h);if(b===!1||!b&&!s||b&&r&&r.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=i1e(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(b&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function vEe(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let s;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=YL(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>r)return{line:a+1,column:r-(a>0?n[a-1]:0)+1,offset:r};a++}}}function i(r){if(r&&typeof r.line=="number"&&typeof r.column=="number"&&!Number.isNaN(r.line)&&!Number.isNaN(r.column)){for(;n.length1?n[r.line-2]:0)+r.column-1;if(a=55296&&e<=57343}function qEe(e){return e>=56320&&e<=57343}function YEe(e,t){return(e-55296)*1024+9216+t}function T$(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function k$(e){return e>=64976&&e<=65007||KEe.has(e)}var Ee;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(Ee||(Ee={}));const WEe=65536;class XEe{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=WEe,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:s,col:i,offset:r}=this,a=i+n,l=r+n;return{code:t,startLine:s,endLine:s,startCol:a,endCol:a,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(qEe(n))return this.pos++,this._addGap(),YEe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(Ee.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let s=0;s=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;const s=this.html.charCodeAt(n);return s===G.CARRIAGE_RETURN?G.LINE_FEED:s}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let t=this.html.charCodeAt(this.pos);return t===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):t===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,N$(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===G.LINE_FEED||t===G.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){T$(t)?this._err(Ee.controlCharacterInInputStream):k$(t)&&this._err(Ee.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const QEe=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),ZEe=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function JEe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=ZEe.get(e))!==null&&t!==void 0?t:e}var Ei;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Ei||(Ei={}));const eve=32;var Kl;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Kl||(Kl={}));function TN(e){return e>=Ei.ZERO&&e<=Ei.NINE}function tve(e){return e>=Ei.UPPER_A&&e<=Ei.UPPER_F||e>=Ei.LOWER_A&&e<=Ei.LOWER_F}function nve(e){return e>=Ei.UPPER_A&&e<=Ei.UPPER_Z||e>=Ei.LOWER_A&&e<=Ei.LOWER_Z||TN(e)}function sve(e){return e===Ei.EQUALS||nve(e)}var gi;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(gi||(gi={}));var zo;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(zo||(zo={}));class ive{constructor(t,n,s){this.decodeTree=t,this.emitCodePoint=n,this.errors=s,this.state=gi.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=zo.Strict}startEntity(t){this.decodeMode=t,this.state=gi.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case gi.EntityStart:return t.charCodeAt(n)===Ei.NUM?(this.state=gi.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=gi.NamedEntity,this.stateNamedEntity(t,n));case gi.NumericStart:return this.stateNumericStart(t,n);case gi.NumericDecimal:return this.stateNumericDecimal(t,n);case gi.NumericHex:return this.stateNumericHex(t,n);case gi.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|eve)===Ei.LOWER_X?(this.state=gi.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=gi.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,s,i){if(n!==s){const r=s-n;this.result=this.result*Math.pow(i,r)+Number.parseInt(t.substr(n,r),i),this.consumed+=r}}stateNumericHex(t,n){const s=n;for(;n>14;for(;n>14,r!==0){if(a===Ei.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==zo.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:s}=this,i=(s[n]&Kl.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,s){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Kl.VALUE_LENGTH:i[t+1],s),n===3&&this.emitCodePoint(i[t+2],s),s}end(){var t;switch(this.state){case gi.NamedEntity:return this.result!==0&&(this.decodeMode!==zo.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case gi.NumericDecimal:return this.emitNumericEntity(0,2);case gi.NumericHex:return this.emitNumericEntity(0,3);case gi.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case gi.EntityStart:return 0}}}function rve(e,t,n,s){const i=(t&Kl.BRANCH_LENGTH)>>7,r=t&Kl.JUMP_TABLE;if(i===0)return r!==0&&s===r?n:-1;if(r){const c=s-r;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(us)l=c-1;else return e[c+i]}return-1}var je;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(je||(je={}));var lu;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(lu||(lu={}));var sa;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(sa||(sa={}));var pe;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(pe||(pe={}));var N;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(N||(N={}));const ave=new Map([[pe.A,N.A],[pe.ADDRESS,N.ADDRESS],[pe.ANNOTATION_XML,N.ANNOTATION_XML],[pe.APPLET,N.APPLET],[pe.AREA,N.AREA],[pe.ARTICLE,N.ARTICLE],[pe.ASIDE,N.ASIDE],[pe.B,N.B],[pe.BASE,N.BASE],[pe.BASEFONT,N.BASEFONT],[pe.BGSOUND,N.BGSOUND],[pe.BIG,N.BIG],[pe.BLOCKQUOTE,N.BLOCKQUOTE],[pe.BODY,N.BODY],[pe.BR,N.BR],[pe.BUTTON,N.BUTTON],[pe.CAPTION,N.CAPTION],[pe.CENTER,N.CENTER],[pe.CODE,N.CODE],[pe.COL,N.COL],[pe.COLGROUP,N.COLGROUP],[pe.DD,N.DD],[pe.DESC,N.DESC],[pe.DETAILS,N.DETAILS],[pe.DIALOG,N.DIALOG],[pe.DIR,N.DIR],[pe.DIV,N.DIV],[pe.DL,N.DL],[pe.DT,N.DT],[pe.EM,N.EM],[pe.EMBED,N.EMBED],[pe.FIELDSET,N.FIELDSET],[pe.FIGCAPTION,N.FIGCAPTION],[pe.FIGURE,N.FIGURE],[pe.FONT,N.FONT],[pe.FOOTER,N.FOOTER],[pe.FOREIGN_OBJECT,N.FOREIGN_OBJECT],[pe.FORM,N.FORM],[pe.FRAME,N.FRAME],[pe.FRAMESET,N.FRAMESET],[pe.H1,N.H1],[pe.H2,N.H2],[pe.H3,N.H3],[pe.H4,N.H4],[pe.H5,N.H5],[pe.H6,N.H6],[pe.HEAD,N.HEAD],[pe.HEADER,N.HEADER],[pe.HGROUP,N.HGROUP],[pe.HR,N.HR],[pe.HTML,N.HTML],[pe.I,N.I],[pe.IMG,N.IMG],[pe.IMAGE,N.IMAGE],[pe.INPUT,N.INPUT],[pe.IFRAME,N.IFRAME],[pe.KEYGEN,N.KEYGEN],[pe.LABEL,N.LABEL],[pe.LI,N.LI],[pe.LINK,N.LINK],[pe.LISTING,N.LISTING],[pe.MAIN,N.MAIN],[pe.MALIGNMARK,N.MALIGNMARK],[pe.MARQUEE,N.MARQUEE],[pe.MATH,N.MATH],[pe.MENU,N.MENU],[pe.META,N.META],[pe.MGLYPH,N.MGLYPH],[pe.MI,N.MI],[pe.MO,N.MO],[pe.MN,N.MN],[pe.MS,N.MS],[pe.MTEXT,N.MTEXT],[pe.NAV,N.NAV],[pe.NOBR,N.NOBR],[pe.NOFRAMES,N.NOFRAMES],[pe.NOEMBED,N.NOEMBED],[pe.NOSCRIPT,N.NOSCRIPT],[pe.OBJECT,N.OBJECT],[pe.OL,N.OL],[pe.OPTGROUP,N.OPTGROUP],[pe.OPTION,N.OPTION],[pe.P,N.P],[pe.PARAM,N.PARAM],[pe.PLAINTEXT,N.PLAINTEXT],[pe.PRE,N.PRE],[pe.RB,N.RB],[pe.RP,N.RP],[pe.RT,N.RT],[pe.RTC,N.RTC],[pe.RUBY,N.RUBY],[pe.S,N.S],[pe.SCRIPT,N.SCRIPT],[pe.SEARCH,N.SEARCH],[pe.SECTION,N.SECTION],[pe.SELECT,N.SELECT],[pe.SOURCE,N.SOURCE],[pe.SMALL,N.SMALL],[pe.SPAN,N.SPAN],[pe.STRIKE,N.STRIKE],[pe.STRONG,N.STRONG],[pe.STYLE,N.STYLE],[pe.SUB,N.SUB],[pe.SUMMARY,N.SUMMARY],[pe.SUP,N.SUP],[pe.TABLE,N.TABLE],[pe.TBODY,N.TBODY],[pe.TEMPLATE,N.TEMPLATE],[pe.TEXTAREA,N.TEXTAREA],[pe.TFOOT,N.TFOOT],[pe.TD,N.TD],[pe.TH,N.TH],[pe.THEAD,N.THEAD],[pe.TITLE,N.TITLE],[pe.TR,N.TR],[pe.TRACK,N.TRACK],[pe.TT,N.TT],[pe.U,N.U],[pe.UL,N.UL],[pe.SVG,N.SVG],[pe.VAR,N.VAR],[pe.WBR,N.WBR],[pe.XMP,N.XMP]]);function hh(e){var t;return(t=ave.get(e))!==null&&t!==void 0?t:N.UNKNOWN}const Re=N,ove={[je.HTML]:new Set([Re.ADDRESS,Re.APPLET,Re.AREA,Re.ARTICLE,Re.ASIDE,Re.BASE,Re.BASEFONT,Re.BGSOUND,Re.BLOCKQUOTE,Re.BODY,Re.BR,Re.BUTTON,Re.CAPTION,Re.CENTER,Re.COL,Re.COLGROUP,Re.DD,Re.DETAILS,Re.DIR,Re.DIV,Re.DL,Re.DT,Re.EMBED,Re.FIELDSET,Re.FIGCAPTION,Re.FIGURE,Re.FOOTER,Re.FORM,Re.FRAME,Re.FRAMESET,Re.H1,Re.H2,Re.H3,Re.H4,Re.H5,Re.H6,Re.HEAD,Re.HEADER,Re.HGROUP,Re.HR,Re.HTML,Re.IFRAME,Re.IMG,Re.INPUT,Re.LI,Re.LINK,Re.LISTING,Re.MAIN,Re.MARQUEE,Re.MENU,Re.META,Re.NAV,Re.NOEMBED,Re.NOFRAMES,Re.NOSCRIPT,Re.OBJECT,Re.OL,Re.P,Re.PARAM,Re.PLAINTEXT,Re.PRE,Re.SCRIPT,Re.SECTION,Re.SELECT,Re.SOURCE,Re.STYLE,Re.SUMMARY,Re.TABLE,Re.TBODY,Re.TD,Re.TEMPLATE,Re.TEXTAREA,Re.TFOOT,Re.TH,Re.THEAD,Re.TITLE,Re.TR,Re.TRACK,Re.UL,Re.WBR,Re.XMP]),[je.MATHML]:new Set([Re.MI,Re.MO,Re.MN,Re.MS,Re.MTEXT,Re.ANNOTATION_XML]),[je.SVG]:new Set([Re.TITLE,Re.FOREIGN_OBJECT,Re.DESC]),[je.XLINK]:new Set,[je.XML]:new Set,[je.XMLNS]:new Set},kN=new Set([Re.H1,Re.H2,Re.H3,Re.H4,Re.H5,Re.H6]);pe.STYLE,pe.SCRIPT,pe.XMP,pe.IFRAME,pe.NOEMBED,pe.NOFRAMES,pe.PLAINTEXT;var Y;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(Y||(Y={}));const Bs={DATA:Y.DATA,RCDATA:Y.RCDATA,RAWTEXT:Y.RAWTEXT,SCRIPT_DATA:Y.SCRIPT_DATA,PLAINTEXT:Y.PLAINTEXT,CDATA_SECTION:Y.CDATA_SECTION};function lve(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function wp(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function cve(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function Al(e){return cve(e)||wp(e)}function XL(e){return Al(e)||lve(e)}function fb(e){return e+32}function C$(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function QL(e){return C$(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function uve(e){return e===G.NULL?Ee.nullCharacterReference:e>1114111?Ee.characterReferenceOutsideUnicodeRange:N$(e)?Ee.surrogateCharacterReference:k$(e)?Ee.noncharacterCharacterReference:T$(e)||e===G.CARRIAGE_RETURN?Ee.controlCharacterReference:null}class dve{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Y.DATA,this.returnState=Y.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new XEe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new ive(QEe,(s,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(s)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Ee.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:s=>{this._err(Ee.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+s)},validateNumericCharacterReference:s=>{const i=uve(s);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var s,i;(i=(s=this.handler).onParseError)===null||i===void 0||i.call(s,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,s){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||s==null||s()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(Ee.endTagWithAttributes),t.selfClosing&&this._err(Ee.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case $t.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case $t.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case $t.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:$t.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=C$(t)?$t.WHITESPACE_CHARACTER:t===G.NULL?$t.NULL_CHARACTER:$t.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken($t.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=Y.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?zo.Attribute:zo.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case Y.DATA:{this._stateData(t);break}case Y.RCDATA:{this._stateRcdata(t);break}case Y.RAWTEXT:{this._stateRawtext(t);break}case Y.SCRIPT_DATA:{this._stateScriptData(t);break}case Y.PLAINTEXT:{this._statePlaintext(t);break}case Y.TAG_OPEN:{this._stateTagOpen(t);break}case Y.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case Y.TAG_NAME:{this._stateTagName(t);break}case Y.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case Y.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case Y.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case Y.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case Y.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case Y.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case Y.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case Y.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case Y.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case Y.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case Y.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case Y.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case Y.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case Y.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case Y.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case Y.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case Y.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case Y.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case Y.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case Y.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case Y.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case Y.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case Y.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case Y.BOGUS_COMMENT:{this._stateBogusComment(t);break}case Y.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case Y.COMMENT_START:{this._stateCommentStart(t);break}case Y.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case Y.COMMENT:{this._stateComment(t);break}case Y.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case Y.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case Y.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case Y.COMMENT_END:{this._stateCommentEnd(t);break}case Y.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case Y.DOCTYPE:{this._stateDoctype(t);break}case Y.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case Y.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case Y.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case Y.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case Y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case Y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case Y.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case Y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case Y.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case Y.CDATA_SECTION:{this._stateCdataSection(t);break}case Y.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case Y.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case Y.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case Y.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=Y.TAG_OPEN;break}case G.AMPERSAND:{this._startCharacterReference();break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitCodePoint(t);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case G.AMPERSAND:{this._startCharacterReference();break}case G.LESS_THAN_SIGN:{this.state=Y.RCDATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(us);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case G.LESS_THAN_SIGN:{this.state=Y.RAWTEXT_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(us);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=Y.SCRIPT_DATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(us);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(us);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Al(t))this._createStartTagToken(),this.state=Y.TAG_NAME,this._stateTagName(t);else switch(t){case G.EXCLAMATION_MARK:{this.state=Y.MARKUP_DECLARATION_OPEN;break}case G.SOLIDUS:{this.state=Y.END_TAG_OPEN;break}case G.QUESTION_MARK:{this._err(Ee.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(t);break}case G.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Ee.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Y.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Al(t))this._createEndTagToken(),this.state=Y.TAG_NAME,this._stateTagName(t);else switch(t){case G.GREATER_THAN_SIGN:{this._err(Ee.missingEndTagName),this.state=Y.DATA;break}case G.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("");break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_ESCAPED,this._emitChars(us);break}case G.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===G.SOLIDUS?this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Al(t)?(this._emitChars("<"),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Al(t)?(this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(us);break}case G.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===G.SOLIDUS?(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(ur.SCRIPT,!1)&&QL(this.preprocessor.peek(ur.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const s=this._indexOf(t);this.items[s]=n,s===this.stackTop&&(this.current=n)}insertAfter(t,n,s){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,s),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==je.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;s--)if(t.has(this.tagIDs[s])&&this.treeAdapter.getNamespaceURI(this.items[s])===n)return s;return-1}clearBackTo(t,n){const s=this._indexOfTagNames(t,n);this.shortenToLength(s+1)}clearBackToTableContext(){this.clearBackTo(gve,je.HTML)}clearBackToTableBodyContext(){this.clearBackTo(mve,je.HTML)}clearBackToTableRowContext(){this.clearBackTo(pve,je.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===N.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===N.HTML}hasInDynamicScope(t,n){for(let s=this.stackTop;s>=0;s--){const i=this.tagIDs[s];switch(this.treeAdapter.getNamespaceURI(this.items[s])){case je.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case je.SVG:{if(e3.has(i))return!1;break}case je.MATHML:{if(JL.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,I1)}hasInListItemScope(t){return this.hasInDynamicScope(t,fve)}hasInButtonScope(t){return this.hasInDynamicScope(t,hve)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case je.HTML:{if(kN.has(n))return!0;if(I1.has(n))return!1;break}case je.SVG:{if(e3.has(n))return!1;break}case je.MATHML:{if(JL.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===je.HTML)switch(this.tagIDs[n]){case t:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===je.HTML)switch(this.tagIDs[t]){case N.TBODY:case N.THEAD:case N.TFOOT:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===je.HTML)switch(this.tagIDs[n]){case t:return!0;case N.OPTION:case N.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&I$.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&ZL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&ZL.has(this.currentTagId);)this.pop()}}const Lw=3;var io;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(io||(io={}));const t3={type:io.Marker};class xve{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const s=[],i=n.length,r=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let r=0;for(let a=0;ai.get(c.name)===c.value)&&(r+=1,r>=Lw&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(t3)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:io.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const s=this.entries.indexOf(this.bookmark);this.entries.splice(s,0,{type:io.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(t3);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(s=>s.type===io.Marker||this.treeAdapter.getTagName(s.element)===t);return n&&n.type===io.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===io.Element&&n.element===t)}}const Cl={createDocument(){return{nodeName:"#document",mode:sa.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,s){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=s;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:s,parentNode:null};Cl.appendChild(e,r)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Cl.isTextNode(n)){n.value+=t;return}}Cl.appendChild(e,Cl.createTextNode(t))},insertTextBefore(e,t,n){const s=e.childNodes[e.childNodes.indexOf(n)-1];s&&Cl.isTextNode(s)?s.value+=t:Cl.insertBefore(e,Cl.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(s=>s.name));for(let s=0;se.startsWith(n))}function Nve(e){return e.name===j$&&e.publicId===null&&(e.systemId===null||e.systemId===Eve)}function Tve(e){if(e.name!==j$)return sa.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===vve)return sa.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),_ve.has(n))return sa.QUIRKS;let s=t===null?wve:R$;if(n3(n,s))return sa.QUIRKS;if(s=t===null?O$:Sve,n3(n,s))return sa.LIMITED_QUIRKS}return sa.NO_QUIRKS}const s3={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},kve="definitionurl",Ave="definitionURL",Cve=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Ive=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:je.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:je.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:je.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:je.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:je.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:je.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:je.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:je.XML}],["xml:space",{prefix:"xml",name:"space",namespace:je.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:je.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:je.XMLNS}]]),jve=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Rve=new Set([N.B,N.BIG,N.BLOCKQUOTE,N.BODY,N.BR,N.CENTER,N.CODE,N.DD,N.DIV,N.DL,N.DT,N.EM,N.EMBED,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HR,N.I,N.IMG,N.LI,N.LISTING,N.MENU,N.META,N.NOBR,N.OL,N.P,N.PRE,N.RUBY,N.S,N.SMALL,N.SPAN,N.STRONG,N.STRIKE,N.SUB,N.SUP,N.TABLE,N.TT,N.U,N.UL,N.VAR]);function Ove(e){const t=e.tagID;return t===N.FONT&&e.attrs.some(({name:s})=>s===lu.COLOR||s===lu.SIZE||s===lu.FACE)||Rve.has(t)}function M$(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var s,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(s=this.treeAdapter).onItemPop)===null||i===void 0||i.call(s,t,this.openElements.current),n){let r,a;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,a=this.fragmentContextID):{current:r,currentTagId:a}=this.openElements,this._setContextModes(r,a)}}_setContextModes(t,n){const s=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===je.HTML;this.currentNotInHTML=!s,this.tokenizer.inForeignNode=!s&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,je.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=ee.TEXT}switchToPlaintextParsing(){this.insertionMode=ee.TEXT,this.originalInsertionMode=ee.IN_BODY,this.tokenizer.state=Bs.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===pe.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==je.HTML))switch(this.fragmentContextID){case N.TITLE:case N.TEXTAREA:{this.tokenizer.state=Bs.RCDATA;break}case N.STYLE:case N.XMP:case N.IFRAME:case N.NOEMBED:case N.NOFRAMES:case N.NOSCRIPT:{this.tokenizer.state=Bs.RAWTEXT;break}case N.SCRIPT:{this.tokenizer.state=Bs.SCRIPT_DATA;break}case N.PLAINTEXT:{this.tokenizer.state=Bs.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",s=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,s,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const s=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,s)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const s=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(s??this.document,t)}}_appendElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location)}_insertElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location),this.openElements.push(s,t.tagID)}_insertFakeElement(t,n){const s=this.treeAdapter.createElement(t,je.HTML,[]);this._attachElementToTree(s,null),this.openElements.push(s,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,je.HTML,t.attrs),s=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,s),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(pe.HTML,je.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,N.HTML)}_appendCommentNode(t,n){const s=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,s),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_insertCharacters(t){let n,s;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:s}=this._findFosterParentingLocation(),s?this.treeAdapter.insertTextBefore(n,t.chars,s):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(n),r=s?i.lastIndexOf(s):i.length,a=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let s=this.treeAdapter.getFirstChild(t);s;s=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(s),this.treeAdapter.appendChild(n,s)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const s=n.location,i=this.treeAdapter.getTagName(t),r=n.type===$t.END_TAG&&i===n.tagName?{endTag:{...s},endLine:s.endLine,endCol:s.endCol,endOffset:s.endOffset}:{endLine:s.startLine,endCol:s.startCol,endOffset:s.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,s;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,s=this.fragmentContextID):{current:n,currentTagId:s}=this.openElements,t.tagID===N.SVG&&this.treeAdapter.getTagName(n)===pe.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===je.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===N.MGLYPH||t.tagID===N.MALIGNMARK)&&s!==void 0&&!this._isIntegrationPoint(s,n,je.HTML)}_processToken(t){switch(t.type){case $t.CHARACTER:{this.onCharacter(t);break}case $t.NULL_CHARACTER:{this.onNullCharacter(t);break}case $t.COMMENT:{this.onComment(t);break}case $t.DOCTYPE:{this.onDoctype(t);break}case $t.START_TAG:{this._processStartTag(t);break}case $t.END_TAG:{this.onEndTag(t);break}case $t.EOF:{this.onEof(t);break}case $t.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,s){const i=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return Pve(t,i,r,s)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===io.Marker||this.openElements.contains(i.element)),s=n===-1?t-1:n-1;for(let i=s;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ee.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(N.P),this.openElements.popUntilTagNamePopped(N.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case N.TR:{this.insertionMode=ee.IN_ROW;return}case N.TBODY:case N.THEAD:case N.TFOOT:{this.insertionMode=ee.IN_TABLE_BODY;return}case N.CAPTION:{this.insertionMode=ee.IN_CAPTION;return}case N.COLGROUP:{this.insertionMode=ee.IN_COLUMN_GROUP;return}case N.TABLE:{this.insertionMode=ee.IN_TABLE;return}case N.BODY:{this.insertionMode=ee.IN_BODY;return}case N.FRAMESET:{this.insertionMode=ee.IN_FRAMESET;return}case N.SELECT:{this._resetInsertionModeForSelect(t);return}case N.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case N.HTML:{this.insertionMode=this.headElement?ee.AFTER_HEAD:ee.BEFORE_HEAD;return}case N.TD:case N.TH:{if(t>0){this.insertionMode=ee.IN_CELL;return}break}case N.HEAD:{if(t>0){this.insertionMode=ee.IN_HEAD;return}break}}this.insertionMode=ee.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const s=this.openElements.tagIDs[n];if(s===N.TEMPLATE)break;if(s===N.TABLE){this.insertionMode=ee.IN_SELECT_IN_TABLE;return}}this.insertionMode=ee.IN_SELECT}_isElementCausesFosterParenting(t){return D$.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case N.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===je.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case N.TABLE:{const s=this.treeAdapter.getParentNode(n);return s?{parent:s,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const s=this.treeAdapter.getNamespaceURI(t);return ove[s].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){b_e(this,t);return}switch(this.insertionMode){case ee.INITIAL:{tp(this,t);break}case ee.BEFORE_HTML:{tm(this,t);break}case ee.BEFORE_HEAD:{nm(this,t);break}case ee.IN_HEAD:{sm(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{im(this,t);break}case ee.AFTER_HEAD:{rm(this,t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:{B$(this,t);break}case ee.TEXT:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{Dw(this,t);break}case ee.IN_TABLE_TEXT:{V$(this,t);break}case ee.IN_COLUMN_GROUP:{j1(this,t);break}case ee.AFTER_BODY:{R1(this,t);break}case ee.AFTER_AFTER_BODY:{cy(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){g_e(this,t);return}switch(this.insertionMode){case ee.INITIAL:{tp(this,t);break}case ee.BEFORE_HTML:{tm(this,t);break}case ee.BEFORE_HEAD:{nm(this,t);break}case ee.IN_HEAD:{sm(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{im(this,t);break}case ee.AFTER_HEAD:{rm(this,t);break}case ee.TEXT:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{Dw(this,t);break}case ee.IN_COLUMN_GROUP:{j1(this,t);break}case ee.AFTER_BODY:{R1(this,t);break}case ee.AFTER_AFTER_BODY:{cy(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){AN(this,t);return}switch(this.insertionMode){case ee.INITIAL:case ee.BEFORE_HTML:case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_TEMPLATE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{AN(this,t);break}case ee.IN_TABLE_TEXT:{np(this,t);break}case ee.AFTER_BODY:{Yve(this,t);break}case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{Wve(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case ee.INITIAL:{Xve(this,t);break}case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:{this._err(t,Ee.misplacedDoctype);break}case ee.IN_TABLE_TEXT:{np(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Ee.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?y_e(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{tp(this,t);break}case ee.BEFORE_HTML:{Qve(this,t);break}case ee.BEFORE_HEAD:{Jve(this,t);break}case ee.IN_HEAD:{Ga(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{nwe(this,t);break}case ee.AFTER_HEAD:{iwe(this,t);break}case ee.IN_BODY:{Vi(this,t);break}case ee.IN_TABLE:{$f(this,t);break}case ee.IN_TABLE_TEXT:{np(this,t);break}case ee.IN_CAPTION:{e_e(this,t);break}case ee.IN_COLUMN_GROUP:{pA(this,t);break}case ee.IN_TABLE_BODY:{tE(this,t);break}case ee.IN_ROW:{nE(this,t);break}case ee.IN_CELL:{s_e(this,t);break}case ee.IN_SELECT:{q$(this,t);break}case ee.IN_SELECT_IN_TABLE:{r_e(this,t);break}case ee.IN_TEMPLATE:{o_e(this,t);break}case ee.AFTER_BODY:{c_e(this,t);break}case ee.IN_FRAMESET:{u_e(this,t);break}case ee.AFTER_FRAMESET:{f_e(this,t);break}case ee.AFTER_AFTER_BODY:{p_e(this,t);break}case ee.AFTER_AFTER_FRAMESET:{m_e(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?x_e(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{tp(this,t);break}case ee.BEFORE_HTML:{Zve(this,t);break}case ee.BEFORE_HEAD:{ewe(this,t);break}case ee.IN_HEAD:{twe(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{swe(this,t);break}case ee.AFTER_HEAD:{rwe(this,t);break}case ee.IN_BODY:{eE(this,t);break}case ee.TEXT:{Vwe(this,t);break}case ee.IN_TABLE:{Xm(this,t);break}case ee.IN_TABLE_TEXT:{np(this,t);break}case ee.IN_CAPTION:{t_e(this,t);break}case ee.IN_COLUMN_GROUP:{n_e(this,t);break}case ee.IN_TABLE_BODY:{CN(this,t);break}case ee.IN_ROW:{K$(this,t);break}case ee.IN_CELL:{i_e(this,t);break}case ee.IN_SELECT:{Y$(this,t);break}case ee.IN_SELECT_IN_TABLE:{a_e(this,t);break}case ee.IN_TEMPLATE:{l_e(this,t);break}case ee.AFTER_BODY:{X$(this,t);break}case ee.IN_FRAMESET:{d_e(this,t);break}case ee.AFTER_FRAMESET:{h_e(this,t);break}case ee.AFTER_AFTER_BODY:{cy(this,t);break}}}onEof(t){switch(this.insertionMode){case ee.INITIAL:{tp(this,t);break}case ee.BEFORE_HTML:{tm(this,t);break}case ee.BEFORE_HEAD:{nm(this,t);break}case ee.IN_HEAD:{sm(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{im(this,t);break}case ee.AFTER_HEAD:{rm(this,t);break}case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{H$(this,t);break}case ee.TEXT:{Gwe(this,t);break}case ee.IN_TABLE_TEXT:{np(this,t);break}case ee.IN_TEMPLATE:{W$(this,t);break}case ee.AFTER_BODY:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{hA(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===G.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.TEXT:case ee.IN_COLUMN_GROUP:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{this._insertCharacters(t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:case ee.AFTER_BODY:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{P$(this,t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{Dw(this,t);break}case ee.IN_TABLE_TEXT:{z$(this,t);break}}}};function Hve(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):$$(e,t),n}function zve(e,t){let n=null,s=e.openElements.stackTop;for(;s>=0;s--){const i=e.openElements.items[s];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[s])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(s,0)),e.activeFormattingElements.removeEntry(t)),n}function Vve(e,t,n){let s=t,i=e.openElements.getCommonAncestor(t);for(let r=0,a=i;a!==n;r++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=Fve;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=Gve(e,l),s===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(a,s),s=a)}return s}function Gve(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function Kve(e,t,n){const s=e.treeAdapter.getTagName(t),i=hh(s);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);i===N.TEMPLATE&&r===je.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function qve(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,r=e.treeAdapter.createElement(i.tagName,s,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,i.tagID)}function fA(e,t){for(let n=0;n=n;s--)e._setEndLocation(e.openElements.items[s],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const s=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(s);if(i&&!i.endTag&&(e._setEndLocation(s,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function Xve(e,t){e._setDocumentType(t);const n=t.forceQuirks?sa.QUIRKS:Tve(t);Nve(t)||e._err(t,Ee.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=ee.BEFORE_HTML}function tp(e,t){e._err(t,Ee.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,sa.QUIRKS),e.insertionMode=ee.BEFORE_HTML,e._processToken(t)}function Qve(e,t){t.tagID===N.HTML?(e._insertElement(t,je.HTML),e.insertionMode=ee.BEFORE_HEAD):tm(e,t)}function Zve(e,t){const n=t.tagID;(n===N.HTML||n===N.HEAD||n===N.BODY||n===N.BR)&&tm(e,t)}function tm(e,t){e._insertFakeRootElement(),e.insertionMode=ee.BEFORE_HEAD,e._processToken(t)}function Jve(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.HEAD:{e._insertElement(t,je.HTML),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD;break}default:nm(e,t)}}function ewe(e,t){const n=t.tagID;n===N.HEAD||n===N.BODY||n===N.HTML||n===N.BR?nm(e,t):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function nm(e,t){e._insertFakeElement(pe.HEAD,N.HEAD),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD,e._processToken(t)}function Ga(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case N.TITLE:{e._switchToTextParsing(t,Bs.RCDATA);break}case N.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Bs.RAWTEXT):(e._insertElement(t,je.HTML),e.insertionMode=ee.IN_HEAD_NO_SCRIPT);break}case N.NOFRAMES:case N.STYLE:{e._switchToTextParsing(t,Bs.RAWTEXT);break}case N.SCRIPT:{e._switchToTextParsing(t,Bs.SCRIPT_DATA);break}case N.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=ee.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(ee.IN_TEMPLATE);break}case N.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:sm(e,t)}}function twe(e,t){switch(t.tagID){case N.HEAD:{e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD;break}case N.BODY:case N.BR:case N.HTML:{sm(e,t);break}case N.TEMPLATE:{Bu(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function Bu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==N.TEMPLATE&&e._err(t,Ee.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function sm(e,t){e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD,e._processToken(t)}function nwe(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.BASEFONT:case N.BGSOUND:case N.HEAD:case N.LINK:case N.META:case N.NOFRAMES:case N.STYLE:{Ga(e,t);break}case N.NOSCRIPT:{e._err(t,Ee.nestedNoscriptInHead);break}default:im(e,t)}}function swe(e,t){switch(t.tagID){case N.NOSCRIPT:{e.openElements.pop(),e.insertionMode=ee.IN_HEAD;break}case N.BR:{im(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function im(e,t){const n=t.type===$t.EOF?Ee.openElementsLeftAfterEof:Ee.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=ee.IN_HEAD,e._processToken(t)}function iwe(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.BODY:{e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_BODY;break}case N.FRAMESET:{e._insertElement(t,je.HTML),e.insertionMode=ee.IN_FRAMESET;break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{e._err(t,Ee.abandonedHeadElementChild),e.openElements.push(e.headElement,N.HEAD),Ga(e,t),e.openElements.remove(e.headElement);break}case N.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:rm(e,t)}}function rwe(e,t){switch(t.tagID){case N.BODY:case N.HTML:case N.BR:{rm(e,t);break}case N.TEMPLATE:{Bu(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function rm(e,t){e._insertFakeElement(pe.BODY,N.BODY),e.insertionMode=ee.IN_BODY,Jx(e,t)}function Jx(e,t){switch(t.type){case $t.CHARACTER:{B$(e,t);break}case $t.WHITESPACE_CHARACTER:{P$(e,t);break}case $t.COMMENT:{AN(e,t);break}case $t.START_TAG:{Vi(e,t);break}case $t.END_TAG:{eE(e,t);break}case $t.EOF:{H$(e,t);break}}}function P$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function B$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function awe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function owe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function lwe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_FRAMESET)}function cwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function uwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&kN.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,je.HTML)}function dwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function fwe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),n||(e.formElement=e.openElements.current))}function hwe(e,t){e.framesetOk=!1;const n=t.tagID;for(let s=e.openElements.stackTop;s>=0;s--){const i=e.openElements.tagIDs[s];if(n===N.LI&&i===N.LI||(n===N.DD||n===N.DT)&&(i===N.DD||i===N.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==N.ADDRESS&&i!==N.DIV&&i!==N.P&&e._isSpecialElement(e.openElements.items[s],i))break}e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function pwe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.tokenizer.state=Bs.PLAINTEXT}function mwe(e,t){e.openElements.hasInScope(N.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(N.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.framesetOk=!1}function gwe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(pe.A);n&&(fA(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bwe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ywe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(N.NOBR)&&(fA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function xwe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Ewe(e,t){e.treeAdapter.getDocumentMode(e.document)!==sa.QUIRKS&&e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_TABLE}function U$(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function F$(e){const t=A$(e,lu.TYPE);return t!=null&&t.toLowerCase()===Bve}function vwe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),F$(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function wwe(e,t){e._appendElement(t,je.HTML),t.ackSelfClosing=!0}function _we(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Swe(e,t){t.tagName=pe.IMG,t.tagID=N.IMG,U$(e,t)}function Nwe(e,t){e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Bs.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=ee.TEXT}function Twe(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Bs.RAWTEXT)}function kwe(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Bs.RAWTEXT)}function a3(e,t){e._switchToTextParsing(t,Bs.RAWTEXT)}function Awe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===ee.IN_TABLE||e.insertionMode===ee.IN_CAPTION||e.insertionMode===ee.IN_TABLE_BODY||e.insertionMode===ee.IN_ROW||e.insertionMode===ee.IN_CELL?ee.IN_SELECT_IN_TABLE:ee.IN_SELECT}function Cwe(e,t){e.openElements.currentTagId===N.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function Iwe(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,je.HTML)}function jwe(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(N.RTC),e._insertElement(t,je.HTML)}function Rwe(e,t){e._reconstructActiveFormattingElements(),M$(t),dA(t),t.selfClosing?e._appendElement(t,je.MATHML):e._insertElement(t,je.MATHML),t.ackSelfClosing=!0}function Owe(e,t){e._reconstructActiveFormattingElements(),L$(t),dA(t),t.selfClosing?e._appendElement(t,je.SVG):e._insertElement(t,je.SVG),t.ackSelfClosing=!0}function o3(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function Vi(e,t){switch(t.tagID){case N.I:case N.S:case N.B:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.SMALL:case N.STRIKE:case N.STRONG:{bwe(e,t);break}case N.A:{gwe(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{uwe(e,t);break}case N.P:case N.DL:case N.OL:case N.UL:case N.DIV:case N.DIR:case N.NAV:case N.MAIN:case N.MENU:case N.ASIDE:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.DETAILS:case N.ADDRESS:case N.ARTICLE:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{cwe(e,t);break}case N.LI:case N.DD:case N.DT:{hwe(e,t);break}case N.BR:case N.IMG:case N.WBR:case N.AREA:case N.EMBED:case N.KEYGEN:{U$(e,t);break}case N.HR:{_we(e,t);break}case N.RB:case N.RTC:{Iwe(e,t);break}case N.RT:case N.RP:{jwe(e,t);break}case N.PRE:case N.LISTING:{dwe(e,t);break}case N.XMP:{Twe(e,t);break}case N.SVG:{Owe(e,t);break}case N.HTML:{awe(e,t);break}case N.BASE:case N.LINK:case N.META:case N.STYLE:case N.TITLE:case N.SCRIPT:case N.BGSOUND:case N.BASEFONT:case N.TEMPLATE:{Ga(e,t);break}case N.BODY:{owe(e,t);break}case N.FORM:{fwe(e,t);break}case N.NOBR:{ywe(e,t);break}case N.MATH:{Rwe(e,t);break}case N.TABLE:{Ewe(e,t);break}case N.INPUT:{vwe(e,t);break}case N.PARAM:case N.TRACK:case N.SOURCE:{wwe(e,t);break}case N.IMAGE:{Swe(e,t);break}case N.BUTTON:{mwe(e,t);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{xwe(e,t);break}case N.IFRAME:{kwe(e,t);break}case N.SELECT:{Awe(e,t);break}case N.OPTION:case N.OPTGROUP:{Cwe(e,t);break}case N.NOEMBED:case N.NOFRAMES:{a3(e,t);break}case N.FRAMESET:{lwe(e,t);break}case N.TEXTAREA:{Nwe(e,t);break}case N.NOSCRIPT:{e.options.scriptingEnabled?a3(e,t):o3(e,t);break}case N.PLAINTEXT:{pwe(e,t);break}case N.COL:case N.TH:case N.TD:case N.TR:case N.HEAD:case N.FRAME:case N.TBODY:case N.TFOOT:case N.THEAD:case N.CAPTION:case N.COLGROUP:break;default:o3(e,t)}}function Mwe(e,t){if(e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Lwe(e,t){e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,X$(e,t))}function Dwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Pwe(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(N.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(N.FORM):n&&e.openElements.remove(n))}function Bwe(e){e.openElements.hasInButtonScope(N.P)||e._insertFakeElement(pe.P,N.P),e._closePElement()}function Uwe(e){e.openElements.hasInListItemScope(N.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(N.LI),e.openElements.popUntilTagNamePopped(N.LI))}function Fwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function $we(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Hwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function zwe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(pe.BR,N.BR),e.openElements.pop(),e.framesetOk=!1}function $$(e,t){const n=t.tagName,s=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],a=e.openElements.tagIDs[i];if(s===a&&(s!==N.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,a))break}}function eE(e,t){switch(t.tagID){case N.A:case N.B:case N.I:case N.S:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.NOBR:case N.SMALL:case N.STRIKE:case N.STRONG:{fA(e,t);break}case N.P:{Bwe(e);break}case N.DL:case N.UL:case N.OL:case N.DIR:case N.DIV:case N.NAV:case N.PRE:case N.MAIN:case N.MENU:case N.ASIDE:case N.BUTTON:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.ADDRESS:case N.ARTICLE:case N.DETAILS:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.LISTING:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{Dwe(e,t);break}case N.LI:{Uwe(e);break}case N.DD:case N.DT:{Fwe(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{$we(e);break}case N.BR:{zwe(e);break}case N.BODY:{Mwe(e,t);break}case N.HTML:{Lwe(e,t);break}case N.FORM:{Pwe(e);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{Hwe(e,t);break}case N.TEMPLATE:{Bu(e,t);break}default:$$(e,t)}}function H$(e,t){e.tmplInsertionModeStack.length>0?W$(e,t):hA(e,t)}function Vwe(e,t){var n;t.tagID===N.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Gwe(e,t){e._err(t,Ee.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Dw(e,t){if(e.openElements.currentTagId!==void 0&&D$.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=ee.IN_TABLE_TEXT,t.type){case $t.CHARACTER:{V$(e,t);break}case $t.WHITESPACE_CHARACTER:{z$(e,t);break}}else Dg(e,t)}function Kwe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_CAPTION}function qwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_COLUMN_GROUP}function Ywe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(pe.COLGROUP,N.COLGROUP),e.insertionMode=ee.IN_COLUMN_GROUP,pA(e,t)}function Wwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_TABLE_BODY}function Xwe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(pe.TBODY,N.TBODY),e.insertionMode=ee.IN_TABLE_BODY,tE(e,t)}function Qwe(e,t){e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Zwe(e,t){F$(t)?e._appendElement(t,je.HTML):Dg(e,t),t.ackSelfClosing=!0}function Jwe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,je.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function $f(e,t){switch(t.tagID){case N.TD:case N.TH:case N.TR:{Xwe(e,t);break}case N.STYLE:case N.SCRIPT:case N.TEMPLATE:{Ga(e,t);break}case N.COL:{Ywe(e,t);break}case N.FORM:{Jwe(e,t);break}case N.TABLE:{Qwe(e,t);break}case N.TBODY:case N.TFOOT:case N.THEAD:{Wwe(e,t);break}case N.INPUT:{Zwe(e,t);break}case N.CAPTION:{Kwe(e,t);break}case N.COLGROUP:{qwe(e,t);break}default:Dg(e,t)}}function Xm(e,t){switch(t.tagID){case N.TABLE:{e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode());break}case N.TEMPLATE:{Bu(e,t);break}case N.BODY:case N.CAPTION:case N.COL:case N.COLGROUP:case N.HTML:case N.TBODY:case N.TD:case N.TFOOT:case N.TH:case N.THEAD:case N.TR:break;default:Dg(e,t)}}function Dg(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Jx(e,t),e.fosterParentingEnabled=n}function z$(e,t){e.pendingCharacterTokens.push(t)}function V$(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function np(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===N.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===N.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===N.OPTGROUP&&e.openElements.pop();break}case N.OPTION:{e.openElements.currentTagId===N.OPTION&&e.openElements.pop();break}case N.SELECT:{e.openElements.hasInSelectScope(N.SELECT)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode());break}case N.TEMPLATE:{Bu(e,t);break}}}function r_e(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e._processStartTag(t)):q$(e,t)}function a_e(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Y$(e,t)}function o_e(e,t){switch(t.tagID){case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{Ga(e,t);break}case N.CAPTION:case N.COLGROUP:case N.TBODY:case N.TFOOT:case N.THEAD:{e.tmplInsertionModeStack[0]=ee.IN_TABLE,e.insertionMode=ee.IN_TABLE,$f(e,t);break}case N.COL:{e.tmplInsertionModeStack[0]=ee.IN_COLUMN_GROUP,e.insertionMode=ee.IN_COLUMN_GROUP,pA(e,t);break}case N.TR:{e.tmplInsertionModeStack[0]=ee.IN_TABLE_BODY,e.insertionMode=ee.IN_TABLE_BODY,tE(e,t);break}case N.TD:case N.TH:{e.tmplInsertionModeStack[0]=ee.IN_ROW,e.insertionMode=ee.IN_ROW,nE(e,t);break}default:e.tmplInsertionModeStack[0]=ee.IN_BODY,e.insertionMode=ee.IN_BODY,Vi(e,t)}}function l_e(e,t){t.tagID===N.TEMPLATE&&Bu(e,t)}function W$(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):hA(e,t)}function c_e(e,t){t.tagID===N.HTML?Vi(e,t):R1(e,t)}function X$(e,t){var n;if(t.tagID===N.HTML){if(e.fragmentContext||(e.insertionMode=ee.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===N.HTML){e._setEndLocation(e.openElements.items[0],t);const s=e.openElements.items[1];s&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(s))===null||n===void 0)&&n.endTag)&&e._setEndLocation(s,t)}}else R1(e,t)}function R1(e,t){e.insertionMode=ee.IN_BODY,Jx(e,t)}function u_e(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.FRAMESET:{e._insertElement(t,je.HTML);break}case N.FRAME:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case N.NOFRAMES:{Ga(e,t);break}}}function d_e(e,t){t.tagID===N.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==N.FRAMESET&&(e.insertionMode=ee.AFTER_FRAMESET))}function f_e(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.NOFRAMES:{Ga(e,t);break}}}function h_e(e,t){t.tagID===N.HTML&&(e.insertionMode=ee.AFTER_AFTER_FRAMESET)}function p_e(e,t){t.tagID===N.HTML?Vi(e,t):cy(e,t)}function cy(e,t){e.insertionMode=ee.IN_BODY,Jx(e,t)}function m_e(e,t){switch(t.tagID){case N.HTML:{Vi(e,t);break}case N.NOFRAMES:{Ga(e,t);break}}}function g_e(e,t){t.chars=us,e._insertCharacters(t)}function b_e(e,t){e._insertCharacters(t),e.framesetOk=!1}function Q$(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==je.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function y_e(e,t){if(Ove(t))Q$(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===je.MATHML?M$(t):s===je.SVG&&(Mve(t),L$(t)),dA(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0}}function x_e(e,t){if(t.tagID===N.P||t.tagID===N.BR){Q$(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===je.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(s);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}pe.AREA,pe.BASE,pe.BASEFONT,pe.BGSOUND,pe.BR,pe.COL,pe.EMBED,pe.FRAME,pe.HR,pe.IMG,pe.INPUT,pe.KEYGEN,pe.LINK,pe.META,pe.PARAM,pe.SOURCE,pe.TRACK,pe.WBR;const E_e=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,v_e=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),l3={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Z$(e,t){const n=j_e(e),s=hF("type",{handlers:{root:w_e,element:__e,text:S_e,comment:eH,doctype:N_e,raw:k_e},unknown:A_e}),i={parser:n?new r3(l3):r3.getFragmentParser(void 0,l3),handle(l){s(l,i)},stitches:!1,options:t||{}};s(e,i),ph(i,xo());const r=n?i.parser.document:i.parser.getFragment(),a=REe(r,{file:i.options.file});return i.stitches&&Mg(a,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function J$(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:$t.CHARACTER,chars:e.value,location:Pg(e)};ph(t,xo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function N_e(e,t){const n={type:$t.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Pg(e)};ph(t,xo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function T_e(e,t){t.stitches=!0;const n=R_e(e);if("children"in e&&"children"in n){const s=Z$({type:"root",children:e.children},t.options);n.children=s.children}eH({type:"comment",value:{stitch:n}},t)}function eH(e,t){const n=e.value,s={type:$t.COMMENT,data:n,location:Pg(e)};ph(t,xo(e)),t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken)}function k_e(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,tH(t,xo(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(E_e,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function A_e(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))T_e(n,t);else{let s="";throw v_e.has(n.type)&&(s=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+s)}}function ph(e,t){tH(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Bs.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function tH(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function C_e(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Bs.PLAINTEXT)return;ph(t,xo(e));const s=t.parser.openElements.current;let i="namespaceURI"in s?s.namespaceURI:qc.html;i===qc.html&&n==="svg"&&(i=qc.svg);const r=PEe({...e,children:[]},{space:i===qc.svg?"svg":"html"}),a={type:$t.START_TAG,tagName:n,tagID:hh(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:Pg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function I_e(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&GEe.includes(n)||t.parser.tokenizer.state===Bs.PLAINTEXT)return;ph(t,qx(e));const s={type:$t.END_TAG,tagName:n,tagID:hh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Pg(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Bs.RCDATA||t.parser.tokenizer.state===Bs.RAWTEXT||t.parser.tokenizer.state===Bs.SCRIPT_DATA)&&(t.parser.tokenizer.state=Bs.DATA)}function j_e(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Pg(e){const t=xo(e)||{line:void 0,column:void 0,offset:void 0},n=qx(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function R_e(e){return"children"in e?Uf({...e,children:[]}):Uf(e)}function O_e(e){return function(t,n){return Z$(t,{...e,file:n})}}const nH=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function sH(e){if(!e)return!1;try{const t=e.toLowerCase();return nH.some(n=>t.includes(n))}catch{return!1}}function M_e(e){var s;const t=(s=e==null?void 0:e.properties)==null?void 0:s.href;if(!t)return!1;if(sH(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return nH.some(r=>i.includes(r))}return!1}function L_e({text:e,className:t,allowRawHtml:n=!0}){const[s,i]=g.useState(null),r=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const b=d(m);if(b)return b}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},l=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(B0e,{remarkPlugins:[Qye],rehypePlugins:n?[O_e,GL]:[GL],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(sH(d)||M_e(c))){const f=d,h=l(c==null?void 0:c.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>i({src:f,title:h}),children:[o.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(su,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return o.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=o.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?o.jsx(OB,{src:u,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(su,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=r({src:u},d);return h?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>i({src:h}),children:[o.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(su,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>i(null),children:o.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||a(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:s.src,download:s.title||a(s.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(yx,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>i(null),children:o.jsx(Mi,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const mh=g.memo(L_e),c3=6,u3=7,D_e={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function IN(e){return D_e[(e||"").trim().toLowerCase()]||"未知"}function d3(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function P_e(e){if(!e)return"";const t=e.trim(),n=Number(t),s=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(s)}function B_e(e){const t=e.replace(/\r\n/g,` `);if(!t.startsWith(`--- `))return e;const n=t.indexOf(` --- -`,4);return n>=0?t.slice(n+5).trimStart():e}function P_e({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function B_e(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function f3({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function jN(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function h3({page:e,total:t,pageSize:n,onPage:s}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>s(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(f3,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>s(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(f3,{direction:"right"})})]})]})}function uy({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function U_e({skill:e,space:t,region:n,cloudProvider:s,detail:i,loading:r,error:a,onClose:l}){return g.useEffect(()=>{const c=u=>{u.key==="Escape"&&l()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:l,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:c=>c.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsxs("div",{className:"skill-detail-heading",children:[o.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:o.jsx(P_e,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(i==null?void 0:i.name)||e.skillName}),o.jsx("p",{children:(i==null?void 0:i.description)||e.skillDescription||"暂无描述"})]})]}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:l,"aria-label":"关闭技能详情",children:o.jsx(B_e,{})})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(i==null?void 0:i.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:IN(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Project"}),o.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:Nf(n,s)})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),r?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(jN,{}),"正在读取技能内容…"]}):a?o.jsx("div",{className:"skillcenter-error",children:a}):i!=null&&i.skillMd?o.jsx(ph,{text:D_e(i.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(uy,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function F_e({cloudProvider:e="volcengine"}){const t=wx(e),[n,s]=g.useState(Ti(e)),[i,r]=g.useState([]),[a,l]=g.useState(1),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),[m,b]=g.useState(null),[v,y]=g.useState([]),[x,E]=g.useState(1),[w,S]=g.useState(0),[_,T]=g.useState(!1),[k,A]=g.useState(""),[j,R]=g.useState(null),[B,z]=g.useState(null),[L,F]=g.useState(!1),[C,I]=g.useState(""),D=g.useRef(0);g.useEffect(()=>{t.some(P=>P.value===n)||(te(),s(Ti(e)),l(1),E(1),b(null),y([]))},[e,n,t]),g.useEffect(()=>{let P=!0;return f(!0),p(""),Kfe({region:n,page:a,pageSize:c3}).then(Q=>{if(!P)return;const ee=Q.items||[];r(ee),u(Q.totalCount||0),b(V=>ee.find(X=>X.id===(V==null?void 0:V.id))||null)}).catch(Q=>{P&&(r([]),u(0),b(null),p(Q instanceof Error?Q.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{P&&f(!1)}),()=>{P=!1}},[n,a]),g.useEffect(()=>{if(!m){y([]),S(0);return}let P=!0;return T(!0),A(""),qfe(m.id,{region:n,page:x,pageSize:u3,project:m.projectName}).then(Q=>{P&&(y(Q.items||[]),S(Q.totalCount||0))}).catch(Q=>{P&&(y([]),S(0),A(Q instanceof Error?Q.message:"读取技能失败,请稍后重试"))}).finally(()=>{P&&T(!1)}),()=>{P=!1}},[n,m,x]);const $=P=>{P!==n&&(te(),s(P),l(1),E(1),b(null),y([]))},O=P=>{te(),b(P),E(1)},te=()=>{D.current+=1,R(null),z(null),I(""),F(!1)},se=async P=>{if(!m)return;const Q=D.current+1;D.current=Q,R(P),z(null),I(""),F(!0);try{const ee=await Yfe(m.id,P.skillId,P.version,n,m.projectName);D.current===Q&&z(ee)}catch(ee){D.current===Q&&I(ee instanceof Error?ee.message:"读取技能详情失败,请稍后重试")}finally{D.current===Q&&F(!1)}};return o.jsxs("section",{className:"skillcenter",children:[o.jsxs("div",{className:"skillcenter-browser",children:[o.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"技能空间"}),o.jsx("span",{className:"skillcenter-count-badge",children:c})]}),o.jsx("div",{className:"skillcenter-regions","aria-label":"地域",children:t.map(P=>o.jsx("button",{type:"button",className:n===P.value?"active":"",onClick:()=>$(P.value),children:P.label},P.value))})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[d&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(jN,{}),"正在读取技能空间…"]}),h?o.jsx("div",{className:"skillcenter-error",children:h}):i.length===0&&!d?o.jsx(uy,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:i.map(P=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(m==null?void 0:m.id)===P.id?"active":""}`,onClick:()=>O(P),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:P.name,children:P.name}),o.jsx("span",{className:"skillcenter-item-description",children:P.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${d3(P.status)}`,children:IN(P.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:P.projectName||"default",children:["Project · ",P.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[P.skillCount??0," 个技能"]}),P.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",L_e(P.updatedAt)]})]})]})},`${P.projectName||"default"}:${P.id}`))})]}),o.jsx(h3,{page:a,total:c,pageSize:c3,onPage:l})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:m?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:m.name,children:[m.name," · 技能"]})}),o.jsx("span",{children:w})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[_&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(jN,{}),"正在读取技能…"]}),k?o.jsx("div",{className:"skillcenter-error",children:k}):v.length===0&&!_?o.jsx(uy,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:v.map(P=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void se(P),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:P.skillName,children:P.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:P.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${d3(P.skillStatus)}`,children:IN(P.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",P.version||"—"]})]})]})},`${P.skillId}:${P.version}`))})]}),o.jsx(h3,{page:x,total:w,pageSize:u3,onPage:E})]}):o.jsx(uy,{children:"点击 Skill 空间以查看详情"})})]}),j&&m&&o.jsx(U_e,{skill:j,space:m,region:n,cloudProvider:e,detail:B,loading:L,error:C,onClose:te})]})}const iH="veadk_agentkit_connections",p3=["cn-beijing","cn-shanghai"];function $_e(e){const t=e||"cn-beijing";return p3.includes(t)?[t,...p3.filter(n=>n!==t)]:[t]}function Ia(){try{const e=localStorage.getItem(iH);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function sE(e){try{localStorage.setItem(iH,JSON.stringify(e))}catch{}}function ho(e,t){return`agentkit:${e}:${t}`}function rH(e){try{return new URL(e).host}catch{return e}}function mh(e){JB();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)ZB(ho(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function aH(e,t,n,s,i,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:s,appLabels:i,currentVersion:r},l=Ia(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,sE(l),mh(l),a}async function dy(e,t,n,s){let i=null,r=n||"cn-beijing",a=null;for(const u of $_e(n))try{const d=await f2(e,u,{retryProbe:!0});if(d&&d.length>0){i=d,r=u;break}}catch(d){if(d instanceof sh)throw O1(e),d;if(d instanceof Or&&d.unsupported){a=d;continue}throw d}if(!i||i.length===0)throw O1(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(i.map(u=>[u,t])),c=aH(e,t,r,i,l,s);return ho(c.id,i[0])}async function oH(e,t,n,s){const i=t.trim().replace(/\/+$/,""),r=await Sx(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||rH(i),base:i,apiKey:n.trim(),apps:r,appLabels:s&&r.length>0?{[r[0]]:s}:void 0},l=[...Ia().filter(c=>c.base!==i),a];return sE(l),mh(l),a}function H_e(e){const t=Ia().filter(n=>n.id!==e);return sE(t),mh(t),t}function O1(e){const t=Ia().filter(n=>n.runtimeId!==e);return sE(t),mh(t),t}function lH(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),s=t.flatMap(i=>i.apps.map(r=>{var l;const a=((l=i.appLabels)==null?void 0:l[r])??r;return{id:ho(i.id,r),label:a,app:r,remote:!0,host:i.runtimeId?i.name:rH(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...s]}const m3=Object.freeze(Object.defineProperty({__proto__:null,addConnection:oH,addRuntimeConnection:aH,buildAgentEntries:lH,connectRuntime:dy,loadConnections:Ia,registerConnections:mh,remoteAppId:ho,removeConnection:H_e,removeRuntimeConnection:O1},Symbol.toStringTag,{value:"Module"}));function z_e({onAdded:e,onCancel:t}){const[n,s]=g.useState(""),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await oH(a,n,i,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(ho(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:m=>s(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:m=>r(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:m=>l(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?o.jsx(yn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function V_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 4.2 21 19H3L12 4.2Z"}),o.jsx("path",{d:"M12 9.4v4.2"}),o.jsx("path",{d:"M12 16.8h.01"})]})}function G_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function mA({title:e,description:t,confirmLabel:n,cancelLabel:s="取消",closeLabel:i="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=g.useId(),d=g.useId(),f=g.useRef(null),h=g.useRef(a),p=g.useRef(l);return g.useEffect(()=>{h.current=a,p.current=l},[a,l]),g.useEffect(()=>{var y;const m=document.body.style.overflow,b=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(y=f.current)==null||y.focus();const v=x=>{x.key==="Escape"&&!h.current&&p.current()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=m,window.removeEventListener("keydown",v),b!=null&&b.isConnected&&b.focus()}},[]),wi.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:m=>{m.target===m.currentTarget&&!a&&l()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${r}`,role:"alertdialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":d,"aria-busy":a||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(V_e,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":i,children:o.jsx(G_e,{})})]}),o.jsx("div",{className:"studio-confirm-body",children:o.jsx("p",{id:d,children:t})}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx("button",{ref:f,type:"button",onClick:l,disabled:a,children:s}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const K_e=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],q_e=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],sd=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],sp=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function Pw(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Y_e(e,t){const n=e.trim();if(!n||!t)return n;try{const s=new URL(n),i=s.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const r=new URL(t);return s.protocol=r.protocol,s.hostname=r.hostname,s.port=r.port,s.toString()}catch{return n}}function g3(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function RN(e){return JSON.stringify(e)}function cH(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function U_e({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function F_e(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function f3({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function jN(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function h3({page:e,total:t,pageSize:n,onPage:s}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>s(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(f3,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>s(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(f3,{direction:"right"})})]})]})}function uy({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function $_e({skill:e,space:t,region:n,cloudProvider:s,detail:i,loading:r,error:a,onClose:l}){return g.useEffect(()=>{const c=u=>{u.key==="Escape"&&l()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:l,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:c=>c.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsxs("div",{className:"skill-detail-heading",children:[o.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:o.jsx(U_e,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(i==null?void 0:i.name)||e.skillName}),o.jsx("p",{children:(i==null?void 0:i.description)||e.skillDescription||"暂无描述"})]})]}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:l,"aria-label":"关闭技能详情",children:o.jsx(F_e,{})})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(i==null?void 0:i.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:IN(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Project"}),o.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:Tf(n,s)})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),r?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(jN,{}),"正在读取技能内容…"]}):a?o.jsx("div",{className:"skillcenter-error",children:a}):i!=null&&i.skillMd?o.jsx(mh,{text:B_e(i.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(uy,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function H_e({cloudProvider:e="volcengine"}){const t=wx(e),[n,s]=g.useState(ki(e)),[i,r]=g.useState([]),[a,l]=g.useState(1),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),[m,b]=g.useState(null),[v,y]=g.useState([]),[x,E]=g.useState(1),[w,S]=g.useState(0),[_,T]=g.useState(!1),[k,A]=g.useState(""),[j,R]=g.useState(null),[B,z]=g.useState(null),[L,F]=g.useState(!1),[C,I]=g.useState(""),D=g.useRef(0);g.useEffect(()=>{t.some(P=>P.value===n)||(ne(),s(ki(e)),l(1),E(1),b(null),y([]))},[e,n,t]),g.useEffect(()=>{let P=!0;return f(!0),p(""),Yfe({region:n,page:a,pageSize:c3}).then(Z=>{if(!P)return;const te=Z.items||[];r(te),u(Z.totalCount||0),b(V=>te.find(Q=>Q.id===(V==null?void 0:V.id))||null)}).catch(Z=>{P&&(r([]),u(0),b(null),p(Z instanceof Error?Z.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{P&&f(!1)}),()=>{P=!1}},[n,a]),g.useEffect(()=>{if(!m){y([]),S(0);return}let P=!0;return T(!0),A(""),Wfe(m.id,{region:n,page:x,pageSize:u3,project:m.projectName}).then(Z=>{P&&(y(Z.items||[]),S(Z.totalCount||0))}).catch(Z=>{P&&(y([]),S(0),A(Z instanceof Error?Z.message:"读取技能失败,请稍后重试"))}).finally(()=>{P&&T(!1)}),()=>{P=!1}},[n,m,x]);const $=P=>{P!==n&&(ne(),s(P),l(1),E(1),b(null),y([]))},O=P=>{ne(),b(P),E(1)},ne=()=>{D.current+=1,R(null),z(null),I(""),F(!1)},se=async P=>{if(!m)return;const Z=D.current+1;D.current=Z,R(P),z(null),I(""),F(!0);try{const te=await Xfe(m.id,P.skillId,P.version,n,m.projectName);D.current===Z&&z(te)}catch(te){D.current===Z&&I(te instanceof Error?te.message:"读取技能详情失败,请稍后重试")}finally{D.current===Z&&F(!1)}};return o.jsxs("section",{className:"skillcenter",children:[o.jsxs("div",{className:"skillcenter-browser",children:[o.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"技能空间"}),o.jsx("span",{className:"skillcenter-count-badge",children:c})]}),o.jsx("div",{className:"skillcenter-regions","aria-label":"地域",children:t.map(P=>o.jsx("button",{type:"button",className:n===P.value?"active":"",onClick:()=>$(P.value),children:P.label},P.value))})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[d&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(jN,{}),"正在读取技能空间…"]}),h?o.jsx("div",{className:"skillcenter-error",children:h}):i.length===0&&!d?o.jsx(uy,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:i.map(P=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(m==null?void 0:m.id)===P.id?"active":""}`,onClick:()=>O(P),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:P.name,children:P.name}),o.jsx("span",{className:"skillcenter-item-description",children:P.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${d3(P.status)}`,children:IN(P.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:P.projectName||"default",children:["Project · ",P.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[P.skillCount??0," 个技能"]}),P.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",P_e(P.updatedAt)]})]})]})},`${P.projectName||"default"}:${P.id}`))})]}),o.jsx(h3,{page:a,total:c,pageSize:c3,onPage:l})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:m?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:m.name,children:[m.name," · 技能"]})}),o.jsx("span",{children:w})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[_&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(jN,{}),"正在读取技能…"]}),k?o.jsx("div",{className:"skillcenter-error",children:k}):v.length===0&&!_?o.jsx(uy,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:v.map(P=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void se(P),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:P.skillName,children:P.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:P.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${d3(P.skillStatus)}`,children:IN(P.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",P.version||"—"]})]})]})},`${P.skillId}:${P.version}`))})]}),o.jsx(h3,{page:x,total:w,pageSize:u3,onPage:E})]}):o.jsx(uy,{children:"点击 Skill 空间以查看详情"})})]}),j&&m&&o.jsx($_e,{skill:j,space:m,region:n,cloudProvider:e,detail:B,loading:L,error:C,onClose:ne})]})}const iH="veadk_agentkit_connections",p3=["cn-beijing","cn-shanghai"];function z_e(e){const t=e||"cn-beijing";return p3.includes(t)?[t,...p3.filter(n=>n!==t)]:[t]}function ja(){try{const e=localStorage.getItem(iH);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function sE(e){try{localStorage.setItem(iH,JSON.stringify(e))}catch{}}function po(e,t){return`agentkit:${e}:${t}`}function rH(e){try{return new URL(e).host}catch{return e}}function gh(e){JB();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)ZB(po(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function aH(e,t,n,s,i,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:s,appLabels:i,currentVersion:r},l=ja(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,sE(l),gh(l),a}async function dy(e,t,n,s){let i=null,r=n||"cn-beijing",a=null;for(const u of z_e(n))try{const d=await f2(e,u,{retryProbe:!0});if(d&&d.length>0){i=d,r=u;break}}catch(d){if(d instanceof ih)throw O1(e),d;if(d instanceof Mr&&d.unsupported){a=d;continue}throw d}if(!i||i.length===0)throw O1(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(i.map(u=>[u,t])),c=aH(e,t,r,i,l,s);return po(c.id,i[0])}async function oH(e,t,n,s){const i=t.trim().replace(/\/+$/,""),r=await Sx(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||rH(i),base:i,apiKey:n.trim(),apps:r,appLabels:s&&r.length>0?{[r[0]]:s}:void 0},l=[...ja().filter(c=>c.base!==i),a];return sE(l),gh(l),a}function V_e(e){const t=ja().filter(n=>n.id!==e);return sE(t),gh(t),t}function O1(e){const t=ja().filter(n=>n.runtimeId!==e);return sE(t),gh(t),t}function lH(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),s=t.flatMap(i=>i.apps.map(r=>{var l;const a=((l=i.appLabels)==null?void 0:l[r])??r;return{id:po(i.id,r),label:a,app:r,remote:!0,host:i.runtimeId?i.name:rH(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...s]}const m3=Object.freeze(Object.defineProperty({__proto__:null,addConnection:oH,addRuntimeConnection:aH,buildAgentEntries:lH,connectRuntime:dy,loadConnections:ja,registerConnections:gh,remoteAppId:po,removeConnection:V_e,removeRuntimeConnection:O1},Symbol.toStringTag,{value:"Module"}));function G_e({onAdded:e,onCancel:t}){const[n,s]=g.useState(""),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await oH(a,n,i,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(po(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:m=>s(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:m=>r(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:m=>l(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?o.jsx(gn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function K_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 4.2 21 19H3L12 4.2Z"}),o.jsx("path",{d:"M12 9.4v4.2"}),o.jsx("path",{d:"M12 16.8h.01"})]})}function q_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function mA({title:e,description:t,confirmLabel:n,cancelLabel:s="取消",closeLabel:i="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=g.useId(),d=g.useId(),f=g.useRef(null),h=g.useRef(a),p=g.useRef(l);return g.useEffect(()=>{h.current=a,p.current=l},[a,l]),g.useEffect(()=>{var y;const m=document.body.style.overflow,b=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(y=f.current)==null||y.focus();const v=x=>{x.key==="Escape"&&!h.current&&p.current()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=m,window.removeEventListener("keydown",v),b!=null&&b.isConnected&&b.focus()}},[]),wi.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:m=>{m.target===m.currentTarget&&!a&&l()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${r}`,role:"alertdialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":d,"aria-busy":a||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(K_e,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":i,children:o.jsx(q_e,{})})]}),o.jsx("div",{className:"studio-confirm-body",children:o.jsx("p",{id:d,children:t})}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx("button",{ref:f,type:"button",onClick:l,disabled:a,children:s}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const Y_e=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],W_e=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],id=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],sp=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function Pw(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function X_e(e,t){const n=e.trim();if(!n||!t)return n;try{const s=new URL(n),i=s.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const r=new URL(t);return s.protocol=r.protocol,s.hostname=r.hostname,s.port=r.port,s.toString()}catch{return n}}function g3(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function RN(e){return JSON.stringify(e)}function cH(e){return e==="key_auth"?`API_KEY = "" HEADERS = {"Authorization": f"Bearer {API_KEY}"}`:e==="custom_jwt"?`ACCESS_TOKEN = "" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"}`:e==="none"?"HEADERS = {}":`AUTH_TOKEN = "" -HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function W_e(e,t,n){const s=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function Q_e(e,t,n){const s=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests @@ -615,7 +615,7 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function X_e(e,t){return`\`\`\`python +\`\`\``}function Z_e(e,t){return`\`\`\`python import uuid import requests @@ -642,11 +642,11 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function Q_e({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function b3({available:e,authType:t,value:n,visible:s,loading:i,error:r,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:s&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":s?"隐藏 API Key":"显示 API Key",title:s?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(Q_e,{visible:s})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function y3({protocol:e,title:t,available:n,fields:s,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:s.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(ph,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function uH(e){const t=e.tools??[],n=Ou.filter(i=>i.toolNames.some(r=>t.includes(r))),s=new Set(n.flatMap(i=>i.toolNames));return{...Ci(),name:e.name,description:e.description,instruction:e.instruction||Ci().instruction,agentType:e.type,modelName:e.model,tools:t.filter(i=>!s.has(i)),builtinTools:n.map(i=>i.id),skills:(e.skills??[]).map(i=>i.name),subAgents:(e.children??[]).map(uH)}}function Z_e(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?uH(e.graph):{...Ci(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(s=>s.name))??[]}}function dH(e){return e?1+e.children.reduce((t,n)=>t+dH(n),0):1}function fH(e){return 1+e.subAgents.reduce((t,n)=>t+fH(n),0)}function ON(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function J_e(e){const t=ON(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function eSe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function tSe(e){return e==="high"?"高":e==="medium"?"中":"低"}const nSe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function sSe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":nSe[e.module]}function iSe(e,t){return e.find(n=>n.kind===t)}function x3(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>ON(n.createdAt)-ON(t.createdAt))}function rSe(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(s=>s.name),(n.mcpTools??[]).map(s=>s.name),n.skills??[],(n.selectedSkills??[]).map(s=>s.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const _p=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],aSe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function oSe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const lSe=_p.findIndex(e=>e.phase==="build");function hH(e){const t=e.instanceRange?[..._p.slice(0,-1),oSe(e.instanceRange),_p[_p.length-1]]:_p;return e.createEvaluationSets?[...t.slice(0,-1),aSe,t[t.length-1]]:t}function pH(e){const t=hH(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],s=t.findIndex(i=>i.phase===n);return s<0?0:s}function cSe(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function uSe({task:e}){const t=e.buildLog,n=g.useRef(null),s=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&pH(e)===lSe,[i,r]=g.useState(s),[a,l]=g.useState(!1),c=!!(t!=null&&t.text||t!=null&&t.error),u=(t==null?void 0:t.text)||(t==null?void 0:t.error)||"",d=u.split(` +\`\`\``}function J_e({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function b3({available:e,authType:t,value:n,visible:s,loading:i,error:r,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:s&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":s?"隐藏 API Key":"显示 API Key",title:s?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(J_e,{visible:s})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function y3({protocol:e,title:t,available:n,fields:s,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:s.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(mh,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function uH(e){const t=e.tools??[],n=Mu.filter(i=>i.toolNames.some(r=>t.includes(r))),s=new Set(n.flatMap(i=>i.toolNames));return{...Ii(),name:e.name,description:e.description,instruction:e.instruction||Ii().instruction,agentType:e.type,modelName:e.model,tools:t.filter(i=>!s.has(i)),builtinTools:n.map(i=>i.id),skills:(e.skills??[]).map(i=>i.name),subAgents:(e.children??[]).map(uH)}}function eSe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?uH(e.graph):{...Ii(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(s=>s.name))??[]}}function dH(e){return e?1+e.children.reduce((t,n)=>t+dH(n),0):1}function fH(e){return 1+e.subAgents.reduce((t,n)=>t+fH(n),0)}function ON(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function tSe(e){const t=ON(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function nSe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function sSe(e){return e==="high"?"高":e==="medium"?"中":"低"}const iSe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function rSe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":iSe[e.module]}function aSe(e,t){return e.find(n=>n.kind===t)}function x3(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>ON(n.createdAt)-ON(t.createdAt))}function oSe(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(s=>s.name),(n.mcpTools??[]).map(s=>s.name),n.skills??[],(n.selectedSkills??[]).map(s=>s.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const _p=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],lSe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function cSe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const uSe=_p.findIndex(e=>e.phase==="build");function hH(e){const t=e.instanceRange?[..._p.slice(0,-1),cSe(e.instanceRange),_p[_p.length-1]]:_p;return e.createEvaluationSets?[...t.slice(0,-1),lSe,t[t.length-1]]:t}function pH(e){const t=hH(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],s=t.findIndex(i=>i.phase===n);return s<0?0:s}function dSe(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function fSe({task:e}){const t=e.buildLog,n=g.useRef(null),s=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&pH(e)===uSe,[i,r]=g.useState(s),[a,l]=g.useState(!1),c=!!(t!=null&&t.text||t!=null&&t.error),u=(t==null?void 0:t.text)||(t==null?void 0:t.error)||"",d=u.split(` `),f=i?u:d.slice(-36).join(` -`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(g.useEffect(()=>{t&&r(s)},[e.id,t==null?void 0:t.status,s]),g.useEffect(()=>{if(!i||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[i,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=cSe(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",b=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",b,p].filter(Boolean).join(" · ");async function y(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{l(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${t.status}${i?"":" is-collapsed"}`,"aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsx("span",{children:v})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[c&&o.jsx("button",{type:"button",onClick:()=>r(x=>!x),children:i?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(Ha,{"aria-hidden":!0}):o.jsx(bx,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),i&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function dSe({task:e}){const t=hH(e),n=pH(e),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),i=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(yn,{className:"spin"}):e.status==="success"?o.jsx(Cee,{}):e.status==="error"?o.jsx(Gk,{}):o.jsx(UR,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:i}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(s)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:o.jsx("span",{style:{width:`${s}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[Vn,un]=g.useState(()=>new Set),[Ht,sn]=g.useState(!1),[kn,zt]=g.useState(""),[ot,An]=g.useState(null),[mn,At]=g.useState([]),[Os,Ms]=g.useState([]),[bs,vn]=g.useState(!1),[Gn,ls]=g.useState(""),[Kn,Ss]=g.useState(""),[Ns,hi]=g.useState(0),[Cn,Ks]=g.useState([]),[cs,qn]=g.useState(!1),[Yn,Wn]=g.useState(""),[Ls,ys]=g.useState(0),[gn,fn]=g.useState(!1),[dn,rn]=g.useState(()=>new Set),[an,xs]=g.useState(!1),[de,Ie]=g.useState(""),[Be,it]=g.useState(""),[et,Et]=g.useState(()=>new Set),je=g.useRef(!1),Ln=g.useRef(""),us=g.useRef(null),pi=g.useRef(0),ri=g.useRef(0),[Xn,Jt]=g.useState(q_e),[vt,Dn]=g.useState("");g.useEffect(()=>{e.length!==0&&Jt(H=>H.map((le,fe)=>fe===0&&le.agentIds.length===0?{...le,agentIds:e.slice(0,2).map(Ae=>Ae.id)}:le))},[e]);const mi=g.useMemo(()=>{const H=new Map;for(const le of e)le.runtimeId&&H.set(le.runtimeId,le);return H},[e]),qa=g.useMemo(()=>{var le;const H=new Map;for(const fe of t){const Ae=(le=fe.deploymentTarget)==null?void 0:le.runtimeId;if(!Ae||!mi.has(Ae))continue;const tt=H.get(Ae);(!tt||fe.updatedAt>tt.updatedAt)&&H.set(Ae,fe)}return H},[mi,t]),ba=g.useMemo(()=>{const H=new Map;for(const le of d){if(!le.runtimeId)continue;const fe=H.get(le.runtimeId);(!fe||le.startedAt>fe.startedAt)&&H.set(le.runtimeId,le)}return H},[d]),wc=g.useMemo(()=>{const H=Me.trim().toLowerCase();return H?e.filter(le=>{const fe=le.runtimeId?qa.get(le.runtimeId):void 0,Ae=le.runtimeId?ba.get(le.runtimeId):void 0;return[le.label,le.app,le.host??"",(fe==null?void 0:fe.draft.name)??"",(fe==null?void 0:fe.draft.description)??"",(Ae==null?void 0:Ae.runtimeName)??""].join(" ").toLowerCase().includes(H)}):e},[e,ba,Me,qa]),nr=g.useMemo(()=>{const H=Me.trim().toLowerCase();return t.filter(le=>{var Ae;const fe=(Ae=le.deploymentTarget)==null?void 0:Ae.runtimeId;return fe&&mi.has(fe)?!1:H?`${le.draft.name} ${le.draft.description}`.toLowerCase().includes(H):!0})},[mi,t,Me]),Hu=g.useMemo(()=>t.filter(H=>{var fe;const le=(fe=H.deploymentTarget)==null?void 0:fe.runtimeId;return!le||!mi.has(le)}).length,[mi,t]),qs=g.useMemo(()=>{const H=Me.trim().toLowerCase();return H?Xn.filter(le=>le.name.toLowerCase().includes(H)):Xn},[Xn,Me]),ie=e.find(H=>H.id===C),Qt=t.find(H=>H.id===D),Pn=f?d.find(H=>H.id===f):void 0,Ts=ie!=null&&ie.runtimeId?qa.get(ie.runtimeId):void 0,en=v?W:C&&i===C?s:null,ks=(en==null?void 0:en.appName)||(ie==null?void 0:ie.runtimeApp)||(ie==null?void 0:ie.app)||"",Vr=`${(ie==null?void 0:ie.region)??"cn-beijing"}:${(ie==null?void 0:ie.runtimeId)??""}`,Gr=(ue==null?void 0:ue.requestKey)===Vr?ue.value:"",ne=(se==null?void 0:se.requestKey)===Vr?se:null,Se=!!((d0=ne==null?void 0:ne.apiApps)!=null&&d0.length),ge=!!(ne!=null&&ne.a2a),st=((Ku=ne==null?void 0:ne.apiApps)==null?void 0:Ku[0])??ks,on=(O==null?void 0:O.endpoint)??"",bn=Y_e(((oi=ne==null?void 0:ne.a2a)==null?void 0:oi.endpoint)??"",on),St=JSON.stringify([(ie==null?void 0:ie.runtimeId)??"",(ie==null?void 0:ie.region)??""]),qt=(Pe==null?void 0:Pe.requestKey)===St?Pe.value:null;g.useEffect(()=>{const H=pi.current+1;pi.current=H,Fe(null),Ue("");const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"";if(!l||!le||!fe){Ce(!1);return}const Ae=new AbortController;return Ce(!0),P8({runtimeId:le,region:fe,signal:Ae.signal}).then(tt=>{var bt;if(H===pi.current){if(tt.runtime.runtimeId!==le||tt.runtime.region!==fe||tt.canUpdate&&!((bt=tt.agent)!=null&&bt.appName)){Ue("Runtime 更新能力响应与当前选择不匹配。");return}Fe({requestKey:St,value:tt})}}).catch(tt=>{H!==pi.current||Ae.signal.aborted||Ue(tt instanceof Error?tt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{H===pi.current&&!Ae.signal.aborted&&Ce(!1)}),()=>Ae.abort()},[l,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId,St]);const wn=g.useMemo(()=>{const H=new Map(e.map((fe,Ae)=>[fe.id,Ae])),le=new Map(n.map((fe,Ae)=>[fe,Ae]));return[...wc].sort((fe,Ae)=>{const tt=fe.runtimeId?ba.get(fe.runtimeId):void 0,bt=Ae.runtimeId?ba.get(Ae.runtimeId):void 0,ds=(tt==null?void 0:tt.status)==="running"?tt.startedAt:0,_r=(bt==null?void 0:bt.status)==="running"?bt.startedAt:0;if(ds!==_r)return _r-ds;const Yt=le.get(fe.id),Gi=le.get(Ae.id);return Yt!=null&&Gi!=null?Yt-Gi:Yt!=null?-1:Gi!=null?1:(H.get(fe.id)??0)-(H.get(Ae.id)??0)})},[n,e,wc,ba]),Ds=(ie==null?void 0:ie.label)||(en==null?void 0:en.name)||(Qt==null?void 0:Qt.draft.name)||(Pn==null?void 0:Pn.runtimeName)||"未选择智能体",sr=Xn.find(H=>H.id===vt),zi=wn.filter(H=>H.canDelete===!0),wr=wn.filter(H=>Ge.has(H.id)&&H.canDelete===!0),Qn=nr.filter(H=>Vn.has(H.id)),ir=zi.length+nr.length,Dt=wr.length+Qn.length,Ps=g.useMemo(()=>(Pn==null?void 0:Pn.agentDraft)??(Qt==null?void 0:Qt.draft)??(Ts==null?void 0:Ts.draft)??Z_e(en,(ie==null?void 0:ie.label)??"agent"),[en,ie==null?void 0:ie.label,Ts==null?void 0:Ts.draft,Qt==null?void 0:Qt.draft,Pn==null?void 0:Pn.agentDraft]),Eo=Qt?a?"":"当前账号没有新建 Agent 的权限。":l?ie!=null&&ie.runtimeId?ie.region?Ye?"正在检查 Runtime 更新能力…":Ve||(qt?qt.canUpdate?(Ah=qt.agent)!=null&&Ah.appName?"":"Runtime 更新能力响应缺少智能体信息。":qt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",Sh="aw-update-disabled-reason",Qg=qt!=null&&qt.agent?{runtimeId:qt.runtime.runtimeId,name:qt.runtime.name,region:qt.runtime.region,appName:qt.agent.appName,currentVersion:qt.runtime.currentVersion}:Ts==null?void 0:Ts.deploymentTarget,Zg=g.useMemo(()=>{if(en)return en.tools;const H=(Ps.builtinTools??[]).map(le=>{var fe;return((fe=Ou.find(Ae=>Ae.id===le))==null?void 0:fe.label)??le});return Array.from(new Set([...Ps.tools,...H,...(Ps.customTools??[]).map(le=>le.name),...(Ps.mcpTools??[]).map(le=>le.name)].filter(Boolean)))},[Ps,en]),vo=g.useMemo(()=>en?en.skillsPreviewSupported?en.skills.map(H=>H.name):null:Array.from(new Set([...(Ps.selectedSkills??[]).map(H=>H.name),...Ps.skills].filter(Boolean))),[Ps,en]),ai=g.useMemo(()=>{if(Pn)return Pn;if(Qt)return d.filter(H=>{var le,fe;return((le=H.agentDraft)==null?void 0:le.name)===Qt.draft.name||H.runtimeName===Qt.draft.name||!!((fe=Qt.deploymentTarget)!=null&&fe.runtimeId)&&H.runtimeId===Qt.deploymentTarget.runtimeId}).sort((H,le)=>le.startedAt-H.startedAt)[0];if(ie)return d.filter(H=>!!ie.runtimeId&&H.runtimeId===ie.runtimeId||H.runtimeName===ie.label).sort((H,le)=>le.startedAt-H.startedAt)[0]},[d,ie,Qt,Pn]),CE=!!(f&&ai&&ai.id===f),Jg=!!(ai&&(ai.status!=="success"||CE)),e0=g.useMemo(()=>rSe(Ps),[Ps]),Ya=(ie==null?void 0:ie.currentVersion)??(O==null?void 0:O.currentVersion)??null,IE=Ya??(Pn==null?void 0:Pn.startedAt)??"unknown",t0=en?`runtime:${(ie==null?void 0:ie.runtimeId)??en.name}:v${IE}:${e0}`:`draft:${(Pn==null?void 0:Pn.id)??(Qt==null?void 0:Qt.id)??(ie==null?void 0:ie.id)??Ds}:${e0}`;g.useEffect(()=>{if(!f)return;const H=d.find(fe=>fe.id===f),le=H!=null&&H.runtimeId?mi.get(H.runtimeId):void 0;if(le){$(""),I(le.id),F("basic");return}I(""),$(""),F("basic")},[mi,d,f]),g.useEffect(()=>{if(!h){Ln.current="";return}const H=`${h}:${p}:${m}`;Ln.current!==H&&e.some(le=>le.id===h)&&(Ln.current=H,$(""),I(h),F(p),p==="evaluations"&&(ut(m),xt("")))},[e,h,p,m]),g.useEffect(()=>{for(const H of wn.slice(0,8)){if(!H.runtimeId)continue;const le=H.region??"cn-beijing";U8(H.runtimeId,le),S8(H.runtimeId,le,H.runtimeApp??""),c1(H.runtimeId,le,H.runtimeApp??"").then(fe=>{const Ae=fe.appName||H.app;Ae&&LS({runtimeId:H.runtimeId??"",region:le,appName:Ae,pageSize:100})}).catch(()=>{})}},[wn]),g.useEffect(()=>{!(ie!=null&&ie.runtimeId)||!ks||LS({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:ks,pageSize:100})},[ks,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",Ae=(ie==null?void 0:ie.runtimeApp)??"",tt=le?_8(le,fe,Ae):null;if(oe(tt),Ee(!!tt||!v||!le),!(!v||!le))return c1(le,fe,Ae,{force:!0}).then(bt=>{H||oe(bt)}).catch(()=>{!H&&!tt&&oe(null)}).finally(()=>{H||Ee(!0)}),()=>{H=!0}},[v,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeApp,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing";if(Ks([]),Wn(""),L!=="optimizations"||!le){qn(!1);return}if(v&&!ks){qn(!Z);return}return qn(!0),c8({runtimeId:le,region:fe,appName:ks}).then(Ae=>{H||Ks(Ae.groups)}).catch(Ae=>{H||Wn(Ae instanceof Error?Ae.message:String(Ae))}).finally(()=>{H||qn(!1)}),()=>{H=!0}},[Z,v,Ls,L,ks,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{ri.current+=1,we(null),Ne(!1),me(!1),Je(""),be("api-server")},[Vr,L]);function n0(){ri.current+=1,we(null),Ne(!1),me(!1),Je("")}function wo(H){H!==he&&(n0(),be(H))}async function s0(){if(Le){n0();return}const H=(ie==null?void 0:ie.runtimeId)??"",le=(ie==null?void 0:ie.region)??"cn-beijing";if(!H)return;const fe=ri.current+1;ri.current=fe,me(!0),Je("");try{const Ae=await L8(H,le);if(fe!==ri.current)return;we({requestKey:Vr,value:Ae}),Ne(!0)}catch(Ae){if(fe!==ri.current)return;we(null),Ne(!1),Je(Ae instanceof Error?Ae.message:"读取 Runtime API Key 失败。")}finally{fe===ri.current&&me(!1)}}g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",Ae=le?B8(le,fe):null;if(te(Ae),!!le)return h2(le,fe,{force:!0}).then(tt=>{H||te(tt)}).catch(()=>{!H&&!Ae&&te(null)}),()=>{H=!0}},[ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",Ae=`${fe}:${le}`;if(X(""),L!=="integrations"||!le){ee(!1),le||P(null);return}ee(!0);const tt=f2(le,fe,{retryProbe:!0}).catch(bt=>{if(bt instanceof Or&&bt.unsupported)return null;throw bt});return Promise.all([tt,M8(le,fe,{retryProbe:!0})]).then(([bt,ds])=>{H||P({requestKey:Ae,apiApps:bt,a2a:ds})}).catch(bt=>{H||(P(null),X(bt instanceof Error?bt.message:"探测集成方式失败。"))}).finally(()=>{H||ee(!1)}),()=>{H=!0}},[K,L,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",Ae=le&&ks?u8({runtimeId:le,region:fe,appName:ks,pageSize:100}):null;if(At(Ae?x3(Ae):[]),Ms((Ae==null?void 0:Ae.sets)??[]),ls(""),Ss((Ae==null?void 0:Ae.unsupportedMessage)??""),L!=="evaluations"||!le){vn(!1);return}if(v&&!ks){vn(!Z);return}return vn(!Ae),Nx({runtimeId:le,region:fe,appName:ks,pageSize:100},{force:!0}).then(tt=>{H||(Ms(tt.sets),At(x3(tt)),Ss(tt.unsupportedMessage??""))}).catch(tt=>{H||(ls(tt instanceof Error?tt.message:String(tt)),Ss(""))}).finally(()=>{H||vn(!1)}),()=>{H=!0}},[Z,v,Ns,L,ks,en==null?void 0:en.appName,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(mn.map(le=>le.id));rn(le=>{const fe=new Set([...le].filter(Ae=>H.has(Ae)));return fe.size===le.size?le:fe}),Et(le=>{const fe=new Set([...le].filter(Ae=>H.has(Ae)));return fe.size===le.size?le:fe}),Be&&!H.has(Be)&&it("")},[mn,Be]),g.useEffect(()=>{fn(!1),rn(new Set),Et(new Set),Ie(""),it("")},[ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(wn.filter(le=>le.canDelete===!0).map(le=>le.id));ht(le=>{const fe=new Set([...le].filter(Ae=>H.has(Ae)));return fe.size===le.size?le:fe})},[wn]),g.useEffect(()=>{const H=new Set(nr.map(le=>le.id));un(le=>{const fe=new Set([...le].filter(Ae=>H.has(Ae)));return fe.size===le.size?le:fe})},[nr]);const _o=g.useMemo(()=>!b||!(ie!=null&&ie.runtimeId)||b.runtimeId!==ie.runtimeId||ks&&b.agentName&&b.agentName!==ks?null:{...b,tag:b.kind==="good"?"Good case":"Bad case"},[b,ie==null?void 0:ie.runtimeId,ks]),So=g.useMemo(()=>ie!=null&&ie.runtimeId?_o?[_o,...mn.filter(H=>H.id!==_o.id&&(!H.messageId||H.messageId!==_o.messageId))]:mn:K_e,[mn,_o,ie==null?void 0:ie.runtimeId]),ml=So.filter(H=>{if(H.kind!==Ot||(H.source==="auto"?"auto":"user")!==wt)return!1;const fe=xn.trim().toLowerCase();return fe?[H.input,H.output,H.referenceOutput,H.comment,H.tag??"",H.sessionId,H.messageId,H.userId,H.evaluationSetName].join(" ").toLowerCase().includes(fe):!0}),Wa=ml.filter(H=>dn.has(H.id)),i0=!!(ie!=null&&ie.runtimeId),Zn=H=>{ut(H),xt(""),Ie("");const le=So.find(fe=>fe.kind===H);it((le==null?void 0:le.id)??""),window.setTimeout(()=>{var fe;(fe=us.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"})},0)},jE=H=>{Ie(""),rn(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe})},RE=()=>{Ie(""),rn(new Set(ml.map(H=>H.id)))},OE=()=>{Ie(""),rn(new Set),fn(!1)},Vi=H=>{Et(le=>{const fe=new Set(le);return fe.has(H)?fe.delete(H):fe.add(H),fe})},r0=H=>{it(H.id),Ie(""),!(!H.sessionId||!H.messageId)&&(T==null||T(H))},zu=async H=>{if(!(ie!=null&&ie.runtimeId)||!ks||an||H.length===0)return;const le=H.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${H.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(le))return;const fe=H.map(tt=>tt.id),Ae=new Set(fe);xs(!0),Ie("");try{await h8({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:ks,itemIds:fe});const tt=new Map;for(const bt of H)tt.set(bt.kind,(tt.get(bt.kind)??0)+1);At(bt=>bt.filter(ds=>!Ae.has(ds.id))),Ms(bt=>bt.map(ds=>({...ds,itemCount:Math.max(0,ds.itemCount-(tt.get(ds.kind)??0))}))),rn(bt=>new Set([...bt].filter(ds=>!Ae.has(ds)))),Et(bt=>new Set([...bt].filter(ds=>!Ae.has(ds)))),Be&&Ae.has(Be)&&it(""),H.length>1&&fn(!1),k==null||k(H)}catch(tt){Ie(tt instanceof Error?tt.message:String(tt))}finally{xs(!1)}},a0=H=>{Jt(le=>le.map(fe=>fe.id===H.id?H:fe))},o0=()=>{const H=new Set(e.map(Ae=>Ae.id)),le=n.filter(Ae=>H.has(Ae)),fe=new Set(le);return[...le,...e.filter(Ae=>!fe.has(Ae.id)).map(Ae=>Ae.id)]},Nh=(H,le,fe)=>{if(!x||H===le)return;const Ae=o0().filter(ds=>ds!==H),tt=Ae.indexOf(le),bt=tt<0?Ae.length:fe==="after"?tt+1:tt;Ae.splice(bt,0,H),x(Ae)},Vu=(H,le)=>{if(!Ut||Ut===le)return;const fe=H.currentTarget.getBoundingClientRect();ft(le),_t(H.clientY>fe.top+fe.height/2?"after":"before")},Gu=(H,le)=>{if(!x)return;const fe=o0(),Ae=fe.indexOf(H),tt=Math.max(0,Math.min(fe.length-1,Ae+le));Ae<0||Ae===tt||(fe.splice(Ae,1),fe.splice(tt,0,H),x(fe))},ME=H=>{H.canDelete===!0&&(zt(""),ht(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe}))},l0=H=>{zt(""),un(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe})},No=()=>{zt(""),ht(new Set(zi.map(H=>H.id))),un(new Set(nr.map(H=>H.id)))},Bt=()=>{zt(""),ht(new Set),un(new Set),We(!1)},c0=()=>{if(Dt===0||Ht)return;const H=wr.length,le=Qn.length;zt(""),An({kind:"selection",title:H===1&&le===0?"删除 Agent?":H===0&&le===1?"删除草稿?":"删除所选项目?",description:H===1&&le===0?`"${wr[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:H===0&&le===1?`"${Qn[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${Dt} 个项目。${H>0?`${H} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:H===0&&le===1?"删除草稿":"删除所选",agents:wr,drafts:Qn})},u0=async()=>{if(!(!ot||Ht)){sn(!0),zt("");try{if(ot.kind==="selection"){const{agents:H,drafts:le}=ot;if(H.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E(H)}le.length>0&&(w==null||w(le)),ht(new Set),un(new Set),We(!1),H.some(fe=>fe.id===C)&&I(""),le.some(fe=>fe.id===D)&&$("")}else if(ot.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([ot.agent]),C===ot.agent.id&&I("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([ot.draft]),D===ot.draft.id&&$("")}An(null)}catch(H){zt(H instanceof Error?H.message:String(H))}finally{sn(!1)}}},LE=H=>{!E||H.canDelete!==!0||Ht||(zt(""),An({kind:"agent",title:"删除 Agent?",description:`"${H.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:H}))},Th=H=>{if(!w||Ht)return;const le=H.draft.name||"未命名 Agent";zt(""),An({kind:"draft",title:"删除草稿?",description:`"${le}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:H})},kh=()=>{const H=`eval-${Date.now()}`,le={id:H,name:`新评测组 ${Xn.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Jt(fe=>[le,...fe]),Dn(H)},DE=H=>{a0({...H,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+H.history.length%7,status:"completed"},...H.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${v?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:B==="library"?"is-active":"","aria-pressed":B==="library",onClick:()=>{z("library"),lt("")},children:"智能体库"}),o.jsx("button",{type:"button",className:B==="evaluation"?"is-active":"","aria-pressed":B==="evaluation",onClick:()=>{z("evaluation"),lt("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":B==="evaluation"||void 0,ref:H=>{H==null||H.toggleAttribute("inert",B==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":B==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(t1,{"aria-hidden":!0}),o.jsx("input",{value:Me,onChange:H=>lt(H.currentTarget.value),placeholder:B==="library"?"搜索智能体":"搜索评测组","aria-label":B==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:B==="library"?A:kh,disabled:B==="library"&&!a,children:[o.jsx(ji,{"aria-hidden":!0}),o.jsx("span",{children:B==="library"?"新建 Agent":"新建评测组"})]}),B==="library"&&(E||w)&&o.jsx("div",{className:`aw-selection-toolbar${ye?" is-active":""}`,children:ye?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Dt," 个"]}),o.jsx("button",{type:"button",onClick:No,disabled:ir===0||Ht,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void c0(),disabled:Dt===0||Ht,children:Ht?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Bt,disabled:Ht,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{zt(""),We(!0)},disabled:ir===0,children:"选择"})}),B==="library"&&kn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:kn}),o.jsx("div",{className:"aw-agent-list",children:B==="evaluation"?qs.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):qs.map(H=>o.jsxs("button",{type:"button",className:`aw-agent-item${H.id===vt?" is-active":""}`,onClick:()=>Dn(H.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:H.name}),o.jsxs("small",{children:[H.agentIds.length," 个智能体 · ",H.history.length," 次运行"]})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)):c&&wn.length===0&&nr.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&wn.length===0&&nr.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:u}),y&&o.jsx("button",{type:"button",onClick:y,children:"重试"})]}):wn.length===0&&nr.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[nr.map(H=>{const le=d.filter(Ae=>{var tt,bt;return((tt=Ae.agentDraft)==null?void 0:tt.name)===H.draft.name||Ae.runtimeName===H.draft.name||!!((bt=H.deploymentTarget)!=null&&bt.runtimeId)&&Ae.runtimeId===H.deploymentTarget.runtimeId}).sort((Ae,tt)=>tt.startedAt-Ae.startedAt)[0],fe=Vn.has(H.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",ye?"is-selecting":"",fe?"is-selected-for-delete":"",H.id===D?"is-active":""].filter(Boolean).join(" "),"aria-pressed":ye?fe:void 0,onClick:()=>{if(ye){l0(H);return}I(""),$(H.id),F("basic")},children:[ye&&o.jsx("span",{className:`aw-select-marker${fe?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(le==null?void 0:le.status)==="running"?" is-deploying":""}`,children:(le==null?void 0:le.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:H.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)}),wn.map(H=>{const le=H.runtimeId?ba.get(H.runtimeId):void 0,fe=H.runtimeId?qa.get(H.runtimeId):void 0,Ae=Ge.has(H.id),tt=H.canDelete===!0,bt=(le==null?void 0:le.status)==="running"?{label:"部署中",className:" is-deploying"}:(le==null?void 0:le.status)==="error"?{label:"失败",className:" is-error"}:(le==null?void 0:le.status)==="cancelled"?{label:"已取消",className:" is-muted"}:fe?{label:"待更新",className:""}:null,ds=(le==null?void 0:le.status)==="running"?"正在更新部署":fe?"待更新":H.remote?H.host||"远程智能体":"本地智能体",_r=["aw-agent-item","aw-agent-item--sortable",H.id===C?"is-active":"",ye?"is-selecting":"",Ae?"is-selected-for-delete":"",ye&&!tt?"is-selection-disabled":"",H.id===Ut?"is-dragging":"",H.id===at&&H.id!==Ut?`is-drop-target is-drop-${He}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!ye,className:_r,"aria-pressed":ye?Ae:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Yt=>{x&&(je.current=!0,Pt(H.id),Yt.dataTransfer.effectAllowed="move",Yt.dataTransfer.setData("text/plain",H.id))},onDragEnter:Yt=>{Vu(Yt,H.id)},onDragOver:Yt=>{!Ut||Ut===H.id||(Yt.preventDefault(),Yt.dataTransfer.dropEffect="move",Vu(Yt,H.id))},onDragLeave:Yt=>{const Gi=Yt.relatedTarget;Gi instanceof Node&&Yt.currentTarget.contains(Gi)||at===H.id&&ft("")},onDrop:Yt=>{Yt.preventDefault();const Gi=Yt.dataTransfer.getData("text/plain")||Ut;Nh(Gi,H.id,He),Pt(""),ft(""),_t("before")},onDragEnd:()=>{Pt(""),ft(""),_t("before"),window.setTimeout(()=>{je.current=!1},0)},onKeyDown:Yt=>{Yt.altKey&&(Yt.key==="ArrowUp"?(Yt.preventDefault(),Gu(H.id,-1)):Yt.key==="ArrowDown"&&(Yt.preventDefault(),Gu(H.id,1)))},onClick:Yt=>{if(ye){Yt.preventDefault(),ME(H);return}if(je.current){Yt.preventDefault(),je.current=!1;return}$(""),I(H.id),F("basic"),S(H.id)},children:[ye&&o.jsx("span",{className:`aw-select-marker${Ae?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.label}),H.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",H.currentVersion]}),bt&&o.jsx("span",{className:`aw-draft-badge${bt.className}`,children:bt.label})]}),o.jsx("small",{children:ds})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",B==="library"?e.length+Hu:Xn.length," 个"]})]}),B==="evaluation"&&sr?o.jsx(gSe,{group:sr,agents:e,cases:So,onChange:a0,onRun:DE}):B==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!ie&&!Qt&&!Pn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[ie&&!en&&r&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),L==="integrations"&&Q&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:Ds}),Ya!=null&&o.jsxs("span",{children:["v",Ya]}),Qt&&o.jsx("span",{children:"草稿"}),Ts&&o.jsx("span",{children:"待更新"}),!ie&&!Qt&&Pn&&o.jsx("span",{children:Pn.label})]}),o.jsx("p",{children:Ps.description||(r||v&&!Z?"正在读取智能体信息…":"暂无描述")})]}),(Qt||Ts||(ie==null?void 0:ie.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(Qt||Ts)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const H=Qt??Ts;H&&Th(H)},disabled:Ht,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(dc,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(ie==null?void 0:ie.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void LE(ie),disabled:Ht,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(dc,{"aria-hidden":!0}),o.jsx("span",{children:Ht?"删除中…":"删除 Agent"})]})]})]}),ai&&Jg&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(dSe,{task:ai})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:sd.map(H=>o.jsx("button",{type:"button",id:`agent-${H.id}-tab`,className:L===H.id?"is-active":"",role:"tab","aria-selected":L===H.id,"aria-controls":`agent-${H.id}-panel`,tabIndex:L===H.id?0:-1,onClick:()=>F(H.id),onKeyDown:le=>{var bt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(le.key))return;le.preventDefault();const fe=sd.findIndex(ds=>ds.id===H.id),Ae=le.key==="Home"?0:le.key==="End"?sd.length-1:(fe+(le.key==="ArrowRight"?1:-1)+sd.length)%sd.length,tt=sd[Ae];F(tt.id),(bt=document.getElementById(`agent-${tt.id}-tab`))==null||bt.focus()},children:H.label},H.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${L}-panel`,role:"tabpanel","aria-labelledby":`agent-${L}-tab`,children:[L==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(O==null?void 0:O.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(O==null?void 0:O.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(O==null?void 0:O.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(O==null?void 0:O.region)||(ie==null?void 0:ie.region)||(ai==null?void 0:ai.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:O!=null&&O.networkTypes.length?O.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(zm,{draft:Ps,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},t0)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:(en==null?void 0:en.model)||Ps.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:en!=null&&en.graph?dH(en.graph):fH(Ps)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:Zg.length?Zg.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:vo===null?"暂不支持预览":vo.length?vo.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Ya!=null?`v${Ya}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:Qt?"草稿":(ai==null?void 0:ai.status)==="error"?"部署失败":(ai==null?void 0:ai.status)==="cancelled"?"已取消":Ts?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),L==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),V&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>ce(H=>H+1),children:"重试"})]}),!V&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${he==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),sp.map((H,le)=>o.jsx("button",{type:"button",id:`integration-${H.id}-tab`,role:"tab","aria-selected":he===H.id,"aria-controls":`integration-${H.id}-panel`,tabIndex:he===H.id?0:-1,onClick:()=>wo(H.id),onKeyDown:fe=>{var bt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(fe.key))return;fe.preventDefault();const Ae=fe.key==="Home"?0:fe.key==="End"?sp.length-1:(le+(fe.key==="ArrowRight"?1:-1)+sp.length)%sp.length,tt=sp[Ae];wo(tt.id),(bt=document.getElementById(`integration-${tt.id}-tab`))==null||bt.focus()},children:H.label},H.id))]}),he==="api-server"?o.jsx(y3,{protocol:"api-server",title:"API Server",available:Se,fields:[{label:"Agent",value:Se?((As=ne==null?void 0:ne.apiApps)==null?void 0:As.join("、"))??"":""},{label:"发现接口",value:Se?Pw(on,"/list-apps"):""},{label:"调用接口",value:Se?Pw(on,"/run_sse"):""},{label:"鉴权方式",value:Se?g3(O==null?void 0:O.authType):""},{label:"API Key",value:o.jsx(b3,{available:Se,authType:O==null?void 0:O.authType,value:Gr,visible:Le&&!!Gr,loading:ae,error:_e,onToggle:()=>void s0()})}],example:Se?W_e(on,st,O==null?void 0:O.authType):""}):o.jsx(y3,{protocol:"a2a",title:"A2A",available:ge,fields:[{label:"Agent",value:((Ch=ne==null?void 0:ne.a2a)==null?void 0:Ch.name)??""},{label:"Agent Card",value:ge?Pw(on,"/.well-known/agent-card.json"):""},{label:"调用地址",value:bn},{label:"鉴权方式",value:ge?g3(O==null?void 0:O.authType):""},{label:"API Key",value:o.jsx(b3,{available:ge,authType:O==null?void 0:O.authType,value:Gr,visible:Le&&!!Gr,loading:ae,error:_e,onToggle:()=>void s0()})}],example:ge?X_e(bn,O==null?void 0:O.authType):""})]})]}),L==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(ie==null?void 0:ie.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(H=>{const le=iSe(Os,H),fe=So.filter(tt=>tt.kind===H).length,Ae=_o?fe:(le==null?void 0:le.itemCount)??fe;return o.jsxs("button",{type:"button",onClick:()=>Zn(H),children:[o.jsx("strong",{children:Ae}),o.jsx("span",{children:H==="good"?"Good cases":"Bad cases"})]},H)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map(H=>o.jsx("button",{type:"button",className:Ot===H?"is-active":"","aria-pressed":Ot===H,onClick:()=>ut(H),children:H==="good"?"Good case":"Bad case"},H))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(H=>o.jsx("button",{type:"button",className:wt===H?"is-active":"","aria-pressed":wt===H,onClick:()=>En(H),children:H==="auto"?"自动回流":"手动回流"},H))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(t1,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:xn,onChange:H=>xt(H.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),i0&&o.jsx("div",{className:`aw-case-toolbar${gn?" is-active":""}`,children:gn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Wa.length," 条"]}),o.jsx("button",{type:"button",onClick:RE,disabled:ml.length===0||an,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void zu(Wa),disabled:Wa.length===0||an,children:an?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:OE,disabled:an,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Ie(""),fn(!0)},disabled:ml.length===0||an,children:"选择案例"})}),de&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:de}),o.jsx("div",{ref:us,children:o.jsx(mSe,{cases:ml,loading:bs&&ml.length===0,error:Gn,notice:Kn,runtimeBacked:!!(ie!=null&&ie.runtimeId),selectionMode:gn,selectedCaseIds:dn,focusedCaseId:Be,expandedCaseIds:et,deleting:an,canDelete:i0,onOpenCase:r0,onToggleCase:jE,onToggleExpanded:Vi,onDeleteCase:H=>void zu([H]),onRetry:()=>hi(H=>H+1)})})]}),L==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),cs?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):Yn?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Yn}),o.jsx("button",{type:"button",onClick:()=>ys(H=>H+1),children:"重试"})]}):Cn.length>0?o.jsx(hSe,{groups:Cn}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),L==="basic"&&(ie||Qt)&&o.jsxs("div",{className:"aw-basic-actions",children:[ie&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(ie),children:[o.jsx(Wee,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${Eo?" is-disabled":""}`,tabIndex:Eo?0:void 0,"aria-describedby":Eo?Sh:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!Eo,"aria-busy":Ye||void 0,"aria-describedby":Eo?Sh:void 0,onClick:()=>{var H;return Qt?R==null?void 0:R(Qt):Ts?R==null?void 0:R({...Ts,deploymentTarget:Qg}):qt?j(((H=qt.agent)==null?void 0:H.draft)??Ps,qt):void 0},children:Ye?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):Qt||Ts?"继续编辑":"更新"}),Eo&&o.jsx("span",{id:Sh,className:"aw-update-disabled-reason",role:"tooltip",children:Eo})]})]})]})]}),B==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),ot&&o.jsx(mA,{variant:"danger",title:ot.title,description:ot.description,confirmLabel:Ht?"删除中...":ot.confirmLabel,closeLabel:"关闭删除确认",busy:Ht,onCancel:()=>An(null),onConfirm:()=>void u0()})]})}function hSe({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:tSe(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:sSe(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function pSe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function mSe({cases:e,loading:t=!1,error:n="",notice:s="",runtimeBacked:i=!1,selectionMode:r=!1,selectedCaseIds:a,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:p,onDeleteCase:m,onRetry:b}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:"重试"})]}):s?o.jsx("div",{className:"aw-case-empty",children:s}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(v=>{var k;const y=v.id.startsWith("local:"),x=(a==null?void 0:a.has(v.id))??!1,E=(c==null?void 0:c.has(v.id))??!1,S=v.output.length+v.referenceOutput.length>220||(((k=v.reason)==null?void 0:k.length)??0)>120,_=d&&!y,T=v.source==="auto";return o.jsxs("div",{className:["aw-case-row",l===v.id?"is-focused":"",r?"is-selecting":"",x?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":r?x:void 0,onClick:()=>{if(r){_&&(h==null||h(v));return}f==null||f(v)},onKeyDown:A=>{A.target===A.currentTarget&&(A.key!=="Enter"&&A.key!==" "||(A.preventDefault(),r?_&&(h==null||h(v)):f==null||f(v)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[r&&_&&o.jsx("span",{className:`aw-select-marker${x?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:v.input,children:v.input||"无用户输入"})]}),v.comment&&o.jsxs("small",{title:v.comment,children:["备注:",v.comment]}),o.jsx("small",{className:"aw-case-time",children:J_e(v.createdAt)}),(v.userId||v.sessionId)&&o.jsx("small",{title:[v.userId,v.sessionId].filter(Boolean).join(" · "),children:[v.userId,v.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${E?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:v.output,children:v.output||"无可见回复"}),v.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:v.referenceOutput,children:["Reference: ",v.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:A=>{A.stopPropagation(),p==null||p(v.id)},children:E?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:eSe(v)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${E?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:T?v.reason:void 0,children:T?v.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:_&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:A=>{A.stopPropagation(),m==null||m(v)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(pSe,{})})})]},v.id)})]})}function gSe({group:e,agents:t,cases:n,onChange:s,onRun:i}){const[r,a]=g.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];g.useEffect(()=>a("config"),[e.id]);const u=f=>{s({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{s({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(Uee,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:r==="config"?"is-active":"","aria-pressed":r==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:r==="history"?"is-active":"","aria-pressed":r==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:r==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>s({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>s({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>s({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(Ha,{}),"已完成"]}),o.jsx(Kp,{"aria-hidden":!0})]},f.id))})]})})]})}function mH(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let s=.985;n<=80?s=.96:n<=150?s=.97:n<=220?s=.98:n>600&&(s=.995),t.style.setProperty("--scale",s.toString())},MN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!vSe||typeof window.requestAnimationFrame!="function"||bH&&document.visibilityState==="hidden")return n();let i=2,r=window.requestAnimationFrame(function a(){i-=1,i===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},wSe=e=>Object.keys(e).reduce((n,s)=>{const i=e[s];if(i||i===0){const r=s.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${r}${s}`]=a}return n},{}),_Se=e=>{const t=g.Children.toArray(e),n=[];let s="";const i=()=>{s!==""&&(n.push(s),s="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){s+=String(r);continue}i(),n.push(r)}return i(),n},xH=e=>{const t=_Se(e),n=g.Children.count(t);return g.Children.map(t,s=>{if(typeof s=="string"&&s.trim())return n<=1?s:o.jsx("span",{children:s});if(g.isValidElement(s)){const i=s,{children:r,...a}=i.props;return r!=null?g.cloneElement(i,a,xH(r)):i}return s})};g.createContext(null);var SSe=typeof Bl=="object"&&Bl&&Bl.Object===Object&&Bl,NSe=typeof self=="object"&&self&&self.Object===Object&&self;SSe||NSe||Function("return this")();var TSe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function kSe(){const e=g.useRef(!1);return g.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),g.useCallback(()=>e.current,[])}var E3={width:void 0,height:void 0};function ASe(e){const{ref:t,box:n="content-box"}=e,[{width:s,height:i},r]=g.useState(E3),a=kSe(),l=g.useRef({...E3}),c=g.useRef(void 0);return c.current=e.onResize,g.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=v3(d,f,"inlineSize"),p=v3(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const b={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(b):a()&&r(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:s,height:i}}function v3(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function CSe(e,t){const n=g.useRef(e);TSe(()=>{n.current=e},[e]),g.useEffect(()=>{if(!t&&t!==0)return;const s=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(s)}},[t])}const ISe="_LoadingIndicator_7yl6f_1",jSe={LoadingIndicator:ISe},RSe=({className:e,size:t,strokeWidth:n,style:s,...i})=>o.jsx("div",{...i,className:ga(jSe.LoadingIndicator,e),style:s||wSe({"indicator-size":t,"indicator-stroke":n})});function OSe(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const MSe=()=>gH,w3=(e,t=!1,n="TransitionGroup")=>{const s=[];return g.Children.forEach(e,i=>{if(i&&typeof i=="object"&&"key"in i&&i.key)s.push(i);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),s},id=()=>{},rd=e=>{const t=g.useRef(e);return t.current=e,g.useCallback(n=>t.current(n),[])};function LSe(e,t,n,s){const i=e.reduce((c,u)=>({...c,[u.key]:1}),{}),r=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=e.filter(c=>!r[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!i[c.component.key]}));return s==="append"?l.concat(a):a.concat(l)}function DSe(e,t,n){if((gH||ySe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const PSe="_TransitionGroupChild_1hv1z_1",BSe={TransitionGroupChild:PSe},EH={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},USe=e=>({...EH,enter:!e}),FSe=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return EH}},$Se=({ref:e,as:t,children:n,className:s,transitionId:i,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:b,onExitComplete:v})=>{const[y,x]=g.useReducer(FSe,USe(a||!1)),E=g.useRef(!1),w=g.useRef(null),S=g.useRef(c);S.current=c;const _=g.useRef(u);_.current=u;const T=g.useRef(null),k=g.useCallback(A=>{const j=w.current;if(!(!j||A===T.current))switch(T.current=A,A){case"enter":f(j);break;case"enter-active":h(j);break;case"enter-complete":p(j);break;case"exit":m(j);break;case"exit-active":b(j);break;case"exit-complete":v(j);break}},[f,h,p,m,b,v]);return Lt.useLayoutEffect(()=>{if(!l){let R;x({type:"exit-before"}),k("exit");const B=MN(()=>{x({type:"exit-active"}),k("exit-active"),R=window.setTimeout(()=>{k("exit-complete"),d()},_.current)});return()=>{B(),R!==void 0&&clearTimeout(R)}}if(a&&!E.current){E.current=!0;return}let A;x({type:"enter-before"}),k("enter");const j=MN(()=>{x({type:"enter-active"}),k("enter-active"),A=window.setTimeout(()=>{x({type:"done"}),k("enter-complete")},S.current)});return()=>{j(),A!==void 0&&clearTimeout(A)}},[l,a,d,k]),g.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:OSe([w,e]),className:ga(s,BSe.TransitionGroupChild),"data-transition-id":i,style:r,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},HSe=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,s=!n&&t!=null?t:null,[i,r]=g.useState(s==null);return CSe(()=>r(!0),i?null:s),i?o.jsx($Se,{...e}):null},zSe=e=>{const{ref:t,as:n="span",children:s,className:i,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=MSe()}=e,p=rd(e.onEnter??id),m=rd(e.onEnterActive??id),b=rd(e.onEnterComplete??id),v=rd(e.onExit??id),y=rd(e.onExitActive??id),x=rd(e.onExitComplete??id);g.Children.forEach(s,_=>{if(_&&!_.key)throw new Error("Child elements of must include a `key`")});const E=g.useCallback(_=>({component:_,shouldRender:!0,removeChild:()=>{S(T=>T.filter(k=>_.key!==k.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,b,v,y,x]),[w,S]=g.useState(()=>w3(s).map(_=>({...E(_),preventMountTransition:u})));return g.useLayoutEffect(()=>{S(_=>{const T=w3(s);return LSe(T,_,E,f)})},[s,f,E]),DSe("TransitionGroup",t,g.Children.count(s)),h?o.jsx(o.Fragment,{children:g.Children.map(s,_=>o.jsx(n,{ref:t,className:i,style:a,"data-transition-id":r,children:_}))}):o.jsx(o.Fragment,{children:w.map(({component:_,...T})=>o.jsx(HSe,{...T,as:n,className:i,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:_},_.key))})},VSe="_Button_1864l_1",GSe="_ButtonInner_1864l_4",KSe="_ButtonLoader_1864l_749",Bw={Button:VSe,ButtonInner:GSe,ButtonLoader:KSe},_3=e=>{const{type:t="button",color:n="primary",variant:s="solid",pill:i=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:b,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,S=g.useCallback(_=>{v||b==null||b(_)},[b,v]);return o.jsxs("button",{type:t,className:ga(Bw.Button,m),"data-color":n,"data-variant":s,"data-pill":i?"":void 0,"data-uniform":r?"":void 0,"data-size":a,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:yH,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:S,...E,children:[o.jsx(zSe,{className:Bw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(RSe,{},"loader")}),o.jsx("span",{className:Bw.ButtonInner,children:xH(p)})]})},qSe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),YSe="_EmptyMessage_1r5gu_1",WSe="_IconBadge_1r5gu_16",XSe="_Title_1r5gu_54",QSe="_Description_1r5gu_69",ZSe="_ActionRow_1r5gu_77",Bg={EmptyMessage:YSe,IconBadge:WSe,Title:XSe,Description:QSe,ActionRow:ZSe},ns=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:ga(Bg.EmptyMessage,t),"data-fill":n,children:e}),JSe=({size:e="md",color:t="secondary",children:n,className:s})=>o.jsx("div",{className:ga(Bg.IconBadge,s),"data-size":e,"data-color":t,children:n}),eNe=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:ga(Bg.Title,t),"data-color":n,children:e}),tNe=({children:e,className:t})=>o.jsx("div",{className:ga(Bg.Description,t),children:e}),nNe=({children:e,className:t})=>o.jsx("div",{className:ga(Bg.ActionRow,t),children:e});ns.Icon=JSe;ns.Title=eNe;ns.Description=tNe;ns.ActionRow=nNe;const dr="/web/sandbox/sessions",S3=3e4,N3=33e4,sNe=6e4,iNe=6e5,Uw=15e3,Uo=6e4,rNe=33e4,T3=40;function iE(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function li(e){const t=Ex(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function ci(e,t){const n=await e.text().catch(()=>"");let s={};try{s=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=s.detail,r=i&&typeof i=="object"&&"message"in i?i.message:i??s.error??s.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function ad(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",toolType:e.toolType??"",createdBy:e.createdBy??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:rE(e.permissions)}}const ip={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function rE(e){if(!e||typeof e!="object")return{...ip};const t=e,n=t.approvalPolicy,s=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:ip.approvalPolicy,approvalsReviewer:s==="user"||s==="auto_review"?s:ip.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:ip.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:ip.networkAccess}}function k3(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:rE(t.permissions)}}function ja(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function aNe(e){const t=ja(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function oNe(e){const t=ja(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function vH(e){const t=ja(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function hb(e){const t=ja(e),n=vH(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const s=t.messages.flatMap(i=>{const r=ja(i);if(!r||typeof r.id!="string"||r.role!=="user"&&r.role!=="assistant"||typeof r.content!="string"||typeof r.timestamp!="number")return[];const a=Array.isArray(r.skillNames)?r.skillNames.filter(l=>typeof l=="string"&&!!l):[];return[{id:r.id,role:r.role,content:r.content,timestamp:r.timestamp,...a.length?{skillNames:a}:{}}]});return{thread:n,threadId:t.threadId,messages:s,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:rE(t.permissions)}}function LN(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(s=>typeof s!="number"||!Number.isFinite(s)||s<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function lNe(e){const t=LN(e.usage);if(!t||typeof e.turnId!="string")return;const n=LN(e.threadTotal),s=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof s=="number"&&Number.isFinite(s)&&s>=0?{modelContextWindow:Math.trunc(s)}:{}}}function cNe(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function uNe(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),s=new TextDecoder;let i="",r="";const a=[],l=new Map;let c;function u(){var p;(p=t.onBlocks)==null||p.call(t,a.map(m=>({...m})))}function d(p){r+=p;const m=a[a.length-1];(m==null?void 0:m.kind)==="text"?m.text+=p:a.push({kind:"text",text:p}),u()}function f(p){if(typeof p.id!="string"||p.kind!=="thinking"&&p.kind!=="tool"||p.status!=="running"&&p.status!=="done")return;const m=p.status==="done";let b;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;b={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;b={kind:"tool",name:p.name,args:p.args,response:p.response,done:m}}const v=l.get(p.id);v===void 0?(l.set(p.id,a.length),a.push(b)):a[v]=b,u()}function h(p){var y,x,E;let m="message";const b=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&b.push(w.slice(5).trimStart());if(b.length===0)return;let v;try{v=JSON.parse(b.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(m==="error")throw new Error(typeof v.message=="string"&&v.message?v.message:"沙箱对话失败,请稍后重试。");if(m==="activity"&&f(v),m==="approval"){const w=cNe(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=lNe(v);w&&(c=w,(x=t.onUsage)==null||x.call(t,w))}m==="approval_resolved"&&typeof v.approvalId=="string"&&((E=t.onApprovalResolved)==null||E.call(t,v.approvalId)),m==="delta"&&typeof v.text=="string"&&d(v.text),m==="done"&&!r&&typeof v.text=="string"&&d(v.text)}for(;;){const{done:p,value:m}=await n.read();i+=s.decode(m,{stream:!p});const b=i.split(/\r?\n\r?\n/);if(i=b.pop()??"",b.forEach(h),p)break}if(i.trim()&&h(i),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function Ja(e,t,{method:n="GET",body:s,options:i={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:li(s===void 0?void 0:{"Content-Type":"application/json"}),...s===void 0?{}:{body:JSON.stringify(s)},signal:Bn(i.signal,Uo)});if(!a.ok)throw await ci(a,r);return a.json()}const cn={async listSessions(e={}){const t=await fetch(Rn(dr),{method:"GET",headers:li(),signal:Bn(e.signal,S3)});if(!t.ok)throw await ci(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(s=>ad(s))},async startSession(e={}){var n;const t=await fetch(Rn(dr),{method:"POST",headers:li({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:Bn(e.signal,N3)});if(!t.ok)throw await ci(t,"无法启动 AgentKit 沙箱,请稍后重试。");return ad(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(Rn(`/web/${e}/sessions`),{method:"GET",headers:li(),signal:Bn(t.signal,S3)});if(!n.ok)throw await ci(n,`无法读取 ${e} 智能体,请稍后重试。`);const s=await n.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return s.sessions.map(i=>ad(i,e))},async startAgentSession(e,t={}){var s;const n=await fetch(Rn(`/web/${e}/sessions`),{method:"POST",headers:li({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=t.displayName)==null?void 0:s.trim())??""}),signal:Bn(t.signal,N3)});if(!n.ok)throw await ci(n,`无法创建 ${e} 智能体,请稍后重试。`);return ad(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const s=await fetch(Rn(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:li(),signal:Bn(n.signal,Uo)});if(!s.ok)throw await ci(s,`无法打开 ${e} 智能体。`);const i=await s.json();if(typeof i.webuiUrl!="string"||!i.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:ad(i,e),kind:e,webuiUrl:Rn(i.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await fetch(Rn(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:li(),signal:Bn(n.signal,Uo)});if(!s.ok)throw await ci(s,`无法打开 ${e} Terminal。`);const i=await s.json();return{url:wH(i.url,`${e} Terminal`),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const s=await fetch(Rn(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:li(),signal:Bn(n.signal,Uw)});if(!s.ok&&s.status!==404)throw await ci(s,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:li({"Content-Type":"application/json"}),signal:Bn(t.signal,sNe)});if(!n.ok)throw await ci(n,"无法连接 Codex 智能体,请稍后重试。");const s=ad(await n.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(e,t={}){var s;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(Rn(`${dr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:li({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(s=e.skillIds)!=null&&s.length?{skillIds:e.skillIds}:{}}),signal:Bn(t.signal,iNe)});if(!n.ok)throw await ci(n,"沙箱对话失败,请稍后重试。");return uNe(n,t)},async getStatus(e,t={}){const n=await Ja(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),s=k3(n),i=ja(n),r=LN(i==null?void 0:i.threadTotal),a=i==null?void 0:i.modelContextWindow;return{...s,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=ja(await Ja(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(s=>{const i=aNe(s);return i?[i]:[]})},async setModel(e,t,n={}){const s=ja(await Ja(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(e,t=!1,n={}){const i=ja(await Ja(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(i==null?void 0:i.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return i.skills.flatMap(r=>{const a=oNe(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const s=new URLSearchParams;t.cursor&&s.set("cursor",t.cursor),t.search&&s.set("search",t.search),t.archived&&s.set("archived","true");const i=s.size?`?${s}`:"",r=ja(await Ja(e,`threads${i}`,{options:n,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(r==null?void 0:r.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:r.threads.flatMap(a=>{const l=vH(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return hb(await Ja(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return hb(await Ja(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return hb(await Ja(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const s=ja(await Ja(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:hb(s)}:{}}},async compactThread(e,t={}){await Ja(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:li(),signal:Bn(t.signal,Uo)});if(!n.ok)throw await ci(n,"无法读取 Codex 权限与工作空间。");return k3(await n.json())},async updatePermissions(e,t,n={}){const s=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:li({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:Bn(n.signal,Uo)});if(!s.ok)throw await ci(s,"无法更新 Codex 权限。");const i=await s.json();return rE(i.permissions)},async updateWorkspace(e,t,n={}){const s=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:li({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:Bn(n.signal,Uo)});if(!s.ok)throw await ci(s,"无法更新 Codex 工作空间。");const i=await s.json();if(typeof i.cwd!="string"||!i.cwd)throw new Error("Sandbox 返回了无效工作目录。");return i.cwd},async listDirectories(e,t,n={}){const s=new URLSearchParams({path:t}),i=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/directories?${s}`),{method:"GET",headers:li(),signal:Bn(n.signal,Uo)});if(!i.ok)throw await ci(i,"无法读取 Sandbox 目录。");const r=await i.json();if(typeof r.path!="string"||!Array.isArray(r.directories)||r.directories.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:r.path,...typeof r.parent=="string"?{parent:r.parent}:{},directories:r.directories}},async resolveApproval(e,t,n,s={}){const i=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:li({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:Bn(s.signal,Uo)});if(!i.ok)throw await ci(i,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return A3(e,"terminal",t)},async launchBrowser(e,t={}){return A3(e,"browser",t)},async uploadFile(e,t,n={}){const s=new FormData;s.set("file",t,t.name);const i=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:li(),body:s,signal:Bn(n.signal,rNe)});if(!i.ok)throw await ci(i,"无法上传文件到 Sandbox。");const r=await i.json();if(typeof r.id!="string"||typeof r.path!="string"||typeof r.name!="string"||typeof r.mimeType!="string"||typeof r.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return r},async closeSession(e,t={}){if(!e)return;const n=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:li(),signal:Bn(t.signal,Uw)});if(!n.ok&&n.status!==404)throw await ci(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(Rn(`${dr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:li(),signal:Bn(t.signal,Uw)});if(!n.ok&&n.status!==404)throw await ci(n,"无法删除 Codex 智能体。")}};async function A3(e,t,n){const s=await fetch(Rn(`${dr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:li(),signal:Bn(n.signal,Uo)});if(!s.ok)throw await ci(s,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const i=await s.json();return{url:wH(i.url,"Sandbox 工具"),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}}function wH(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return Rn(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const s=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!s)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function Hd(e,t,n){const s=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${s}`,n?`请求:${n}`:""].filter(Boolean).join(` -`)}function dNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function fNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function hNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function Qm({kind:e,...t}){return e==="codex"?o.jsx(dNe,{...t}):e==="openclaw"?o.jsx(fNe,{...t}):o.jsx(hNe,{...t})}const Fw=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],pNe=24,mNe=3e4,zd=new Map,of=new Map,gNe=new Set;function pb(e){if(!e){zd.clear(),of.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,s]of of)s.page.runtimes.some(i=>t.has(i.runtimeId))&&of.delete(n);zd.clear()}}function bNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function $w(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function yNe({type:e}){return e==="general"?o.jsx(su,{}):o.jsx(Qm,{kind:e})}function gA(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function C3(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:gA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function xNe(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:iE(e.status),createdAt:gA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function ENe(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:gA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function vNe(e,t,n){const s=`${e}:all:${t}`,i=of.get(s);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(C3)),i.page.nextToken;i&&of.delete(s);let r=zd.get(s);r||(r=Tx({scope:e,region:"all",pageSize:pNe,nextToken:t}),zd.set(s,r),r.then(()=>zd.delete(s),()=>zd.delete(s)));const a=await r;return of.set(s,{page:a,expiresAt:Date.now()+mNe}),n(a.runtimes.map(C3)),a.nextToken}function wNe({agent:e,cloudProvider:t,onUse:n,onViewDetails:s,connecting:i,connected:r,showOwnership:a,deploymentTask:l,onViewDeploymentTask:c,onEditDraft:u,onDeleteDraft:d}){const f=!!(e.runtime||e.sandbox);return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:e.sandbox.id,children:e.sandbox.id}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:l?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[l?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:Nf(e.runtime.region,t)}),a&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]})]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":l?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>l?c==null?void 0:c(l):u==null?void 0:u(e.draft),children:l?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>d==null?void 0:d(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!f,"aria-label":l?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>l?c==null?void 0:c(l):s==null?void 0:s(e),children:l?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${r?" is-connected":""}`,disabled:!f||i||r,"aria-busy":i||void 0,"aria-label":r?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(n==null?void 0:n(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):r?"已连接":"使用"})]})})]})}function _Ne({cloudProvider:e,canCreate:t,runtimeScope:n,onCreateAgent:s,onUseAgent:i,onViewAgentDetails:r,onCreateSandboxAgent:a,onUseSandboxAgent:l,onViewSandboxAgentDetails:c,sandboxRefreshKey:u=0,connectedRuntimeId:d="",hiddenRuntimeIds:f=gNe,drafts:h=[],deploymentTasks:p=[],draftDeploymentTaskIds:m={},onViewDeploymentTask:b,onEditDraft:v,onDeleteDraft:y}){const x=g.useRef(null),E=g.useRef(null),w=g.useRef(0),S=g.useRef(0),_=g.useRef(null),[T,k]=g.useState("general"),[A,j]=g.useState(""),[R,B]=g.useState([]),[z,L]=g.useState(""),[F,C]=g.useState(!0),[I,D]=g.useState(""),[$,O]=g.useState([]),[te,se]=g.useState(!1),[P,Q]=g.useState(""),[ee,V]=g.useState(""),[X,K]=g.useState(null),ce=g.useMemo(()=>h.map(ENe),[h]),he=g.useMemo(()=>{const Ce=new Map,Ve=new Map;for(const Ue of p){if(Ue.status!=="running"||(Ce.set(Ue.id,Ue),!Ue.runtimeId))continue;const W=Ve.get(Ue.runtimeId);(!W||Ue.startedAt>W.startedAt)&&Ve.set(Ue.runtimeId,Ue)}return{byId:Ce,byRuntimeId:Ve}},[p]),be=g.useCallback(Ce=>{var Ue;if(Ce.draft){const W=m[Ce.draft.id];return W?he.byId.get(W):void 0}const Ve=(Ue=Ce.runtime)==null?void 0:Ue.runtimeId;return Ve?he.byRuntimeId.get(Ve):void 0},[he,m]),ue=g.useCallback((Ce,Ve)=>{const Ue=++w.current;return C(!0),D(""),vNe(n,Ce,W=>{w.current===Ue&&B(oe=>Ve?W:[...oe,...W])}).then(W=>{w.current===Ue&&L(W)}).catch(W=>{w.current===Ue&&D(Hd(W,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{w.current===Ue&&C(!1)})},[n]);g.useEffect(()=>{if(T==="general")return B([]),L(""),ue("",!0),()=>{w.current+=1}},[T,ue]);const we=g.useCallback(async Ce=>{var W,oe;(W=_.current)==null||W.abort();const Ve=new AbortController;_.current=Ve;const Ue=++S.current;se(!0),Q(""),O([]);try{const Z=Ce==="codex"?await cn.listSessions({signal:Ve.signal}):await cn.listAgentSessions(Ce,{signal:Ve.signal});if(S.current!==Ue)return;O(Z.map(xNe))}catch(Z){if((Z==null?void 0:Z.name)==="AbortError"||S.current!==Ue)return;Q(Hd(Z,`加载 ${((oe=Fw.find(Ee=>Ee.id===Ce))==null?void 0:oe.label)??Ce}`,`GET /web/${Ce==="codex"?"sandbox":Ce}/sessions`))}finally{_.current===Ve&&(_.current=null),S.current===Ue&&se(!1)}},[]);function Le(Ce){var Ve;Ce!==T&&(Ce==="general"?(w.current+=1,B([]),L(""),D(""),C(!0)):((Ve=_.current)==null||Ve.abort(),_.current=null,S.current+=1,O([]),Q(""),se(!0)),k(Ce))}g.useEffect(()=>{var Ce;if(T==="general"){(Ce=_.current)==null||Ce.abort(),_.current=null,S.current+=1;return}return we(T),()=>{var Ve;(Ve=_.current)==null||Ve.abort(),_.current=null,S.current+=1}},[T,we,u]),g.useEffect(()=>{const Ce=E.current,Ve=x.current;if(!Ce||!Ve||T!=="general"||!z||F)return;const Ue=new IntersectionObserver(([W])=>{W.isIntersecting&&ue(z,!1)},{root:Ve,rootMargin:"240px 0px",threshold:.01});return Ue.observe(Ce),()=>Ue.disconnect()},[T,ue,F,z]);const Ne=g.useCallback(async Ce=>{if(!ee){V(Ce.id);try{await new Promise(Ve=>requestAnimationFrame(()=>Ve())),Ce.sandbox?await l(Ce.sandbox):await i(Ce)}finally{V("")}}},[ee,i,l]),ae=g.useMemo(()=>{const Ce=A.trim().toLocaleLowerCase(),Ve=T==="general"?[...ce,...R]:$,Ue=Ce?Ve.filter(Z=>Z.name.toLocaleLowerCase().includes(Ce)):Ve;if(T!=="general")return Ue;const W=f.size>0?Ue.filter(Z=>!Z.runtime||!f.has(Z.runtime.runtimeId)):Ue,oe=W.findIndex(Z=>{var Ee;return((Ee=Z.runtime)==null?void 0:Ee.runtimeId)===d});return oe<=0?W:[W[oe],...W.slice(0,oe),...W.slice(oe+1)]},[T,d,ce,f,A,R,$]),me=Fw.find(Ce=>Ce.id===T),_e=(me==null?void 0:me.label)??"智能体",Je=T==="general"?F&&R.length===0&&ce.length===0:te&&$.length===0,Pe=!Je&&ae.length===0,Fe=t?T==="general"?()=>s(Ti(e)):()=>a(T):void 0,Ye=t?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:n==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(bNe,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:A,onChange:Ce=>j(Ce.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:Fw.map(Ce=>o.jsx("button",{type:"button",className:`my-agent-type-pill${T===Ce.id?" is-active":""}`,"aria-pressed":T===Ce.id,onClick:()=>Le(Ce.id),children:Ce.label},Ce.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!Fe,title:Ye,onClick:()=>Fe==null?void 0:Fe(),children:[o.jsx($w,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:x,"aria-label":`${_e}列表`,children:[Je?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(T==="general"?I:P)&&ae.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:T==="general"?I:P}),o.jsx("button",{type:"button",onClick:()=>{T==="general"?ue("",!0):we(T)},children:"重新加载"})]}):Pe?A.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(qSe,{})}),o.jsx(ns.Title,{children:"没有匹配的智能体"}),o.jsx(ns.Description,{children:"请尝试搜索其他名称"})]})}):T!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(yNe,{type:T})}),o.jsxs(ns.Title,{children:["暂无 ",_e]}),t?o.jsx(ns.ActionRow,{children:o.jsxs(_3,{color:"primary",size:"lg",onClick:()=>a(T),children:[o.jsx($w,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(su,{})}),o.jsx(ns.Title,{children:"暂无通用智能体"}),o.jsx(ns.Description,{children:"创建一个通用智能体,开始构建和对话"}),t?o.jsx(ns.ActionRow,{children:o.jsxs(_3,{color:"primary",size:"lg",onClick:()=>s(Ti(e)),children:[o.jsx($w,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[T==="general"&&I?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:I}),o.jsx("button",{type:"button",onClick:()=>void ue("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ae.map(Ce=>{var Ve;return o.jsx(wNe,{agent:Ce,cloudProvider:e,deploymentTask:be(Ce),onViewDeploymentTask:b,onUse:Ne,onViewDetails:Ue=>{Ue.sandbox?c(Ue.sandbox):r(Ue)},connecting:Ce.id===ee,connected:((Ve=Ce.runtime)==null?void 0:Ve.runtimeId)===d,showOwnership:n==="all",onEditDraft:v,onDeleteDraft:K},Ce.id)})})]}),T==="general"&&!I&&!Je&&(ae.length>0||!!z)&&o.jsx("div",{className:"my-agent-load-more",ref:E,"aria-live":"polite",children:F?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):z?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),X?o.jsx(mA,{title:"删除草稿?",description:`删除后将无法恢复“${X.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>K(null),onConfirm:()=>{y==null||y(X),K(null)}}):null]})}const SNe={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},NNe={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},TNe="https://api.github.com",kNe=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,I3=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,ANe=/^[A-Za-z0-9._/-]+$/;function CNe(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function Cc(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let s;try{s=await fetch(`${TNe}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(r){throw t.signal.aborted?r:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await s.json().catch(()=>null);if(!t.expected.includes(s.status))throw new Error(CNe(s.status,i,t.token));return{status:s.status,payload:i}}function Hw(e){return e.split("/").map(encodeURIComponent).join("/")}function INe(e){const t=new TextEncoder().encode(e);let n="";const s=32768;for(let i=0;i({...h,path:bA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Cc(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await Cc(`${a}/git/ref/heads/${Hw(s)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=jNe(e.branchPrefix);await Cc(`${a}/git/refs`,{token:e.token,expected:[201],signal:r,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const p of i){const m=Hw(p.path),b=await Cc(`${a}/contents/${m}?ref=${encodeURIComponent(s)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await Cc(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:INe(p.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await Cc(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:s,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await Cc(`${a}/git/refs/heads/${Hw(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const xA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},EA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},SH={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},NH={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function vA(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function wA(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const RNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,ONe=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function MNe(e){if(!RNe.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!ONe.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function LNe(e){MNe(e);const t=String.raw`name: PR Automated Review +`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(g.useEffect(()=>{t&&r(s)},[e.id,t==null?void 0:t.status,s]),g.useEffect(()=>{if(!i||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[i,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=dSe(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",b=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",b,p].filter(Boolean).join(" · ");async function y(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{l(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${t.status}${i?"":" is-collapsed"}`,"aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsx("span",{children:v})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[c&&o.jsx("button",{type:"button",onClick:()=>r(x=>!x),children:i?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(za,{"aria-hidden":!0}):o.jsx(bx,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),i&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function hSe({task:e}){const t=hH(e),n=pH(e),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),i=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(gn,{className:"spin"}):e.status==="success"?o.jsx(Cee,{}):e.status==="error"?o.jsx(Gk,{}):o.jsx(UR,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:i}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(s)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:o.jsx("span",{style:{width:`${s}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[Gn,dn]=g.useState(()=>new Set),[zt,rn]=g.useState(!1),[Sn,Vt]=g.useState(""),[ot,Nn]=g.useState(null),[mn,Ct]=g.useState([]),[ms,Rs]=g.useState([]),[gs,Mn]=g.useState(!1),[zs,is]=g.useState(""),[Tn,rs]=g.useState(""),[bs,_i]=g.useState(0),[kn,Vs]=g.useState([]),[Ss,Fn]=g.useState(!1),[$n,Gs]=g.useState(""),[Os,An]=g.useState(0),[xn,fn]=g.useState(!1),[Jt,an]=g.useState(()=>new Set),[on,ys]=g.useState(!1),[de,Ce]=g.useState(""),[Pe,it]=g.useState(""),[Ze,xt]=g.useState(()=>new Set),Ie=g.useRef(!1),Kn=g.useRef(""),as=g.useRef(null),Ks=g.useRef(0),ai=g.useRef(0),[qn,en]=g.useState(W_e),[Lt,Ms]=g.useState("");g.useEffect(()=>{e.length!==0&&en(H=>H.map((le,fe)=>fe===0&&le.agentIds.length===0?{...le,agentIds:e.slice(0,2).map(ke=>ke.id)}:le))},[e]);const os=g.useMemo(()=>{const H=new Map;for(const le of e)le.runtimeId&&H.set(le.runtimeId,le);return H},[e]),Gi=g.useMemo(()=>{var le;const H=new Map;for(const fe of t){const ke=(le=fe.deploymentTarget)==null?void 0:le.runtimeId;if(!ke||!os.has(ke))continue;const tt=H.get(ke);(!tt||fe.updatedAt>tt.updatedAt)&&H.set(ke,fe)}return H},[os,t]),Ya=g.useMemo(()=>{const H=new Map;for(const le of d){if(!le.runtimeId)continue;const fe=H.get(le.runtimeId);(!fe||le.startedAt>fe.startedAt)&&H.set(le.runtimeId,le)}return H},[d]),_c=g.useMemo(()=>{const H=Oe.trim().toLowerCase();return H?e.filter(le=>{const fe=le.runtimeId?Gi.get(le.runtimeId):void 0,ke=le.runtimeId?Ya.get(le.runtimeId):void 0;return[le.label,le.app,le.host??"",(fe==null?void 0:fe.draft.name)??"",(fe==null?void 0:fe.draft.description)??"",(ke==null?void 0:ke.runtimeName)??""].join(" ").toLowerCase().includes(H)}):e},[e,Ya,Oe,Gi]),rr=g.useMemo(()=>{const H=Oe.trim().toLowerCase();return t.filter(le=>{var ke;const fe=(ke=le.deploymentTarget)==null?void 0:ke.runtimeId;return fe&&os.has(fe)?!1:H?`${le.draft.name} ${le.draft.description}`.toLowerCase().includes(H):!0})},[os,t,Oe]),zu=g.useMemo(()=>t.filter(H=>{var fe;const le=(fe=H.deploymentTarget)==null?void 0:fe.runtimeId;return!le||!os.has(le)}).length,[os,t]),qs=g.useMemo(()=>{const H=Oe.trim().toLowerCase();return H?qn.filter(le=>le.name.toLowerCase().includes(H)):qn},[qn,Oe]),ie=e.find(H=>H.id===C),Qt=t.find(H=>H.id===D),Ln=f?d.find(H=>H.id===f):void 0,Ns=ie!=null&&ie.runtimeId?Gi.get(ie.runtimeId):void 0,tn=v?X:C&&i===C?s:null,Ts=(tn==null?void 0:tn.appName)||(ie==null?void 0:ie.runtimeApp)||(ie==null?void 0:ie.app)||"",Gr=`${(ie==null?void 0:ie.region)??"cn-beijing"}:${(ie==null?void 0:ie.runtimeId)??""}`,Kr=(ue==null?void 0:ue.requestKey)===Gr?ue.value:"",ls=(se==null?void 0:se.requestKey)===Gr?se:null,_r=!!((d0=ls==null?void 0:ls.apiApps)!=null&&d0.length),q=!!(ls!=null&&ls.a2a),_e=((qu=ls==null?void 0:ls.apiApps)==null?void 0:qu[0])??Ts,Ve=(O==null?void 0:O.endpoint)??"",st=X_e(((ci=ls==null?void 0:ls.a2a)==null?void 0:ci.endpoint)??"",Ve),bt=JSON.stringify([(ie==null?void 0:ie.runtimeId)??"",(ie==null?void 0:ie.region)??""]),Nt=(De==null?void 0:De.requestKey)===bt?De.value:null;g.useEffect(()=>{const H=Ks.current+1;Ks.current=H,Ue(null),Be("");const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"";if(!l||!le||!fe){Ae(!1);return}const ke=new AbortController;return Ae(!0),P8({runtimeId:le,region:fe,signal:ke.signal}).then(tt=>{var Et;if(H===Ks.current){if(tt.runtime.runtimeId!==le||tt.runtime.region!==fe||tt.canUpdate&&!((Et=tt.agent)!=null&&Et.appName)){Be("Runtime 更新能力响应与当前选择不匹配。");return}Ue({requestKey:bt,value:tt})}}).catch(tt=>{H!==Ks.current||ke.signal.aborted||Be(tt instanceof Error?tt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{H===Ks.current&&!ke.signal.aborted&&Ae(!1)}),()=>ke.abort()},[l,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId,bt]);const ln=g.useMemo(()=>{const H=new Map(e.map((fe,ke)=>[fe.id,ke])),le=new Map(n.map((fe,ke)=>[fe,ke]));return[..._c].sort((fe,ke)=>{const tt=fe.runtimeId?Ya.get(fe.runtimeId):void 0,Et=ke.runtimeId?Ya.get(ke.runtimeId):void 0,cs=(tt==null?void 0:tt.status)==="running"?tt.startedAt:0,Sr=(Et==null?void 0:Et.status)==="running"?Et.startedAt:0;if(cs!==Sr)return Sr-cs;const Yt=le.get(fe.id),Yi=le.get(ke.id);return Yt!=null&&Yi!=null?Yt-Yi:Yt!=null?-1:Yi!=null?1:(H.get(fe.id)??0)-(H.get(ke.id)??0)})},[n,e,_c,Ya]),oi=(ie==null?void 0:ie.label)||(tn==null?void 0:tn.name)||(Qt==null?void 0:Qt.draft.name)||(Ln==null?void 0:Ln.runtimeName)||"未选择智能体",Ys=qn.find(H=>H.id===Lt),xs=ln.filter(H=>H.canDelete===!0),Li=ln.filter(H=>Ge.has(H.id)&&H.canDelete===!0),mi=rr.filter(H=>Gn.has(H.id)),ya=xs.length+rr.length,yt=Li.length+mi.length,Dn=g.useMemo(()=>(Ln==null?void 0:Ln.agentDraft)??(Qt==null?void 0:Qt.draft)??(Ns==null?void 0:Ns.draft)??eSe(tn,(ie==null?void 0:ie.label)??"agent"),[tn,ie==null?void 0:ie.label,Ns==null?void 0:Ns.draft,Qt==null?void 0:Qt.draft,Ln==null?void 0:Ln.agentDraft]),Ki=Qt?a?"":"当前账号没有新建 Agent 的权限。":l?ie!=null&&ie.runtimeId?ie.region?Ye?"正在检查 Runtime 更新能力…":ze||(Nt?Nt.canUpdate?(Ah=Nt.agent)!=null&&Ah.appName?"":"Runtime 更新能力响应缺少智能体信息。":Nt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",vo="aw-update-disabled-reason",Qg=Nt!=null&&Nt.agent?{runtimeId:Nt.runtime.runtimeId,name:Nt.runtime.name,region:Nt.runtime.region,appName:Nt.agent.appName,currentVersion:Nt.runtime.currentVersion}:Ns==null?void 0:Ns.deploymentTarget,Zg=g.useMemo(()=>{if(tn)return tn.tools;const H=(Dn.builtinTools??[]).map(le=>{var fe;return((fe=Mu.find(ke=>ke.id===le))==null?void 0:fe.label)??le});return Array.from(new Set([...Dn.tools,...H,...(Dn.customTools??[]).map(le=>le.name),...(Dn.mcpTools??[]).map(le=>le.name)].filter(Boolean)))},[Dn,tn]),wo=g.useMemo(()=>tn?tn.skillsPreviewSupported?tn.skills.map(H=>H.name):null:Array.from(new Set([...(Dn.selectedSkills??[]).map(H=>H.name),...Dn.skills].filter(Boolean))),[Dn,tn]),li=g.useMemo(()=>{if(Ln)return Ln;if(Qt)return d.filter(H=>{var le,fe;return((le=H.agentDraft)==null?void 0:le.name)===Qt.draft.name||H.runtimeName===Qt.draft.name||!!((fe=Qt.deploymentTarget)!=null&&fe.runtimeId)&&H.runtimeId===Qt.deploymentTarget.runtimeId}).sort((H,le)=>le.startedAt-H.startedAt)[0];if(ie)return d.filter(H=>!!ie.runtimeId&&H.runtimeId===ie.runtimeId||H.runtimeName===ie.label).sort((H,le)=>le.startedAt-H.startedAt)[0]},[d,ie,Qt,Ln]),CE=!!(f&&li&&li.id===f),Jg=!!(li&&(li.status!=="success"||CE)),e0=g.useMemo(()=>oSe(Dn),[Dn]),Wa=(ie==null?void 0:ie.currentVersion)??(O==null?void 0:O.currentVersion)??null,IE=Wa??(Ln==null?void 0:Ln.startedAt)??"unknown",t0=tn?`runtime:${(ie==null?void 0:ie.runtimeId)??tn.name}:v${IE}:${e0}`:`draft:${(Ln==null?void 0:Ln.id)??(Qt==null?void 0:Qt.id)??(ie==null?void 0:ie.id)??oi}:${e0}`;g.useEffect(()=>{if(!f)return;const H=d.find(fe=>fe.id===f),le=H!=null&&H.runtimeId?os.get(H.runtimeId):void 0;if(le){$(""),I(le.id),F("basic");return}I(""),$(""),F("basic")},[os,d,f]),g.useEffect(()=>{if(!h){Kn.current="";return}const H=`${h}:${p}:${m}`;Kn.current!==H&&e.some(le=>le.id===h)&&(Kn.current=H,$(""),I(h),F(p),p==="evaluations"&&(ut(m),wt("")))},[e,h,p,m]),g.useEffect(()=>{for(const H of ln.slice(0,8)){if(!H.runtimeId)continue;const le=H.region??"cn-beijing";U8(H.runtimeId,le),S8(H.runtimeId,le,H.runtimeApp??""),c1(H.runtimeId,le,H.runtimeApp??"").then(fe=>{const ke=fe.appName||H.app;ke&&LS({runtimeId:H.runtimeId??"",region:le,appName:ke,pageSize:100})}).catch(()=>{})}},[ln]),g.useEffect(()=>{!(ie!=null&&ie.runtimeId)||!Ts||LS({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:Ts,pageSize:100})},[Ts,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",ke=(ie==null?void 0:ie.runtimeApp)??"",tt=le?_8(le,fe,ke):null;if(oe(tt),xe(!!tt||!v||!le),!(!v||!le))return c1(le,fe,ke,{force:!0}).then(Et=>{H||oe(Et)}).catch(()=>{!H&&!tt&&oe(null)}).finally(()=>{H||xe(!0)}),()=>{H=!0}},[v,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeApp,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing";if(Vs([]),Gs(""),L!=="optimizations"||!le){Fn(!1);return}if(v&&!Ts){Fn(!J);return}return Fn(!0),c8({runtimeId:le,region:fe,appName:Ts}).then(ke=>{H||Vs(ke.groups)}).catch(ke=>{H||Gs(ke instanceof Error?ke.message:String(ke))}).finally(()=>{H||Fn(!1)}),()=>{H=!0}},[J,v,Os,L,Ts,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{ai.current+=1,ve(null),Se(!1),me(!1),et(""),ge("api-server")},[Gr,L]);function n0(){ai.current+=1,ve(null),Se(!1),me(!1),et("")}function _o(H){H!==he&&(n0(),ge(H))}async function s0(){if(Me){n0();return}const H=(ie==null?void 0:ie.runtimeId)??"",le=(ie==null?void 0:ie.region)??"cn-beijing";if(!H)return;const fe=ai.current+1;ai.current=fe,me(!0),et("");try{const ke=await L8(H,le);if(fe!==ai.current)return;ve({requestKey:Gr,value:ke}),Se(!0)}catch(ke){if(fe!==ai.current)return;ve(null),Se(!1),et(ke instanceof Error?ke.message:"读取 Runtime API Key 失败。")}finally{fe===ai.current&&me(!1)}}g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",ke=le?B8(le,fe):null;if(ne(ke),!!le)return h2(le,fe,{force:!0}).then(tt=>{H||ne(tt)}).catch(()=>{!H&&!ke&&ne(null)}),()=>{H=!0}},[ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",ke=`${fe}:${le}`;if(Q(""),L!=="integrations"||!le){te(!1),le||P(null);return}te(!0);const tt=f2(le,fe,{retryProbe:!0}).catch(Et=>{if(Et instanceof Mr&&Et.unsupported)return null;throw Et});return Promise.all([tt,M8(le,fe,{retryProbe:!0})]).then(([Et,cs])=>{H||P({requestKey:ke,apiApps:Et,a2a:cs})}).catch(Et=>{H||(P(null),Q(Et instanceof Error?Et.message:"探测集成方式失败。"))}).finally(()=>{H||te(!1)}),()=>{H=!0}},[K,L,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const le=(ie==null?void 0:ie.runtimeId)??"",fe=(ie==null?void 0:ie.region)??"cn-beijing",ke=le&&Ts?u8({runtimeId:le,region:fe,appName:Ts,pageSize:100}):null;if(Ct(ke?x3(ke):[]),Rs((ke==null?void 0:ke.sets)??[]),is(""),rs((ke==null?void 0:ke.unsupportedMessage)??""),L!=="evaluations"||!le){Mn(!1);return}if(v&&!Ts){Mn(!J);return}return Mn(!ke),Nx({runtimeId:le,region:fe,appName:Ts,pageSize:100},{force:!0}).then(tt=>{H||(Rs(tt.sets),Ct(x3(tt)),rs(tt.unsupportedMessage??""))}).catch(tt=>{H||(is(tt instanceof Error?tt.message:String(tt)),rs(""))}).finally(()=>{H||Mn(!1)}),()=>{H=!0}},[J,v,bs,L,Ts,tn==null?void 0:tn.appName,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(mn.map(le=>le.id));an(le=>{const fe=new Set([...le].filter(ke=>H.has(ke)));return fe.size===le.size?le:fe}),xt(le=>{const fe=new Set([...le].filter(ke=>H.has(ke)));return fe.size===le.size?le:fe}),Pe&&!H.has(Pe)&&it("")},[mn,Pe]),g.useEffect(()=>{fn(!1),an(new Set),xt(new Set),Ce(""),it("")},[ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(ln.filter(le=>le.canDelete===!0).map(le=>le.id));ht(le=>{const fe=new Set([...le].filter(ke=>H.has(ke)));return fe.size===le.size?le:fe})},[ln]),g.useEffect(()=>{const H=new Set(rr.map(le=>le.id));dn(le=>{const fe=new Set([...le].filter(ke=>H.has(ke)));return fe.size===le.size?le:fe})},[rr]);const So=g.useMemo(()=>!b||!(ie!=null&&ie.runtimeId)||b.runtimeId!==ie.runtimeId||Ts&&b.agentName&&b.agentName!==Ts?null:{...b,tag:b.kind==="good"?"Good case":"Bad case"},[b,ie==null?void 0:ie.runtimeId,Ts]),No=g.useMemo(()=>ie!=null&&ie.runtimeId?So?[So,...mn.filter(H=>H.id!==So.id&&(!H.messageId||H.messageId!==So.messageId))]:mn:Y_e,[mn,So,ie==null?void 0:ie.runtimeId]),gl=No.filter(H=>{if(H.kind!==Mt||(H.source==="auto"?"auto":"user")!==_t)return!1;const fe=bn.trim().toLowerCase();return fe?[H.input,H.output,H.referenceOutput,H.comment,H.tag??"",H.sessionId,H.messageId,H.userId,H.evaluationSetName].join(" ").toLowerCase().includes(fe):!0}),Xa=gl.filter(H=>Jt.has(H.id)),i0=!!(ie!=null&&ie.runtimeId),Yn=H=>{ut(H),wt(""),Ce("");const le=No.find(fe=>fe.kind===H);it((le==null?void 0:le.id)??""),window.setTimeout(()=>{var fe;(fe=as.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"})},0)},jE=H=>{Ce(""),an(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe})},RE=()=>{Ce(""),an(new Set(gl.map(H=>H.id)))},OE=()=>{Ce(""),an(new Set),fn(!1)},qi=H=>{xt(le=>{const fe=new Set(le);return fe.has(H)?fe.delete(H):fe.add(H),fe})},r0=H=>{it(H.id),Ce(""),!(!H.sessionId||!H.messageId)&&(T==null||T(H))},Vu=async H=>{if(!(ie!=null&&ie.runtimeId)||!Ts||on||H.length===0)return;const le=H.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${H.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(le))return;const fe=H.map(tt=>tt.id),ke=new Set(fe);ys(!0),Ce("");try{await h8({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:Ts,itemIds:fe});const tt=new Map;for(const Et of H)tt.set(Et.kind,(tt.get(Et.kind)??0)+1);Ct(Et=>Et.filter(cs=>!ke.has(cs.id))),Rs(Et=>Et.map(cs=>({...cs,itemCount:Math.max(0,cs.itemCount-(tt.get(cs.kind)??0))}))),an(Et=>new Set([...Et].filter(cs=>!ke.has(cs)))),xt(Et=>new Set([...Et].filter(cs=>!ke.has(cs)))),Pe&&ke.has(Pe)&&it(""),H.length>1&&fn(!1),k==null||k(H)}catch(tt){Ce(tt instanceof Error?tt.message:String(tt))}finally{ys(!1)}},a0=H=>{en(le=>le.map(fe=>fe.id===H.id?H:fe))},o0=()=>{const H=new Set(e.map(ke=>ke.id)),le=n.filter(ke=>H.has(ke)),fe=new Set(le);return[...le,...e.filter(ke=>!fe.has(ke.id)).map(ke=>ke.id)]},Nh=(H,le,fe)=>{if(!x||H===le)return;const ke=o0().filter(cs=>cs!==H),tt=ke.indexOf(le),Et=tt<0?ke.length:fe==="after"?tt+1:tt;ke.splice(Et,0,H),x(ke)},Gu=(H,le)=>{if(!Ft||Ft===le)return;const fe=H.currentTarget.getBoundingClientRect();ft(le),St(H.clientY>fe.top+fe.height/2?"after":"before")},Ku=(H,le)=>{if(!x)return;const fe=o0(),ke=fe.indexOf(H),tt=Math.max(0,Math.min(fe.length-1,ke+le));ke<0||ke===tt||(fe.splice(ke,1),fe.splice(tt,0,H),x(fe))},ME=H=>{H.canDelete===!0&&(Vt(""),ht(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe}))},l0=H=>{Vt(""),dn(le=>{const fe=new Set(le);return fe.has(H.id)?fe.delete(H.id):fe.add(H.id),fe})},To=()=>{Vt(""),ht(new Set(xs.map(H=>H.id))),dn(new Set(rr.map(H=>H.id)))},Ut=()=>{Vt(""),ht(new Set),dn(new Set),We(!1)},c0=()=>{if(yt===0||zt)return;const H=Li.length,le=mi.length;Vt(""),Nn({kind:"selection",title:H===1&&le===0?"删除 Agent?":H===0&&le===1?"删除草稿?":"删除所选项目?",description:H===1&&le===0?`"${Li[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:H===0&&le===1?`"${mi[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${yt} 个项目。${H>0?`${H} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:H===0&&le===1?"删除草稿":"删除所选",agents:Li,drafts:mi})},u0=async()=>{if(!(!ot||zt)){rn(!0),Vt("");try{if(ot.kind==="selection"){const{agents:H,drafts:le}=ot;if(H.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E(H)}le.length>0&&(w==null||w(le)),ht(new Set),dn(new Set),We(!1),H.some(fe=>fe.id===C)&&I(""),le.some(fe=>fe.id===D)&&$("")}else if(ot.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([ot.agent]),C===ot.agent.id&&I("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([ot.draft]),D===ot.draft.id&&$("")}Nn(null)}catch(H){Vt(H instanceof Error?H.message:String(H))}finally{rn(!1)}}},LE=H=>{!E||H.canDelete!==!0||zt||(Vt(""),Nn({kind:"agent",title:"删除 Agent?",description:`"${H.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:H}))},Th=H=>{if(!w||zt)return;const le=H.draft.name||"未命名 Agent";Vt(""),Nn({kind:"draft",title:"删除草稿?",description:`"${le}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:H})},kh=()=>{const H=`eval-${Date.now()}`,le={id:H,name:`新评测组 ${qn.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};en(fe=>[le,...fe]),Ms(H)},DE=H=>{a0({...H,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+H.history.length%7,status:"completed"},...H.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${v?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:B==="library"?"is-active":"","aria-pressed":B==="library",onClick:()=>{z("library"),lt("")},children:"智能体库"}),o.jsx("button",{type:"button",className:B==="evaluation"?"is-active":"","aria-pressed":B==="evaluation",onClick:()=>{z("evaluation"),lt("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":B==="evaluation"||void 0,ref:H=>{H==null||H.toggleAttribute("inert",B==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":B==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(t1,{"aria-hidden":!0}),o.jsx("input",{value:Oe,onChange:H=>lt(H.currentTarget.value),placeholder:B==="library"?"搜索智能体":"搜索评测组","aria-label":B==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:B==="library"?A:kh,disabled:B==="library"&&!a,children:[o.jsx(Ri,{"aria-hidden":!0}),o.jsx("span",{children:B==="library"?"新建 Agent":"新建评测组"})]}),B==="library"&&(E||w)&&o.jsx("div",{className:`aw-selection-toolbar${be?" is-active":""}`,children:be?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",yt," 个"]}),o.jsx("button",{type:"button",onClick:To,disabled:ya===0||zt,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void c0(),disabled:yt===0||zt,children:zt?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Ut,disabled:zt,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Vt(""),We(!0)},disabled:ya===0,children:"选择"})}),B==="library"&&Sn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Sn}),o.jsx("div",{className:"aw-agent-list",children:B==="evaluation"?qs.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):qs.map(H=>o.jsxs("button",{type:"button",className:`aw-agent-item${H.id===Lt?" is-active":""}`,onClick:()=>Ms(H.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:H.name}),o.jsxs("small",{children:[H.agentIds.length," 个智能体 · ",H.history.length," 次运行"]})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)):c&&ln.length===0&&rr.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&ln.length===0&&rr.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:u}),y&&o.jsx("button",{type:"button",onClick:y,children:"重试"})]}):ln.length===0&&rr.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[rr.map(H=>{const le=d.filter(ke=>{var tt,Et;return((tt=ke.agentDraft)==null?void 0:tt.name)===H.draft.name||ke.runtimeName===H.draft.name||!!((Et=H.deploymentTarget)!=null&&Et.runtimeId)&&ke.runtimeId===H.deploymentTarget.runtimeId}).sort((ke,tt)=>tt.startedAt-ke.startedAt)[0],fe=Gn.has(H.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",be?"is-selecting":"",fe?"is-selected-for-delete":"",H.id===D?"is-active":""].filter(Boolean).join(" "),"aria-pressed":be?fe:void 0,onClick:()=>{if(be){l0(H);return}I(""),$(H.id),F("basic")},children:[be&&o.jsx("span",{className:`aw-select-marker${fe?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(le==null?void 0:le.status)==="running"?" is-deploying":""}`,children:(le==null?void 0:le.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:H.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)}),ln.map(H=>{const le=H.runtimeId?Ya.get(H.runtimeId):void 0,fe=H.runtimeId?Gi.get(H.runtimeId):void 0,ke=Ge.has(H.id),tt=H.canDelete===!0,Et=(le==null?void 0:le.status)==="running"?{label:"部署中",className:" is-deploying"}:(le==null?void 0:le.status)==="error"?{label:"失败",className:" is-error"}:(le==null?void 0:le.status)==="cancelled"?{label:"已取消",className:" is-muted"}:fe?{label:"待更新",className:""}:null,cs=(le==null?void 0:le.status)==="running"?"正在更新部署":fe?"待更新":H.remote?H.host||"远程智能体":"本地智能体",Sr=["aw-agent-item","aw-agent-item--sortable",H.id===C?"is-active":"",be?"is-selecting":"",ke?"is-selected-for-delete":"",be&&!tt?"is-selection-disabled":"",H.id===Ft?"is-dragging":"",H.id===at&&H.id!==Ft?`is-drop-target is-drop-${$e}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!be,className:Sr,"aria-pressed":be?ke:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Yt=>{x&&(Ie.current=!0,Bt(H.id),Yt.dataTransfer.effectAllowed="move",Yt.dataTransfer.setData("text/plain",H.id))},onDragEnter:Yt=>{Gu(Yt,H.id)},onDragOver:Yt=>{!Ft||Ft===H.id||(Yt.preventDefault(),Yt.dataTransfer.dropEffect="move",Gu(Yt,H.id))},onDragLeave:Yt=>{const Yi=Yt.relatedTarget;Yi instanceof Node&&Yt.currentTarget.contains(Yi)||at===H.id&&ft("")},onDrop:Yt=>{Yt.preventDefault();const Yi=Yt.dataTransfer.getData("text/plain")||Ft;Nh(Yi,H.id,$e),Bt(""),ft(""),St("before")},onDragEnd:()=>{Bt(""),ft(""),St("before"),window.setTimeout(()=>{Ie.current=!1},0)},onKeyDown:Yt=>{Yt.altKey&&(Yt.key==="ArrowUp"?(Yt.preventDefault(),Ku(H.id,-1)):Yt.key==="ArrowDown"&&(Yt.preventDefault(),Ku(H.id,1)))},onClick:Yt=>{if(be){Yt.preventDefault(),ME(H);return}if(Ie.current){Yt.preventDefault(),Ie.current=!1;return}$(""),I(H.id),F("basic"),S(H.id)},children:[be&&o.jsx("span",{className:`aw-select-marker${ke?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.label}),H.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",H.currentVersion]}),Et&&o.jsx("span",{className:`aw-draft-badge${Et.className}`,children:Et.label})]}),o.jsx("small",{children:cs})]}),o.jsx(Kp,{"aria-hidden":!0})]},H.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",B==="library"?e.length+zu:qn.length," 个"]})]}),B==="evaluation"&&Ys?o.jsx(ySe,{group:Ys,agents:e,cases:No,onChange:a0,onRun:DE}):B==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!ie&&!Qt&&!Ln?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[ie&&!tn&&r&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),L==="integrations"&&Z&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:oi}),Wa!=null&&o.jsxs("span",{children:["v",Wa]}),Qt&&o.jsx("span",{children:"草稿"}),Ns&&o.jsx("span",{children:"待更新"}),!ie&&!Qt&&Ln&&o.jsx("span",{children:Ln.label})]}),o.jsx("p",{children:Dn.description||(r||v&&!J?"正在读取智能体信息…":"暂无描述")})]}),(Qt||Ns||(ie==null?void 0:ie.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(Qt||Ns)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const H=Qt??Ns;H&&Th(H)},disabled:zt,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(fc,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(ie==null?void 0:ie.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void LE(ie),disabled:zt,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(fc,{"aria-hidden":!0}),o.jsx("span",{children:zt?"删除中…":"删除 Agent"})]})]})]}),li&&Jg&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(hSe,{task:li})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:id.map(H=>o.jsx("button",{type:"button",id:`agent-${H.id}-tab`,className:L===H.id?"is-active":"",role:"tab","aria-selected":L===H.id,"aria-controls":`agent-${H.id}-panel`,tabIndex:L===H.id?0:-1,onClick:()=>F(H.id),onKeyDown:le=>{var Et;if(!["ArrowLeft","ArrowRight","Home","End"].includes(le.key))return;le.preventDefault();const fe=id.findIndex(cs=>cs.id===H.id),ke=le.key==="Home"?0:le.key==="End"?id.length-1:(fe+(le.key==="ArrowRight"?1:-1)+id.length)%id.length,tt=id[ke];F(tt.id),(Et=document.getElementById(`agent-${tt.id}-tab`))==null||Et.focus()},children:H.label},H.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${L}-panel`,role:"tabpanel","aria-labelledby":`agent-${L}-tab`,children:[L==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(O==null?void 0:O.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(O==null?void 0:O.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(O==null?void 0:O.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(O==null?void 0:O.region)||(ie==null?void 0:ie.region)||(li==null?void 0:li.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:O!=null&&O.networkTypes.length?O.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(zm,{draft:Dn,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},t0)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:(tn==null?void 0:tn.model)||Dn.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:tn!=null&&tn.graph?dH(tn.graph):fH(Dn)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:Zg.length?Zg.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:wo===null?"暂不支持预览":wo.length?wo.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Wa!=null?`v${Wa}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:Qt?"草稿":(li==null?void 0:li.status)==="error"?"部署失败":(li==null?void 0:li.status)==="cancelled"?"已取消":Ns?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),L==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),V&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>ce(H=>H+1),children:"重试"})]}),!V&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${he==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),sp.map((H,le)=>o.jsx("button",{type:"button",id:`integration-${H.id}-tab`,role:"tab","aria-selected":he===H.id,"aria-controls":`integration-${H.id}-panel`,tabIndex:he===H.id?0:-1,onClick:()=>_o(H.id),onKeyDown:fe=>{var Et;if(!["ArrowLeft","ArrowRight","Home","End"].includes(fe.key))return;fe.preventDefault();const ke=fe.key==="Home"?0:fe.key==="End"?sp.length-1:(le+(fe.key==="ArrowRight"?1:-1)+sp.length)%sp.length,tt=sp[ke];_o(tt.id),(Et=document.getElementById(`integration-${tt.id}-tab`))==null||Et.focus()},children:H.label},H.id))]}),he==="api-server"?o.jsx(y3,{protocol:"api-server",title:"API Server",available:_r,fields:[{label:"Agent",value:_r?((ks=ls==null?void 0:ls.apiApps)==null?void 0:ks.join("、"))??"":""},{label:"发现接口",value:_r?Pw(Ve,"/list-apps"):""},{label:"调用接口",value:_r?Pw(Ve,"/run_sse"):""},{label:"鉴权方式",value:_r?g3(O==null?void 0:O.authType):""},{label:"API Key",value:o.jsx(b3,{available:_r,authType:O==null?void 0:O.authType,value:Kr,visible:Me&&!!Kr,loading:ae,error:we,onToggle:()=>void s0()})}],example:_r?Q_e(Ve,_e,O==null?void 0:O.authType):""}):o.jsx(y3,{protocol:"a2a",title:"A2A",available:q,fields:[{label:"Agent",value:((Ch=ls==null?void 0:ls.a2a)==null?void 0:Ch.name)??""},{label:"Agent Card",value:q?Pw(Ve,"/.well-known/agent-card.json"):""},{label:"调用地址",value:st},{label:"鉴权方式",value:q?g3(O==null?void 0:O.authType):""},{label:"API Key",value:o.jsx(b3,{available:q,authType:O==null?void 0:O.authType,value:Kr,visible:Me&&!!Kr,loading:ae,error:we,onToggle:()=>void s0()})}],example:q?Z_e(st,O==null?void 0:O.authType):""})]})]}),L==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(ie==null?void 0:ie.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(H=>{const le=aSe(ms,H),fe=No.filter(tt=>tt.kind===H).length,ke=So?fe:(le==null?void 0:le.itemCount)??fe;return o.jsxs("button",{type:"button",onClick:()=>Yn(H),children:[o.jsx("strong",{children:ke}),o.jsx("span",{children:H==="good"?"Good cases":"Bad cases"})]},H)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map(H=>o.jsx("button",{type:"button",className:Mt===H?"is-active":"","aria-pressed":Mt===H,onClick:()=>ut(H),children:H==="good"?"Good case":"Bad case"},H))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(H=>o.jsx("button",{type:"button",className:_t===H?"is-active":"","aria-pressed":_t===H,onClick:()=>yn(H),children:H==="auto"?"自动回流":"手动回流"},H))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(t1,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:bn,onChange:H=>wt(H.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),i0&&o.jsx("div",{className:`aw-case-toolbar${xn?" is-active":""}`,children:xn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Xa.length," 条"]}),o.jsx("button",{type:"button",onClick:RE,disabled:gl.length===0||on,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Vu(Xa),disabled:Xa.length===0||on,children:on?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:OE,disabled:on,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Ce(""),fn(!0)},disabled:gl.length===0||on,children:"选择案例"})}),de&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:de}),o.jsx("div",{ref:as,children:o.jsx(bSe,{cases:gl,loading:gs&&gl.length===0,error:zs,notice:Tn,runtimeBacked:!!(ie!=null&&ie.runtimeId),selectionMode:xn,selectedCaseIds:Jt,focusedCaseId:Pe,expandedCaseIds:Ze,deleting:on,canDelete:i0,onOpenCase:r0,onToggleCase:jE,onToggleExpanded:qi,onDeleteCase:H=>void Vu([H]),onRetry:()=>_i(H=>H+1)})})]}),L==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),Ss?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):$n?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:$n}),o.jsx("button",{type:"button",onClick:()=>An(H=>H+1),children:"重试"})]}):kn.length>0?o.jsx(mSe,{groups:kn}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),L==="basic"&&(ie||Qt)&&o.jsxs("div",{className:"aw-basic-actions",children:[ie&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(ie),children:[o.jsx(Wee,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${Ki?" is-disabled":""}`,tabIndex:Ki?0:void 0,"aria-describedby":Ki?vo:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!Ki,"aria-busy":Ye||void 0,"aria-describedby":Ki?vo:void 0,onClick:()=>{var H;return Qt?R==null?void 0:R(Qt):Ns?R==null?void 0:R({...Ns,deploymentTarget:Qg}):Nt?j(((H=Nt.agent)==null?void 0:H.draft)??Dn,Nt):void 0},children:Ye?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):Qt||Ns?"继续编辑":"更新"}),Ki&&o.jsx("span",{id:vo,className:"aw-update-disabled-reason",role:"tooltip",children:Ki})]})]})]})]}),B==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),ot&&o.jsx(mA,{variant:"danger",title:ot.title,description:ot.description,confirmLabel:zt?"删除中...":ot.confirmLabel,closeLabel:"关闭删除确认",busy:zt,onCancel:()=>Nn(null),onConfirm:()=>void u0()})]})}function mSe({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:sSe(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:rSe(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function gSe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function bSe({cases:e,loading:t=!1,error:n="",notice:s="",runtimeBacked:i=!1,selectionMode:r=!1,selectedCaseIds:a,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:p,onDeleteCase:m,onRetry:b}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:"重试"})]}):s?o.jsx("div",{className:"aw-case-empty",children:s}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(v=>{var k;const y=v.id.startsWith("local:"),x=(a==null?void 0:a.has(v.id))??!1,E=(c==null?void 0:c.has(v.id))??!1,S=v.output.length+v.referenceOutput.length>220||(((k=v.reason)==null?void 0:k.length)??0)>120,_=d&&!y,T=v.source==="auto";return o.jsxs("div",{className:["aw-case-row",l===v.id?"is-focused":"",r?"is-selecting":"",x?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":r?x:void 0,onClick:()=>{if(r){_&&(h==null||h(v));return}f==null||f(v)},onKeyDown:A=>{A.target===A.currentTarget&&(A.key!=="Enter"&&A.key!==" "||(A.preventDefault(),r?_&&(h==null||h(v)):f==null||f(v)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[r&&_&&o.jsx("span",{className:`aw-select-marker${x?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:v.input,children:v.input||"无用户输入"})]}),v.comment&&o.jsxs("small",{title:v.comment,children:["备注:",v.comment]}),o.jsx("small",{className:"aw-case-time",children:tSe(v.createdAt)}),(v.userId||v.sessionId)&&o.jsx("small",{title:[v.userId,v.sessionId].filter(Boolean).join(" · "),children:[v.userId,v.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${E?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:v.output,children:v.output||"无可见回复"}),v.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:v.referenceOutput,children:["Reference: ",v.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:A=>{A.stopPropagation(),p==null||p(v.id)},children:E?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:nSe(v)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${E?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:T?v.reason:void 0,children:T?v.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:_&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:A=>{A.stopPropagation(),m==null||m(v)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(gSe,{})})})]},v.id)})]})}function ySe({group:e,agents:t,cases:n,onChange:s,onRun:i}){const[r,a]=g.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];g.useEffect(()=>a("config"),[e.id]);const u=f=>{s({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{s({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(Uee,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:r==="config"?"is-active":"","aria-pressed":r==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:r==="history"?"is-active":"","aria-pressed":r==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:r==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>s({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>s({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>s({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(za,{}),"已完成"]}),o.jsx(Kp,{"aria-hidden":!0})]},f.id))})]})})]})}function mH(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let s=.985;n<=80?s=.96:n<=150?s=.97:n<=220?s=.98:n>600&&(s=.995),t.style.setProperty("--scale",s.toString())},MN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!_Se||typeof window.requestAnimationFrame!="function"||bH&&document.visibilityState==="hidden")return n();let i=2,r=window.requestAnimationFrame(function a(){i-=1,i===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},SSe=e=>Object.keys(e).reduce((n,s)=>{const i=e[s];if(i||i===0){const r=s.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${r}${s}`]=a}return n},{}),NSe=e=>{const t=g.Children.toArray(e),n=[];let s="";const i=()=>{s!==""&&(n.push(s),s="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){s+=String(r);continue}i(),n.push(r)}return i(),n},xH=e=>{const t=NSe(e),n=g.Children.count(t);return g.Children.map(t,s=>{if(typeof s=="string"&&s.trim())return n<=1?s:o.jsx("span",{children:s});if(g.isValidElement(s)){const i=s,{children:r,...a}=i.props;return r!=null?g.cloneElement(i,a,xH(r)):i}return s})};g.createContext(null);var TSe=typeof Ul=="object"&&Ul&&Ul.Object===Object&&Ul,kSe=typeof self=="object"&&self&&self.Object===Object&&self;TSe||kSe||Function("return this")();var ASe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function CSe(){const e=g.useRef(!1);return g.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),g.useCallback(()=>e.current,[])}var E3={width:void 0,height:void 0};function ISe(e){const{ref:t,box:n="content-box"}=e,[{width:s,height:i},r]=g.useState(E3),a=CSe(),l=g.useRef({...E3}),c=g.useRef(void 0);return c.current=e.onResize,g.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=v3(d,f,"inlineSize"),p=v3(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const b={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(b):a()&&r(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:s,height:i}}function v3(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function jSe(e,t){const n=g.useRef(e);ASe(()=>{n.current=e},[e]),g.useEffect(()=>{if(!t&&t!==0)return;const s=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(s)}},[t])}const RSe="_LoadingIndicator_7yl6f_1",OSe={LoadingIndicator:RSe},MSe=({className:e,size:t,strokeWidth:n,style:s,...i})=>o.jsx("div",{...i,className:ba(OSe.LoadingIndicator,e),style:s||SSe({"indicator-size":t,"indicator-stroke":n})});function LSe(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const DSe=()=>gH,w3=(e,t=!1,n="TransitionGroup")=>{const s=[];return g.Children.forEach(e,i=>{if(i&&typeof i=="object"&&"key"in i&&i.key)s.push(i);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),s},rd=()=>{},ad=e=>{const t=g.useRef(e);return t.current=e,g.useCallback(n=>t.current(n),[])};function PSe(e,t,n,s){const i=e.reduce((c,u)=>({...c,[u.key]:1}),{}),r=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=e.filter(c=>!r[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!i[c.component.key]}));return s==="append"?l.concat(a):a.concat(l)}function BSe(e,t,n){if((gH||ESe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const USe="_TransitionGroupChild_1hv1z_1",FSe={TransitionGroupChild:USe},EH={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},$Se=e=>({...EH,enter:!e}),HSe=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return EH}},zSe=({ref:e,as:t,children:n,className:s,transitionId:i,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:b,onExitComplete:v})=>{const[y,x]=g.useReducer(HSe,$Se(a||!1)),E=g.useRef(!1),w=g.useRef(null),S=g.useRef(c);S.current=c;const _=g.useRef(u);_.current=u;const T=g.useRef(null),k=g.useCallback(A=>{const j=w.current;if(!(!j||A===T.current))switch(T.current=A,A){case"enter":f(j);break;case"enter-active":h(j);break;case"enter-complete":p(j);break;case"exit":m(j);break;case"exit-active":b(j);break;case"exit-complete":v(j);break}},[f,h,p,m,b,v]);return Pt.useLayoutEffect(()=>{if(!l){let R;x({type:"exit-before"}),k("exit");const B=MN(()=>{x({type:"exit-active"}),k("exit-active"),R=window.setTimeout(()=>{k("exit-complete"),d()},_.current)});return()=>{B(),R!==void 0&&clearTimeout(R)}}if(a&&!E.current){E.current=!0;return}let A;x({type:"enter-before"}),k("enter");const j=MN(()=>{x({type:"enter-active"}),k("enter-active"),A=window.setTimeout(()=>{x({type:"done"}),k("enter-complete")},S.current)});return()=>{j(),A!==void 0&&clearTimeout(A)}},[l,a,d,k]),g.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:LSe([w,e]),className:ba(s,FSe.TransitionGroupChild),"data-transition-id":i,style:r,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},VSe=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,s=!n&&t!=null?t:null,[i,r]=g.useState(s==null);return jSe(()=>r(!0),i?null:s),i?o.jsx(zSe,{...e}):null},GSe=e=>{const{ref:t,as:n="span",children:s,className:i,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=DSe()}=e,p=ad(e.onEnter??rd),m=ad(e.onEnterActive??rd),b=ad(e.onEnterComplete??rd),v=ad(e.onExit??rd),y=ad(e.onExitActive??rd),x=ad(e.onExitComplete??rd);g.Children.forEach(s,_=>{if(_&&!_.key)throw new Error("Child elements of must include a `key`")});const E=g.useCallback(_=>({component:_,shouldRender:!0,removeChild:()=>{S(T=>T.filter(k=>_.key!==k.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,b,v,y,x]),[w,S]=g.useState(()=>w3(s).map(_=>({...E(_),preventMountTransition:u})));return g.useLayoutEffect(()=>{S(_=>{const T=w3(s);return PSe(T,_,E,f)})},[s,f,E]),BSe("TransitionGroup",t,g.Children.count(s)),h?o.jsx(o.Fragment,{children:g.Children.map(s,_=>o.jsx(n,{ref:t,className:i,style:a,"data-transition-id":r,children:_}))}):o.jsx(o.Fragment,{children:w.map(({component:_,...T})=>o.jsx(VSe,{...T,as:n,className:i,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:_},_.key))})},KSe="_Button_1864l_1",qSe="_ButtonInner_1864l_4",YSe="_ButtonLoader_1864l_749",Bw={Button:KSe,ButtonInner:qSe,ButtonLoader:YSe},_3=e=>{const{type:t="button",color:n="primary",variant:s="solid",pill:i=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:b,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,S=g.useCallback(_=>{v||b==null||b(_)},[b,v]);return o.jsxs("button",{type:t,className:ba(Bw.Button,m),"data-color":n,"data-variant":s,"data-pill":i?"":void 0,"data-uniform":r?"":void 0,"data-size":a,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:yH,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:S,...E,children:[o.jsx(GSe,{className:Bw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(MSe,{},"loader")}),o.jsx("span",{className:Bw.ButtonInner,children:xH(p)})]})},WSe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),XSe="_EmptyMessage_1r5gu_1",QSe="_IconBadge_1r5gu_16",ZSe="_Title_1r5gu_54",JSe="_Description_1r5gu_69",eNe="_ActionRow_1r5gu_77",Bg={EmptyMessage:XSe,IconBadge:QSe,Title:ZSe,Description:JSe,ActionRow:eNe},Zn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:ba(Bg.EmptyMessage,t),"data-fill":n,children:e}),tNe=({size:e="md",color:t="secondary",children:n,className:s})=>o.jsx("div",{className:ba(Bg.IconBadge,s),"data-size":e,"data-color":t,children:n}),nNe=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:ba(Bg.Title,t),"data-color":n,children:e}),sNe=({children:e,className:t})=>o.jsx("div",{className:ba(Bg.Description,t),children:e}),iNe=({children:e,className:t})=>o.jsx("div",{className:ba(Bg.ActionRow,t),children:e});Zn.Icon=tNe;Zn.Title=nNe;Zn.Description=sNe;Zn.ActionRow=iNe;const fr="/web/sandbox/sessions",S3=3e4,N3=33e4,rNe=6e4,aNe=6e5,Uw=15e3,Fo=6e4,oNe=33e4,T3=40;function iE(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function ui(e){const t=Ex(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function di(e,t){const n=await e.text().catch(()=>"");let s={};try{s=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=s.detail,r=i&&typeof i=="object"&&"message"in i?i.message:i??s.error??s.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function od(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",toolType:e.toolType??"",createdBy:e.createdBy??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:rE(e.permissions)}}const ip={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function rE(e){if(!e||typeof e!="object")return{...ip};const t=e,n=t.approvalPolicy,s=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:ip.approvalPolicy,approvalsReviewer:s==="user"||s==="auto_review"?s:ip.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:ip.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:ip.networkAccess}}function k3(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:rE(t.permissions)}}function Ra(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function lNe(e){const t=Ra(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function cNe(e){const t=Ra(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function vH(e){const t=Ra(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function hb(e){const t=Ra(e),n=vH(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const s=t.messages.flatMap(i=>{const r=Ra(i);if(!r||typeof r.id!="string"||r.role!=="user"&&r.role!=="assistant"||typeof r.content!="string"||typeof r.timestamp!="number")return[];const a=Array.isArray(r.skillNames)?r.skillNames.filter(l=>typeof l=="string"&&!!l):[];return[{id:r.id,role:r.role,content:r.content,timestamp:r.timestamp,...a.length?{skillNames:a}:{}}]});return{thread:n,threadId:t.threadId,messages:s,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:rE(t.permissions)}}function LN(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(s=>typeof s!="number"||!Number.isFinite(s)||s<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function uNe(e){const t=LN(e.usage);if(!t||typeof e.turnId!="string")return;const n=LN(e.threadTotal),s=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof s=="number"&&Number.isFinite(s)&&s>=0?{modelContextWindow:Math.trunc(s)}:{}}}function dNe(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function fNe(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),s=new TextDecoder;let i="",r="";const a=[],l=new Map;let c;function u(){var p;(p=t.onBlocks)==null||p.call(t,a.map(m=>({...m})))}function d(p){r+=p;const m=a[a.length-1];(m==null?void 0:m.kind)==="text"?m.text+=p:a.push({kind:"text",text:p}),u()}function f(p){if(typeof p.id!="string"||p.kind!=="thinking"&&p.kind!=="tool"||p.status!=="running"&&p.status!=="done")return;const m=p.status==="done";let b;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;b={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;b={kind:"tool",name:p.name,args:p.args,response:p.response,done:m}}const v=l.get(p.id);v===void 0?(l.set(p.id,a.length),a.push(b)):a[v]=b,u()}function h(p){var y,x,E;let m="message";const b=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&b.push(w.slice(5).trimStart());if(b.length===0)return;let v;try{v=JSON.parse(b.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(m==="error")throw new Error(typeof v.message=="string"&&v.message?v.message:"沙箱对话失败,请稍后重试。");if(m==="activity"&&f(v),m==="approval"){const w=dNe(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=uNe(v);w&&(c=w,(x=t.onUsage)==null||x.call(t,w))}m==="approval_resolved"&&typeof v.approvalId=="string"&&((E=t.onApprovalResolved)==null||E.call(t,v.approvalId)),m==="delta"&&typeof v.text=="string"&&d(v.text),m==="done"&&!r&&typeof v.text=="string"&&d(v.text)}for(;;){const{done:p,value:m}=await n.read();i+=s.decode(m,{stream:!p});const b=i.split(/\r?\n\r?\n/);if(i=b.pop()??"",b.forEach(h),p)break}if(i.trim()&&h(i),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function eo(e,t,{method:n="GET",body:s,options:i={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(jn(`${fr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:ui(s===void 0?void 0:{"Content-Type":"application/json"}),...s===void 0?{}:{body:JSON.stringify(s)},signal:Pn(i.signal,Fo)});if(!a.ok)throw await di(a,r);return a.json()}const un={async listSessions(e={}){const t=await fetch(jn(fr),{method:"GET",headers:ui(),signal:Pn(e.signal,S3)});if(!t.ok)throw await di(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(s=>od(s))},async startSession(e={}){var n;const t=await fetch(jn(fr),{method:"POST",headers:ui({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:Pn(e.signal,N3)});if(!t.ok)throw await di(t,"无法启动 AgentKit 沙箱,请稍后重试。");return od(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(jn(`/web/${e}/sessions`),{method:"GET",headers:ui(),signal:Pn(t.signal,S3)});if(!n.ok)throw await di(n,`无法读取 ${e} 智能体,请稍后重试。`);const s=await n.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return s.sessions.map(i=>od(i,e))},async startAgentSession(e,t={}){var s;const n=await fetch(jn(`/web/${e}/sessions`),{method:"POST",headers:ui({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=t.displayName)==null?void 0:s.trim())??""}),signal:Pn(t.signal,N3)});if(!n.ok)throw await di(n,`无法创建 ${e} 智能体,请稍后重试。`);return od(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const s=await fetch(jn(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:ui(),signal:Pn(n.signal,Fo)});if(!s.ok)throw await di(s,`无法打开 ${e} 智能体。`);const i=await s.json();if(typeof i.webuiUrl!="string"||!i.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:od(i,e),kind:e,webuiUrl:jn(i.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await fetch(jn(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:ui(),signal:Pn(n.signal,Fo)});if(!s.ok)throw await di(s,`无法打开 ${e} Terminal。`);const i=await s.json();return{url:wH(i.url,`${e} Terminal`),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const s=await fetch(jn(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:ui(),signal:Pn(n.signal,Uw)});if(!s.ok&&s.status!==404)throw await di(s,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(jn(`${fr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:ui({"Content-Type":"application/json"}),signal:Pn(t.signal,rNe)});if(!n.ok)throw await di(n,"无法连接 Codex 智能体,请稍后重试。");const s=od(await n.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(e,t={}){var s;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(jn(`${fr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:ui({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(s=e.skillIds)!=null&&s.length?{skillIds:e.skillIds}:{}}),signal:Pn(t.signal,aNe)});if(!n.ok)throw await di(n,"沙箱对话失败,请稍后重试。");return fNe(n,t)},async getStatus(e,t={}){const n=await eo(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),s=k3(n),i=Ra(n),r=LN(i==null?void 0:i.threadTotal),a=i==null?void 0:i.modelContextWindow;return{...s,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=Ra(await eo(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(s=>{const i=lNe(s);return i?[i]:[]})},async setModel(e,t,n={}){const s=Ra(await eo(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(e,t=!1,n={}){const i=Ra(await eo(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(i==null?void 0:i.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return i.skills.flatMap(r=>{const a=cNe(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const s=new URLSearchParams;t.cursor&&s.set("cursor",t.cursor),t.search&&s.set("search",t.search),t.archived&&s.set("archived","true");const i=s.size?`?${s}`:"",r=Ra(await eo(e,`threads${i}`,{options:n,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(r==null?void 0:r.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:r.threads.flatMap(a=>{const l=vH(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return hb(await eo(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return hb(await eo(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return hb(await eo(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const s=Ra(await eo(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:hb(s)}:{}}},async compactThread(e,t={}){await eo(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(jn(`${fr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:ui(),signal:Pn(t.signal,Fo)});if(!n.ok)throw await di(n,"无法读取 Codex 权限与工作空间。");return k3(await n.json())},async updatePermissions(e,t,n={}){const s=await fetch(jn(`${fr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:ui({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:Pn(n.signal,Fo)});if(!s.ok)throw await di(s,"无法更新 Codex 权限。");const i=await s.json();return rE(i.permissions)},async updateWorkspace(e,t,n={}){const s=await fetch(jn(`${fr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:ui({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:Pn(n.signal,Fo)});if(!s.ok)throw await di(s,"无法更新 Codex 工作空间。");const i=await s.json();if(typeof i.cwd!="string"||!i.cwd)throw new Error("Sandbox 返回了无效工作目录。");return i.cwd},async listDirectories(e,t,n={}){const s=new URLSearchParams({path:t}),i=await fetch(jn(`${fr}/${encodeURIComponent(e)}/directories?${s}`),{method:"GET",headers:ui(),signal:Pn(n.signal,Fo)});if(!i.ok)throw await di(i,"无法读取 Sandbox 目录。");const r=await i.json();if(typeof r.path!="string"||!Array.isArray(r.directories)||r.directories.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:r.path,...typeof r.parent=="string"?{parent:r.parent}:{},directories:r.directories}},async resolveApproval(e,t,n,s={}){const i=await fetch(jn(`${fr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:ui({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:Pn(s.signal,Fo)});if(!i.ok)throw await di(i,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return A3(e,"terminal",t)},async launchBrowser(e,t={}){return A3(e,"browser",t)},async uploadFile(e,t,n={}){const s=new FormData;s.set("file",t,t.name);const i=await fetch(jn(`${fr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:ui(),body:s,signal:Pn(n.signal,oNe)});if(!i.ok)throw await di(i,"无法上传文件到 Sandbox。");const r=await i.json();if(typeof r.id!="string"||typeof r.path!="string"||typeof r.name!="string"||typeof r.mimeType!="string"||typeof r.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return r},async closeSession(e,t={}){if(!e)return;const n=await fetch(jn(`${fr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:ui(),signal:Pn(t.signal,Uw)});if(!n.ok&&n.status!==404)throw await di(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(jn(`${fr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:ui(),signal:Pn(t.signal,Uw)});if(!n.ok&&n.status!==404)throw await di(n,"无法删除 Codex 智能体。")}};async function A3(e,t,n){const s=await fetch(jn(`${fr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:ui(),signal:Pn(n.signal,Fo)});if(!s.ok)throw await di(s,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const i=await s.json();return{url:wH(i.url,"Sandbox 工具"),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}}function wH(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return jn(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const s=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!s)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function zd(e,t,n){const s=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${s}`,n?`请求:${n}`:""].filter(Boolean).join(` +`)}function hNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function pNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function mNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function Qm({kind:e,...t}){return e==="codex"?o.jsx(hNe,{...t}):e==="openclaw"?o.jsx(pNe,{...t}):o.jsx(mNe,{...t})}const Fw=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],gNe=24,bNe=3e4,Vd=new Map,lf=new Map,yNe=new Set;function pb(e){if(!e){Vd.clear(),lf.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,s]of lf)s.page.runtimes.some(i=>t.has(i.runtimeId))&&lf.delete(n);Vd.clear()}}function xNe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function $w(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function ENe({type:e}){return e==="general"?o.jsx(iu,{}):o.jsx(Qm,{kind:e})}function gA(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function C3(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:gA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function vNe(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:iE(e.status),createdAt:gA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function wNe(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:gA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function _Ne(e,t,n){const s=`${e}:all:${t}`,i=lf.get(s);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(C3)),i.page.nextToken;i&&lf.delete(s);let r=Vd.get(s);r||(r=Tx({scope:e,region:"all",pageSize:gNe,nextToken:t}),Vd.set(s,r),r.then(()=>Vd.delete(s),()=>Vd.delete(s)));const a=await r;return lf.set(s,{page:a,expiresAt:Date.now()+bNe}),n(a.runtimes.map(C3)),a.nextToken}function SNe({agent:e,cloudProvider:t,onUse:n,onViewDetails:s,connecting:i,connected:r,showOwnership:a,deploymentTask:l,onViewDeploymentTask:c,onEditDraft:u,onDeleteDraft:d}){const f=!!(e.runtime||e.sandbox);return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:e.sandbox.id,children:e.sandbox.id}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:l?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[l?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:Tf(e.runtime.region,t)}),a&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]})]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":l?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>l?c==null?void 0:c(l):u==null?void 0:u(e.draft),children:l?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>d==null?void 0:d(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!f,"aria-label":l?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>l?c==null?void 0:c(l):s==null?void 0:s(e),children:l?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${r?" is-connected":""}`,disabled:!f||i||r,"aria-busy":i||void 0,"aria-label":r?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(n==null?void 0:n(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):r?"已连接":"使用"})]})})]})}function NNe({cloudProvider:e,canCreate:t,runtimeScope:n,onCreateAgent:s,onUseAgent:i,onViewAgentDetails:r,onCreateSandboxAgent:a,onUseSandboxAgent:l,onViewSandboxAgentDetails:c,sandboxRefreshKey:u=0,connectedRuntimeId:d="",hiddenRuntimeIds:f=yNe,drafts:h=[],deploymentTasks:p=[],draftDeploymentTaskIds:m={},onViewDeploymentTask:b,onEditDraft:v,onDeleteDraft:y}){const x=g.useRef(null),E=g.useRef(null),w=g.useRef(0),S=g.useRef(0),_=g.useRef(null),[T,k]=g.useState("general"),[A,j]=g.useState(""),[R,B]=g.useState([]),[z,L]=g.useState(""),[F,C]=g.useState(!0),[I,D]=g.useState(""),[$,O]=g.useState([]),[ne,se]=g.useState(!1),[P,Z]=g.useState(""),[te,V]=g.useState(""),[Q,K]=g.useState(null),ce=g.useMemo(()=>h.map(wNe),[h]),he=g.useMemo(()=>{const Ae=new Map,ze=new Map;for(const Be of p){if(Be.status!=="running"||(Ae.set(Be.id,Be),!Be.runtimeId))continue;const X=ze.get(Be.runtimeId);(!X||Be.startedAt>X.startedAt)&&ze.set(Be.runtimeId,Be)}return{byId:Ae,byRuntimeId:ze}},[p]),ge=g.useCallback(Ae=>{var Be;if(Ae.draft){const X=m[Ae.draft.id];return X?he.byId.get(X):void 0}const ze=(Be=Ae.runtime)==null?void 0:Be.runtimeId;return ze?he.byRuntimeId.get(ze):void 0},[he,m]),ue=g.useCallback((Ae,ze)=>{const Be=++w.current;return C(!0),D(""),_Ne(n,Ae,X=>{w.current===Be&&B(oe=>ze?X:[...oe,...X])}).then(X=>{w.current===Be&&L(X)}).catch(X=>{w.current===Be&&D(zd(X,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{w.current===Be&&C(!1)})},[n]);g.useEffect(()=>{if(T==="general")return B([]),L(""),ue("",!0),()=>{w.current+=1}},[T,ue]);const ve=g.useCallback(async Ae=>{var X,oe;(X=_.current)==null||X.abort();const ze=new AbortController;_.current=ze;const Be=++S.current;se(!0),Z(""),O([]);try{const J=Ae==="codex"?await un.listSessions({signal:ze.signal}):await un.listAgentSessions(Ae,{signal:ze.signal});if(S.current!==Be)return;O(J.map(vNe))}catch(J){if((J==null?void 0:J.name)==="AbortError"||S.current!==Be)return;Z(zd(J,`加载 ${((oe=Fw.find(xe=>xe.id===Ae))==null?void 0:oe.label)??Ae}`,`GET /web/${Ae==="codex"?"sandbox":Ae}/sessions`))}finally{_.current===ze&&(_.current=null),S.current===Be&&se(!1)}},[]);function Me(Ae){var ze;Ae!==T&&(Ae==="general"?(w.current+=1,B([]),L(""),D(""),C(!0)):((ze=_.current)==null||ze.abort(),_.current=null,S.current+=1,O([]),Z(""),se(!0)),k(Ae))}g.useEffect(()=>{var Ae;if(T==="general"){(Ae=_.current)==null||Ae.abort(),_.current=null,S.current+=1;return}return ve(T),()=>{var ze;(ze=_.current)==null||ze.abort(),_.current=null,S.current+=1}},[T,ve,u]),g.useEffect(()=>{const Ae=E.current,ze=x.current;if(!Ae||!ze||T!=="general"||!z||F)return;const Be=new IntersectionObserver(([X])=>{X.isIntersecting&&ue(z,!1)},{root:ze,rootMargin:"240px 0px",threshold:.01});return Be.observe(Ae),()=>Be.disconnect()},[T,ue,F,z]);const Se=g.useCallback(async Ae=>{if(!te){V(Ae.id);try{await new Promise(ze=>requestAnimationFrame(()=>ze())),Ae.sandbox?await l(Ae.sandbox):await i(Ae)}finally{V("")}}},[te,i,l]),ae=g.useMemo(()=>{const Ae=A.trim().toLocaleLowerCase(),ze=T==="general"?[...ce,...R]:$,Be=Ae?ze.filter(J=>J.name.toLocaleLowerCase().includes(Ae)):ze;if(T!=="general")return Be;const X=f.size>0?Be.filter(J=>!J.runtime||!f.has(J.runtime.runtimeId)):Be,oe=X.findIndex(J=>{var xe;return((xe=J.runtime)==null?void 0:xe.runtimeId)===d});return oe<=0?X:[X[oe],...X.slice(0,oe),...X.slice(oe+1)]},[T,d,ce,f,A,R,$]),me=Fw.find(Ae=>Ae.id===T),we=(me==null?void 0:me.label)??"智能体",et=T==="general"?F&&R.length===0&&ce.length===0:ne&&$.length===0,De=!et&&ae.length===0,Ue=t?T==="general"?()=>s(ki(e)):()=>a(T):void 0,Ye=t?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:n==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(xNe,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:A,onChange:Ae=>j(Ae.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:Fw.map(Ae=>o.jsx("button",{type:"button",className:`my-agent-type-pill${T===Ae.id?" is-active":""}`,"aria-pressed":T===Ae.id,onClick:()=>Me(Ae.id),children:Ae.label},Ae.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!Ue,title:Ye,onClick:()=>Ue==null?void 0:Ue(),children:[o.jsx($w,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:x,"aria-label":`${we}列表`,children:[et?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(T==="general"?I:P)&&ae.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:T==="general"?I:P}),o.jsx("button",{type:"button",onClick:()=>{T==="general"?ue("",!0):ve(T)},children:"重新加载"})]}):De?A.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Zn,{fill:"none",children:[o.jsx(Zn.Icon,{children:o.jsx(WSe,{})}),o.jsx(Zn.Title,{children:"没有匹配的智能体"}),o.jsx(Zn.Description,{children:"请尝试搜索其他名称"})]})}):T!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Zn,{fill:"none",children:[o.jsx(Zn.Icon,{children:o.jsx(ENe,{type:T})}),o.jsxs(Zn.Title,{children:["暂无 ",we]}),t?o.jsx(Zn.ActionRow,{children:o.jsxs(_3,{color:"primary",size:"lg",onClick:()=>a(T),children:[o.jsx($w,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Zn,{fill:"none",children:[o.jsx(Zn.Icon,{children:o.jsx(iu,{})}),o.jsx(Zn.Title,{children:"暂无通用智能体"}),o.jsx(Zn.Description,{children:"创建一个通用智能体,开始构建和对话"}),t?o.jsx(Zn.ActionRow,{children:o.jsxs(_3,{color:"primary",size:"lg",onClick:()=>s(ki(e)),children:[o.jsx($w,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[T==="general"&&I?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:I}),o.jsx("button",{type:"button",onClick:()=>void ue("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ae.map(Ae=>{var ze;return o.jsx(SNe,{agent:Ae,cloudProvider:e,deploymentTask:ge(Ae),onViewDeploymentTask:b,onUse:Se,onViewDetails:Be=>{Be.sandbox?c(Be.sandbox):r(Be)},connecting:Ae.id===te,connected:((ze=Ae.runtime)==null?void 0:ze.runtimeId)===d,showOwnership:n==="all",onEditDraft:v,onDeleteDraft:K},Ae.id)})})]}),T==="general"&&!I&&!et&&(ae.length>0||!!z)&&o.jsx("div",{className:"my-agent-load-more",ref:E,"aria-live":"polite",children:F?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):z?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),Q?o.jsx(mA,{title:"删除草稿?",description:`删除后将无法恢复“${Q.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>K(null),onConfirm:()=>{y==null||y(Q),K(null)}}):null]})}const TNe={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},kNe={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},ANe="https://api.github.com",CNe=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,I3=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,INe=/^[A-Za-z0-9._/-]+$/;function jNe(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function Ic(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let s;try{s=await fetch(`${ANe}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(r){throw t.signal.aborted?r:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await s.json().catch(()=>null);if(!t.expected.includes(s.status))throw new Error(jNe(s.status,i,t.token));return{status:s.status,payload:i}}function Hw(e){return e.split("/").map(encodeURIComponent).join("/")}function RNe(e){const t=new TextEncoder().encode(e);let n="";const s=32768;for(let i=0;i({...h,path:bA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Ic(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await Ic(`${a}/git/ref/heads/${Hw(s)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=ONe(e.branchPrefix);await Ic(`${a}/git/refs`,{token:e.token,expected:[201],signal:r,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const p of i){const m=Hw(p.path),b=await Ic(`${a}/contents/${m}?ref=${encodeURIComponent(s)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await Ic(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:RNe(p.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await Ic(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:s,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await Ic(`${a}/git/refs/heads/${Hw(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const xA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},EA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},SH={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},NH={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function vA(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function wA(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const MNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,LNe=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function DNe(e){if(!MNe.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!LNe.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function PNe(e){DNe(e);const t=String.raw`name: PR Automated Review "on": pull_request: @@ -730,7 +730,7 @@ jobs: gh pr review "__GH__ github.event.pull_request.number }}" \ --comment \ --body-file review-body.md -`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const DNe={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[xA,EA,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:vA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e);return yA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:LNe({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},PNe=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,BNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function UNe(e){if(!PNe.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!BNe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function TH(e){UNe(e);const t=`name: Publish to AgentKit Runtime +`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const BNe={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[xA,EA,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:vA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e);return yA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:PNe({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},UNe=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,FNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function $Ne(e){if(!UNe.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!FNe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function TH(e){$Ne(e);const t=`name: Publish to AgentKit Runtime on: push: @@ -826,7 +826,7 @@ jobs: if not result.success: raise SystemExit(f"AgentKit publish failed: {result.error}") PY -`,n={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const FNe={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[xA,EA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},SH,NH],initialValues:vA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e),s=bA(e.projectPath,".");return yA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:TH({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function $Ne(e,t){return e==="."?t:`${e}/${t}`}function HNe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function zNe(e){return Object.fromEntries(Object.entries({"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" +`,n={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const HNe={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[xA,EA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},SH,NH],initialValues:vA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e),s=bA(e.projectPath,".");return yA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:TH({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function zNe(e,t){return e==="."?t:`${e}/${t}`}function VNe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function GNe(e){return Object.fromEntries(Object.entries({"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" from assistant import root_agent from veadk.integrations.agentkit import create_agentkit_app, run_agentkit_app @@ -934,78 +934,78 @@ __pycache__/ Dockerfile .dockerignore README.md -`}).map(([n,s])=>[n,s.split("__PROJECT_NAME__").join(e)]))}const VNe={id:"template",kind:"github",category:"development",icon:"github",name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",fields:[xA,EA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},SH,NH],initialValues:vA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e),s=_H(n.repository),i=bA(e.projectPath,"agentkit-basic-agent"),r=i==="."?s.split("/").slice(-1)[0]||"agentkit-basic-agent":i.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(zNe(r)).map(([l,c])=>({path:$Ne(i,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:HNe(i),content:TH({baseBranch:n.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),yA({...n,repository:s,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},j3=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],kH=[SNe,VNe,FNe,DNe,NNe],GNe=new Map(kH.map(e=>[e.id,e]));function KNe(e){const t=GNe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function qNe(e){const t=KNe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const _A="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e";function AH(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function R3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function YNe(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function WNe({onOpen:e}){var c;const[t,n]=g.useState("development"),[s,i]=g.useState(""),r=g.useDeferredValue(s),a=g.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return kH.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=j3.find(u=>u.id===t))==null?void 0:c.label;return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"自动化"}),o.jsx("p",{children:"连接研发工具,为智能体扩展自动化工作流"})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(R3,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:s,onChange:u=>i(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:j3.map(u=>o.jsx("button",{type:"button",className:t===u.id?"is-active":"","aria-pressed":t===u.id,onClick:()=>n(u.id),children:u.label},u.id))}),o.jsx("section",{className:"applications-results","aria-label":`${l}自动化列表`,children:a.length?o.jsx("div",{className:"applications-grid",children:a.map(u=>o.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(u.id),"aria-label":`打开${u.name}`,children:[u.icon==="feishu"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:_A,alt:"","aria-hidden":"true"}):u.icon==="coding-agents"?o.jsx(YNe,{className:"application-card-icon"}):o.jsx(AH,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:u.name}),u.badge?o.jsx("span",{className:`application-card-badge is-${u.badgeTone||"default"}`,children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(R3,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function XNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function QNe({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function O3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function ZNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function JNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zw(e,t,n){const s=t.trim();if(!s)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(s))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(s)||s.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(s.startsWith("/")||s.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(s))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const i=new URL(s);if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function eTe({automation:e,onBack:t}){const n=qNe(e),[s,i]=g.useState(()=>({...n.initialValues})),[r,a]=g.useState({}),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(null),y=g.useRef(null);g.useEffect(()=>()=>{var T;return(T=y.current)==null?void 0:T.abort()},[]);const x=(T,k)=>{i(A=>({...A,[T]:k})),r[T]&&a(A=>({...A,[T]:""}))},E=T=>{var j;const k=T==="token"||((j=n.fields.find(R=>R.name===T))==null?void 0:j.required)===!0,A=zw(T,s[T],k);a(R=>({...R,[T]:A}))},w=async T=>{var R;T.preventDefault();const k={};for(const B of n.fields){const z=zw(B.name,s[B.name],B.required);z&&(k[B.name]=z)}const A=zw("token",s.token,!0);if(A&&(k.token=A),a(k),Object.keys(k).length)return;(R=y.current)==null||R.abort();const j=new AbortController;y.current=j,d(!0),c(""),v(null);try{const B=await n.submit(s,j.signal);if(y.current!==j)return;v(B),i(z=>({...z,token:""}))}catch(B){if(j.signal.aborted||y.current!==j)return;c(B instanceof Error?B.message:String(B))}finally{y.current===j&&(y.current=null,d(!1))}},S=T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)&&T.preventDefault()},_=T=>{const{name:k,label:A,placeholder:j,help:R,required:B}=T;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${k}`,children:[o.jsx("span",{children:A}),o.jsx("span",{className:`github-field-requirement${B?" is-required":""}`,children:B?"必填":"可选"})]}),o.jsx("input",{id:`github-${k}`,value:s[k],onChange:z=>x(k,z.target.value),onBlur:()=>E(k),placeholder:j,required:B,"aria-invalid":!!r[k],"aria-describedby":`github-${k}-help${r[k]?` github-${k}-error`:""}`}),o.jsx("span",{id:`github-${k}-help`,className:"github-field-help",children:R}),r[k]?o.jsx("span",{id:`github-${k}-error`,className:"github-field-error",role:"alert",children:r[k]}):null]},k)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:t,"aria-label":"返回自动化列表",children:o.jsx(XNe,{})}),o.jsx(AH,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:n.title}),o.jsx("p",{children:n.subtitle})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:n.panel})}),o.jsxs("form",{className:"github-release-form",onSubmit:w,onKeyDown:S,noValidate:!0,children:[o.jsxs("div",{className:"github-field-grid",children:[n.fields.map(_),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:"地域"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:T=>{T.key==="Escape"&&m(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(T=>!T),children:[o.jsx("span",{children:s.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(ZNe,{className:`pp-region-chevron${p?" is-open":""}`})]}),p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>m(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"地域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(T=>{const k=T.value===s.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":k,className:`pp-region-option${k?" is-selected":""}`,onClick:()=>{x("region",T.value),m(!1)},children:[o.jsx("span",{children:T.label}),k?o.jsx(JNe,{}):null]},T.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:n.regionHelp})]})]}),o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:"GitHub Token"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write",target:"_blank",rel:"noreferrer",children:["获取 Token",o.jsx(O3,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:s.token,onChange:T=>x("token",T.target.value),onBlur:()=>E("token"),autoComplete:"off",required:!0,placeholder:"需要仓库 Contents 与 Pull requests 写权限","aria-invalid":!!r.token,"aria-describedby":`github-token-help${r.token?" github-token-error":""}`}),o.jsx("button",{type:"button",onClick:()=>h(T=>!T),"aria-label":f?"隐藏 Token":"显示 Token",title:f?"隐藏 Token":"显示 Token",children:o.jsx(QNe,{hidden:f})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:"Token 仅用于本次提交,不会保存在浏览器或写入 PR"}),r.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r.token}):null]}),l?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:l}):null,b?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",b.number," 已创建"]}),o.jsxs("a",{href:b.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(O3,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsx("strong",{children:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:"}),n.secrets.map(T=>o.jsx("span",{children:T},T))]}),o.jsx("button",{type:"submit",disabled:u,children:u?"提交 PR 中…":n.submitLabel})]})]})]})})]})}function tTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function nTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function sTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function iTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function rTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function aTe(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function gh(e){return(e instanceof Error?e.message:String(e)).replace(/\b((?:app[_-]?)?secret|token|api[_-]?key|password)\b\s*[:=]\s*["']?[^"',\s}]+/gi,"$1=").slice(0,300)}const oTe="modulepreload",lTe=function(e){return"/"+e},M3={},lu=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=lTe(c),c in M3)return;M3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":oTe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})},L3=new Set;let M1={enabled:!1},ts,$f=null,D3=null,Vd="",DN="unknown",CH="unknown",Zm=[];function cTe(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function uTe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,cTe(n)]))}function dTe(e){return e?Object.fromEntries(Object.entries(e).filter(([,t])=>Number.isFinite(t))):{}}function fTe(){return new Date().toISOString().slice(0,10)}function hTe(e){if(!e)return!0;if(e.dedupeKey){if(L3.has(e.dedupeKey))return!1;L3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${fTe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function IH(e){if($f){try{$f("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Zm=[...Zm.slice(-49),e]}function pTe(){if(!$f)return;const e=Zm;Zm=[];for(const t of e)IH(t)}function mTe(e){if(M1=e,ts=e.studio,!e.enabled||!e.apmplus||D3)return;const t=e.apmplus;D3=lu(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Vd||void 0}),s("start"),$f=s,pTe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),M1={enabled:!1},Zm=[]})}function vr(e,t={},n,s){if(!M1.enabled||!M1.apmplus||!hTe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Vd,user_role:DN,user_source:CH}:{};IH({name:e,categories:uTe({studio_deploy_id:ts==null?void 0:ts.deployId,user_pool_id:ts==null?void 0:ts.userPoolId,vefaas_application_id:ts==null?void 0:ts.applicationId,vefaas_function_id:ts==null?void 0:ts.functionId,studio_region:ts==null?void 0:ts.region,studio_project:ts==null?void 0:ts.project,studio_version:ts==null?void 0:ts.version,...i,...t}),metrics:dTe(n)})}function gTe(e){if(Vd=e.userId.trim(),!!Vd){if(DN=e.role??"unknown",CH=e.local?"local":"sso",$f)try{$f("config",{userId:Vd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}vr("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(ts==null?void 0:ts.deployId)??"",Vd,DN].join(":")})}}function jH(e){return{deploy_source:e.telemetry.source,create_mode:e.telemetry.createMode,ai_assisted:e.telemetry.aiAssisted,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function RH(e){return{deploy_source:e.telemetry.source,create_mode:e.telemetry.createMode,ai_assisted:e.telemetry.aiAssisted,deploy_action:e.action}}function bTe(e){vr("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function OH(e){vr("studio_agent_deploy",{...jH(e),deploy_status:"succeeded",runtime_id:e.runtimeId})}function MH(e){vr("studio_agent_deploy",{...jH(e),deploy_status:"failed",failed_phase:e.phase,error_kind:aTe(e.error,e.phase),error_summary:gh(e.error)})}function yTe(e){vr("studio_sandbox_create",{sandbox_status:"succeeded",sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function xTe(e){vr("studio_sandbox_create",{sandbox_status:"failed",sandbox_kind:e.kind,sandbox_source:e.source,error_kind:tTe(e.error),error_summary:gh(e.error)})}function ETe(e){vr("studio_agent_debug",{debug_status:"succeeded",variant_type:e.variantType},{duration_ms:e.durationMs})}function vTe(e){vr("studio_agent_debug",{debug_status:"failed",variant_type:e.variantType,failed_phase:e.phase,error_kind:nTe(e.error),error_summary:gh(e.error)},{duration_ms:e.durationMs})}function mb(e){vr("studio_agent_connect",{connect_status:"succeeded",agent_kind:e.kind,connect_source:e.source,runtime_region:e.runtimeRegion,runtime_is_mine:e.runtimeIsMine,sandbox_status:e.sandboxStatus},{duration_ms:e.durationMs})}function Vw(e){vr("studio_agent_connect",{connect_status:"failed",agent_kind:e.kind,connect_source:e.source,error_kind:sTe(e.error),error_summary:gh(e.error)},{duration_ms:e.durationMs})}function P3(e){vr("studio_agent_message",{message_status:"succeeded",agent_kind:e.kind,message_source:e.source,session_state:e.sessionState},{duration_ms:e.durationMs})}function rp(e){vr("studio_agent_message",{message_status:"failed",agent_kind:e.kind,message_source:e.source,session_state:e.sessionState,failed_phase:e.phase,error_kind:iTe(e.error),error_summary:gh(e.error)},{duration_ms:e.durationMs})}function wTe(e){vr("studio_agent_source_download",{...RH(e),download_status:"succeeded"},{duration_ms:e.durationMs,file_count:e.fileCount,zip_size_bytes:e.zipSizeBytes})}function _Te(e){vr("studio_agent_source_download",{...RH(e),download_status:"failed",error_kind:rTe(e.error),error_summary:gh(e.error)},{duration_ms:e.durationMs,file_count:e.fileCount})}const STe=/^[A-Za-z_][A-Za-z0-9_]*$/;function nc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":STe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function LH(e){const t=new Set,n=new Set,s=i=>{nc(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(s)};return s(e),n}function NTe(e){return{...Ci(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function TTe(e){const t=NTe(e.agentName),n=await kx(t);return vg(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const va=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],DH=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function kTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ATe(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function B3(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function CTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function ITe(e){if(!e||e==="upload")return 0;const t=DH.findIndex(n=>n.phase===e);return t<0?0:t}function jTe({onBack:e}){var X;const[t,n]=g.useState("feishu_assistant"),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState("cn-beijing"),[f,h]=g.useState(!1),[p,m]=g.useState(""),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState("idle"),[S,_]=g.useState(null),[T,k]=g.useState(""),[A,j]=g.useState(null),R=g.useRef(null),B=g.useRef(null),z=g.useRef([]),L=g.useRef(0),F=g.useRef(null),C=g.useRef("prepare"),I=g.useRef(!1),D=g.useRef(!0),$=["preparing","running","cancelling"].includes(E);g.useEffect(()=>(D.current=!0,()=>{D.current=!1}),[]),g.useEffect(()=>{var he;if(!f)return;(he=z.current[L.current])==null||he.focus();const K=be=>{be.target instanceof Node&&R.current&&!R.current.contains(be.target)&&h(!1)},ce=be=>{var ue;be.key==="Escape"&&(h(!1),(ue=B.current)==null||ue.focus())};return window.addEventListener("pointerdown",K),window.addEventListener("keydown",ce),()=>{window.removeEventListener("pointerdown",K),window.removeEventListener("keydown",ce)}},[f]);const O=K=>{K.key==="Enter"&&(K.nativeEvent.isComposing||K.nativeEvent.keyCode===229)&&K.preventDefault()},te=()=>{const K=nc(t.trim())??"",ce=s.trim()?"":"请输入飞书 App ID",he=r.trim()?"":"请输入飞书 App Secret";return m(K),v(ce),x(he),!K&&!ce&&!he},se=async K=>{if(K.preventDefault(),!te()||$)return;const ce=crypto.randomUUID();F.current=ce,C.current="prepare",I.current=!1,w("preparing"),_(null),k(""),j(null);try{const he=await TTe({agentName:t.trim(),appId:s.trim(),appSecret:r.trim(),region:u,taskId:ce,onStage:be=>{C.current=be.phase||"deploy",!(!D.current||I.current)&&(w("running"),_(be))}});if(!D.current||I.current)return;OH({telemetry:{source:"feishu_automation",createMode:"feishu_template",aiAssisted:!1},action:"create",region:u,networkType:"public",feishuEnabled:!0,runtimeId:he.runtimeId||""}),j(he),a(""),c(!1),w("succeeded")}catch(he){if(!D.current||I.current)return;MH({telemetry:{source:"feishu_automation",createMode:"feishu_template",aiAssisted:!1},action:"create",region:u,networkType:"public",feishuEnabled:!0,phase:C.current,error:he}),w("failed"),k(he instanceof Error?he.message:String(he))}finally{F.current===ce&&(F.current=null)}},P=async()=>{const K=F.current;if(!(!K||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){I.current=!0,w("cancelling"),k("");try{await A8(K),D.current&&w("cancelled")}catch(ce){if(I.current=!1,!D.current)return;w("failed"),k(ce instanceof Error?ce.message:String(ce))}}},Q=ITe((S==null?void 0:S.phase)??null),ee=!!(t.trim()&&s.trim()&&r.trim()&&!$),V=va.find(K=>K.value===u);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":"返回自动化列表",disabled:$,children:o.jsx(kTe,{})}),o.jsx("img",{className:"feishu-integration-logo",src:_A,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:"飞书机器人"}),o.jsx("p",{children:"创建一个由 AgentKit Runtime 驱动的飞书智能体"})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。"}),o.jsxs("form",{className:"feishu-form",onSubmit:se,onKeyDown:O,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:"智能体名称"}),o.jsx("input",{id:"feishu-agent-name",value:t,maxLength:64,disabled:$,onChange:K=>{n(K.target.value),p&&m("")},onBlur:()=>m(nc(t.trim())??""),"aria-invalid":!!p,"aria-describedby":`feishu-agent-name-help${p?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:"将作为新 Runtime 中的根智能体名称"}),p?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:p}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:"部署地域"}),o.jsxs("div",{className:"feishu-region-picker",ref:R,children:[o.jsxs("button",{ref:B,type:"button",className:"feishu-region-trigger",disabled:$,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{L.current=va.findIndex(K=>K.value===u),h(K=>!K)},onKeyDown:K=>{K.key!=="ArrowDown"&&K.key!=="ArrowUp"||(K.preventDefault(),L.current=K.key==="ArrowUp"?va.length-1:va.findIndex(ce=>ce.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:V.label}),o.jsx(ATe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:K=>{var be;const ce=z.current.findIndex(ue=>ue===document.activeElement);let he=null;K.key==="ArrowDown"?he=(ce+1)%va.length:K.key==="ArrowUp"?he=(ce-1+va.length)%va.length:K.key==="Home"?he=0:K.key==="End"?he=va.length-1:K.key==="Tab"&&h(!1),he!==null&&(K.preventDefault(),(be=z.current[he])==null||be.focus())},children:va.map(K=>o.jsx("button",{ref:ce=>{const he=va.findIndex(be=>be.value===K.value);z.current[he]=ce},type:"button",role:"option","aria-selected":u===K.value,className:`feishu-region-option${u===K.value?" is-selected":""}`,onClick:()=>{var ce;d(K.value),h(!1),(ce=B.current)==null||ce.focus()},children:K.label},K.value))}):null]}),o.jsx("span",{className:"feishu-field-help",children:"Runtime 与构建产物将创建在该地域"})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:"飞书 App ID"}),o.jsx("input",{id:"feishu-app-id",value:s,maxLength:128,autoComplete:"off",disabled:$,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:K=>{i(K.target.value),b&&v("")},onBlur:()=>v(s.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!b,"aria-describedby":`feishu-app-id-help${b?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),b?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:b}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:"飞书 App Secret"}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:l?"text":"password",value:r,maxLength:256,autoComplete:"off",disabled:$,placeholder:"请输入 App Secret",onChange:K=>{a(K.target.value),y&&x("")},onBlur:()=>x(r.trim()?"":"请输入飞书 App Secret"),"aria-invalid":!!y,"aria-describedby":`feishu-app-secret-help${y?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:$,onClick:()=>c(K=>!K),"aria-label":l?"隐藏 App Secret":"显示 App Secret",children:l?"隐藏":"显示"})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:"仅写入新 Runtime 的环境变量"}),y?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:y}):null]})]}),E!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${E}`,role:E==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[E==="preparing"?o.jsx(Pa,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(Pa,{as:"strong",children:(S==null?void 0:S.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(Pa,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(B3,{}),"飞书机器人 Runtime 已创建"]}):null,E==="cancelled"?o.jsx("strong",{children:"部署已取消"}):null,E==="failed"?o.jsx("strong",{children:"创建失败"}):null]}),E==="preparing"||E==="running"||E==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:DH.map((K,ce)=>{const he=E==="running"&&ceK.value===(A.region||u)))==null?void 0:X.label)||A.region}),A.consoleUrl?o.jsxs("a",{href:A.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(CTe,{})]}):null]}):null]}):null,o.jsxs("div",{className:"feishu-form-actions",children:[o.jsxs("div",{className:"feishu-secrets-note",children:[o.jsx("strong",{children:"凭据处理"}),o.jsx("span",{children:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"})]}),o.jsxs("div",{className:"feishu-action-buttons",children:[E==="running"?o.jsx("button",{type:"button",className:"feishu-cancel",onClick:()=>void P(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!ee,children:$?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}async function SA(e,t,n,s=yc){var r;const i=await e8(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},s);if(!i.ok){let a="";try{a=((r=(await i.json()).detail)==null?void 0:r.trim())||""}catch{}throw new Error(a||`请求失败 (${i.status})`)}return i.json()}function RTe(e){return SA("/web/coding-agents/capabilities",{method:"GET"},e,Qk)}function OTe(e,t){return SA(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function MTe(e,t){return SA("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const LTe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function DTe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function U3(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function F3(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function PTe(e){return e instanceof DOMException&&e.name==="AbortError"}function BTe(e){return e instanceof Error&&e.message?e.message:"读取 Skill 文件失败"}function UTe(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function FTe(e){const t=e.split("/");return t[t.length-1]??e}function $Te(e){const t=new Map;for(const n of e){const s=n.path.split("/"),i=s.length>1?s.slice(0,-1).join("/"):"";t.set(i,[...t.get(i)??[],n])}return Array.from(t,([n,s])=>({directory:n,files:s})).sort((n,s)=>n.directory?s.directory?n.directory.localeCompare(s.directory):1:-1)}function HTe({skill:e,onClose:t}){const n=g.useRef(null),s=g.useRef(null),i=g.useId(),r=g.useId(),[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(!0),[h,p]=g.useState(""),[m,b]=g.useState(0);g.useEffect(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const x=n.current;return x&&!x.open&&x.showModal(),()=>{var E;x!=null&&x.open&&x.close(),(E=s.current)==null||E.focus()}},[]),g.useEffect(()=>{const x=new AbortController;return f(!0),p(""),l(null),u(""),OTe(e.id,x.signal).then(E=>{if(x.signal.aborted)return;l(E);const w=E.files.find(S=>S.path==="SKILL.md")??E.files[0];u((w==null?void 0:w.path)??"")}).catch(E=>{!x.signal.aborted&&!PTe(E)&&p(BTe(E))}).finally(()=>{x.signal.aborted||f(!1)}),()=>x.abort()},[m,e.id]);const v=g.useMemo(()=>$Te((a==null?void 0:a.files)??[]),[a]),y=(a==null?void 0:a.files.find(x=>x.path===c))??null;return o.jsxs("dialog",{ref:n,className:"coding-agents-preview-dialog","aria-labelledby":i,"aria-describedby":r,onCancel:x=>{x.preventDefault(),t()},onMouseDown:x=>{const E=x.currentTarget.getBoundingClientRect();(x.clientXE.right||x.clientYE.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(F3,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:i,children:e.name}),o.jsx("p",{id:r,children:"只读浏览随 Studio 提供的 Skill 文件"})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":"关闭文件预览",onClick:t,children:o.jsx(DTe,{})})]}),d?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),"正在读取文件…"]}):h?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:h}),o.jsx("button",{type:"button",onClick:()=>b(x=>x+1),children:"重试"})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":`${e.name} 文件`,children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:"文件"}),o.jsx("small",{children:(a==null?void 0:a.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:v.map(x=>x.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(F3,{}),o.jsx("span",{children:x.directory})]}),o.jsx("div",{children:x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(U3,{}),o.jsx("span",{children:FTe(E.path)})]},E.path))})]},x.directory):x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(U3,{}),o.jsx("span",{children:E.path})]},E.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":"文件内容",children:y?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:y.path}),o.jsx("span",{children:UTe(y.size)})]}),y.previewable&&y.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:y.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"此文件不是可预览的 UTF-8 文本。"})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"没有可预览的文件。"})})]})]})}function zTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function VTe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function GTe(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function KTe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function qTe(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function YTe({agentId:e}){return e==="trae"?o.jsx("img",{src:LTe,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(GTe,{}):o.jsx(KTe,{})}function H3(e){return e instanceof DOMException&&e.name==="AbortError"}function z3(e,t){return e instanceof Error&&e.message?e.message:t}function WTe({onBack:e}){var j;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(new Set),[f,h]=g.useState(new Set),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),E=g.useRef(null);g.useEffect(()=>{const R=new AbortController;return i(!0),a(""),RTe(R.signal).then(B=>{if(R.signal.aborted)return;n(B);const z=B.agents.filter(L=>L.available);d(L=>{const F=z.filter(C=>L.has(C.id));return new Set((F.length?F:z.slice(0,1)).map(C=>C.id))}),h(L=>{const F=B.skills.filter(C=>L.has(C.id));return new Set((F.length?F:B.skills).map(C=>C.id))})}).catch(B=>{!H3(B)&&!R.signal.aborted&&(n(null),a(z3(B,"检测本机客户端失败")))}).finally(()=>{R.signal.aborted||i(!1)}),()=>R.abort()},[l]),g.useEffect(()=>()=>{var R;return(R=E.current)==null?void 0:R.abort()},[]);const w=g.useMemo(()=>(t==null?void 0:t.agents.filter(R=>R.available&&u.has(R.id)))||[],[t,u]),S=g.useMemo(()=>(t==null?void 0:t.skills.filter(R=>f.has(R.id)))||[],[t,f]),_=!!(!b&&w.length&&S.length),T=(R,B)=>{!B||b||(x(null),d(z=>{const L=new Set(z);return L.has(R)?L.delete(R):L.add(R),L}))},k=R=>{b||(x(null),h(B=>{const z=new Set(B);return z.has(R)?z.delete(R):z.add(R),z}))},A=async()=>{var B;if(!_)return;(B=E.current)==null||B.abort();const R=new AbortController;E.current=R,v(!0),x(null);try{const z=await MTe({agents:w.map(F=>F.id),skills:S.map(F=>F.id)},R.signal);if(R.signal.aborted)return;const L=z.installations;x({tone:"success",message:`已为 ${w.length} 个客户端配置 ${S.length} 个 Skill`,details:L.map(F=>`${F.agentName} · ${F.skill} → ${F.displayPath}`)})}catch(z){!H3(z)&&!R.signal.aborted&&x({tone:"error",message:z3(z,"配置失败,请检查用户目录权限后重试")})}finally{E.current===R&&(E.current=null),R.signal.aborted||v(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:b,"aria-label":"返回自动化列表",children:o.jsx(zTe,{})}),o.jsx(VTe,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"配置 Coding Agents"}),o.jsx("p",{children:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。"})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":"选择 Coding Agent",children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:"本机客户端"})]}),o.jsx("button",{type:"button",onClick:()=>c(R=>R+1),disabled:s||b,children:"重新检测"})]}),s?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),"正在检测本机客户端…"]}):r?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(R=>R+1),children:"重试"})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:t==null?void 0:t.agents.map(R=>o.jsxs("button",{type:"button",className:`coding-agents-agent ${u.has(R.id)?"is-selected":""}`,"aria-pressed":u.has(R.id),disabled:!R.available||b,onClick:()=>T(R.id,R.available),title:R.available?R.name:R.reason,children:[o.jsx("span",{className:`coding-agents-agent-mark is-${R.id}`,children:o.jsx(YTe,{agentId:R.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:R.name}),o.jsx("small",{children:R.available?R.version||"已检测到客户端":R.reason})]}),o.jsx("span",{className:`coding-agents-status ${R.available?"is-ready":""}`,children:R.available?"可用":"未检测到"}),o.jsx("span",{className:"coding-agents-check",children:o.jsx($3,{})})]},R.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":"选择内置 Skill",children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:"内置 Skills"})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:t==null?void 0:t.skills.map(R=>o.jsxs("div",{className:`coding-agents-skill ${f.has(R.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:f.has(R.id),onChange:()=>k(R.id),disabled:b}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx($3,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:R.name}),o.jsx("small",{children:R.description})]})]}),o.jsx("button",{type:"button",onClick:()=>m(R),children:"查看文件"})]},R.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":"全局安装目录",children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(qTe,{}),o.jsxs("div",{children:[o.jsx("strong",{children:"全局安装"}),o.jsx("span",{children:"配置后可在本机其他项目中使用"})]})]}),w.length?o.jsx("dl",{children:w.map(R=>o.jsxs("div",{children:[o.jsx("dt",{children:R.name}),o.jsx("dd",{children:R.globalSkillsPath})]},R.id))}):o.jsx("p",{children:"选择客户端后显示对应安装目录。"})]})]}),y?o.jsxs("div",{className:`coding-agents-result is-${y.tone}`,role:y.tone==="error"?"alert":"status",children:[o.jsx("strong",{children:y.message}),(j=y.details)!=null&&j.length?o.jsx("ul",{children:y.details.map(R=>o.jsx("li",{children:R},R))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:w.length?`已选择 ${w.length} 个客户端、${S.length} 个 Skill`:"请先选择客户端"}),o.jsx("button",{type:"button",onClick:()=>void A(),disabled:!_,children:b?"正在配置…":"配置"})]})]})}),p?o.jsx(HTe,{skill:p,onClose:()=>m(null)}):null]})}const XTe={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function QTe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(const i of n){if(s==null||typeof s!="object")return;s=s[i]}return s}function ZTe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function JTe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function NA(e,t){if(ZTe(e))return QTe(t,e.path);if(JTe(e)){const n=XTe[e.call],s={};for(const[i,r]of Object.entries(e.args??{}))s[i]=NA(r,t);return n?n(s):`[unknown fn: ${e.call}]`}return e}function eke(e,t){const n=NA(e,t);return n==null?"":typeof n=="string"?n:String(n)}const PH=new Map;function Bu(e,t){PH.set(e,t)}function tke(e){return PH.get(e)}function nke(e,t,n){const s=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let r=0;rNA(s,e.dataModel),resolveString:s=>eke(s,e.dataModel),dispatchAction:t,render:s=>{if(!s)return null;const i=e.components[s];if(!i)return null;const r=tke(i.component)??ske;return o.jsx(r,{node:i,ctx:n},s)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function rke(e){const t=g.useRef(null),n=g.useRef(!0),s=28,i=g.useCallback(()=>{const r=t.current;r&&(n.current=r.scrollHeight-r.scrollTop-r.clientHeight{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),{ref:t,onScroll:i}}function aE({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:s}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(mu,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(Oi,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(PB,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),s?o.jsx("button",{type:"button",onClick:s,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Oi,{})}):null]}):null]})}function TA(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function UH(e){var n,s,i,r;const t=TA(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((s=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:s.toUpperCase())??"VIDEO":t==="image"?((r=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function FH(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function $H(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?x8(t,e.uri):""}function ake({kind:e}){return e==="image"?o.jsx(Wk,{}):e==="video"?o.jsx(UB,{}):e==="pdf"?o.jsx(Pee,{}):o.jsx(qk,{})}function oE({appName:e,items:t,compact:n=!1,onRemove:s}){const[i,r]=g.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=TA(a.mimeType),c=$H(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:l==="image"?void 0:()=>r(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(ite,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(ake,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:UH(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(yn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":FH(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(nu,{className:"media-card-open"}):null]});return o.jsxs(is.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(OB,{src:c,children:d}):d,s?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>s(a.id),children:o.jsx(Oi,{})}):null]},a.id)})}),o.jsx(Ko,{children:i?o.jsx(oke,{appName:e,item:i,onClose:()=>r(null)}):null})]})}function oke({appName:e,item:t,onClose:n}){const s=g.useMemo(()=>$H(t,e),[e,t]),i=TA(t.mimeType),[r,a]=g.useState(""),[l,c]=g.useState(i==="text"||i==="markdown"),[u,d]=g.useState("");return g.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),g.useEffect(()=>{if(i!=="text"&&i!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(s,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[i,s]),o.jsx(is.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:o.jsxs(is.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[UH(t),t.sizeBytes?` · ${FH(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:s,download:t.name,"aria-label":"下载",children:o.jsx(yx,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Oi,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:s,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:s,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:s,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(yn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(ph,{text:r})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function lke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function cke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function HH(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"17.5",height:"13.5",rx:"2.4"}),o.jsx("path",{d:"M3.25 9h17.5M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function uke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function dke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),o.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function fke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function hke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),o.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),o.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function pke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function zH(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function mke({definition:e,label:t,done:n,open:s,onToggle:i}){const r=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":s,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(r,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(Pa,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(zH,{className:`builtin-tool-chevron${s?" is-open":""}`})]})}const gke={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:lke},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:pke},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:cke},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:HH},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:uke},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:dke},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:fke},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:hke}};function bke(e){return gke[e]}const VH="send_a2ui_json_to_client",yke=28;function xke(e,t,n){let s=t;for(let i=0;i65535?2:1}return s}function Eke(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function GH(e,t,n){const[s,i]=g.useState(()=>t?"":e),r=g.useRef(s),a=g.useRef(e),l=g.useRef(null),c=g.useRef(0),u=g.useRef(n);return a.current=e,u.current=n,g.useEffect(()=>{const d=r.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){l.current!==null&&window.cancelAnimationFrame(l.current),l.current=null,d!==e&&(r.current=e,i(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,b=r.current;if(!m.startsWith(b)){r.current=m,i(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[s]),g.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),s}function vke({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function wke(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function _ke(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function KH({text:e,done:t,answerStarted:n=!1,streaming:s=!1,onStreamFrame:i}){const[r,a]=g.useState(!(t||n)),l=g.useRef(!1);g.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=GH(u,!t||s,i),{ref:f,onScroll:h}=rke(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(vke,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(Pa,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(uc,{className:`chev ${r?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${r&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function qH(){return o.jsx(KH,{text:"",done:!1})}const Ske=g.memo(function({text:t,streaming:n,onStreamFrame:s}){const i=GH(t,n,s);return i?o.jsx("div",{className:"bubble",children:o.jsx(ph,{text:i})}):null});function Nke({name:e,args:t,response:n,done:s}){const[i,r]=g.useState(!1),a=e===VH?"渲染 UI":e,l=bke(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` -…(已截断)`:c;return o.jsxs(is.div,{className:`block-tool${l?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l?o.jsx(mke,{definition:l,label:_ke(e,t),done:s,open:i,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":i,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(wke,{})}),s?o.jsx("span",{className:"tool-name",children:a}):o.jsx(Pa,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(zH,{className:`tool-chevron${i?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${i?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function Tke({block:e,onDownload:t,onPreview:n}){const[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(null);g.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){i(`download:${p}`),a("");try{await t(p,m)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(p,m,b)=>{if(n){i(`preview:${b}`),a("");try{const v=await n(p,m);c({name:b,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const m=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(v=>v.filename===m);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(qk,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||s!=="",onClick:()=>void f(b.filename,b.version,p.filename),children:[s===`preview:${p.filename}`?o.jsx(yn,{className:"spin"}):o.jsx(Mee,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||s!=="",onClick:()=>void d(p.filename,p.version),children:[s===`download:${p.filename}`?o.jsx(yn,{className:"spin"}):o.jsx(yx,{}),"下载"]})]})]},`${p.filename}:${p.version}`)}),r&&o.jsx("div",{className:"artifact-card__error",children:r}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(Oi,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function kke({block:e,onAuth:t}){const[n,s]=g.useState(e.done?"done":"idle"),[i,r]=g.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),s("authorizing");try{await t(e),s("done")}catch(d){r(d instanceof Error?d.message:String(d)),s("idle")}}};return e.done||n==="done"?o.jsxs(is.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx($R,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(is.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx($R,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(yn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function kA({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:s,onAction:i,onAuth:r,onArtifactDownload:a,onArtifactPreview:l}){return o.jsx(o.Fragment,{children:e.map((c,u)=>{switch(c.kind){case"thinking":{const d=e.slice(u+1).some(f=>f.kind==="text"&&!!f.text.trim());return o.jsx(KH,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:s},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(Ske,{text:d,streaming:n,onStreamFrame:s},u):null}case"attachment":return o.jsx(oE,{appName:t,items:c.files},u);case"artifact":return o.jsx(Tke,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(aE,{value:c.value},u);case"tool":return c.name===VH&&c.done?null:o.jsx(Nke,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(kke,{block:c,onAuth:r},u);case"a2ui":return BH(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(is.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(ike,{surface:d,onAction:i})},`${u}-${d.surfaceId}`));default:return null}})})}function AA(e){return e.isComposing||e.keyCode===229}function Ake({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),o.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),o.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),o.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),o.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),o.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),o.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}const wa=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],Cke=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function V3({mode:e}){return e==="skill-create"?o.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),o.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?o.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),o.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):o.jsx(Ake,{className:"new-chat-mode__agent-icon"})}function Ike(){return o.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function jke({value:e,onChange:t,disabled:n=!1,temporaryEnabled:s,skillCreateEnabled:i}){const[r,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState(()=>wa.findIndex(S=>S.value===e)),f=g.useRef(null),h=g.useRef(null),p=wa.find(S=>S.value===e)??wa[0],m=p.value==="temporary"?"Codex 智能体":p.label;function b(S){return S.value==="temporary"?s:S.value==="skill-create"?i:!0}function v(S){return b(S)!==!0}function y(S){const _=b(S);return _===void 0?"正在检查配置":_?S.description:"管理员未配置"}g.useEffect(()=>{if(!r)return;const S=_=>{var T;(T=f.current)!=null&&T.contains(_.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[r]);function x(S){let _=u;do _=(_+S+wa.length)%wa.length;while(v(wa[_]));d(_),c(wa[_].value==="temporary")}function E(S){var _;if(!v(S)){if(S.value==="temporary"){c(!0);return}t(S.value),a(!1),c(!1),(_=h.current)==null||_.focus()}}function w(){t("temporary"),a(!1),c(!1)}return o.jsxs("div",{className:"new-chat-mode",ref:f,children:[o.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":r,disabled:n,onClick:()=>{d(wa.findIndex(S=>S.value===e)),a(S=>(S&&c(!1),!S))},onKeyDown:S=>{S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),r?x(S.key==="ArrowDown"?1:-1):a(!0)):r&&(S.key==="Enter"||S.key===" ")?(S.preventDefault(),E(wa[u])):r&&S.key==="Escape"&&(S.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx(V3,{mode:p.value})}),o.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),o.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),r?o.jsxs("div",{className:"new-chat-mode__menus",children:[o.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:S=>{var _;S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),x(S.key==="ArrowDown"?1:-1)):S.key==="Enter"?(S.preventDefault(),E(wa[u])):S.key==="Escape"&&(S.preventDefault(),a(!1),c(!1),(_=h.current)==null||_.focus())},children:wa.map((S,_)=>{const T=S.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===S.value,"aria-haspopup":T?"menu":void 0,"aria-expanded":T?l:void 0,"aria-disabled":v(S),disabled:v(S),className:`new-chat-mode__option${_===u?" is-active":""}`,onMouseEnter:()=>{d(_),c(S.value==="temporary")},onClick:()=>E(S),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx(V3,{mode:S.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[S.label,S.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(S)})]}),T?o.jsx(Ike,{}):e===S.value?o.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},S.value)})}),l?o.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:w,children:[o.jsx(Qm,{kind:"codex",className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),o.jsx("span",{children:"在沙箱中执行任务"})]})]}),Cke.map(({label:S,kind:_})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx(Qm,{kind:_,className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:S}),o.jsx("span",{children:"暂不可用"})]})]},S))]}):null]}):null]})}const od=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],Rke=15,Oke=15e3,Mke=120,Lke=180;function G3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5.75 3.75 4.25 4.25-4.25 4.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Dke(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Gw({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(su,{className:t}):o.jsx(Qm,{kind:e,className:t})}function Pke({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:s=!1,onSelectRuntime:i,onSelectSandboxSession:r}){var Ne;const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(0),[h,p]=g.useState(0),[m,b]=g.useState("types"),[v,y]=g.useState(!1),[x,E]=g.useState([]),[w,S]=g.useState([]),[_,T]=g.useState(null),[k,A]=g.useState(""),[j,R]=g.useState(!1),[B,z]=g.useState(""),[L,F]=g.useState(""),C=g.useRef(null),I=g.useRef(null),D=g.useRef(null),$=g.useRef(0),O=g.useRef(null),te=g.useRef(null),se=g.useRef(null),P=((Ne=od.find(ae=>ae.id===c))==null?void 0:Ne.label)??"智能体",Q=g.useCallback((ae=!1)=>{var me;te.current!==null&&(window.clearTimeout(te.current),te.current=null),se.current!==null&&(window.clearTimeout(se.current),se.current=null),l(!1),u(null),b("types"),y(!1),ae&&((me=I.current)==null||me.focus())},[]),ee=g.useCallback(async(ae="",me=!1)=>{const _e=++$.current;let Je;R(!0),z("");try{const Pe=await Promise.race([Tx({scope:n,region:"all",pageSize:Rke,nextToken:ae}),new Promise((Fe,Ye)=>{Je=window.setTimeout(()=>{Ye(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},Oke)})]);if($.current!==_e)return;E(Fe=>{const Ye=me?Pe.runtimes:[...Fe,...Pe.runtimes];return Ye.filter((Ce,Ve)=>Ye.findIndex(Ue=>Ue.runtimeId===Ce.runtimeId)===Ve)}),A(Pe.nextToken),p(0)}catch(Pe){if($.current!==_e)return;z(Hd(Pe,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(Je),$.current===_e&&R(!1)}},[n]),V=g.useCallback(async ae=>{var Je,Pe;(Je=O.current)==null||Je.abort();const me=new AbortController;O.current=me;const _e=++$.current;R(!0),z(""),S([]);try{const Fe=ae==="codex"?await cn.listSessions({signal:me.signal}):await cn.listAgentSessions(ae,{signal:me.signal});if($.current!==_e)return;S(Fe),T(ae),p(0)}catch(Fe){if((Fe==null?void 0:Fe.name)==="AbortError"||$.current!==_e)return;z(Hd(Fe,`加载 ${((Pe=od.find(Ye=>Ye.id===ae))==null?void 0:Pe.label)??ae}`,`GET /web/${ae==="codex"?"sandbox":ae}/sessions`)),T(ae)}finally{O.current===me&&(O.current=null),$.current===_e&&R(!1)}},[]);g.useEffect(()=>{!a||c!=="general"||x.length>0||j||B||ee("",!0)},[c,B,ee,j,a,x.length]),g.useEffect(()=>{!a||c===null||c==="general"||_===c||V(c)},[c,V,_,a]),g.useEffect(()=>{if(!a)return;const ae=me=>{var _e;(_e=C.current)!=null&&_e.contains(me.target)||Q()};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[Q,a]),g.useEffect(()=>()=>{var ae;$.current+=1,(ae=O.current)==null||ae.abort(),te.current!==null&&window.clearTimeout(te.current),se.current!==null&&window.clearTimeout(se.current)},[]);function X(ae,me=!1){te.current!==null&&(window.clearTimeout(te.current),te.current=null),se.current!==null&&(window.clearTimeout(se.current),se.current=null),l(!0),u(me?"general":null),f(0),b("types"),y(me),ae&&requestAnimationFrame(()=>{var _e;return(_e=D.current)==null?void 0:_e.focus()})}function K(){s||a||te.current!==null||(te.current=window.setTimeout(()=>{te.current=null,X(!1)},Mke))}function ce(){se.current!==null&&(window.clearTimeout(se.current),se.current=null)}function he(){te.current!==null&&(window.clearTimeout(te.current),te.current=null),!(!a||se.current!==null)&&(se.current=window.setTimeout(()=>{se.current=null,Q()},Lke))}function be(ae){var Je;const me=(ae+od.length)%od.length,_e=od[me].id;_e!==c&&($.current+=1,(Je=O.current)==null||Je.abort(),O.current=null,R(!1),z("")),f(me),u(_e),p(0)}async function ue(ae){if(!L){F(ae.runtimeId),z("");try{await i(ae),Q(!0)}catch(me){z(Hd(me,"连接通用智能体"))}finally{F("")}}}async function we(ae){if(!L){F(ae.id),z("");try{await r(ae),Q(!0)}catch(me){z(Hd(me,`打开 ${P}`))}finally{F("")}}}function Le(ae){if(ae.key==="Escape"){ae.preventDefault(),Q(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(ae.key)&&y(!0),m==="types"){ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),be(d+(ae.key==="ArrowDown"?1:-1))):(ae.key==="ArrowRight"||ae.key==="Enter")&&(ae.preventDefault(),c===null&&be(d),b("runtimes"));return}if(ae.key==="ArrowLeft")ae.preventDefault(),b("types");else if((c==="general"?x:w).length>0&&(ae.key==="ArrowDown"||ae.key==="ArrowUp")){ae.preventDefault();const me=ae.key==="ArrowDown"?1:-1,_e=c==="general"?x.length:w.length;p(Je=>(Je+me+_e)%_e)}else ae.key==="Enter"&&c==="general"&&x[h]?(ae.preventDefault(),ue(x[h])):ae.key==="Enter"&&c!=="general"&&w[h]&&(ae.preventDefault(),we(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:C,onPointerEnter:ae=>{ae.pointerType==="mouse"&&ce()},onPointerLeave:ae=>{ae.pointerType==="mouse"&&he()},children:[o.jsxs("button",{ref:I,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:s,onPointerEnter:ae=>{ae.pointerType==="mouse"&&K()},onClick:()=>a?Q():X(!0),onKeyDown:ae=>{ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),a||X(!0,!0)):ae.key==="Escape"&&a&&(ae.preventDefault(),Q(!0))},children:[o.jsx(su,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(G3,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:D,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Le,onPointerMove:ae=>{ae.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:od.map((ae,me)=>o.jsxs("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":c===ae.id,className:`new-chat-agent-picker__type${v&&m==="types"&&d===me?" is-keyboard-active":""}`,onMouseEnter:()=>be(me),onClick:()=>{be(me),b("runtimes")},children:[o.jsx(Gw,{type:ae.id}),o.jsx("span",{children:ae.label}),o.jsx(G3,{className:"new-chat-agent-picker__nested-chevron"})]},ae.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${P}列表`,children:c!=="general"&&j&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):c!=="general"&&B&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:B}),o.jsx("button",{type:"button",onClick:()=>void V(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(ns,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(ns.Icon,{size:"sm",children:o.jsx(Gw,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(ns.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",P]})}),o.jsx(ns.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((ae,me)=>{const _e=L===ae.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":_e||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===me?" is-keyboard-active":""}`,disabled:!!L,title:`${ae.displayName||P} · ${ae.id}`,onMouseEnter:()=>p(me),onClick:()=>void we(ae),children:[o.jsx(Gw,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.displayName||P}),o.jsx("small",{children:_e?"正在打开":iE(ae.status)})]},ae.id)})}):j&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):B&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:B}),o.jsx("button",{type:"button",onClick:()=>void ee("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(ns,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(ns.Icon,{size:"sm",children:o.jsx(su,{})}),o.jsx(ns.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(ns.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((ae,me)=>{const _e=L===ae.runtimeId,Je=ae.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":Je,"aria-busy":_e||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===me?" is-keyboard-active":""}`,disabled:!!L,title:ae.name,onMouseEnter:()=>p(me),onClick:()=>void ue(ae),children:[o.jsx(su,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.name}),_e?o.jsx("small",{children:"正在连接"}):Je?o.jsx(Dke,{className:"new-chat-agent-picker__check"}):null]},ae.runtimeId)})}),B?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:B}):null,k?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:j||!!L,onClick:()=>void ee(k),children:j?"加载中":"加载更多"}):null]})}):null]}):null]})}const YH={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},Bke={ppt:[],image:[],video:["video_task_query"]},CA=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function K3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.25",y:"6.25",width:"13.5",height:"13.5",rx:"2.5"}),o.jsx("path",{d:"M11 10v6M8 13h6"}),o.jsx("path",{d:"m19.25 2.75.53 1.47 1.47.53-1.47.53-.53 1.47-.53-1.47-1.47-.53 1.47-.53.53-1.47Z",fill:"currentColor",stroke:"none"})]})}const q3=[{value:"ppt",label:"PPT",icon:Jee,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:Wk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:HH,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function Uke({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:s,value:i,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:b=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:S=!1,showModeSelector:_=!1,onModeChange:T,onTaskChange:k,temporaryEnabled:A,skillCreateEnabled:j,harnessEnabled:R=!1,builtinTools:B=[],showAgentPicker:z=!1,agentPickerDisabled:L=!1,selectedRuntimeId:F="",runtimeScope:C="mine",onSelectRuntime:I,onSelectSandboxSession:D}){const $=g.useRef(null),O=g.useRef(null),te=g.useRef(null),se=g.useRef(null),[P,Q]=g.useState(!1),[ee,V]=g.useState(null),[X,K]=g.useState(0),[ce,he]=g.useState(!1);async function be(){if(e)try{await navigator.clipboard.writeText(e),he(!0),setTimeout(()=>he(!1),1500)}catch{he(!1)}}g.useLayoutEffect(()=>{const Z=$.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,200)}px`)},[i]);const ue=E==="skill-create";g.useEffect(()=>{ue&&(Q(!1),V(null))},[ue]);const we=!ue&&d.some(Z=>Z.status!=="ready"),Le=!l&&!c&&!we&&(i.trim().length>0||!ue&&d.length>0),Ne=ue?`描述你想创建的 Skill,将使用 ${CA.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${s} 发消息…`,ae=(ee==null?void 0:ee.query.toLocaleLowerCase())??"",me=(ee==null?void 0:ee.kind)==="skill"?f.filter(Z=>!p.skills.some(Ee=>Ee.name===Z.name)).filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(ae)).map(Z=>({kind:"skill",value:Z})):(ee==null?void 0:ee.kind)==="agent"?h.filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(ae)).map(Z=>({kind:"agent",value:Z})):[];function _e(Z){var Ee;Q(!1),V(null),(Ee=Z.current)==null||Ee.click()}function Je(Z){k==null||k(Z.value),Q(!1),V(null),requestAnimationFrame(()=>{var Ee,Me;(Ee=$.current)==null||Ee.focus(),(Me=$.current)==null||Me.setSelectionRange(i.length,i.length)})}function Pe(Z){r(Z),Q(!1),V(null),requestAnimationFrame(()=>{var lt,Ot,ut;(lt=$.current)==null||lt.focus();const Ee=Z.indexOf("【"),Me=Z.indexOf("】",Ee+1);Ee>=0&&Me>Ee?(Ot=$.current)==null||Ot.setSelectionRange(Ee+1,Me):(ut=$.current)==null||ut.setSelectionRange(Z.length,Z.length)})}function Fe(){k==null||k(null),r(""),Q(!1),V(null),requestAnimationFrame(()=>{var Z,Ee;(Z=$.current)==null||Z.focus(),(Ee=$.current)==null||Ee.setSelectionRange(0,0)})}const Ye=q3.find(Z=>Z.value===w),Ce=q3.filter(Z=>YH[Z.value].every(Ee=>B.includes(Ee)));function Ve(Z,Ee){const Me=Z.slice(0,Ee),lt=/(^|\s)([/@])([^\s/@]*)$/.exec(Me);if(!lt){V(null);return}const Ot=lt[2].length+lt[3].length,ut={kind:lt[2]==="/"?"skill":"agent",query:lt[3],start:Ee-Ot,end:Ee},xn=!ee||ee.kind!==ut.kind||ee.query!==ut.query||ee.start!==ut.start||ee.end!==ut.end;V(ut),xn&&K(0),Q(!1)}function Ue(Z){if(!ee)return;const Ee=i.slice(0,ee.start)+i.slice(ee.end);r(Ee),Z.kind==="skill"?v({...p,skills:[...p.skills,Z.value]}):v({skills:[],targetAgent:Z.value});const Me=ee.start;V(null),requestAnimationFrame(()=>{var lt,Ot;(lt=$.current)==null||lt.focus(),(Ot=$.current)==null||Ot.setSelectionRange(Me,Me)})}function W(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function oe(Z){const Ee=Z.target.files?Array.from(Z.target.files):[];Ee.length&&y(Ee),Z.target.value=""}return o.jsxs("div",{className:`composer${S?" composer--new-chat":""}${ue?" composer--skill-mode":""}${Ye?` composer--has-task composer--task-${Ye.value}`:""}`,children:[ue?null:o.jsx(aE,{value:p,onRemoveSkill:Z=>v({...p,skills:p.skills.filter(Ee=>Ee.name!==Z)}),onRemoveAgent:()=>v({skills:[]})}),!ue&&d.length>0&&o.jsx(oE,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[ee?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":ee.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[ee.kind==="skill"?o.jsx(mu,{}):o.jsx(PB,{}),o.jsx("span",{children:ee.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:ee.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(yn,{className:"spin"})," 正在读取 Agent 能力…"]}):me.length===0?o.jsx("div",{className:"composer-command-empty",children:ee.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:me.map((Z,Ee)=>o.jsxs("button",{type:"button",role:"option","aria-selected":Ee===X,className:`composer-command-item${Ee===X?" is-active":""}`,onMouseDown:Me=>{Me.preventDefault(),Ue(Z)},onMouseEnter:()=>K(Ee),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${Z.kind}`,children:Z.kind==="skill"?o.jsx(mu,{}):o.jsx(pu,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[Z.kind==="skill"?"/":"@",Z.value.name]}),o.jsx("span",{children:Z.value.description||(Z.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:Ee===X?"↵":Z.kind==="skill"?"技能":"Agent"})]},`${Z.kind}-${Z.value.name}`))})]}):null,ue?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!b,onClick:()=>{V(null),Q(Z=>!Z)},children:o.jsx(ji,{className:"icon"})}),P&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>Q(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>_e(O),children:[o.jsx(Wk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>_e(te),children:[o.jsx(qk,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>_e(se),children:[o.jsx(UB,{className:"icon"}),"上传视频"]})]})]})]}),z&&I&&D?o.jsx(Pke,{selectedAgentName:n?s:"",selectedRuntimeId:F,runtimeScope:C,disabled:L,onSelectRuntime:I,onSelectSandboxSession:D}):null,_&&T?o.jsx(jke,{value:E,onChange:T,disabled:c,temporaryEnabled:A,skillCreateEnabled:j}):null,S&&E==="agent"&&Ye&&k?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${Ye.value}`,"aria-label":`取消${Ye.label}任务`,disabled:c,onClick:Fe,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(Ye.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(Oi,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:Ye.label})]}):null,S&&ue&&T?o.jsxs("button",{type:"button",className:"new-chat-task-chip new-chat-task-chip--skill","aria-label":"退出创建 Skill",disabled:c,onClick:()=>T("agent"),children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(K3,{className:"new-chat-task-chip__task-icon"}),o.jsx(Oi,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:"Skill"})]}):null,o.jsxs("div",{className:"composer-input-stack",children:[o.jsx("textarea",{ref:$,className:"comp-input scroll",rows:S?4:1,value:i,disabled:l,placeholder:Ne,"aria-expanded":!!ee,onChange:Z=>{r(Z.target.value),ue||Ve(Z.target.value,Z.target.selectionStart)},onSelect:Z=>{ue||Ve(Z.currentTarget.value,Z.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>V(null),0),onKeyDown:Z=>{if(!AA(Z.nativeEvent)){if(ee){if(Z.key==="ArrowDown"&&me.length>0){Z.preventDefault(),K(Ee=>(Ee+1)%me.length);return}if(Z.key==="ArrowUp"&&me.length>0){Z.preventDefault(),K(Ee=>(Ee-1+me.length)%me.length);return}if((Z.key==="Enter"||Z.key==="Tab")&&me[X]){Z.preventDefault(),Ue(me[X]);return}if(Z.key==="Escape"){Z.preventDefault(),V(null);return}}if(Z.key==="Backspace"&&!i&&Z.currentTarget.selectionStart===0&&Z.currentTarget.selectionEnd===0){W();return}Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),Le&&a())}}}),S&&i.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:Ne},Ne):null]}),o.jsx(is.button,{type:"button",className:"comp-send",disabled:!Le,onClick:a,"aria-label":"发送",whileTap:Le?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(yn,{className:"icon spin"}):o.jsx(DB,{className:"icon"})})]}),S&&E==="agent"&&R&&!Ye?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[Ce.map(Z=>{const Ee=Z.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>Je(Z),children:[o.jsx(Ee,{}),o.jsx("span",{children:Z.label})]},Z.value)}),j===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>T==null?void 0:T("skill-create"),children:[o.jsx(K3,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,S&&E==="agent"&&Ye?o.jsx("div",{className:"prompt-suggestions","aria-label":`${Ye.label}企业提示词`,children:Ye.prompts.map(Z=>{const Ee=Ye.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>Pe(Z),children:[o.jsx(Ee,{}),o.jsx("span",{children:Z})]},Z)})}):null,u&&o.jsxs("div",{className:"composer-meta",children:[o.jsxs("span",{className:"composer-session-line",children:["会话 ID:",o.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&o.jsx("button",{type:"button",className:"composer-session-copy",title:ce?"已复制":"复制会话 ID","aria-label":ce?"已复制会话 ID":"复制会话 ID",onClick:()=>void be(),children:ce?o.jsx(Ha,{}):o.jsx(bx,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:te,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:se,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:oe})]})}function WH({title:e,sub:t,cards:n,footer:s}){return o.jsxs("div",{className:"stk",children:[o.jsxs("div",{className:"stk-head",children:[o.jsx("h1",{className:"stk-title",children:e}),t&&o.jsx("p",{className:"stk-sub",children:t})]}),o.jsx("div",{className:"stk-list",children:n.map((i,r)=>o.jsxs(is.button,{type:"button",className:`stk-card ${i.disabled?"stk-card-disabled":""}`,onClick:i.disabled?void 0:i.onClick,disabled:i.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:r*.04},children:[o.jsx("span",{className:"stk-card-icon",children:o.jsx(i.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:i.title}),o.jsx("span",{className:"stk-card-desc",children:i.desc})]}),i.status&&o.jsx("span",{className:"stk-card-status",children:i.status}),o.jsx(uc,{className:"stk-card-arrow"})]},i.key))}),s&&o.jsx("div",{className:"stk-footer",children:s})]})}const IA=Symbol.for("yaml.alias"),PN=Symbol.for("yaml.document"),sc=Symbol.for("yaml.map"),XH=Symbol.for("yaml.pair"),po=Symbol.for("yaml.scalar"),bh=Symbol.for("yaml.seq"),ha=Symbol.for("yaml.node.type"),yh=e=>!!e&&typeof e=="object"&&e[ha]===IA,Ug=e=>!!e&&typeof e=="object"&&e[ha]===PN,Fg=e=>!!e&&typeof e=="object"&&e[ha]===sc,Gs=e=>!!e&&typeof e=="object"&&e[ha]===XH,zn=e=>!!e&&typeof e=="object"&&e[ha]===po,$g=e=>!!e&&typeof e=="object"&&e[ha]===bh;function Hs(e){if(e&&typeof e=="object")switch(e[ha]){case sc:case bh:return!0}return!1}function Vs(e){if(e&&typeof e=="object")switch(e[ha]){case IA:case sc:case po:case bh:return!0}return!1}const QH=e=>(zn(e)||Hs(e))&&!!e.anchor,Fc=Symbol("break visit"),Fke=Symbol("skip children"),am=Symbol("remove node");function xh(e,t){const n=$ke(t);Ug(e)?Gd(null,e.contents,n,Object.freeze([e]))===am&&(e.contents=null):Gd(null,e,n,Object.freeze([]))}xh.BREAK=Fc;xh.SKIP=Fke;xh.REMOVE=am;function Gd(e,t,n,s){const i=Hke(e,t,n,s);if(Vs(i)||Gs(i))return zke(e,s,i),Gd(e,i,n,s);if(typeof i!="symbol"){if(Hs(t)){s=Object.freeze(s.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>Vke[t]);class Xi{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Xi.defaultYaml,t),this.tags=Object.assign({},Xi.defaultTags,n)}clone(){const t=new Xi(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Xi(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Xi.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Xi.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Xi.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Xi.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,a]=s;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const a=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(a){return n(String(a)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+Gke(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(t&&s.length>0&&Vs(t.contents)){const r={};xh(t.contents,(a,l)=>{Vs(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,a]of s)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` -`)}}Xi.defaultYaml={explicit:!1,version:"1.2"};Xi.defaultTags={"!!":"tag:yaml.org,2002:"};function ZH(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function JH(e){const t=new Set;return xh(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function ez(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function Kke(e,t){const n=[],s=new Map;let i=null;return{onAnchor:r=>{n.push(r),i??(i=JH(e));const a=ez(t,i);return i.add(a),a},setAnchors:()=>{for(const r of n){const a=s.get(r);if(typeof a=="object"&&a.anchor&&(zn(a.node)||Hs(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function Kd(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;ida(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!QH(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class jA{constructor(t){Object.defineProperty(this,ha,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!Ug(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=da(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof r=="function"?Kd(r,{"":l},"",l):l}}class RA extends jA{constructor(t){super(IA),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],xh(t,{Node:(r,a)=>{(yh(a)||QH(a))&&s.push(a)}}),n&&(n.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=s.get(a);if(l||(da(a,null,n),l=s.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=fy(i,a,s)),l.count*l.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,s){const i=`*${this.source}`;if(t){if(ZH(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function fy(e,t,n){if(yh(t)){const s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Hs(t)){let s=0;for(const i of t.items){const r=fy(e,i,n);r>s&&(s=r)}return s}else if(Gs(t)){const s=fy(e,t.key,n),i=fy(e,t.value,n);return Math.max(s,i)}return 1}const tz=e=>!e||typeof e!="function"&&typeof e!="object";class Ct extends jA{constructor(t){super(po),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:da(this.value,t,n)}toString(){return String(this.value)}}Ct.BLOCK_FOLDED="BLOCK_FOLDED";Ct.BLOCK_LITERAL="BLOCK_LITERAL";Ct.PLAIN="PLAIN";Ct.QUOTE_DOUBLE="QUOTE_DOUBLE";Ct.QUOTE_SINGLE="QUOTE_SINGLE";const qke="tag:yaml.org,2002:";function Yke(e,t,n){if(t){const s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,e))&&!s.format})}function Jm(e,t,n){var f,h,p;if(Ug(e)&&(e=e.contents),Vs(e))return e;if(Gs(e)){const m=(h=(f=n.schema[sc]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(s&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new RA(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=qke+t.slice(2));let u=Yke(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new Ct(e);return c&&(c.node=m),m}u=e instanceof Map?a[sc]:Symbol.iterator in Object(e)?a[bh]:a[sc]}r&&(r(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new Ct(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function L1(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=s,s=a}else s=new Map([[r,s]])}return Jm(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Sp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let nz=class extends jA{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>Vs(s)||Gs(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Sp(t))this.add(n);else{const[s,...i]=t,r=this.get(s,!0);if(Hs(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,L1(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const i=this.get(n,!0);if(Hs(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&zn(r)?r.value:r:Hs(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Gs(n))return!1;const s=n.value;return s==null||t&&zn(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const i=this.get(n,!0);return Hs(i)?i.hasIn(s):!1}setIn(t,n){const[s,...i]=t;if(i.length===0)this.set(s,n);else{const r=this.get(s,!0);if(Hs(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,L1(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};const Wke=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Yo(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const qc=(e,t,n)=>e.endsWith(` -`)?Yo(n,t):n.includes(` +`}).map(([n,s])=>[n,s.split("__PROJECT_NAME__").join(e)]))}const KNe={id:"template",kind:"github",category:"development",icon:"github",name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",fields:[xA,EA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},SH,NH],initialValues:vA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=wA(e),s=_H(n.repository),i=bA(e.projectPath,"agentkit-basic-agent"),r=i==="."?s.split("/").slice(-1)[0]||"agentkit-basic-agent":i.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(GNe(r)).map(([l,c])=>({path:zNe(i,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:VNe(i),content:TH({baseBranch:n.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),yA({...n,repository:s,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},j3=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],kH=[TNe,KNe,HNe,BNe,kNe],qNe=new Map(kH.map(e=>[e.id,e]));function YNe(e){const t=qNe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function WNe(e){const t=YNe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const _A="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e";function AH(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function R3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function XNe(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function QNe({onOpen:e}){var c;const[t,n]=g.useState("development"),[s,i]=g.useState(""),r=g.useDeferredValue(s),a=g.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return kH.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=j3.find(u=>u.id===t))==null?void 0:c.label;return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"自动化"}),o.jsx("p",{children:"连接研发工具,为智能体扩展自动化工作流"})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(R3,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:s,onChange:u=>i(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:j3.map(u=>o.jsx("button",{type:"button",className:t===u.id?"is-active":"","aria-pressed":t===u.id,onClick:()=>n(u.id),children:u.label},u.id))}),o.jsx("section",{className:"applications-results","aria-label":`${l}自动化列表`,children:a.length?o.jsx("div",{className:"applications-grid",children:a.map(u=>o.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(u.id),"aria-label":`打开${u.name}`,children:[u.icon==="feishu"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:_A,alt:"","aria-hidden":"true"}):u.icon==="coding-agents"?o.jsx(XNe,{className:"application-card-icon"}):o.jsx(AH,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:u.name}),u.badge?o.jsx("span",{className:`application-card-badge is-${u.badgeTone||"default"}`,children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(R3,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function ZNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function JNe({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function O3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function eTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function tTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zw(e,t,n){const s=t.trim();if(!s)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(s))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(s)||s.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(s.startsWith("/")||s.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(s))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const i=new URL(s);if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function nTe({automation:e,onBack:t}){const n=WNe(e),[s,i]=g.useState(()=>({...n.initialValues})),[r,a]=g.useState({}),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(null),y=g.useRef(null);g.useEffect(()=>()=>{var T;return(T=y.current)==null?void 0:T.abort()},[]);const x=(T,k)=>{i(A=>({...A,[T]:k})),r[T]&&a(A=>({...A,[T]:""}))},E=T=>{var j;const k=T==="token"||((j=n.fields.find(R=>R.name===T))==null?void 0:j.required)===!0,A=zw(T,s[T],k);a(R=>({...R,[T]:A}))},w=async T=>{var R;T.preventDefault();const k={};for(const B of n.fields){const z=zw(B.name,s[B.name],B.required);z&&(k[B.name]=z)}const A=zw("token",s.token,!0);if(A&&(k.token=A),a(k),Object.keys(k).length)return;(R=y.current)==null||R.abort();const j=new AbortController;y.current=j,d(!0),c(""),v(null);try{const B=await n.submit(s,j.signal);if(y.current!==j)return;v(B),i(z=>({...z,token:""}))}catch(B){if(j.signal.aborted||y.current!==j)return;c(B instanceof Error?B.message:String(B))}finally{y.current===j&&(y.current=null,d(!1))}},S=T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)&&T.preventDefault()},_=T=>{const{name:k,label:A,placeholder:j,help:R,required:B}=T;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${k}`,children:[o.jsx("span",{children:A}),o.jsx("span",{className:`github-field-requirement${B?" is-required":""}`,children:B?"必填":"可选"})]}),o.jsx("input",{id:`github-${k}`,value:s[k],onChange:z=>x(k,z.target.value),onBlur:()=>E(k),placeholder:j,required:B,"aria-invalid":!!r[k],"aria-describedby":`github-${k}-help${r[k]?` github-${k}-error`:""}`}),o.jsx("span",{id:`github-${k}-help`,className:"github-field-help",children:R}),r[k]?o.jsx("span",{id:`github-${k}-error`,className:"github-field-error",role:"alert",children:r[k]}):null]},k)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:t,"aria-label":"返回自动化列表",children:o.jsx(ZNe,{})}),o.jsx(AH,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:n.title}),o.jsx("p",{children:n.subtitle})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:n.panel})}),o.jsxs("form",{className:"github-release-form",onSubmit:w,onKeyDown:S,noValidate:!0,children:[o.jsxs("div",{className:"github-field-grid",children:[n.fields.map(_),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:"地域"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:T=>{T.key==="Escape"&&m(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(T=>!T),children:[o.jsx("span",{children:s.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(eTe,{className:`pp-region-chevron${p?" is-open":""}`})]}),p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>m(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"地域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(T=>{const k=T.value===s.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":k,className:`pp-region-option${k?" is-selected":""}`,onClick:()=>{x("region",T.value),m(!1)},children:[o.jsx("span",{children:T.label}),k?o.jsx(tTe,{}):null]},T.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:n.regionHelp})]})]}),o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:"GitHub Token"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write",target:"_blank",rel:"noreferrer",children:["获取 Token",o.jsx(O3,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:s.token,onChange:T=>x("token",T.target.value),onBlur:()=>E("token"),autoComplete:"off",required:!0,placeholder:"需要仓库 Contents 与 Pull requests 写权限","aria-invalid":!!r.token,"aria-describedby":`github-token-help${r.token?" github-token-error":""}`}),o.jsx("button",{type:"button",onClick:()=>h(T=>!T),"aria-label":f?"隐藏 Token":"显示 Token",title:f?"隐藏 Token":"显示 Token",children:o.jsx(JNe,{hidden:f})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:"Token 仅用于本次提交,不会保存在浏览器或写入 PR"}),r.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r.token}):null]}),l?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:l}):null,b?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",b.number," 已创建"]}),o.jsxs("a",{href:b.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(O3,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsx("strong",{children:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:"}),n.secrets.map(T=>o.jsx("span",{children:T},T))]}),o.jsx("button",{type:"submit",disabled:u,children:u?"提交 PR 中…":n.submitLabel})]})]})]})})]})}function sTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function iTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function rTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function aTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function oTe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function lTe(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function bh(e){return(e instanceof Error?e.message:String(e)).replace(/\b((?:app[_-]?)?secret|token|api[_-]?key|password)\b\s*[:=]\s*["']?[^"',\s}]+/gi,"$1=").slice(0,300)}const cTe="modulepreload",uTe=function(e){return"/"+e},M3={},cu=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=uTe(c),c in M3)return;M3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":cTe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})},L3=new Set;let M1={enabled:!1},Qn,Hf=null,D3=null,Gd="",DN="unknown",CH="unknown",Zm=[];function dTe(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function fTe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,dTe(n)]))}function hTe(e){return e?Object.fromEntries(Object.entries(e).filter(([,t])=>Number.isFinite(t))):{}}function pTe(){return new Date().toISOString().slice(0,10)}function mTe(e){if(!e)return!0;if(e.dedupeKey){if(L3.has(e.dedupeKey))return!1;L3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${pTe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function IH(e){if(Hf){try{Hf("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Zm=[...Zm.slice(-49),e]}function gTe(){if(!Hf)return;const e=Zm;Zm=[];for(const t of e)IH(t)}function bTe(e){if(M1=e,Qn=e.studio,!e.enabled||!e.apmplus||D3)return;const t=e.apmplus;D3=cu(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Gd||void 0}),s("start"),Hf=s,gTe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),M1={enabled:!1},Zm=[]})}function wr(e,t={},n,s){if(!M1.enabled||!M1.apmplus||!mTe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Gd,user_role:DN,user_source:CH}:{};IH({name:e,categories:fTe({studio_deploy_id:Qn==null?void 0:Qn.deployId,user_pool_id:Qn==null?void 0:Qn.userPoolId,vefaas_application_id:Qn==null?void 0:Qn.applicationId,vefaas_function_id:Qn==null?void 0:Qn.functionId,studio_region:Qn==null?void 0:Qn.region,studio_project:Qn==null?void 0:Qn.project,studio_version:Qn==null?void 0:Qn.version,...i,...t}),metrics:hTe(n)})}function yTe(e){if(Gd=e.userId.trim(),!!Gd){if(DN=e.role??"unknown",CH=e.local?"local":"sso",Hf)try{Hf("config",{userId:Gd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}wr("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(Qn==null?void 0:Qn.deployId)??"",Gd,DN].join(":")})}}function jH(e){return{deploy_source:e.telemetry.source,create_mode:e.telemetry.createMode,ai_assisted:e.telemetry.aiAssisted,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function RH(e){return{deploy_source:e.telemetry.source,create_mode:e.telemetry.createMode,ai_assisted:e.telemetry.aiAssisted,deploy_action:e.action}}function xTe(e){wr("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function OH(e){wr("studio_agent_deploy",{...jH(e),deploy_status:"succeeded",runtime_id:e.runtimeId})}function MH(e){wr("studio_agent_deploy",{...jH(e),deploy_status:"failed",failed_phase:e.phase,error_kind:lTe(e.error,e.phase),error_summary:bh(e.error)})}function ETe(e){wr("studio_sandbox_create",{sandbox_status:"succeeded",sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function vTe(e){wr("studio_sandbox_create",{sandbox_status:"failed",sandbox_kind:e.kind,sandbox_source:e.source,error_kind:sTe(e.error),error_summary:bh(e.error)})}function wTe(e){wr("studio_agent_debug",{debug_status:"succeeded",variant_type:e.variantType},{duration_ms:e.durationMs})}function _Te(e){wr("studio_agent_debug",{debug_status:"failed",variant_type:e.variantType,failed_phase:e.phase,error_kind:iTe(e.error),error_summary:bh(e.error)},{duration_ms:e.durationMs})}function mb(e){wr("studio_agent_connect",{connect_status:"succeeded",agent_kind:e.kind,connect_source:e.source,runtime_region:e.runtimeRegion,runtime_is_mine:e.runtimeIsMine,sandbox_status:e.sandboxStatus},{duration_ms:e.durationMs})}function Vw(e){wr("studio_agent_connect",{connect_status:"failed",agent_kind:e.kind,connect_source:e.source,error_kind:rTe(e.error),error_summary:bh(e.error)},{duration_ms:e.durationMs})}function P3(e){wr("studio_agent_message",{message_status:"succeeded",agent_kind:e.kind,message_source:e.source,session_state:e.sessionState},{duration_ms:e.durationMs})}function rp(e){wr("studio_agent_message",{message_status:"failed",agent_kind:e.kind,message_source:e.source,session_state:e.sessionState,failed_phase:e.phase,error_kind:aTe(e.error),error_summary:bh(e.error)},{duration_ms:e.durationMs})}function STe(e){wr("studio_agent_source_download",{...RH(e),download_status:"succeeded"},{duration_ms:e.durationMs,file_count:e.fileCount,zip_size_bytes:e.zipSizeBytes})}function NTe(e){wr("studio_agent_source_download",{...RH(e),download_status:"failed",error_kind:oTe(e.error),error_summary:bh(e.error)},{duration_ms:e.durationMs,file_count:e.fileCount})}const TTe=/^[A-Za-z_][A-Za-z0-9_]*$/;function sc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":TTe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function LH(e){const t=new Set,n=new Set,s=i=>{sc(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(s)};return s(e),n}function kTe(e){return{...Ii(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function ATe(e){const t=kTe(e.agentName),n=await kx(t);return vg(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const wa=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],DH=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function CTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ITe(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function B3(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function jTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function RTe(e){if(!e||e==="upload")return 0;const t=DH.findIndex(n=>n.phase===e);return t<0?0:t}function OTe({onBack:e}){var Q;const[t,n]=g.useState("feishu_assistant"),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState("cn-beijing"),[f,h]=g.useState(!1),[p,m]=g.useState(""),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState("idle"),[S,_]=g.useState(null),[T,k]=g.useState(""),[A,j]=g.useState(null),R=g.useRef(null),B=g.useRef(null),z=g.useRef([]),L=g.useRef(0),F=g.useRef(null),C=g.useRef("prepare"),I=g.useRef(!1),D=g.useRef(!0),$=["preparing","running","cancelling"].includes(E);g.useEffect(()=>(D.current=!0,()=>{D.current=!1}),[]),g.useEffect(()=>{var he;if(!f)return;(he=z.current[L.current])==null||he.focus();const K=ge=>{ge.target instanceof Node&&R.current&&!R.current.contains(ge.target)&&h(!1)},ce=ge=>{var ue;ge.key==="Escape"&&(h(!1),(ue=B.current)==null||ue.focus())};return window.addEventListener("pointerdown",K),window.addEventListener("keydown",ce),()=>{window.removeEventListener("pointerdown",K),window.removeEventListener("keydown",ce)}},[f]);const O=K=>{K.key==="Enter"&&(K.nativeEvent.isComposing||K.nativeEvent.keyCode===229)&&K.preventDefault()},ne=()=>{const K=sc(t.trim())??"",ce=s.trim()?"":"请输入飞书 App ID",he=r.trim()?"":"请输入飞书 App Secret";return m(K),v(ce),x(he),!K&&!ce&&!he},se=async K=>{if(K.preventDefault(),!ne()||$)return;const ce=crypto.randomUUID();F.current=ce,C.current="prepare",I.current=!1,w("preparing"),_(null),k(""),j(null);try{const he=await ATe({agentName:t.trim(),appId:s.trim(),appSecret:r.trim(),region:u,taskId:ce,onStage:ge=>{C.current=ge.phase||"deploy",!(!D.current||I.current)&&(w("running"),_(ge))}});if(!D.current||I.current)return;OH({telemetry:{source:"feishu_automation",createMode:"feishu_template",aiAssisted:!1},action:"create",region:u,networkType:"public",feishuEnabled:!0,runtimeId:he.runtimeId||""}),j(he),a(""),c(!1),w("succeeded")}catch(he){if(!D.current||I.current)return;MH({telemetry:{source:"feishu_automation",createMode:"feishu_template",aiAssisted:!1},action:"create",region:u,networkType:"public",feishuEnabled:!0,phase:C.current,error:he}),w("failed"),k(he instanceof Error?he.message:String(he))}finally{F.current===ce&&(F.current=null)}},P=async()=>{const K=F.current;if(!(!K||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){I.current=!0,w("cancelling"),k("");try{await A8(K),D.current&&w("cancelled")}catch(ce){if(I.current=!1,!D.current)return;w("failed"),k(ce instanceof Error?ce.message:String(ce))}}},Z=RTe((S==null?void 0:S.phase)??null),te=!!(t.trim()&&s.trim()&&r.trim()&&!$),V=wa.find(K=>K.value===u);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":"返回自动化列表",disabled:$,children:o.jsx(CTe,{})}),o.jsx("img",{className:"feishu-integration-logo",src:_A,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:"飞书机器人"}),o.jsx("p",{children:"创建一个由 AgentKit Runtime 驱动的飞书智能体"})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。"}),o.jsxs("form",{className:"feishu-form",onSubmit:se,onKeyDown:O,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:"智能体名称"}),o.jsx("input",{id:"feishu-agent-name",value:t,maxLength:64,disabled:$,onChange:K=>{n(K.target.value),p&&m("")},onBlur:()=>m(sc(t.trim())??""),"aria-invalid":!!p,"aria-describedby":`feishu-agent-name-help${p?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:"将作为新 Runtime 中的根智能体名称"}),p?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:p}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:"部署地域"}),o.jsxs("div",{className:"feishu-region-picker",ref:R,children:[o.jsxs("button",{ref:B,type:"button",className:"feishu-region-trigger",disabled:$,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{L.current=wa.findIndex(K=>K.value===u),h(K=>!K)},onKeyDown:K=>{K.key!=="ArrowDown"&&K.key!=="ArrowUp"||(K.preventDefault(),L.current=K.key==="ArrowUp"?wa.length-1:wa.findIndex(ce=>ce.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:V.label}),o.jsx(ITe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:K=>{var ge;const ce=z.current.findIndex(ue=>ue===document.activeElement);let he=null;K.key==="ArrowDown"?he=(ce+1)%wa.length:K.key==="ArrowUp"?he=(ce-1+wa.length)%wa.length:K.key==="Home"?he=0:K.key==="End"?he=wa.length-1:K.key==="Tab"&&h(!1),he!==null&&(K.preventDefault(),(ge=z.current[he])==null||ge.focus())},children:wa.map(K=>o.jsx("button",{ref:ce=>{const he=wa.findIndex(ge=>ge.value===K.value);z.current[he]=ce},type:"button",role:"option","aria-selected":u===K.value,className:`feishu-region-option${u===K.value?" is-selected":""}`,onClick:()=>{var ce;d(K.value),h(!1),(ce=B.current)==null||ce.focus()},children:K.label},K.value))}):null]}),o.jsx("span",{className:"feishu-field-help",children:"Runtime 与构建产物将创建在该地域"})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:"飞书 App ID"}),o.jsx("input",{id:"feishu-app-id",value:s,maxLength:128,autoComplete:"off",disabled:$,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:K=>{i(K.target.value),b&&v("")},onBlur:()=>v(s.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!b,"aria-describedby":`feishu-app-id-help${b?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),b?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:b}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:"飞书 App Secret"}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:l?"text":"password",value:r,maxLength:256,autoComplete:"off",disabled:$,placeholder:"请输入 App Secret",onChange:K=>{a(K.target.value),y&&x("")},onBlur:()=>x(r.trim()?"":"请输入飞书 App Secret"),"aria-invalid":!!y,"aria-describedby":`feishu-app-secret-help${y?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:$,onClick:()=>c(K=>!K),"aria-label":l?"隐藏 App Secret":"显示 App Secret",children:l?"隐藏":"显示"})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:"仅写入新 Runtime 的环境变量"}),y?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:y}):null]})]}),E!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${E}`,role:E==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[E==="preparing"?o.jsx(Ba,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(Ba,{as:"strong",children:(S==null?void 0:S.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(Ba,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(B3,{}),"飞书机器人 Runtime 已创建"]}):null,E==="cancelled"?o.jsx("strong",{children:"部署已取消"}):null,E==="failed"?o.jsx("strong",{children:"创建失败"}):null]}),E==="preparing"||E==="running"||E==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:DH.map((K,ce)=>{const he=E==="running"&&ceK.value===(A.region||u)))==null?void 0:Q.label)||A.region}),A.consoleUrl?o.jsxs("a",{href:A.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(jTe,{})]}):null]}):null]}):null,o.jsxs("div",{className:"feishu-form-actions",children:[o.jsxs("div",{className:"feishu-secrets-note",children:[o.jsx("strong",{children:"凭据处理"}),o.jsx("span",{children:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"})]}),o.jsxs("div",{className:"feishu-action-buttons",children:[E==="running"?o.jsx("button",{type:"button",className:"feishu-cancel",onClick:()=>void P(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!te,children:$?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}async function SA(e,t,n,s=xc){var r;const i=await e8(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},s);if(!i.ok){let a="";try{a=((r=(await i.json()).detail)==null?void 0:r.trim())||""}catch{}throw new Error(a||`请求失败 (${i.status})`)}return i.json()}function MTe(e){return SA("/web/coding-agents/capabilities",{method:"GET"},e,Qk)}function LTe(e,t){return SA(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function DTe(e,t){return SA("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const PTe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function BTe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function U3(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function F3(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function UTe(e){return e instanceof DOMException&&e.name==="AbortError"}function FTe(e){return e instanceof Error&&e.message?e.message:"读取 Skill 文件失败"}function $Te(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function HTe(e){const t=e.split("/");return t[t.length-1]??e}function zTe(e){const t=new Map;for(const n of e){const s=n.path.split("/"),i=s.length>1?s.slice(0,-1).join("/"):"";t.set(i,[...t.get(i)??[],n])}return Array.from(t,([n,s])=>({directory:n,files:s})).sort((n,s)=>n.directory?s.directory?n.directory.localeCompare(s.directory):1:-1)}function VTe({skill:e,onClose:t}){const n=g.useRef(null),s=g.useRef(null),i=g.useId(),r=g.useId(),[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(!0),[h,p]=g.useState(""),[m,b]=g.useState(0);g.useEffect(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const x=n.current;return x&&!x.open&&x.showModal(),()=>{var E;x!=null&&x.open&&x.close(),(E=s.current)==null||E.focus()}},[]),g.useEffect(()=>{const x=new AbortController;return f(!0),p(""),l(null),u(""),LTe(e.id,x.signal).then(E=>{if(x.signal.aborted)return;l(E);const w=E.files.find(S=>S.path==="SKILL.md")??E.files[0];u((w==null?void 0:w.path)??"")}).catch(E=>{!x.signal.aborted&&!UTe(E)&&p(FTe(E))}).finally(()=>{x.signal.aborted||f(!1)}),()=>x.abort()},[m,e.id]);const v=g.useMemo(()=>zTe((a==null?void 0:a.files)??[]),[a]),y=(a==null?void 0:a.files.find(x=>x.path===c))??null;return o.jsxs("dialog",{ref:n,className:"coding-agents-preview-dialog","aria-labelledby":i,"aria-describedby":r,onCancel:x=>{x.preventDefault(),t()},onMouseDown:x=>{const E=x.currentTarget.getBoundingClientRect();(x.clientXE.right||x.clientYE.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(F3,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:i,children:e.name}),o.jsx("p",{id:r,children:"只读浏览随 Studio 提供的 Skill 文件"})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":"关闭文件预览",onClick:t,children:o.jsx(BTe,{})})]}),d?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),"正在读取文件…"]}):h?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:h}),o.jsx("button",{type:"button",onClick:()=>b(x=>x+1),children:"重试"})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":`${e.name} 文件`,children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:"文件"}),o.jsx("small",{children:(a==null?void 0:a.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:v.map(x=>x.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(F3,{}),o.jsx("span",{children:x.directory})]}),o.jsx("div",{children:x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(U3,{}),o.jsx("span",{children:HTe(E.path)})]},E.path))})]},x.directory):x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(U3,{}),o.jsx("span",{children:E.path})]},E.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":"文件内容",children:y?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:y.path}),o.jsx("span",{children:$Te(y.size)})]}),y.previewable&&y.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:y.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"此文件不是可预览的 UTF-8 文本。"})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"没有可预览的文件。"})})]})]})}function GTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function KTe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function qTe(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function YTe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function WTe(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function XTe({agentId:e}){return e==="trae"?o.jsx("img",{src:PTe,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(qTe,{}):o.jsx(YTe,{})}function H3(e){return e instanceof DOMException&&e.name==="AbortError"}function z3(e,t){return e instanceof Error&&e.message?e.message:t}function QTe({onBack:e}){var j;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(new Set),[f,h]=g.useState(new Set),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),E=g.useRef(null);g.useEffect(()=>{const R=new AbortController;return i(!0),a(""),MTe(R.signal).then(B=>{if(R.signal.aborted)return;n(B);const z=B.agents.filter(L=>L.available);d(L=>{const F=z.filter(C=>L.has(C.id));return new Set((F.length?F:z.slice(0,1)).map(C=>C.id))}),h(L=>{const F=B.skills.filter(C=>L.has(C.id));return new Set((F.length?F:B.skills).map(C=>C.id))})}).catch(B=>{!H3(B)&&!R.signal.aborted&&(n(null),a(z3(B,"检测本机客户端失败")))}).finally(()=>{R.signal.aborted||i(!1)}),()=>R.abort()},[l]),g.useEffect(()=>()=>{var R;return(R=E.current)==null?void 0:R.abort()},[]);const w=g.useMemo(()=>(t==null?void 0:t.agents.filter(R=>R.available&&u.has(R.id)))||[],[t,u]),S=g.useMemo(()=>(t==null?void 0:t.skills.filter(R=>f.has(R.id)))||[],[t,f]),_=!!(!b&&w.length&&S.length),T=(R,B)=>{!B||b||(x(null),d(z=>{const L=new Set(z);return L.has(R)?L.delete(R):L.add(R),L}))},k=R=>{b||(x(null),h(B=>{const z=new Set(B);return z.has(R)?z.delete(R):z.add(R),z}))},A=async()=>{var B;if(!_)return;(B=E.current)==null||B.abort();const R=new AbortController;E.current=R,v(!0),x(null);try{const z=await DTe({agents:w.map(F=>F.id),skills:S.map(F=>F.id)},R.signal);if(R.signal.aborted)return;const L=z.installations;x({tone:"success",message:`已为 ${w.length} 个客户端配置 ${S.length} 个 Skill`,details:L.map(F=>`${F.agentName} · ${F.skill} → ${F.displayPath}`)})}catch(z){!H3(z)&&!R.signal.aborted&&x({tone:"error",message:z3(z,"配置失败,请检查用户目录权限后重试")})}finally{E.current===R&&(E.current=null),R.signal.aborted||v(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:b,"aria-label":"返回自动化列表",children:o.jsx(GTe,{})}),o.jsx(KTe,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"配置 Coding Agents"}),o.jsx("p",{children:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。"})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":"选择 Coding Agent",children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:"本机客户端"})]}),o.jsx("button",{type:"button",onClick:()=>c(R=>R+1),disabled:s||b,children:"重新检测"})]}),s?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),"正在检测本机客户端…"]}):r?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(R=>R+1),children:"重试"})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:t==null?void 0:t.agents.map(R=>o.jsxs("button",{type:"button",className:`coding-agents-agent ${u.has(R.id)?"is-selected":""}`,"aria-pressed":u.has(R.id),disabled:!R.available||b,onClick:()=>T(R.id,R.available),title:R.available?R.name:R.reason,children:[o.jsx("span",{className:`coding-agents-agent-mark is-${R.id}`,children:o.jsx(XTe,{agentId:R.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:R.name}),o.jsx("small",{children:R.available?R.version||"已检测到客户端":R.reason})]}),o.jsx("span",{className:`coding-agents-status ${R.available?"is-ready":""}`,children:R.available?"可用":"未检测到"}),o.jsx("span",{className:"coding-agents-check",children:o.jsx($3,{})})]},R.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":"选择内置 Skill",children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:"内置 Skills"})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:t==null?void 0:t.skills.map(R=>o.jsxs("div",{className:`coding-agents-skill ${f.has(R.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:f.has(R.id),onChange:()=>k(R.id),disabled:b}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx($3,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:R.name}),o.jsx("small",{children:R.description})]})]}),o.jsx("button",{type:"button",onClick:()=>m(R),children:"查看文件"})]},R.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":"全局安装目录",children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(WTe,{}),o.jsxs("div",{children:[o.jsx("strong",{children:"全局安装"}),o.jsx("span",{children:"配置后可在本机其他项目中使用"})]})]}),w.length?o.jsx("dl",{children:w.map(R=>o.jsxs("div",{children:[o.jsx("dt",{children:R.name}),o.jsx("dd",{children:R.globalSkillsPath})]},R.id))}):o.jsx("p",{children:"选择客户端后显示对应安装目录。"})]})]}),y?o.jsxs("div",{className:`coding-agents-result is-${y.tone}`,role:y.tone==="error"?"alert":"status",children:[o.jsx("strong",{children:y.message}),(j=y.details)!=null&&j.length?o.jsx("ul",{children:y.details.map(R=>o.jsx("li",{children:R},R))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:w.length?`已选择 ${w.length} 个客户端、${S.length} 个 Skill`:"请先选择客户端"}),o.jsx("button",{type:"button",onClick:()=>void A(),disabled:!_,children:b?"正在配置…":"配置"})]})]})}),p?o.jsx(VTe,{skill:p,onClose:()=>m(null)}):null]})}const ZTe={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function JTe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(const i of n){if(s==null||typeof s!="object")return;s=s[i]}return s}function eke(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function tke(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function NA(e,t){if(eke(e))return JTe(t,e.path);if(tke(e)){const n=ZTe[e.call],s={};for(const[i,r]of Object.entries(e.args??{}))s[i]=NA(r,t);return n?n(s):`[unknown fn: ${e.call}]`}return e}function nke(e,t){const n=NA(e,t);return n==null?"":typeof n=="string"?n:String(n)}const PH=new Map;function Uu(e,t){PH.set(e,t)}function ske(e){return PH.get(e)}function ike(e,t,n){const s=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let r=0;rNA(s,e.dataModel),resolveString:s=>nke(s,e.dataModel),dispatchAction:t,render:s=>{if(!s)return null;const i=e.components[s];if(!i)return null;const r=ske(i.component)??rke;return o.jsx(r,{node:i,ctx:n},s)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function oke(e){const t=g.useRef(null),n=g.useRef(!0),s=28,i=g.useCallback(()=>{const r=t.current;r&&(n.current=r.scrollHeight-r.scrollTop-r.clientHeight{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),{ref:t,onScroll:i}}function aE({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:s}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(gu,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(Mi,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(PB,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),s?o.jsx("button",{type:"button",onClick:s,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Mi,{})}):null]}):null]})}function TA(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function UH(e){var n,s,i,r;const t=TA(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((s=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:s.toUpperCase())??"VIDEO":t==="image"?((r=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function FH(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function $H(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?x8(t,e.uri):""}function lke({kind:e}){return e==="image"?o.jsx(Wk,{}):e==="video"?o.jsx(UB,{}):e==="pdf"?o.jsx(Pee,{}):o.jsx(qk,{})}function oE({appName:e,items:t,compact:n=!1,onRemove:s}){const[i,r]=g.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=TA(a.mimeType),c=$H(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:l==="image"?void 0:()=>r(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(ite,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(lke,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:UH(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(gn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":FH(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(su,{className:"media-card-open"}):null]});return o.jsxs(es.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(OB,{src:c,children:d}):d,s?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>s(a.id),children:o.jsx(Mi,{})}):null]},a.id)})}),o.jsx(qo,{children:i?o.jsx(cke,{appName:e,item:i,onClose:()=>r(null)}):null})]})}function cke({appName:e,item:t,onClose:n}){const s=g.useMemo(()=>$H(t,e),[e,t]),i=TA(t.mimeType),[r,a]=g.useState(""),[l,c]=g.useState(i==="text"||i==="markdown"),[u,d]=g.useState("");return g.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),g.useEffect(()=>{if(i!=="text"&&i!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(s,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[i,s]),o.jsx(es.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:o.jsxs(es.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[UH(t),t.sizeBytes?` · ${FH(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:s,download:t.name,"aria-label":"下载",children:o.jsx(yx,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Mi,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:s,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:s,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:s,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(gn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(mh,{text:r})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function uke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function dke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function HH(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"17.5",height:"13.5",rx:"2.4"}),o.jsx("path",{d:"M3.25 9h17.5M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function fke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function hke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),o.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function pke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function mke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),o.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),o.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function gke(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function zH(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function bke({definition:e,label:t,done:n,open:s,onToggle:i}){const r=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":s,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(r,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(Ba,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(zH,{className:`builtin-tool-chevron${s?" is-open":""}`})]})}const yke={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:uke},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:gke},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:dke},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:HH},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:fke},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:hke},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:pke},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:mke}};function xke(e){return yke[e]}const VH="send_a2ui_json_to_client",Eke=28;function vke(e,t,n){let s=t;for(let i=0;i65535?2:1}return s}function wke(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function GH(e,t,n){const[s,i]=g.useState(()=>t?"":e),r=g.useRef(s),a=g.useRef(e),l=g.useRef(null),c=g.useRef(0),u=g.useRef(n);return a.current=e,u.current=n,g.useEffect(()=>{const d=r.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){l.current!==null&&window.cancelAnimationFrame(l.current),l.current=null,d!==e&&(r.current=e,i(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,b=r.current;if(!m.startsWith(b)){r.current=m,i(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[s]),g.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),s}function _ke({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Ske(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function Nke(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function KH({text:e,done:t,answerStarted:n=!1,streaming:s=!1,onStreamFrame:i}){const[r,a]=g.useState(!(t||n)),l=g.useRef(!1);g.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=GH(u,!t||s,i),{ref:f,onScroll:h}=oke(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(_ke,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(Ba,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(dc,{className:`chev ${r?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${r&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function qH(){return o.jsx(KH,{text:"",done:!1})}const Tke=g.memo(function({text:t,streaming:n,onStreamFrame:s}){const i=GH(t,n,s);return i?o.jsx("div",{className:"bubble",children:o.jsx(mh,{text:i})}):null});function kke({name:e,args:t,response:n,done:s}){const[i,r]=g.useState(!1),a=e===VH?"渲染 UI":e,l=xke(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` +…(已截断)`:c;return o.jsxs(es.div,{className:`block-tool${l?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l?o.jsx(bke,{definition:l,label:Nke(e,t),done:s,open:i,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":i,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(Ske,{})}),s?o.jsx("span",{className:"tool-name",children:a}):o.jsx(Ba,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(zH,{className:`tool-chevron${i?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${i?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function Ake({block:e,onDownload:t,onPreview:n}){const[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(null);g.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){i(`download:${p}`),a("");try{await t(p,m)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(p,m,b)=>{if(n){i(`preview:${b}`),a("");try{const v=await n(p,m);c({name:b,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const m=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(v=>v.filename===m);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(qk,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||s!=="",onClick:()=>void f(b.filename,b.version,p.filename),children:[s===`preview:${p.filename}`?o.jsx(gn,{className:"spin"}):o.jsx(Mee,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||s!=="",onClick:()=>void d(p.filename,p.version),children:[s===`download:${p.filename}`?o.jsx(gn,{className:"spin"}):o.jsx(yx,{}),"下载"]})]})]},`${p.filename}:${p.version}`)}),r&&o.jsx("div",{className:"artifact-card__error",children:r}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(Mi,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function Cke({block:e,onAuth:t}){const[n,s]=g.useState(e.done?"done":"idle"),[i,r]=g.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),s("authorizing");try{await t(e),s("done")}catch(d){r(d instanceof Error?d.message:String(d)),s("idle")}}};return e.done||n==="done"?o.jsxs(es.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx($R,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(es.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx($R,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(gn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function kA({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:s,onAction:i,onAuth:r,onArtifactDownload:a,onArtifactPreview:l}){return o.jsx(o.Fragment,{children:e.map((c,u)=>{switch(c.kind){case"thinking":{const d=e.slice(u+1).some(f=>f.kind==="text"&&!!f.text.trim());return o.jsx(KH,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:s},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(Tke,{text:d,streaming:n,onStreamFrame:s},u):null}case"attachment":return o.jsx(oE,{appName:t,items:c.files},u);case"artifact":return o.jsx(Ake,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(aE,{value:c.value},u);case"tool":return c.name===VH&&c.done?null:o.jsx(kke,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(Cke,{block:c,onAuth:r},u);case"a2ui":return BH(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(es.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(ake,{surface:d,onAction:i})},`${u}-${d.surfaceId}`));default:return null}})})}function AA(e){return e.isComposing||e.keyCode===229}function Ike({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),o.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),o.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),o.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),o.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),o.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),o.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}const _a=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],jke=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function V3({mode:e}){return e==="skill-create"?o.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),o.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?o.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),o.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):o.jsx(Ike,{className:"new-chat-mode__agent-icon"})}function Rke(){return o.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function Oke({value:e,onChange:t,disabled:n=!1,temporaryEnabled:s,skillCreateEnabled:i}){const[r,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState(()=>_a.findIndex(S=>S.value===e)),f=g.useRef(null),h=g.useRef(null),p=_a.find(S=>S.value===e)??_a[0],m=p.value==="temporary"?"Codex 智能体":p.label;function b(S){return S.value==="temporary"?s:S.value==="skill-create"?i:!0}function v(S){return b(S)!==!0}function y(S){const _=b(S);return _===void 0?"正在检查配置":_?S.description:"管理员未配置"}g.useEffect(()=>{if(!r)return;const S=_=>{var T;(T=f.current)!=null&&T.contains(_.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[r]);function x(S){let _=u;do _=(_+S+_a.length)%_a.length;while(v(_a[_]));d(_),c(_a[_].value==="temporary")}function E(S){var _;if(!v(S)){if(S.value==="temporary"){c(!0);return}t(S.value),a(!1),c(!1),(_=h.current)==null||_.focus()}}function w(){t("temporary"),a(!1),c(!1)}return o.jsxs("div",{className:"new-chat-mode",ref:f,children:[o.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":r,disabled:n,onClick:()=>{d(_a.findIndex(S=>S.value===e)),a(S=>(S&&c(!1),!S))},onKeyDown:S=>{S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),r?x(S.key==="ArrowDown"?1:-1):a(!0)):r&&(S.key==="Enter"||S.key===" ")?(S.preventDefault(),E(_a[u])):r&&S.key==="Escape"&&(S.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx(V3,{mode:p.value})}),o.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),o.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),r?o.jsxs("div",{className:"new-chat-mode__menus",children:[o.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:S=>{var _;S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),x(S.key==="ArrowDown"?1:-1)):S.key==="Enter"?(S.preventDefault(),E(_a[u])):S.key==="Escape"&&(S.preventDefault(),a(!1),c(!1),(_=h.current)==null||_.focus())},children:_a.map((S,_)=>{const T=S.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===S.value,"aria-haspopup":T?"menu":void 0,"aria-expanded":T?l:void 0,"aria-disabled":v(S),disabled:v(S),className:`new-chat-mode__option${_===u?" is-active":""}`,onMouseEnter:()=>{d(_),c(S.value==="temporary")},onClick:()=>E(S),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx(V3,{mode:S.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[S.label,S.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(S)})]}),T?o.jsx(Rke,{}):e===S.value?o.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},S.value)})}),l?o.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:w,children:[o.jsx(Qm,{kind:"codex",className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),o.jsx("span",{children:"在沙箱中执行任务"})]})]}),jke.map(({label:S,kind:_})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx(Qm,{kind:_,className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:S}),o.jsx("span",{children:"暂不可用"})]})]},S))]}):null]}):null]})}const ld=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],Mke=15,Lke=15e3,Dke=120,Pke=180;function G3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5.75 3.75 4.25 4.25-4.25 4.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Bke(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Gw({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(iu,{className:t}):o.jsx(Qm,{kind:e,className:t})}function Uke({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:s=!1,onSelectRuntime:i,onSelectSandboxSession:r}){var Se;const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(0),[h,p]=g.useState(0),[m,b]=g.useState("types"),[v,y]=g.useState(!1),[x,E]=g.useState([]),[w,S]=g.useState([]),[_,T]=g.useState(null),[k,A]=g.useState(""),[j,R]=g.useState(!1),[B,z]=g.useState(""),[L,F]=g.useState(""),C=g.useRef(null),I=g.useRef(null),D=g.useRef(null),$=g.useRef(0),O=g.useRef(null),ne=g.useRef(null),se=g.useRef(null),P=((Se=ld.find(ae=>ae.id===c))==null?void 0:Se.label)??"智能体",Z=g.useCallback((ae=!1)=>{var me;ne.current!==null&&(window.clearTimeout(ne.current),ne.current=null),se.current!==null&&(window.clearTimeout(se.current),se.current=null),l(!1),u(null),b("types"),y(!1),ae&&((me=I.current)==null||me.focus())},[]),te=g.useCallback(async(ae="",me=!1)=>{const we=++$.current;let et;R(!0),z("");try{const De=await Promise.race([Tx({scope:n,region:"all",pageSize:Mke,nextToken:ae}),new Promise((Ue,Ye)=>{et=window.setTimeout(()=>{Ye(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},Lke)})]);if($.current!==we)return;E(Ue=>{const Ye=me?De.runtimes:[...Ue,...De.runtimes];return Ye.filter((Ae,ze)=>Ye.findIndex(Be=>Be.runtimeId===Ae.runtimeId)===ze)}),A(De.nextToken),p(0)}catch(De){if($.current!==we)return;z(zd(De,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(et),$.current===we&&R(!1)}},[n]),V=g.useCallback(async ae=>{var et,De;(et=O.current)==null||et.abort();const me=new AbortController;O.current=me;const we=++$.current;R(!0),z(""),S([]);try{const Ue=ae==="codex"?await un.listSessions({signal:me.signal}):await un.listAgentSessions(ae,{signal:me.signal});if($.current!==we)return;S(Ue),T(ae),p(0)}catch(Ue){if((Ue==null?void 0:Ue.name)==="AbortError"||$.current!==we)return;z(zd(Ue,`加载 ${((De=ld.find(Ye=>Ye.id===ae))==null?void 0:De.label)??ae}`,`GET /web/${ae==="codex"?"sandbox":ae}/sessions`)),T(ae)}finally{O.current===me&&(O.current=null),$.current===we&&R(!1)}},[]);g.useEffect(()=>{!a||c!=="general"||x.length>0||j||B||te("",!0)},[c,B,te,j,a,x.length]),g.useEffect(()=>{!a||c===null||c==="general"||_===c||V(c)},[c,V,_,a]),g.useEffect(()=>{if(!a)return;const ae=me=>{var we;(we=C.current)!=null&&we.contains(me.target)||Z()};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[Z,a]),g.useEffect(()=>()=>{var ae;$.current+=1,(ae=O.current)==null||ae.abort(),ne.current!==null&&window.clearTimeout(ne.current),se.current!==null&&window.clearTimeout(se.current)},[]);function Q(ae,me=!1){ne.current!==null&&(window.clearTimeout(ne.current),ne.current=null),se.current!==null&&(window.clearTimeout(se.current),se.current=null),l(!0),u(me?"general":null),f(0),b("types"),y(me),ae&&requestAnimationFrame(()=>{var we;return(we=D.current)==null?void 0:we.focus()})}function K(){s||a||ne.current!==null||(ne.current=window.setTimeout(()=>{ne.current=null,Q(!1)},Dke))}function ce(){se.current!==null&&(window.clearTimeout(se.current),se.current=null)}function he(){ne.current!==null&&(window.clearTimeout(ne.current),ne.current=null),!(!a||se.current!==null)&&(se.current=window.setTimeout(()=>{se.current=null,Z()},Pke))}function ge(ae){var et;const me=(ae+ld.length)%ld.length,we=ld[me].id;we!==c&&($.current+=1,(et=O.current)==null||et.abort(),O.current=null,R(!1),z("")),f(me),u(we),p(0)}async function ue(ae){if(!L){F(ae.runtimeId),z("");try{await i(ae),Z(!0)}catch(me){z(zd(me,"连接通用智能体"))}finally{F("")}}}async function ve(ae){if(!L){F(ae.id),z("");try{await r(ae),Z(!0)}catch(me){z(zd(me,`打开 ${P}`))}finally{F("")}}}function Me(ae){if(ae.key==="Escape"){ae.preventDefault(),Z(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(ae.key)&&y(!0),m==="types"){ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),ge(d+(ae.key==="ArrowDown"?1:-1))):(ae.key==="ArrowRight"||ae.key==="Enter")&&(ae.preventDefault(),c===null&&ge(d),b("runtimes"));return}if(ae.key==="ArrowLeft")ae.preventDefault(),b("types");else if((c==="general"?x:w).length>0&&(ae.key==="ArrowDown"||ae.key==="ArrowUp")){ae.preventDefault();const me=ae.key==="ArrowDown"?1:-1,we=c==="general"?x.length:w.length;p(et=>(et+me+we)%we)}else ae.key==="Enter"&&c==="general"&&x[h]?(ae.preventDefault(),ue(x[h])):ae.key==="Enter"&&c!=="general"&&w[h]&&(ae.preventDefault(),ve(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:C,onPointerEnter:ae=>{ae.pointerType==="mouse"&&ce()},onPointerLeave:ae=>{ae.pointerType==="mouse"&&he()},children:[o.jsxs("button",{ref:I,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:s,onPointerEnter:ae=>{ae.pointerType==="mouse"&&K()},onClick:()=>a?Z():Q(!0),onKeyDown:ae=>{ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),a||Q(!0,!0)):ae.key==="Escape"&&a&&(ae.preventDefault(),Z(!0))},children:[o.jsx(iu,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(G3,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:D,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Me,onPointerMove:ae=>{ae.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:ld.map((ae,me)=>o.jsxs("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":c===ae.id,className:`new-chat-agent-picker__type${v&&m==="types"&&d===me?" is-keyboard-active":""}`,onMouseEnter:()=>ge(me),onClick:()=>{ge(me),b("runtimes")},children:[o.jsx(Gw,{type:ae.id}),o.jsx("span",{children:ae.label}),o.jsx(G3,{className:"new-chat-agent-picker__nested-chevron"})]},ae.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${P}列表`,children:c!=="general"&&j&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):c!=="general"&&B&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:B}),o.jsx("button",{type:"button",onClick:()=>void V(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(Zn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Zn.Icon,{size:"sm",children:o.jsx(Gw,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(Zn.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",P]})}),o.jsx(Zn.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((ae,me)=>{const we=L===ae.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":we||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===me?" is-keyboard-active":""}`,disabled:!!L,title:`${ae.displayName||P} · ${ae.id}`,onMouseEnter:()=>p(me),onClick:()=>void ve(ae),children:[o.jsx(Gw,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.displayName||P}),o.jsx("small",{children:we?"正在打开":iE(ae.status)})]},ae.id)})}):j&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):B&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:B}),o.jsx("button",{type:"button",onClick:()=>void te("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(Zn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Zn.Icon,{size:"sm",children:o.jsx(iu,{})}),o.jsx(Zn.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(Zn.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((ae,me)=>{const we=L===ae.runtimeId,et=ae.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":et,"aria-busy":we||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===me?" is-keyboard-active":""}`,disabled:!!L,title:ae.name,onMouseEnter:()=>p(me),onClick:()=>void ue(ae),children:[o.jsx(iu,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.name}),we?o.jsx("small",{children:"正在连接"}):et?o.jsx(Bke,{className:"new-chat-agent-picker__check"}):null]},ae.runtimeId)})}),B?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:B}):null,k?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:j||!!L,onClick:()=>void te(k),children:j?"加载中":"加载更多"}):null]})}):null]}):null]})}const YH={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},Fke={ppt:[],image:[],video:["video_task_query"]},CA=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function K3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.25",y:"6.25",width:"13.5",height:"13.5",rx:"2.5"}),o.jsx("path",{d:"M11 10v6M8 13h6"}),o.jsx("path",{d:"m19.25 2.75.53 1.47 1.47.53-1.47.53-.53 1.47-.53-1.47-1.47-.53 1.47-.53.53-1.47Z",fill:"currentColor",stroke:"none"})]})}const q3=[{value:"ppt",label:"PPT",icon:Jee,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:Wk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:HH,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function $ke({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:s,value:i,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:b=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:S=!1,showModeSelector:_=!1,onModeChange:T,onTaskChange:k,temporaryEnabled:A,skillCreateEnabled:j,harnessEnabled:R=!1,builtinTools:B=[],showAgentPicker:z=!1,agentPickerDisabled:L=!1,selectedRuntimeId:F="",runtimeScope:C="mine",onSelectRuntime:I,onSelectSandboxSession:D}){const $=g.useRef(null),O=g.useRef(null),ne=g.useRef(null),se=g.useRef(null),[P,Z]=g.useState(!1),[te,V]=g.useState(null),[Q,K]=g.useState(0),[ce,he]=g.useState(!1);async function ge(){if(e)try{await navigator.clipboard.writeText(e),he(!0),setTimeout(()=>he(!1),1500)}catch{he(!1)}}g.useLayoutEffect(()=>{const J=$.current;J&&(J.style.height="auto",J.style.height=`${Math.min(J.scrollHeight,200)}px`)},[i]);const ue=E==="skill-create";g.useEffect(()=>{ue&&(Z(!1),V(null))},[ue]);const ve=!ue&&d.some(J=>J.status!=="ready"),Me=!l&&!c&&!ve&&(i.trim().length>0||!ue&&d.length>0),Se=ue?`描述你想创建的 Skill,将使用 ${CA.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${s} 发消息…`,ae=(te==null?void 0:te.query.toLocaleLowerCase())??"",me=(te==null?void 0:te.kind)==="skill"?f.filter(J=>!p.skills.some(xe=>xe.name===J.name)).filter(J=>`${J.name} ${J.description}`.toLocaleLowerCase().includes(ae)).map(J=>({kind:"skill",value:J})):(te==null?void 0:te.kind)==="agent"?h.filter(J=>`${J.name} ${J.description}`.toLocaleLowerCase().includes(ae)).map(J=>({kind:"agent",value:J})):[];function we(J){var xe;Z(!1),V(null),(xe=J.current)==null||xe.click()}function et(J){k==null||k(J.value),Z(!1),V(null),requestAnimationFrame(()=>{var xe,Oe;(xe=$.current)==null||xe.focus(),(Oe=$.current)==null||Oe.setSelectionRange(i.length,i.length)})}function De(J){r(J),Z(!1),V(null),requestAnimationFrame(()=>{var lt,Mt,ut;(lt=$.current)==null||lt.focus();const xe=J.indexOf("【"),Oe=J.indexOf("】",xe+1);xe>=0&&Oe>xe?(Mt=$.current)==null||Mt.setSelectionRange(xe+1,Oe):(ut=$.current)==null||ut.setSelectionRange(J.length,J.length)})}function Ue(){k==null||k(null),r(""),Z(!1),V(null),requestAnimationFrame(()=>{var J,xe;(J=$.current)==null||J.focus(),(xe=$.current)==null||xe.setSelectionRange(0,0)})}const Ye=q3.find(J=>J.value===w),Ae=q3.filter(J=>YH[J.value].every(xe=>B.includes(xe)));function ze(J,xe){const Oe=J.slice(0,xe),lt=/(^|\s)([/@])([^\s/@]*)$/.exec(Oe);if(!lt){V(null);return}const Mt=lt[2].length+lt[3].length,ut={kind:lt[2]==="/"?"skill":"agent",query:lt[3],start:xe-Mt,end:xe},bn=!te||te.kind!==ut.kind||te.query!==ut.query||te.start!==ut.start||te.end!==ut.end;V(ut),bn&&K(0),Z(!1)}function Be(J){if(!te)return;const xe=i.slice(0,te.start)+i.slice(te.end);r(xe),J.kind==="skill"?v({...p,skills:[...p.skills,J.value]}):v({skills:[],targetAgent:J.value});const Oe=te.start;V(null),requestAnimationFrame(()=>{var lt,Mt;(lt=$.current)==null||lt.focus(),(Mt=$.current)==null||Mt.setSelectionRange(Oe,Oe)})}function X(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function oe(J){const xe=J.target.files?Array.from(J.target.files):[];xe.length&&y(xe),J.target.value=""}return o.jsxs("div",{className:`composer${S?" composer--new-chat":""}${ue?" composer--skill-mode":""}${Ye?` composer--has-task composer--task-${Ye.value}`:""}`,children:[ue?null:o.jsx(aE,{value:p,onRemoveSkill:J=>v({...p,skills:p.skills.filter(xe=>xe.name!==J)}),onRemoveAgent:()=>v({skills:[]})}),!ue&&d.length>0&&o.jsx(oE,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[te?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":te.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[te.kind==="skill"?o.jsx(gu,{}):o.jsx(PB,{}),o.jsx("span",{children:te.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:te.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(gn,{className:"spin"})," 正在读取 Agent 能力…"]}):me.length===0?o.jsx("div",{className:"composer-command-empty",children:te.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:me.map((J,xe)=>o.jsxs("button",{type:"button",role:"option","aria-selected":xe===Q,className:`composer-command-item${xe===Q?" is-active":""}`,onMouseDown:Oe=>{Oe.preventDefault(),Be(J)},onMouseEnter:()=>K(xe),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${J.kind}`,children:J.kind==="skill"?o.jsx(gu,{}):o.jsx(mu,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[J.kind==="skill"?"/":"@",J.value.name]}),o.jsx("span",{children:J.value.description||(J.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:xe===Q?"↵":J.kind==="skill"?"技能":"Agent"})]},`${J.kind}-${J.value.name}`))})]}):null,ue?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!b,onClick:()=>{V(null),Z(J=>!J)},children:o.jsx(Ri,{className:"icon"})}),P&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>Z(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(O),children:[o.jsx(Wk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(ne),children:[o.jsx(qk,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(se),children:[o.jsx(UB,{className:"icon"}),"上传视频"]})]})]})]}),z&&I&&D?o.jsx(Uke,{selectedAgentName:n?s:"",selectedRuntimeId:F,runtimeScope:C,disabled:L,onSelectRuntime:I,onSelectSandboxSession:D}):null,_&&T?o.jsx(Oke,{value:E,onChange:T,disabled:c,temporaryEnabled:A,skillCreateEnabled:j}):null,S&&E==="agent"&&Ye&&k?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${Ye.value}`,"aria-label":`取消${Ye.label}任务`,disabled:c,onClick:Ue,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(Ye.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(Mi,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:Ye.label})]}):null,S&&ue&&T?o.jsxs("button",{type:"button",className:"new-chat-task-chip new-chat-task-chip--skill","aria-label":"退出创建 Skill",disabled:c,onClick:()=>T("agent"),children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(K3,{className:"new-chat-task-chip__task-icon"}),o.jsx(Mi,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:"Skill"})]}):null,o.jsxs("div",{className:"composer-input-stack",children:[o.jsx("textarea",{ref:$,className:"comp-input scroll",rows:S?4:1,value:i,disabled:l,placeholder:Se,"aria-expanded":!!te,onChange:J=>{r(J.target.value),ue||ze(J.target.value,J.target.selectionStart)},onSelect:J=>{ue||ze(J.currentTarget.value,J.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>V(null),0),onKeyDown:J=>{if(!AA(J.nativeEvent)){if(te){if(J.key==="ArrowDown"&&me.length>0){J.preventDefault(),K(xe=>(xe+1)%me.length);return}if(J.key==="ArrowUp"&&me.length>0){J.preventDefault(),K(xe=>(xe-1+me.length)%me.length);return}if((J.key==="Enter"||J.key==="Tab")&&me[Q]){J.preventDefault(),Be(me[Q]);return}if(J.key==="Escape"){J.preventDefault(),V(null);return}}if(J.key==="Backspace"&&!i&&J.currentTarget.selectionStart===0&&J.currentTarget.selectionEnd===0){X();return}J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),Me&&a())}}}),S&&i.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:Se},Se):null]}),o.jsx(es.button,{type:"button",className:"comp-send",disabled:!Me,onClick:a,"aria-label":"发送",whileTap:Me?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(gn,{className:"icon spin"}):o.jsx(DB,{className:"icon"})})]}),S&&E==="agent"&&R&&!Ye?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[Ae.map(J=>{const xe=J.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>et(J),children:[o.jsx(xe,{}),o.jsx("span",{children:J.label})]},J.value)}),j===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>T==null?void 0:T("skill-create"),children:[o.jsx(K3,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,S&&E==="agent"&&Ye?o.jsx("div",{className:"prompt-suggestions","aria-label":`${Ye.label}企业提示词`,children:Ye.prompts.map(J=>{const xe=Ye.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>De(J),children:[o.jsx(xe,{}),o.jsx("span",{children:J})]},J)})}):null,u&&o.jsxs("div",{className:"composer-meta",children:[o.jsxs("span",{className:"composer-session-line",children:["会话 ID:",o.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&o.jsx("button",{type:"button",className:"composer-session-copy",title:ce?"已复制":"复制会话 ID","aria-label":ce?"已复制会话 ID":"复制会话 ID",onClick:()=>void ge(),children:ce?o.jsx(za,{}):o.jsx(bx,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:ne,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:se,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:oe})]})}function WH({title:e,sub:t,cards:n,footer:s}){return o.jsxs("div",{className:"stk",children:[o.jsxs("div",{className:"stk-head",children:[o.jsx("h1",{className:"stk-title",children:e}),t&&o.jsx("p",{className:"stk-sub",children:t})]}),o.jsx("div",{className:"stk-list",children:n.map((i,r)=>o.jsxs(es.button,{type:"button",className:`stk-card ${i.disabled?"stk-card-disabled":""}`,onClick:i.disabled?void 0:i.onClick,disabled:i.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:r*.04},children:[o.jsx("span",{className:"stk-card-icon",children:o.jsx(i.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:i.title}),o.jsx("span",{className:"stk-card-desc",children:i.desc})]}),i.status&&o.jsx("span",{className:"stk-card-status",children:i.status}),o.jsx(dc,{className:"stk-card-arrow"})]},i.key))}),s&&o.jsx("div",{className:"stk-footer",children:s})]})}const IA=Symbol.for("yaml.alias"),PN=Symbol.for("yaml.document"),ic=Symbol.for("yaml.map"),XH=Symbol.for("yaml.pair"),mo=Symbol.for("yaml.scalar"),yh=Symbol.for("yaml.seq"),pa=Symbol.for("yaml.node.type"),xh=e=>!!e&&typeof e=="object"&&e[pa]===IA,Ug=e=>!!e&&typeof e=="object"&&e[pa]===PN,Fg=e=>!!e&&typeof e=="object"&&e[pa]===ic,Hs=e=>!!e&&typeof e=="object"&&e[pa]===XH,Vn=e=>!!e&&typeof e=="object"&&e[pa]===mo,$g=e=>!!e&&typeof e=="object"&&e[pa]===yh;function Us(e){if(e&&typeof e=="object")switch(e[pa]){case ic:case yh:return!0}return!1}function $s(e){if(e&&typeof e=="object")switch(e[pa]){case IA:case ic:case mo:case yh:return!0}return!1}const QH=e=>(Vn(e)||Us(e))&&!!e.anchor,$c=Symbol("break visit"),Hke=Symbol("skip children"),am=Symbol("remove node");function Eh(e,t){const n=zke(t);Ug(e)?Kd(null,e.contents,n,Object.freeze([e]))===am&&(e.contents=null):Kd(null,e,n,Object.freeze([]))}Eh.BREAK=$c;Eh.SKIP=Hke;Eh.REMOVE=am;function Kd(e,t,n,s){const i=Vke(e,t,n,s);if($s(i)||Hs(i))return Gke(e,s,i),Kd(e,i,n,s);if(typeof i!="symbol"){if(Us(t)){s=Object.freeze(s.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>Kke[t]);class Ji{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Ji.defaultYaml,t),this.tags=Object.assign({},Ji.defaultTags,n)}clone(){const t=new Ji(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Ji(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Ji.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Ji.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Ji.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Ji.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,a]=s;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const a=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(a){return n(String(a)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+qke(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(t&&s.length>0&&$s(t.contents)){const r={};Eh(t.contents,(a,l)=>{$s(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,a]of s)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` +`)}}Ji.defaultYaml={explicit:!1,version:"1.2"};Ji.defaultTags={"!!":"tag:yaml.org,2002:"};function ZH(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function JH(e){const t=new Set;return Eh(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function ez(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function Yke(e,t){const n=[],s=new Map;let i=null;return{onAnchor:r=>{n.push(r),i??(i=JH(e));const a=ez(t,i);return i.add(a),a},setAnchors:()=>{for(const r of n){const a=s.get(r);if(typeof a=="object"&&a.anchor&&(Vn(a.node)||Us(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function qd(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;ifa(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!QH(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class jA{constructor(t){Object.defineProperty(this,pa,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!Ug(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=fa(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof r=="function"?qd(r,{"":l},"",l):l}}class RA extends jA{constructor(t){super(IA),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],Eh(t,{Node:(r,a)=>{(xh(a)||QH(a))&&s.push(a)}}),n&&(n.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=s.get(a);if(l||(fa(a,null,n),l=s.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=fy(i,a,s)),l.count*l.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,s){const i=`*${this.source}`;if(t){if(ZH(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function fy(e,t,n){if(xh(t)){const s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Us(t)){let s=0;for(const i of t.items){const r=fy(e,i,n);r>s&&(s=r)}return s}else if(Hs(t)){const s=fy(e,t.key,n),i=fy(e,t.value,n);return Math.max(s,i)}return 1}const tz=e=>!e||typeof e!="function"&&typeof e!="object";class It extends jA{constructor(t){super(mo),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:fa(this.value,t,n)}toString(){return String(this.value)}}It.BLOCK_FOLDED="BLOCK_FOLDED";It.BLOCK_LITERAL="BLOCK_LITERAL";It.PLAIN="PLAIN";It.QUOTE_DOUBLE="QUOTE_DOUBLE";It.QUOTE_SINGLE="QUOTE_SINGLE";const Wke="tag:yaml.org,2002:";function Xke(e,t,n){if(t){const s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,e))&&!s.format})}function Jm(e,t,n){var f,h,p;if(Ug(e)&&(e=e.contents),$s(e))return e;if(Hs(e)){const m=(h=(f=n.schema[ic]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(s&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new RA(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=Wke+t.slice(2));let u=Xke(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new It(e);return c&&(c.node=m),m}u=e instanceof Map?a[ic]:Symbol.iterator in Object(e)?a[yh]:a[ic]}r&&(r(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new It(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function L1(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=s,s=a}else s=new Map([[r,s]])}return Jm(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Sp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let nz=class extends jA{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>$s(s)||Hs(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Sp(t))this.add(n);else{const[s,...i]=t,r=this.get(s,!0);if(Us(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,L1(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const i=this.get(n,!0);if(Us(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&Vn(r)?r.value:r:Us(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Hs(n))return!1;const s=n.value;return s==null||t&&Vn(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const i=this.get(n,!0);return Us(i)?i.hasIn(s):!1}setIn(t,n){const[s,...i]=t;if(i.length===0)this.set(s,n);else{const r=this.get(s,!0);if(Us(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,L1(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};const Qke=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Wo(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Yc=(e,t,n)=>e.endsWith(` +`)?Wo(n,t):n.includes(` `)?` -`+Yo(n,t):(e.endsWith(" ")?"":" ")+n,sz="flow",BN="block",hy="quoted";function lE(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,r)?u.push(0):f=i-s);let h,p,m=!1,b=-1,v=-1,y=-1;n===BN&&(b=Y3(e,b,t.length),b!==-1&&(f=b+c));for(let E;E=e[b+=1];){if(n===hy&&E==="\\"){switch(v=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}y=b}if(E===` +`+Wo(n,t):(e.endsWith(" ")?"":" ")+n,sz="flow",BN="block",hy="quoted";function lE(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,r)?u.push(0):f=i-s);let h,p,m=!1,b=-1,v=-1,y=-1;n===BN&&(b=Y3(e,b,t.length),b!==-1&&(f=b+c));for(let E;E=e[b+=1];){if(n===hy&&E==="\\"){switch(v=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}y=b}if(E===` `)n===BN&&(b=Y3(e,b,t.length)),f=b+t.length+c,h=void 0;else{if(E===" "&&p&&p!==" "&&p!==` `&&p!==" "){const w=e[b+1];w&&w!==" "&&w!==` `&&w!==" "&&(h=b)}if(b>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===hy){for(;p===" "||p===" ";)p=E,E=e[b+=1],m=!0;const w=b>y+1?b-2:v-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else m=!0}p=E}if(m&&l&&l(),u.length===0)return e;a&&a();let x=e.slice(0,u[0]);for(let E=0;E({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),uE=e=>/^(%|---|\.\.\.)/m.test(e);function Xke(e,t,n){if(!t||t<0)return!1;const s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,a=0;r({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),uE=e=>/^(%|---|\.\.\.)/m.test(e);function Zke(e,t,n){if(!t||t<0)return!1;const s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,a=0;rs)return!0;if(a=r+1,i-a<=s)return!1}return!0}function om(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(uE(e)?" ":"");let a="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(l,c);const d=n.substr(c+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(c,6)}c+=5,l=c+1}break;case"n":if(s||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const S=n[h-1];if(S!==` `&&S!==" "&&S!==" ")break}let p=n.substring(h);const m=p.indexOf(` `);m===-1?f="-":n===p||m!==p.length-1?(f="+",r&&r()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` `&&(p=p.slice(0,-1)),p=p.replace(FN,`$&${u}`));let b=!1,v,y=-1;for(v=0;v{_=!0});const k=lE(`${x}${S}${p}`,u,BN,T);if(!_)return`>${w} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let _=!1;const T=cE(s,!0);a!=="folded"&&t!==It.BLOCK_FOLDED&&(T.onOverflow=()=>{_=!0});const k=lE(`${x}${S}${p}`,u,BN,T);if(!_)return`>${w} ${u}${k}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} -${u}${x}${n}${p}`}function Qke(e,t,n,s){const{type:i,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` -`)||d&&/[[\]{},]/.test(r))return qd(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` -`)?qd(r,t):py(e,t,n,s);if(!l&&!d&&i!==Ct.PLAIN&&r.includes(` -`))return py(e,t,n,s);if(uE(r)){if(c==="")return t.forceBlockIndent=!0,py(e,t,n,s);if(l&&c===u)return qd(r,t)}const f=r.replace(/\n+/g,`$& -${c}`);if(a){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return qd(r,t)}return l?f:lE(f,c,sz,cE(t,!1))}function OA(e,t,n,s){const{implicitKey:i,inFlow:r}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==Ct.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=Ct.QUOTE_DOUBLE);const c=d=>{switch(d){case Ct.BLOCK_FOLDED:case Ct.BLOCK_LITERAL:return i||r?qd(a.value,t):py(a,t,n,s);case Ct.QUOTE_DOUBLE:return om(a.value,t);case Ct.QUOTE_SINGLE:return UN(a.value,t);case Ct.PLAIN:return Qke(a,t,n,s);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function iz(e,t){const n=Object.assign({blockQuote:!0,commentString:Wke,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function Zke(e,t){var i;if(t.tag){const r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let n,s;if(zn(t)){s=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,s)});if(r.length>1){const a=r.filter(l=>l.test);a.length>0&&(r=a)}n=r.find(a=>a.format===t.format)??r.find(a=>!a.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function Jke(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const i=[],r=(zn(e)||Hs(e))&&e.anchor;r&&ZH(r)&&(n.add(r),i.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(s.directives.tagString(a)),i.join(" ")}function Hf(e,t,n,s){var c;if(Gs(e))return e.toString(t,n,s);if(yh(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const r=Vs(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=Zke(t.doc.schema.tags,r));const a=Jke(r,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(r,t,n,s):zn(r)?OA(r,t,n,s):r.toString(t,n,s);return a?zn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} -${t.indent}${l}`:l}function e2e({key:e,value:t},n,s,i){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Vs(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Hs(e)||!Vs(e)&&typeof e=="object"){const T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Hs(e)||(zn(e)?e.type===Ct.BLOCK_FOLDED||e.type===Ct.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+c});let m=!1,b=!1,v=Hf(e,n,()=>m=!0,()=>b=!0);if(!p&&!n.inFlow&&v.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(r||t==null)return m&&s&&s(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=qc(v,n.indent,u(h)):b&&i&&i(),v;m&&(h=null),p?(h&&(v+=qc(v,n.indent,u(h))),v=`? ${v} -${l}:`):(v=`${v}:`,h&&(v+=qc(v,n.indent,u(h))));let y,x,E;Vs(t)?(y=!!t.spaceBefore,x=t.commentBefore,E=t.comment):(y=!1,x=null,E=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&zn(t)&&(n.indentAtStart=v.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!p&&$g(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=Hf(t,n,()=>w=!0,()=>b=!0);let _=" ";if(h||y||x){if(_=y?` +${u}${x}${n}${p}`}function Jke(e,t,n,s){const{type:i,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` +`)||d&&/[[\]{},]/.test(r))return Yd(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` +`)?Yd(r,t):py(e,t,n,s);if(!l&&!d&&i!==It.PLAIN&&r.includes(` +`))return py(e,t,n,s);if(uE(r)){if(c==="")return t.forceBlockIndent=!0,py(e,t,n,s);if(l&&c===u)return Yd(r,t)}const f=r.replace(/\n+/g,`$& +${c}`);if(a){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Yd(r,t)}return l?f:lE(f,c,sz,cE(t,!1))}function OA(e,t,n,s){const{implicitKey:i,inFlow:r}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==It.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=It.QUOTE_DOUBLE);const c=d=>{switch(d){case It.BLOCK_FOLDED:case It.BLOCK_LITERAL:return i||r?Yd(a.value,t):py(a,t,n,s);case It.QUOTE_DOUBLE:return om(a.value,t);case It.QUOTE_SINGLE:return UN(a.value,t);case It.PLAIN:return Jke(a,t,n,s);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function iz(e,t){const n=Object.assign({blockQuote:!0,commentString:Qke,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function e2e(e,t){var i;if(t.tag){const r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let n,s;if(Vn(t)){s=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,s)});if(r.length>1){const a=r.filter(l=>l.test);a.length>0&&(r=a)}n=r.find(a=>a.format===t.format)??r.find(a=>!a.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function t2e(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const i=[],r=(Vn(e)||Us(e))&&e.anchor;r&&ZH(r)&&(n.add(r),i.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(s.directives.tagString(a)),i.join(" ")}function zf(e,t,n,s){var c;if(Hs(e))return e.toString(t,n,s);if(xh(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const r=$s(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=e2e(t.doc.schema.tags,r));const a=t2e(r,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(r,t,n,s):Vn(r)?OA(r,t,n,s):r.toString(t,n,s);return a?Vn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} +${t.indent}${l}`:l}function n2e({key:e,value:t},n,s,i){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=$s(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Us(e)||!$s(e)&&typeof e=="object"){const T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Us(e)||(Vn(e)?e.type===It.BLOCK_FOLDED||e.type===It.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+c});let m=!1,b=!1,v=zf(e,n,()=>m=!0,()=>b=!0);if(!p&&!n.inFlow&&v.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(r||t==null)return m&&s&&s(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=Yc(v,n.indent,u(h)):b&&i&&i(),v;m&&(h=null),p?(h&&(v+=Yc(v,n.indent,u(h))),v=`? ${v} +${l}:`):(v=`${v}:`,h&&(v+=Yc(v,n.indent,u(h))));let y,x,E;$s(t)?(y=!!t.spaceBefore,x=t.commentBefore,E=t.comment):(y=!1,x=null,E=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&Vn(t)&&(n.indentAtStart=v.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!p&&$g(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=zf(t,n,()=>w=!0,()=>b=!0);let _=" ";if(h||y||x){if(_=y?` `:"",x){const T=u(x);_+=` -${Yo(T,n.indent)}`}S===""&&!n.inFlow?_===` +${Wo(T,n.indent)}`}S===""&&!n.inFlow?_===` `&&E&&(_=` `):_+=` -${n.indent}`}else if(!p&&Hs(t)){const T=S[0],k=S.indexOf(` +${n.indent}`}else if(!p&&Us(t)){const T=S[0],k=S.indexOf(` `),A=k!==-1,j=n.inFlow??t.flow??t.items.length===0;if(A||!j){let R=!1;if(A&&(T==="&"||T==="!")){let B=S.indexOf(" ");T==="&"&&B!==-1&&Be===gb||typeof e=="symbol"&&e.description===gb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ct(Symbol(gb)),{addToJSMap:az}),stringify:()=>gb},t2e=(e,t)=>(el.identify(t)||zn(t)&&(!t.type||t.type===Ct.PLAIN)&&el.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===el.tag&&n.default));function az(e,t,n){const s=oz(e,n);if($g(s))for(const i of s.items)Kw(e,t,i);else if(Array.isArray(s))for(const i of s)Kw(e,t,i);else Kw(e,t,s)}function Kw(e,t,n){const s=oz(e,n);if(!Fg(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,e,Map);for(const[r,a]of i)t instanceof Map?t.has(r)||t.set(r,a):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function oz(e,t){return e&&yh(t)?t.resolve(e.doc,e):t}function lz(e,t,{key:n,value:s}){if(Vs(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(t2e(e,n))az(e,t,s);else{const i=da(n,"",e);if(t instanceof Map)t.set(i,da(s,i,e));else if(t instanceof Set)t.add(i);else{const r=n2e(n,i,e),a=da(s,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function n2e(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Vs(e)&&(n!=null&&n.doc)){const s=iz(n.doc,{});s.anchors=new Set;for(const r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),rz(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function MA(e,t,n){const s=Jm(e,void 0,n),i=Jm(t,void 0,n);return new Ji(s,i)}class Ji{constructor(t,n=null){Object.defineProperty(this,ha,{value:XH}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return Vs(n)&&(n=n.clone(t)),Vs(s)&&(s=s.clone(t)),new Ji(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return lz(n,s,this)}toString(t,n,s){return t!=null&&t.doc?e2e(this,t,n,s):JSON.stringify(this)}}function cz(e,t,n){return(t.inFlow??e.flow?i2e:s2e)(e,t,n)}function s2e({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:r,type:null});let f=!1;const h=[];for(let m=0;mv=null,()=>f=!0);v&&(y+=qc(y,r,u(v))),f&&v&&(f=!1),h.push(s+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;me===gb||typeof e=="symbol"&&e.description===gb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new It(Symbol(gb)),{addToJSMap:az}),stringify:()=>gb},s2e=(e,t)=>(tl.identify(t)||Vn(t)&&(!t.type||t.type===It.PLAIN)&&tl.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===tl.tag&&n.default));function az(e,t,n){const s=oz(e,n);if($g(s))for(const i of s.items)Kw(e,t,i);else if(Array.isArray(s))for(const i of s)Kw(e,t,i);else Kw(e,t,s)}function Kw(e,t,n){const s=oz(e,n);if(!Fg(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,e,Map);for(const[r,a]of i)t instanceof Map?t.has(r)||t.set(r,a):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function oz(e,t){return e&&xh(t)?t.resolve(e.doc,e):t}function lz(e,t,{key:n,value:s}){if($s(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(s2e(e,n))az(e,t,s);else{const i=fa(n,"",e);if(t instanceof Map)t.set(i,fa(s,i,e));else if(t instanceof Set)t.add(i);else{const r=i2e(n,i,e),a=fa(s,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function i2e(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if($s(e)&&(n!=null&&n.doc)){const s=iz(n.doc,{});s.anchors=new Set;for(const r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),rz(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function MA(e,t,n){const s=Jm(e,void 0,n),i=Jm(t,void 0,n);return new nr(s,i)}class nr{constructor(t,n=null){Object.defineProperty(this,pa,{value:XH}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return $s(n)&&(n=n.clone(t)),$s(s)&&(s=s.clone(t)),new nr(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return lz(n,s,this)}toString(t,n,s){return t!=null&&t.doc?n2e(this,t,n,s):JSON.stringify(this)}}function cz(e,t,n){return(t.inFlow??e.flow?a2e:r2e)(e,t,n)}function r2e({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:r,type:null});let f=!1;const h=[];for(let m=0;mv=null,()=>f=!0);v&&(y+=Yc(y,r,u(v))),f&&v&&(f=!1),h.push(s+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;mv=null);u||(u=f.length>d||y.includes(` -`)),m0&&(u||(u=f.reduce((x,E)=>x+E.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),v&&(y+=qc(y,s,l(v))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((b,v)=>b+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const b of f)m+=b?` +`+Wo(u(e),c),l&&l()):f&&a&&a(),p}function a2e({items:e},t,{flowChars:n,itemIndent:s}){const{indent:i,indentStep:r,flowCollectionPadding:a,options:{commentString:l}}=t;s+=r;const c=Object.assign({},t,{indent:s,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let m=0;mv=null);u||(u=f.length>d||y.includes(` +`)),m0&&(u||(u=f.reduce((x,E)=>x+E.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),v&&(y+=Yc(y,s,l(v))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((b,v)=>b+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const b of f)m+=b?` ${r}${i}${b}`:` `;return`${m} -${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function D1({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=Yo(t(s),e);n.push(r.trimStart())}}function Yc(e,t){const n=zn(t)?t.value:t;for(const s of e)if(Gs(s)&&(s.key===t||s.key===n||zn(s.key)&&s.key.value===n))return s}class oa extends nz{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(sc,t),this.items=[]}static from(t,n,s){const{keepUndefined:i,replacer:r}=s,a=new this(t),l=(c,u)=>{if(typeof r=="function")u=r.call(n,c,u);else if(Array.isArray(r)&&!r.includes(c))return;(u!==void 0||i)&&a.items.push(MA(c,u,s))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let s;Gs(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Ji(t,t==null?void 0:t.value):s=new Ji(t.key,t.value);const i=Yc(this.items,s.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);zn(i.value)&&tz(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(c=>r(s,c)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(t){const n=Yc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=Yc(this.items,t),i=s==null?void 0:s.value;return(!n&&zn(i)?i.value:i)??void 0}has(t){return!!Yc(this.items,t)}set(t,n){this.add(new Ji(t,n),!0)}toJSON(t,n,s){const i=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items)lz(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Gs(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),cz(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const Eh={collection:"map",default:!0,nodeClass:oa,tag:"tag:yaml.org,2002:map",resolve(e,t){return Fg(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>oa.from(e,t,n)};class _u extends nz{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(bh,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=bb(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=bb(t);if(typeof s!="number")return;const i=this.items[s];return!n&&zn(i)?i.value:i}has(t){const n=bb(t);return typeof n=="number"&&n=0?t:null}const vh={collection:"seq",default:!0,nodeClass:_u,tag:"tag:yaml.org,2002:seq",resolve(e,t){return $g(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>_u.from(e,t,n)},dE={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),OA(e,t,n,s)}},fE={identify:e=>e==null,createNode:()=>new Ct(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ct(null),stringify:({source:e},t)=>typeof e=="string"&&fE.test.test(e)?e:t.options.nullStr},LA={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ct(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&LA.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function Ga({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let a=r.indexOf(".");a<0&&(a=r.length,r+=".");let l=t-(r.length-a-1);for(;l-- >0;)r+="0"}return r}const uz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ga},dz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ga(e)}},fz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Ct(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ga},hE=e=>typeof e=="bigint"||Number.isInteger(e),DA=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function hz(e,t,n){const{value:s}=e;return hE(s)&&s>=0?n+s.toString(t):Ga(e)}const pz={identify:e=>hE(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>DA(e,2,8,n),stringify:e=>hz(e,8,"0o")},mz={identify:hE,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>DA(e,0,10,n),stringify:Ga},gz={identify:e=>hE(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>DA(e,2,16,n),stringify:e=>hz(e,16,"0x")},r2e=[Eh,vh,dE,fE,LA,pz,mz,gz,uz,dz,fz];function W3(e){return typeof e=="bigint"||Number.isInteger(e)}const yb=({value:e})=>JSON.stringify(e),a2e=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:yb},{identify:e=>e==null,createNode:()=>new Ct(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:yb},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:yb},{identify:W3,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>W3(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:yb}],o2e={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},l2e=[Eh,vh].concat(a2e,o2e),PA={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=s.items[0]||new Ji(new Ct(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore} +${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function D1({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=Wo(t(s),e);n.push(r.trimStart())}}function Wc(e,t){const n=Vn(t)?t.value:t;for(const s of e)if(Hs(s)&&(s.key===t||s.key===n||Vn(s.key)&&s.key.value===n))return s}class la extends nz{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ic,t),this.items=[]}static from(t,n,s){const{keepUndefined:i,replacer:r}=s,a=new this(t),l=(c,u)=>{if(typeof r=="function")u=r.call(n,c,u);else if(Array.isArray(r)&&!r.includes(c))return;(u!==void 0||i)&&a.items.push(MA(c,u,s))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let s;Hs(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new nr(t,t==null?void 0:t.value):s=new nr(t.key,t.value);const i=Wc(this.items,s.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Vn(i.value)&&tz(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(c=>r(s,c)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(t){const n=Wc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=Wc(this.items,t),i=s==null?void 0:s.value;return(!n&&Vn(i)?i.value:i)??void 0}has(t){return!!Wc(this.items,t)}set(t,n){this.add(new nr(t,n),!0)}toJSON(t,n,s){const i=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items)lz(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Hs(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),cz(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const vh={collection:"map",default:!0,nodeClass:la,tag:"tag:yaml.org,2002:map",resolve(e,t){return Fg(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>la.from(e,t,n)};class Su extends nz{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(yh,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=bb(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=bb(t);if(typeof s!="number")return;const i=this.items[s];return!n&&Vn(i)?i.value:i}has(t){const n=bb(t);return typeof n=="number"&&n=0?t:null}const wh={collection:"seq",default:!0,nodeClass:Su,tag:"tag:yaml.org,2002:seq",resolve(e,t){return $g(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Su.from(e,t,n)},dE={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),OA(e,t,n,s)}},fE={identify:e=>e==null,createNode:()=>new It(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new It(null),stringify:({source:e},t)=>typeof e=="string"&&fE.test.test(e)?e:t.options.nullStr},LA={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new It(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&LA.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function Ka({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let a=r.indexOf(".");a<0&&(a=r.length,r+=".");let l=t-(r.length-a-1);for(;l-- >0;)r+="0"}return r}const uz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ka},dz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ka(e)}},fz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new It(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ka},hE=e=>typeof e=="bigint"||Number.isInteger(e),DA=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function hz(e,t,n){const{value:s}=e;return hE(s)&&s>=0?n+s.toString(t):Ka(e)}const pz={identify:e=>hE(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>DA(e,2,8,n),stringify:e=>hz(e,8,"0o")},mz={identify:hE,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>DA(e,0,10,n),stringify:Ka},gz={identify:e=>hE(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>DA(e,2,16,n),stringify:e=>hz(e,16,"0x")},o2e=[vh,wh,dE,fE,LA,pz,mz,gz,uz,dz,fz];function W3(e){return typeof e=="bigint"||Number.isInteger(e)}const yb=({value:e})=>JSON.stringify(e),l2e=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:yb},{identify:e=>e==null,createNode:()=>new It(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:yb},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:yb},{identify:W3,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>W3(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:yb}],c2e={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},u2e=[vh,wh].concat(l2e,c2e),PA={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=s.items[0]||new nr(new It(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore} ${i.key.commentBefore}`:s.commentBefore),s.comment){const r=i.value??i.key;r.comment=r.comment?`${s.comment} -${r.comment}`:s.comment}s=i}e.items[n]=Gs(s)?s:new Ji(s)}}else t("Expected a sequence for this tag");return e}function yz(e,t,n){const{replacer:s}=n,i=new _u(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof s=="function"&&(a=s.call(t,String(r++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(MA(l,c,n))}return i}const BA={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bz,createNode:yz};class lf extends _u{constructor(){super(),this.add=oa.prototype.add.bind(this),this.delete=oa.prototype.delete.bind(this),this.get=oa.prototype.get.bind(this),this.has=oa.prototype.has.bind(this),this.set=oa.prototype.set.bind(this),this.tag=lf.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items){let r,a;if(Gs(i)?(r=da(i.key,"",n),a=da(i.value,r,n)):r=da(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,a)}return s}static from(t,n,s){const i=yz(t,n,s),r=new this;return r.items=i.items,r}}lf.tag="tag:yaml.org,2002:omap";const UA={collection:"seq",identify:e=>e instanceof Map,nodeClass:lf,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=bz(e,t),s=[];for(const{key:i}of n.items)zn(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new lf,n)},createNode:(e,t,n)=>lf.from(e,t,n)};function xz({value:e,source:t},n){return t&&(e?Ez:vz).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const Ez={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ct(!0),stringify:xz},vz={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ct(!1),stringify:xz},c2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ga},u2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ga(e)}},d2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Ct(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Ga},Hg=e=>typeof e=="bigint"||Number.isInteger(e);function pE(e,t,n,{intAsBigInt:s}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return i==="-"?BigInt(-1)*a:a}const r=parseInt(e,n);return i==="-"?-1*r:r}function FA(e,t,n){const{value:s}=e;if(Hg(s)){const i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return Ga(e)}const f2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>pE(e,2,2,n),stringify:e=>FA(e,2,"0b")},h2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>pE(e,1,8,n),stringify:e=>FA(e,8,"0")},p2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>pE(e,0,10,n),stringify:Ga},m2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>pE(e,2,16,n),stringify:e=>FA(e,16,"0x")};class cf extends oa{constructor(t){super(t),this.tag=cf.tag}add(t){let n;Gs(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ji(t.key,null):n=new Ji(t,null),Yc(this.items,n.key)||this.items.push(n)}get(t,n){const s=Yc(this.items,t);return!n&&Gs(s)?zn(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const s=Yc(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Ji(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),r.items.push(MA(a,null,s));return r}}cf.tag="tag:yaml.org,2002:set";const $A={collection:"map",identify:e=>e instanceof Set,nodeClass:cf,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>cf.from(e,t,n),resolve(e,t){if(Fg(e)){if(e.hasAllNullValues(!0))return Object.assign(new cf,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function HA(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),r=s.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function wz(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Ga(e);let s="";t<0&&(s="-",t*=n(-1));const i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const _z={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>HA(e,n),stringify:wz},Sz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>HA(e,!1),stringify:wz},mE={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(mE.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,i,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,s-1,i,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=HA(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},X3=[Eh,vh,dE,fE,Ez,vz,f2e,h2e,p2e,m2e,c2e,u2e,d2e,PA,el,UA,BA,$A,_z,Sz,mE],Q3=new Map([["core",r2e],["failsafe",[Eh,vh,dE]],["json",l2e],["yaml11",X3],["yaml-1.1",X3]]),Z3={binary:PA,bool:LA,float:fz,floatExp:dz,floatNaN:uz,floatTime:Sz,int:mz,intHex:gz,intOct:pz,intTime:_z,map:Eh,merge:el,null:fE,omap:UA,pairs:BA,seq:vh,set:$A,timestamp:mE},g2e={"tag:yaml.org,2002:binary":PA,"tag:yaml.org,2002:merge":el,"tag:yaml.org,2002:omap":UA,"tag:yaml.org,2002:pairs":BA,"tag:yaml.org,2002:set":$A,"tag:yaml.org,2002:timestamp":mE};function qw(e,t,n){const s=Q3.get(t);if(s&&!e)return n&&!s.includes(el)?s.concat(el):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{const r=Array.from(Q3.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(el)),i.reduce((r,a)=>{const l=typeof a=="string"?Z3[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(Z3).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return r.includes(l)||r.push(l),r},[])}const b2e=(e,t)=>e.keyt.key?1:0;class zA{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?qw(t,"compat"):t?qw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?g2e:{},this.tags=qw(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,sc,{value:Eh}),Object.defineProperty(this,po,{value:dE}),Object.defineProperty(this,bh,{value:vh}),this.sortMapEntries=typeof a=="function"?a:a===!0?b2e:null}clone(){const t=Object.create(zA.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function y2e(e,t){var c;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const i=iz(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Yo(u,""))}let a=!1,l=null;if(e.contents){if(Vs(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Yo(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=Hf(e.contents,i,()=>l=null,u);l&&(d+=qc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Hf(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` -`)?(n.push("..."),n.push(Yo(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||l)&&n[n.length-1]!==""&&n.push(""),n.push(Yo(r(u),"")))}return n.join(` +${r.comment}`:s.comment}s=i}e.items[n]=Hs(s)?s:new nr(s)}}else t("Expected a sequence for this tag");return e}function yz(e,t,n){const{replacer:s}=n,i=new Su(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof s=="function"&&(a=s.call(t,String(r++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(MA(l,c,n))}return i}const BA={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bz,createNode:yz};class cf extends Su{constructor(){super(),this.add=la.prototype.add.bind(this),this.delete=la.prototype.delete.bind(this),this.get=la.prototype.get.bind(this),this.has=la.prototype.has.bind(this),this.set=la.prototype.set.bind(this),this.tag=cf.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items){let r,a;if(Hs(i)?(r=fa(i.key,"",n),a=fa(i.value,r,n)):r=fa(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,a)}return s}static from(t,n,s){const i=yz(t,n,s),r=new this;return r.items=i.items,r}}cf.tag="tag:yaml.org,2002:omap";const UA={collection:"seq",identify:e=>e instanceof Map,nodeClass:cf,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=bz(e,t),s=[];for(const{key:i}of n.items)Vn(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new cf,n)},createNode:(e,t,n)=>cf.from(e,t,n)};function xz({value:e,source:t},n){return t&&(e?Ez:vz).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const Ez={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new It(!0),stringify:xz},vz={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new It(!1),stringify:xz},d2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ka},f2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ka(e)}},h2e={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new It(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Ka},Hg=e=>typeof e=="bigint"||Number.isInteger(e);function pE(e,t,n,{intAsBigInt:s}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return i==="-"?BigInt(-1)*a:a}const r=parseInt(e,n);return i==="-"?-1*r:r}function FA(e,t,n){const{value:s}=e;if(Hg(s)){const i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return Ka(e)}const p2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>pE(e,2,2,n),stringify:e=>FA(e,2,"0b")},m2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>pE(e,1,8,n),stringify:e=>FA(e,8,"0")},g2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>pE(e,0,10,n),stringify:Ka},b2e={identify:Hg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>pE(e,2,16,n),stringify:e=>FA(e,16,"0x")};class uf extends la{constructor(t){super(t),this.tag=uf.tag}add(t){let n;Hs(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new nr(t.key,null):n=new nr(t,null),Wc(this.items,n.key)||this.items.push(n)}get(t,n){const s=Wc(this.items,t);return!n&&Hs(s)?Vn(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const s=Wc(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new nr(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),r.items.push(MA(a,null,s));return r}}uf.tag="tag:yaml.org,2002:set";const $A={collection:"map",identify:e=>e instanceof Set,nodeClass:uf,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>uf.from(e,t,n),resolve(e,t){if(Fg(e)){if(e.hasAllNullValues(!0))return Object.assign(new uf,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function HA(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),r=s.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function wz(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Ka(e);let s="";t<0&&(s="-",t*=n(-1));const i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const _z={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>HA(e,n),stringify:wz},Sz={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>HA(e,!1),stringify:wz},mE={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(mE.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,i,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,s-1,i,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=HA(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},X3=[vh,wh,dE,fE,Ez,vz,p2e,m2e,g2e,b2e,d2e,f2e,h2e,PA,tl,UA,BA,$A,_z,Sz,mE],Q3=new Map([["core",o2e],["failsafe",[vh,wh,dE]],["json",u2e],["yaml11",X3],["yaml-1.1",X3]]),Z3={binary:PA,bool:LA,float:fz,floatExp:dz,floatNaN:uz,floatTime:Sz,int:mz,intHex:gz,intOct:pz,intTime:_z,map:vh,merge:tl,null:fE,omap:UA,pairs:BA,seq:wh,set:$A,timestamp:mE},y2e={"tag:yaml.org,2002:binary":PA,"tag:yaml.org,2002:merge":tl,"tag:yaml.org,2002:omap":UA,"tag:yaml.org,2002:pairs":BA,"tag:yaml.org,2002:set":$A,"tag:yaml.org,2002:timestamp":mE};function qw(e,t,n){const s=Q3.get(t);if(s&&!e)return n&&!s.includes(tl)?s.concat(tl):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{const r=Array.from(Q3.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(tl)),i.reduce((r,a)=>{const l=typeof a=="string"?Z3[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(Z3).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return r.includes(l)||r.push(l),r},[])}const x2e=(e,t)=>e.keyt.key?1:0;class zA{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?qw(t,"compat"):t?qw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?y2e:{},this.tags=qw(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,ic,{value:vh}),Object.defineProperty(this,mo,{value:dE}),Object.defineProperty(this,yh,{value:wh}),this.sortMapEntries=typeof a=="function"?a:a===!0?x2e:null}clone(){const t=Object.create(zA.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function E2e(e,t){var c;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const i=iz(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Wo(u,""))}let a=!1,l=null;if(e.contents){if($s(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Wo(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=zf(e.contents,i,()=>l=null,u);l&&(d+=Yc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(zf(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` +`)?(n.push("..."),n.push(Wo(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||l)&&n[n.length-1]!==""&&n.push(""),n.push(Wo(r(u),"")))}return n.join(` `)+` -`}class zg{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ha,{value:PN});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:a}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Xi({version:a}),this.setSchema(a,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){const t=Object.create(zg.prototype,{[ha]:{value:PN}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Vs(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ld(this.contents)&&this.contents.add(t)}addIn(t,n){ld(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=JH(this);t.anchor=!n||s.has(n)?ez(n||"a",s):n}return new RA(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),i=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=s??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Kke(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},b=Jm(t,d,m);return l&&Hs(b)&&(b.flow=!0),h(),b}createPair(t,n,s={}){const i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new Ji(i,r)}delete(t){return ld(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Sp(t)?this.contents==null?!1:(this.contents=null,!0):ld(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Hs(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Sp(t)?!n&&zn(this.contents)?this.contents.value:this.contents:Hs(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Hs(this.contents)?this.contents.has(t):!1}hasIn(t){return Sp(t)?this.contents!==void 0:Hs(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=L1(this.schema,[t],n):ld(this.contents)&&this.contents.set(t,n)}setIn(t,n){Sp(t)?this.contents=n:this.contents==null?this.contents=L1(this.schema,Array.from(t),n):ld(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Xi({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Xi({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new zA(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=da(this.contents,n??"",l);if(typeof r=="function")for(const{count:u,res:d}of l.anchors.values())r(d,u);return typeof a=="function"?Kd(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return y2e(this,t)}}function ld(e){if(Hs(e))return!0;throw new Error("Expected a YAML collection as document contents")}class Nz extends Error{constructor(t,n,s,i){super(),this.name=t,this.code=s,this.message=i,this.pos=n}}class Np extends Nz{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class x2e extends Nz{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const J3=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,a=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&a.length>80){const l=Math.min(r-39,a.length-79);a="…"+a.substring(l),r-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),s>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`… +`}class zg{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,pa,{value:PN});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:a}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Ji({version:a}),this.setSchema(a,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){const t=Object.create(zg.prototype,{[pa]:{value:PN}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=$s(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){cd(this.contents)&&this.contents.add(t)}addIn(t,n){cd(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=JH(this);t.anchor=!n||s.has(n)?ez(n||"a",s):n}return new RA(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),i=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=s??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Yke(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},b=Jm(t,d,m);return l&&Us(b)&&(b.flow=!0),h(),b}createPair(t,n,s={}){const i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new nr(i,r)}delete(t){return cd(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Sp(t)?this.contents==null?!1:(this.contents=null,!0):cd(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Us(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Sp(t)?!n&&Vn(this.contents)?this.contents.value:this.contents:Us(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Us(this.contents)?this.contents.has(t):!1}hasIn(t){return Sp(t)?this.contents!==void 0:Us(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=L1(this.schema,[t],n):cd(this.contents)&&this.contents.set(t,n)}setIn(t,n){Sp(t)?this.contents=n:this.contents==null?this.contents=L1(this.schema,Array.from(t),n):cd(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ji({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ji({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new zA(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=fa(this.contents,n??"",l);if(typeof r=="function")for(const{count:u,res:d}of l.anchors.values())r(d,u);return typeof a=="function"?qd(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return E2e(this,t)}}function cd(e){if(Us(e))return!0;throw new Error("Expected a YAML collection as document contents")}class Nz extends Error{constructor(t,n,s,i){super(),this.name=t,this.code=s,this.message=i,this.pos=n}}class Np extends Nz{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class v2e extends Nz{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const J3=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,a=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&a.length>80){const l=Math.min(r-39,a.length-79);a="…"+a.substring(l),r-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),s>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`… `),a=l+a}if(/[^ ]/.test(a)){let l=1;const c=n.linePos[1];(c==null?void 0:c.line)===s&&c.col>i&&(l=Math.max(1,Math.min(c.col-i,80-r)));const u=" ".repeat(r)+"^".repeat(l);n.message+=`: ${a} ${u} -`}};function zf(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,b=null,v=null,y=null,x=null,E=null,w=null,S=null;for(const k of e)switch(m&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),b&&(u&&k.type!=="comment"&&k.type!=="newline"&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),k.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&k.source.includes(" ")&&(b=k),d=!0;break;case"comment":{d||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const A=k.source.substring(1)||" ";f?f+=h+A:f=A,h="",u=!1;break}case"newline":u?f?f+=k.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=k.source,u=!0,p=!0,(v||y)&&(x=k),d=!0;break;case"anchor":v&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=k,S??(S=k.offset),u=!1,d=!1,m=!0;break;case"tag":{y&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,S??(S=k.offset),u=!1,d=!1,m=!0;break}case n:(v||y)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),w&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${t??"collection"}`),w=k,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){E&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),E=k,u=!1,d=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),u=!1,d=!1}const _=e[e.length-1],T=_?_.offset+_.source.length:i;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:v,tag:y,newlineAfterProp:x,end:T,start:S??T}}function eg(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(eg(t.key)||eg(t.value))return!0}return!1;default:return!0}}function $N(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&eg(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Tz(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,a)=>r===a||zn(r)&&zn(a)&&r.value===a.value;return t.some(r=>i(r.key,n))}const eD="All mapping items must start at the same column";function E2e({composeNode:e,composeEmptyNode:t},n,s,i,r){var d;const a=(r==null?void 0:r.nodeClass)??oa,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,u=null;for(const f of s.items){const{start:h,key:p,sep:m,value:b}=f,v=zf(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&i(c,"BAD_INDENT",eD)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` -`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||eg(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=v.found)==null?void 0:d.indent)!==s.indent&&i(c,"BAD_INDENT",eD);n.atKey=!0;const x=v.end,E=p?e(n,p,v,i):t(n,x,h,null,v,i);n.schema.compat&&$N(s.indent,p,i),n.atKey=!1,Tz(n,l.items,E)&&i(x,"DUPLICATE_KEY","Map keys must be unique");const w=zf(m??[],{indicator:"map-value-ind",next:b,offset:E.range[2],onError:i,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&v.starte&&(e.type==="block-map"||e.type==="block-seq");function w2e({composeNode:e,composeEmptyNode:t},n,s,i,r){var v;const a=s.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?oa:_u),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let y=0;y0){const y=Vg(m,b,n.options.strict,i);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[s.offset,b,y.offset]}else u.range=[s.offset,b,b];return u}function Xw(e,t,n,s,i,r){const a=n.type==="block-map"?E2e(e,t,n,s,r):n.type==="block-seq"?v2e(e,t,n,s,r):w2e(e,t,n,s,r),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function _2e(e,t,n,s,i){var h;const r=s.tag,a=r?t.directives.tagName(r.source,p=>i(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=s,b=p&&r?p.offset>r.offset?p:r:p??r;b&&(!m||m.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Xw(e,t,n,i,a)}const u=Xw(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Vs(d)?d:new Ct(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function S2e(e,t,n){const s=t.offset,i=N2e(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?Ct.BLOCK_FOLDED:Ct.BLOCK_LITERAL,a=t.source?T2e(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const v=a[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` +`}};function Vf(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,b=null,v=null,y=null,x=null,E=null,w=null,S=null;for(const k of e)switch(m&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),b&&(u&&k.type!=="comment"&&k.type!=="newline"&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),k.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&k.source.includes(" ")&&(b=k),d=!0;break;case"comment":{d||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const A=k.source.substring(1)||" ";f?f+=h+A:f=A,h="",u=!1;break}case"newline":u?f?f+=k.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=k.source,u=!0,p=!0,(v||y)&&(x=k),d=!0;break;case"anchor":v&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=k,S??(S=k.offset),u=!1,d=!1,m=!0;break;case"tag":{y&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,S??(S=k.offset),u=!1,d=!1,m=!0;break}case n:(v||y)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),w&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${t??"collection"}`),w=k,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){E&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),E=k,u=!1,d=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),u=!1,d=!1}const _=e[e.length-1],T=_?_.offset+_.source.length:i;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:v,tag:y,newlineAfterProp:x,end:T,start:S??T}}function eg(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` +`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(eg(t.key)||eg(t.value))return!0}return!1;default:return!0}}function $N(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&eg(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Tz(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,a)=>r===a||Vn(r)&&Vn(a)&&r.value===a.value;return t.some(r=>i(r.key,n))}const eD="All mapping items must start at the same column";function w2e({composeNode:e,composeEmptyNode:t},n,s,i,r){var d;const a=(r==null?void 0:r.nodeClass)??la,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,u=null;for(const f of s.items){const{start:h,key:p,sep:m,value:b}=f,v=Vf(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&i(c,"BAD_INDENT",eD)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` +`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||eg(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=v.found)==null?void 0:d.indent)!==s.indent&&i(c,"BAD_INDENT",eD);n.atKey=!0;const x=v.end,E=p?e(n,p,v,i):t(n,x,h,null,v,i);n.schema.compat&&$N(s.indent,p,i),n.atKey=!1,Tz(n,l.items,E)&&i(x,"DUPLICATE_KEY","Map keys must be unique");const w=Vf(m??[],{indicator:"map-value-ind",next:b,offset:E.range[2],onError:i,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&v.starte&&(e.type==="block-map"||e.type==="block-seq");function S2e({composeNode:e,composeEmptyNode:t},n,s,i,r){var v;const a=s.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?la:Su),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let y=0;y0){const y=Vg(m,b,n.options.strict,i);y.comment&&(u.comment?u.comment+=` +`+y.comment:u.comment=y.comment),u.range=[s.offset,b,y.offset]}else u.range=[s.offset,b,b];return u}function Xw(e,t,n,s,i,r){const a=n.type==="block-map"?w2e(e,t,n,s,r):n.type==="block-seq"?_2e(e,t,n,s,r):S2e(e,t,n,s,r),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function N2e(e,t,n,s,i){var h;const r=s.tag,a=r?t.directives.tagName(r.source,p=>i(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=s,b=p&&r?p.offset>r.offset?p:r:p??r;b&&(!m||m.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Xw(e,t,n,i,a)}const u=Xw(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=$s(d)?d:new It(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function T2e(e,t,n){const s=t.offset,i=k2e(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?It.BLOCK_FOLDED:It.BLOCK_LITERAL,a=t.source?A2e(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const v=a[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let v=s+i.length;return t.source&&(v+=t.source.length),{value:b,type:r,comment:i.comment,range:[s,v,v]}}let c=t.indent+i.indent,u=t.offset+i.length,d=0;for(let b=0;bc&&(c=v.length);else{v.length=l;--b)a[b][0].length>c&&(l=b+1);let f="",h="",p=!1;for(let b=0;bc||y[0]===" "?(h===" "?h=` `:!p&&h===` `&&(h=` @@ -1018,78 +1018,78 @@ ${u} `+a[b][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const m=s+i.length+t.source.length;return{value:f,type:r,comment:i.comment,range:[s,m,m]}}function N2e({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=t[0],r=i[0];let a=0,l="",c=-1;for(let h=1;hn(s+h,p,m);switch(i){case"scalar":l=Ct.PLAIN,c=A2e(r,u);break;case"single-quoted-scalar":l=Ct.QUOTE_SINGLE,c=C2e(r,u);break;case"double-quoted-scalar":l=Ct.QUOTE_DOUBLE,c=I2e(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const d=s+r.length,f=Vg(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[s,d,f.offset]}}function A2e(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),kz(e)}function C2e(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),kz(e.slice(1,-1)).replace(/''/g,"'")}function kz(e){let t,n;try{t=new RegExp(`(.*?)(?n(s+h,p,m);switch(i){case"scalar":l=It.PLAIN,c=I2e(r,u);break;case"single-quoted-scalar":l=It.QUOTE_SINGLE,c=j2e(r,u);break;case"double-quoted-scalar":l=It.QUOTE_DOUBLE,c=R2e(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const d=s+r.length,f=Vg(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[s,d,f.offset]}}function I2e(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),kz(e)}function j2e(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),kz(e.slice(1,-1)).replace(/''/g,"'")}function kz(e){let t,n;try{t=new RegExp(`(.*?)(?r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function j2e(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===` +`)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function O2e(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===` `||s==="\r")&&!(s==="\r"&&e[t+2]!==` `);)s===` `&&(n+=` -`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}const R2e={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function O2e(e,t,n,s){const i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{const l=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function Az(e,t,n,s){const{value:i,type:r,comment:a,range:l}=t.type==="block-scalar"?S2e(e,t,s):k2e(t,e.options.strict,s),c=n?e.directives.tagName(n.source,f=>s(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[po]:c?u=M2e(e.schema,i,c,n,s):t.type==="scalar"?u=L2e(e,i,t,s):u=e.schema[po];let d;try{const f=u.resolve(i,h=>s(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=zn(f)?f:new Ct(f)}catch(f){const h=f instanceof Error?f.message:String(f);s(n??t,"TAG_RESOLVE_FAILED",h),d=new Ct(i)}return d.range=l,d.source=i,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function M2e(e,t,n,s,i){var l;if(n==="!")return e[po];const r=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)r.push(c);else return c;for(const c of r)if((l=c.test)!=null&&l.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[po])}function L2e({atKey:e,directives:t,schema:n},s,i,r){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(s))})||n[po];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(s))})??n[po];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function D2e(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++s];break}}return e}const P2e={composeNode:Cz,composeEmptyNode:VA};function Cz(e,t,n,s){const i=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=B2e(e,t,s),(l||c)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=Az(e,t,c,s),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=_2e(P2e,e,t,n,s),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);s(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=VA(e,t.offset,void 0,null,n,s)),l&&u.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!zn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function VA(e,t,n,s,{spaceBefore:i,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:D2e(t,n,s),indent:-1,source:""},f=Az(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=c),f}function B2e({options:e},{offset:t,source:n,end:s},i){const r=new RA(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Vg(s,a,e.strict,i);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function U2e(e,t,{offset:n,start:s,value:i,end:r},a){const l=Object.assign({_directives:t},e),c=new zg(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=zf(s,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Cz(u,i,d,a):VA(u,d.end,s,null,d,a);const f=c.contents.range[2],h=Vg(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function ap(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function tD(e){var i;let t="",n=!1,s=!1;for(let r=0;rs(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[mo]:c?u=D2e(e.schema,i,c,n,s):t.type==="scalar"?u=P2e(e,i,t,s):u=e.schema[mo];let d;try{const f=u.resolve(i,h=>s(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Vn(f)?f:new It(f)}catch(f){const h=f instanceof Error?f.message:String(f);s(n??t,"TAG_RESOLVE_FAILED",h),d=new It(i)}return d.range=l,d.source=i,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function D2e(e,t,n,s,i){var l;if(n==="!")return e[mo];const r=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)r.push(c);else return c;for(const c of r)if((l=c.test)!=null&&l.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[mo])}function P2e({atKey:e,directives:t,schema:n},s,i,r){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(s))})||n[mo];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(s))})??n[mo];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function B2e(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++s];break}}return e}const U2e={composeNode:Cz,composeEmptyNode:VA};function Cz(e,t,n,s){const i=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=F2e(e,t,s),(l||c)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=Az(e,t,c,s),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=N2e(U2e,e,t,n,s),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);s(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=VA(e,t.offset,void 0,null,n,s)),l&&u.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Vn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function VA(e,t,n,s,{spaceBefore:i,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:B2e(t,n,s),indent:-1,source:""},f=Az(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=c),f}function F2e({options:e},{offset:t,source:n,end:s},i){const r=new RA(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Vg(s,a,e.strict,i);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function $2e(e,t,{offset:n,start:s,value:i,end:r},a){const l=Object.assign({_directives:t},e),c=new zg(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Vf(s,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Cz(u,i,d,a):VA(u,d.end,s,null,d,a);const f=c.contents.range[2],h=Vg(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function ap(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function tD(e){var i;let t="",n=!1,s=!1;for(let r=0;r{const a=ap(n);r?this.warnings.push(new x2e(a,s,i)):this.errors.push(new Np(a,s,i))},this.directives=new Xi({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:i}=tD(this.prelude);if(s){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} -${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(Hs(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Gs(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${s} +`)+(a.substring(1)||" "),n=!0,s=!1;break;case"%":((i=e[r+1])==null?void 0:i[0])!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}class H2e{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{const a=ap(n);r?this.warnings.push(new v2e(a,s,i)):this.errors.push(new Np(a,s,i))},this.directives=new Ji({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:i}=tD(this.prelude);if(s){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} +${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(Us(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Hs(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${s} ${l}`:s}else{const a=r.commentBefore;r.commentBefore=a?`${s} -${a}`:s}}if(n){for(let r=0;r{const r=ap(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=U2e(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new Np(ap(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new Np(ap(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=Vg(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Np(ap(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const s=Object.assign({_directives:this.directives},this.options),i=new zg(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}const Iz="\uFEFF",jz="",Rz="",HN="";function $2e(e){switch(e){case Iz:return"byte-order-mark";case jz:return"doc-mode";case Rz:return"flow-error-end";case HN:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:s}}if(n){for(let r=0;r{const r=ap(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=$2e(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new Np(ap(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new Np(ap(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=Vg(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Np(ap(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const s=Object.assign({_directives:this.directives},this.options),i=new zg(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}const Iz="\uFEFF",jz="",Rz="",HN="";function z2e(e){switch(e){case Iz:return"byte-order-mark";case jz:return"doc-mode";case Rz:return"flow-error-end";case HN:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function _a(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const nD=new Set("0123456789ABCDEFabcdef"),H2e=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xb=new Set(",[]{}"),z2e=new Set(` ,[]{} -\r `),Qw=e=>!e||z2e.has(e);class V2e{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Sa(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}const nD=new Set("0123456789ABCDEFabcdef"),V2e=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xb=new Set(",[]{}"),G2e=new Set(` ,[]{} +\r `),Qw=e=>!e||G2e.has(e);class K2e{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){const i=this.buffer[s+t+1];if(i===` `||!i&&!this.atEnd)return t+s+1}return n===` -`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&_a(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!_a(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&_a(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Qw),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&Sa(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!Sa(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Sa(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Qw),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>_a(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case` +`,r)}i!==-1&&(n=i-(s[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Sa(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case` `:t=r,n=0;break;case"\r":{const a=this.buffer[r+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===` `)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const r=this.continueScalar(t+1);if(r===-1)break;t=this.buffer.indexOf(` `,r)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===` `;)s=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let r=t-1,a=this.buffer[r];a==="\r"&&(a=this.buffer[--r]);const l=r;for(;a===" ";)a=this.buffer[--r];if(a===` -`&&r>=this.pos&&r+1+n>l)t=r;else break}while(!0);return yield HN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(_a(r)||t&&xb.has(r))break;n=s}else if(_a(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===` +`&&r>=this.pos&&r+1+n>l)t=r;else break}while(!0);return yield HN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(Sa(r)||t&&xb.has(r))break;n=s}else if(Sa(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===` `?(s+=1,i=` `,r=this.buffer[s+1]):n=s),r==="#"||t&&xb.has(r))break;if(i===` -`){const a=this.continueScalar(s+1);if(a===-1)break;s=Math.max(s,a-2)}}else{if(t&&xb.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield HN,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Qw),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,s=this.charAt(1);if(_a(s)||n&&xb.has(s)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!_a(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(H2e.has(n))n=this.buffer[++t];else if(n==="%"&&nD.has(this.buffer[t+1])&&nD.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` +`){const a=this.continueScalar(s+1);if(a===-1)break;s=Math.max(s,a-2)}}else{if(t&&xb.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield HN,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Qw),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,s=this.charAt(1);if(Sa(s)||n&&xb.has(s)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Sa(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(V2e.has(n))n=this.buffer[++t];else if(n==="%"&&nD.has(this.buffer[t+1])&&nD.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class G2e{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n>1;this.lineStarts[r]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function P1(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&iD(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&sD(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class q2e{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n>1;this.lineStarts[r]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function P1(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&iD(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&sD(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(r&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Rl(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Oz(n.key)&&!Rl(n.sep,"newline")){const l=cd(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Rl(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=cd(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Rl(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);r||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Rl(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){P1(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Rl(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=Eb(s),r=cd(i);iD(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` +`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){P1(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(r&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ol(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Oz(n.key)&&!Ol(n.sep,"newline")){const l=ud(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Ol(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=ud(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ol(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);r||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ol(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){P1(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ol(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=Eb(s),r=ud(i);iD(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` -`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Eb(t),s=cd(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Eb(t),s=cd(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function q2e(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new G2e||null,prettyErrors:t}}function Y2e(e,t={}){const{lineCounter:n,prettyErrors:s}=q2e(t),i=new K2e(n==null?void 0:n.addNewLine),r=new F2e(t);let a=null;for(const l of r.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new Np(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(a.errors.forEach(J3(e,n)),a.warnings.forEach(J3(e,n))),a}function W2e(e,t,n){let s;const i=Y2e(e,n);if(!i)return null;if(i.warnings.forEach(r=>rz(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function X2e(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Ug(e)&&!s?e.toString(n):new zg(e,s,n).toString(n)}const Mz=new Set(["local","sqlite","mysql","postgresql"]),Lz=new Set(["local","opensearch","redis","viking","openviking","mem0"]),Dz=new Set(["opensearch","viking","context_search"]),Pz=new Set(["apmplus","cozeloop","tls"]),Bz=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Q2e=new Set(b7.map(e=>e.id)),Z2e=new Set(["llm","sequential","parallel","loop","a2a"]);function jt(e,t=""){return typeof e=="string"?e:t}function sa(e){return e===!0}function lm(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function J2e(e){return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function Uz(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:jt(t.name),description:jt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function uf(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function Fz(e){return typeof e=="string"&&Z2e.has(e)?e:"llm"}function $z(e){return e==="byteplus"?"byteplus":"volcengine"}function Hz(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function zz(e){const t=e&&typeof e=="object"?e:{};return{enabled:sa(t.enabled),registrySpaceId:jt(t.registrySpaceId),registryTopK:jt(t.registryTopK),registryRegion:jt(t.registryRegion),registryEndpoint:jt(t.registryEndpoint)}}function Vz(e,t="volcengine"){return Array.isArray(e)?e.map(n=>{const s=n&&typeof n=="object"?n:{},i=$z(s.cloudProvider??t),r=s.memory&&typeof s.memory=="object"?s.memory:{},a=zz(s.a2aRegistry),l=Fz(s.agentType),c=a.enabled&&l==="llm"?"a2a":l;return{...Ci(i),cloudProvider:i,name:jt(s.name),description:jt(s.description),instruction:jt(s.instruction),agentType:c,maxIterations:Hz(s.maxIterations),a2aUrl:jt(s.a2aUrl),modelName:jt(s.modelName),modelProvider:jt(s.modelProvider),modelApiBase:jt(s.modelApiBase),builtinTools:lm(s.builtinTools).filter(u=>Bz.has(u)),customTools:Uz(s.customTools),memory:{shortTerm:sa(r.shortTerm),longTerm:sa(r.longTerm)},shortTermBackend:uf(s.shortTermBackend,Mz,"local"),longTermBackend:uf(s.longTermBackend,Lz,"local"),autoSaveSession:sa(s.autoSaveSession),knowledgebase:sa(s.knowledgebase),knowledgebaseBackend:uf(s.knowledgebaseBackend,Dz,vu),knowledgebaseIndex:jt(s.knowledgebaseIndex),tracing:sa(s.tracing),tracingExporters:lm(s.tracingExporters).filter(u=>Pz.has(u)),a2aRegistry:c==="a2a"?{...a,enabled:!0}:a,subAgents:Vz(s.subAgents,i),selectedSkills:Gz(s)}}):[]}function Gz(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const s=n&&typeof n=="object"?n:{},i=jt(s.source),r=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=jt(s.name)||jt(s.slug)||jt(s.skillName)||jt(s.skillId)||"skill",l=jt(s.folder)||a,c=jt(s.description);if(r==="skillhub"){const f=jt(s.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:jt(s.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(s.localFiles)?s.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=jt(m.path),v=jt(m.content);return b?{path:b,content:v}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:r,folder:l,name:a,description:c,localFiles:h});continue}const u=jt(s.skillSpaceId),d=jt(s.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:jt(s.skillSpaceName),skillId:d,version:jt(s.version)})}return t}function GA(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},s=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=J2e(s.envValues),r=zz(t.a2aRegistry),a=Fz(t.agentType),l=r.enabled&&a==="llm"?"a2a":a,c=$z(t.cloudProvider),u=Array.isArray(t.mcpTools)?t.mcpTools.map(d=>{const f=d&&typeof d=="object"?d:{},h=f.transport==="stdio"?"stdio":"http";return{name:jt(f.name),transport:h,url:jt(f.url),authToken:jt(f.authToken),authTokenEnv:jt(f.authTokenEnv),command:jt(f.command),args:lm(f.args)}}).filter(d=>d.transport==="http"?!!d.url:!!d.command):[];return{...Ci(c),cloudProvider:c,name:jt(t.name)||"my_agent",description:jt(t.description),instruction:jt(t.instruction)||"You are a helpful assistant.",agentType:l,maxIterations:Hz(t.maxIterations),a2aUrl:jt(t.a2aUrl),modelName:jt(t.modelName),modelProvider:jt(t.modelProvider),modelApiBase:jt(t.modelApiBase),builtinTools:lm(t.builtinTools).filter(d=>Bz.has(d)),customTools:Uz(t.customTools),mcpTools:u,a2aRegistry:l==="a2a"?{...r,enabled:!0}:r,memory:{shortTerm:sa(n.shortTerm),longTerm:sa(n.longTerm)},shortTermBackend:uf(t.shortTermBackend,Mz,"local"),longTermBackend:uf(t.longTermBackend,Lz,"local"),autoSaveSession:sa(t.autoSaveSession),knowledgebase:sa(t.knowledgebase),knowledgebaseBackend:uf(t.knowledgebaseBackend,Dz,vu),knowledgebaseIndex:jt(t.knowledgebaseIndex),tracing:sa(t.tracing),tracingExporters:lm(t.tracingExporters).filter(d=>Pz.has(d)),deployment:{feishuEnabled:sa(s.feishuEnabled),...Object.keys(i).length>0?{envValues:i}:{}},subAgents:Vz(t.subAgents,c),selectedSkills:Gz(t)}}function Kz(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>Q2e.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:vu,knowledgebaseIndex:"",subAgents:e.subAgents.map(Kz)}}const eAe=/^[A-Za-z_][A-Za-z0-9_]*$/,KA=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function rD(e,t){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||t}function tAe(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n+=1;return`${e}_${n}`}function qz(e){var n,s,i;const t=(n=e.authTokenEnv)==null?void 0:n.trim();return t&&eAe.test(t)?t:((i=(s=e.authToken)==null?void 0:s.trim().match(KA))==null?void 0:i[1])??""}function nAe(e){if(e.authToken)return e.authToken;const t=qz(e);return t?`\${${t}}`:""}function sAe(e,t){if(!t){const s={...e};return delete s.authToken,delete s.authTokenEnv,s}const n=t.trim().match(KA);if(n){const s={...e,authTokenEnv:n[1]};return delete s.authToken,s}return{...e,authToken:t}}function iAe(e){if(!e.trim())return!1;try{return!new URL(e).pathname.replace(/\/+$/,"").endsWith("/mcp")}catch{return!1}}function gE(e){const t=new Set,n={},s=i=>{var u;const r=rD(i.name,"AGENT"),a=(u=i.mcpTools)==null?void 0:u.map((d,f)=>{var y,x;const h=((y=d.authToken)==null?void 0:y.trim())??"",p=((x=h.match(KA))==null?void 0:x[1])??"";let b=qz(d);if(!b&&h){const E=rD(d.name,`TOOL_${f+1}`);b=tAe(`MCP_${r}_${E}_AUTH_TOKEN`,t)}b&&t.add(b),b&&h&&!p&&(n[b]=h);const v={...d};return delete v.authToken,b?v.authTokenEnv=b:delete v.authTokenEnv,v}),l=i.subAgents.map(s),c=i.workflow?{...i.workflow,nodes:i.workflow.nodes.map(d=>({...d,agent:s(d.agent)}))}:void 0;return{...i,subAgents:l,...a?{mcpTools:a}:{},...c?{workflow:c}:{}}};return{draft:s(e),envValues:n}}function Yz(e){var n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x,E,w,S,_,T;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const k={enabled:!0};(s=e.a2aRegistry.registrySpaceId)!=null&&s.trim()&&(k.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),k.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||Da.topK,k.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||Da.region,k.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||Da.endpoint,t.a2aRegistry=k}return t}if(t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(l=e.modelName)!=null&&l.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(k=>({name:k.name,description:k.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(k=>{var j,R,B,z;const A={name:k.name,transport:k.transport};return(j=k.url)!=null&&j.trim()&&(A.url=k.url.trim()),(R=k.authTokenEnv)!=null&&R.trim()&&(A.authTokenEnv=k.authTokenEnv.trim()),(B=k.command)!=null&&B.trim()&&(A.command=k.command.trim()),(z=k.args)!=null&&z.length&&(A.args=k.args),A})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"viking",(b=e.knowledgebaseIndex)!=null&&b.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((v=e.tracingExporters)!=null&&v.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled||Object.keys(((x=e.deployment)==null?void 0:x.envValues)??{}).length>0){const k={feishuEnabled:!!((E=e.deployment)!=null&&E.feishuEnabled)};Object.keys(((w=e.deployment)==null?void 0:w.envValues)??{}).length>0&&(k.envValues={...(S=e.deployment)==null?void 0:S.envValues}),t.deployment=k}return(_=e.selectedSkills)!=null&&_.length&&(t.selectedSkills=e.selectedSkills.map(k=>{const A={source:k.source,name:k.name,folder:k.folder};return k.description&&(A.description=k.description),k.source==="skillhub"?(A.slug=k.slug,A.namespace=k.namespace??"public"):k.source==="local"?A.localFiles=k.localFiles??[]:(A.skillSpaceId=k.skillSpaceId,A.skillSpaceName=k.skillSpaceName,A.skillId=k.skillId,k.version&&(A.version=k.version)),A})),(T=e.subAgents)!=null&&T.length&&(t.subAgents=e.subAgents.map(Yz)),t}function rAe(e){var i;const t=gE(e),n={...((i=t.draft.deployment)==null?void 0:i.envValues)??{},...t.envValues},s={...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}};return`# VeADK Agent 结构配置 +`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Eb(t),s=ud(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Eb(t),s=ud(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function W2e(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new q2e||null,prettyErrors:t}}function X2e(e,t={}){const{lineCounter:n,prettyErrors:s}=W2e(t),i=new Y2e(n==null?void 0:n.addNewLine),r=new H2e(t);let a=null;for(const l of r.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new Np(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(a.errors.forEach(J3(e,n)),a.warnings.forEach(J3(e,n))),a}function Q2e(e,t,n){let s;const i=X2e(e,n);if(!i)return null;if(i.warnings.forEach(r=>rz(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function Z2e(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Ug(e)&&!s?e.toString(n):new zg(e,s,n).toString(n)}const Mz=new Set(["local","sqlite","mysql","postgresql"]),Lz=new Set(["local","opensearch","redis","viking","openviking","mem0"]),Dz=new Set(["opensearch","viking","context_search"]),Pz=new Set(["apmplus","cozeloop","tls"]),Bz=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),J2e=new Set(["llm","sequential","parallel","loop","a2a"]);function Rt(e,t=""){return typeof e=="string"?e:t}function ia(e){return e===!0}function lm(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function eAe(e){return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function Uz(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Rt(t.name),description:Rt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function df(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function Fz(e){return typeof e=="string"&&J2e.has(e)?e:"llm"}function $z(e){return e==="byteplus"?"byteplus":"volcengine"}function Hz(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function zz(e){const t=e&&typeof e=="object"?e:{};return{enabled:ia(t.enabled),registrySpaceId:Rt(t.registrySpaceId),registryTopK:Rt(t.registryTopK),registryRegion:Rt(t.registryRegion),registryEndpoint:Rt(t.registryEndpoint)}}function Vz(e,t="volcengine"){return Array.isArray(e)?e.map(n=>{const s=n&&typeof n=="object"?n:{},i=$z(s.cloudProvider??t),r=s.memory&&typeof s.memory=="object"?s.memory:{},a=zz(s.a2aRegistry),l=Fz(s.agentType),c=a.enabled&&l==="llm"?"a2a":l;return{...Ii(i),cloudProvider:i,name:Rt(s.name),description:Rt(s.description),instruction:Rt(s.instruction),agentType:c,maxIterations:Hz(s.maxIterations),a2aUrl:Rt(s.a2aUrl),modelName:Rt(s.modelName),modelProvider:Rt(s.modelProvider),modelApiBase:Rt(s.modelApiBase),builtinTools:lm(s.builtinTools).filter(u=>Bz.has(u)),customTools:Uz(s.customTools),memory:{shortTerm:ia(r.shortTerm),longTerm:ia(r.longTerm)},shortTermBackend:df(s.shortTermBackend,Mz,"local"),longTermBackend:df(s.longTermBackend,Lz,"local"),autoSaveSession:ia(s.autoSaveSession),knowledgebase:ia(s.knowledgebase),knowledgebaseBackend:df(s.knowledgebaseBackend,Dz,wu),knowledgebaseIndex:Rt(s.knowledgebaseIndex),tracing:ia(s.tracing),tracingExporters:lm(s.tracingExporters).filter(u=>Pz.has(u)),a2aRegistry:c==="a2a"?{...a,enabled:!0}:a,subAgents:Vz(s.subAgents,i),selectedSkills:Gz(s)}}):[]}function Gz(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const s=n&&typeof n=="object"?n:{},i=Rt(s.source),r=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=Rt(s.name)||Rt(s.slug)||Rt(s.skillName)||Rt(s.skillId)||"skill",l=Rt(s.folder)||a,c=Rt(s.description);if(r==="skillhub"){const f=Rt(s.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:Rt(s.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(s.localFiles)?s.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=Rt(m.path),v=Rt(m.content);return b?{path:b,content:v}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:r,folder:l,name:a,description:c,localFiles:h});continue}const u=Rt(s.skillSpaceId),d=Rt(s.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:Rt(s.skillSpaceName),skillId:d,version:Rt(s.version)})}return t}function GA(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},s=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=eAe(s.envValues),r=zz(t.a2aRegistry),a=Fz(t.agentType),l=r.enabled&&a==="llm"?"a2a":a,c=$z(t.cloudProvider),u=Array.isArray(t.mcpTools)?t.mcpTools.map(d=>{const f=d&&typeof d=="object"?d:{},h=f.transport==="stdio"?"stdio":"http";return{name:Rt(f.name),transport:h,url:Rt(f.url),authToken:Rt(f.authToken),authTokenEnv:Rt(f.authTokenEnv),command:Rt(f.command),args:lm(f.args)}}).filter(d=>d.transport==="http"?!!d.url:!!d.command):[];return{...Ii(c),cloudProvider:c,name:Rt(t.name)||"my_agent",description:Rt(t.description),instruction:Rt(t.instruction)||"You are a helpful assistant.",agentType:l,maxIterations:Hz(t.maxIterations),a2aUrl:Rt(t.a2aUrl),modelName:Rt(t.modelName),modelProvider:Rt(t.modelProvider),modelApiBase:Rt(t.modelApiBase),builtinTools:lm(t.builtinTools).filter(d=>Bz.has(d)),customTools:Uz(t.customTools),mcpTools:u,a2aRegistry:l==="a2a"?{...r,enabled:!0}:r,memory:{shortTerm:ia(n.shortTerm),longTerm:ia(n.longTerm)},shortTermBackend:df(t.shortTermBackend,Mz,"local"),longTermBackend:df(t.longTermBackend,Lz,"local"),autoSaveSession:ia(t.autoSaveSession),knowledgebase:ia(t.knowledgebase),knowledgebaseBackend:df(t.knowledgebaseBackend,Dz,wu),knowledgebaseIndex:Rt(t.knowledgebaseIndex),tracing:ia(t.tracing),tracingExporters:lm(t.tracingExporters).filter(d=>Pz.has(d)),deployment:{feishuEnabled:ia(s.feishuEnabled),...Object.keys(i).length>0?{envValues:i}:{}},subAgents:Vz(t.subAgents,c),selectedSkills:Gz(t)}}function Kz(e,t=e.cloudProvider??"volcengine"){const n=e.cloudProvider??t,s=new Set(b7(n).map(i=>i.id));return{...e,builtinTools:(e.builtinTools??[]).filter(i=>s.has(i)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:wu,knowledgebaseIndex:"",subAgents:e.subAgents.map(i=>Kz(i,n))}}const tAe=/^[A-Za-z_][A-Za-z0-9_]*$/,KA=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function rD(e,t){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||t}function nAe(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n+=1;return`${e}_${n}`}function qz(e){var n,s,i;const t=(n=e.authTokenEnv)==null?void 0:n.trim();return t&&tAe.test(t)?t:((i=(s=e.authToken)==null?void 0:s.trim().match(KA))==null?void 0:i[1])??""}function sAe(e){if(e.authToken)return e.authToken;const t=qz(e);return t?`\${${t}}`:""}function iAe(e,t){if(!t){const s={...e};return delete s.authToken,delete s.authTokenEnv,s}const n=t.trim().match(KA);if(n){const s={...e,authTokenEnv:n[1]};return delete s.authToken,s}return{...e,authToken:t}}function rAe(e){if(!e.trim())return!1;try{return!new URL(e).pathname.replace(/\/+$/,"").endsWith("/mcp")}catch{return!1}}function gE(e){const t=new Set,n={},s=i=>{var u;const r=rD(i.name,"AGENT"),a=(u=i.mcpTools)==null?void 0:u.map((d,f)=>{var y,x;const h=((y=d.authToken)==null?void 0:y.trim())??"",p=((x=h.match(KA))==null?void 0:x[1])??"";let b=qz(d);if(!b&&h){const E=rD(d.name,`TOOL_${f+1}`);b=nAe(`MCP_${r}_${E}_AUTH_TOKEN`,t)}b&&t.add(b),b&&h&&!p&&(n[b]=h);const v={...d};return delete v.authToken,b?v.authTokenEnv=b:delete v.authTokenEnv,v}),l=i.subAgents.map(s),c=i.workflow?{...i.workflow,nodes:i.workflow.nodes.map(d=>({...d,agent:s(d.agent)}))}:void 0;return{...i,subAgents:l,...a?{mcpTools:a}:{},...c?{workflow:c}:{}}};return{draft:s(e),envValues:n}}function Yz(e){var n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x,E,w,S,_,T;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const k={enabled:!0};(s=e.a2aRegistry.registrySpaceId)!=null&&s.trim()&&(k.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),k.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||Pa.topK,k.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||Pa.region,k.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||Pa.endpoint,t.a2aRegistry=k}return t}if(t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(l=e.modelName)!=null&&l.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(k=>({name:k.name,description:k.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(k=>{var j,R,B,z;const A={name:k.name,transport:k.transport};return(j=k.url)!=null&&j.trim()&&(A.url=k.url.trim()),(R=k.authTokenEnv)!=null&&R.trim()&&(A.authTokenEnv=k.authTokenEnv.trim()),(B=k.command)!=null&&B.trim()&&(A.command=k.command.trim()),(z=k.args)!=null&&z.length&&(A.args=k.args),A})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"viking",(b=e.knowledgebaseIndex)!=null&&b.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((v=e.tracingExporters)!=null&&v.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled||Object.keys(((x=e.deployment)==null?void 0:x.envValues)??{}).length>0){const k={feishuEnabled:!!((E=e.deployment)!=null&&E.feishuEnabled)};Object.keys(((w=e.deployment)==null?void 0:w.envValues)??{}).length>0&&(k.envValues={...(S=e.deployment)==null?void 0:S.envValues}),t.deployment=k}return(_=e.selectedSkills)!=null&&_.length&&(t.selectedSkills=e.selectedSkills.map(k=>{const A={source:k.source,name:k.name,folder:k.folder};return k.description&&(A.description=k.description),k.source==="skillhub"?(A.slug=k.slug,A.namespace=k.namespace??"public"):k.source==="local"?A.localFiles=k.localFiles??[]:(A.skillSpaceId=k.skillSpaceId,A.skillSpaceName=k.skillSpaceName,A.skillId=k.skillId,k.version&&(A.version=k.version)),A})),(T=e.subAgents)!=null&&T.length&&(t.subAgents=e.subAgents.map(Yz)),t}function aAe(e){var i;const t=gE(e),n={...((i=t.draft.deployment)==null?void 0:i.envValues)??{},...t.envValues},s={...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}};return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+X2e(Yz(s))}function aAe(e){const t=W2e(e);return GA(t)}const oAe=[{kind:"custom",icon:pte,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:Xee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:Kee,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:mte,title:"工作流",desc:"敬请期待",disabled:!0}];function lAe({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=oAe.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(aAe(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(WH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(fte,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}function bE(e,t){return t[e.key]??e.defaultValue??""}function Wz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function cAe(e,t){return Wz([{env:e}]).specs.map(s=>({...s,value:bE(s,t)}))}function Xz(e,t){const n=new Map;for(const s of e){const i=bE(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function aD(e,t){return e.find(n=>n.required&&!bE(n,t).trim())}function qA(e,t){if(e.format!=="json")return;const n=bE(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function Qz(e,t){for(const n of e){const s=qA(n,t);if(s)return{spec:n,error:s}}}const uAe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function dAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function vs(e,t){e.push(t&255,t>>>8&255)}function Nr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const oD=2048,Zw=20,lD=0;function fAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=dAe(b),y=b.length,x=[];Nr(x,67324752),vs(x,Zw),vs(x,oD),vs(x,lD),vs(x,0),vs(x,0),Nr(x,v),Nr(x,y),Nr(x,y),vs(x,m.length),vs(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];Nr(m,33639248),vs(m,Zw),vs(m,Zw),vs(m,oD),vs(m,lD),vs(m,0),vs(m,0),Nr(m,p.crc),Nr(m,p.size),Nr(m,p.size),vs(m,p.nameBytes.length),vs(m,0),vs(m,0),vs(m,0),vs(m,0),Nr(m,0),Nr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];Nr(c,101010256),vs(c,0),vs(c,0),vs(c,s.length),vs(c,s.length),Nr(c,l),Nr(c,r),vs(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const hAe=g.lazy(()=>lu(()=>import("./CodeEditor-1lm8yIe5.js"),[]));function pAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function mAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function Zz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>pAe(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return mAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(FR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const S=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!S,children:[o.jsx(uc,{className:S?"":"is-open","aria-hidden":"true"}),o.jsx(FB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!S&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return wi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(Kk,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Oi,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(FR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(hAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function gAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(Kk,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(Zz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function B1({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(yn,{className:"spin"}):o.jsx(ote,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(Zee,{}):o.jsx(nu,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(Ha,{}):o.jsx(bx,{})})]})]})}const bAe=5e4;function yAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` +`+Z2e(Yz(s))}function oAe(e){const t=Q2e(e);return GA(t)}const lAe=[{kind:"custom",icon:pte,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:Xee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:Kee,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:mte,title:"工作流",desc:"敬请期待",disabled:!0}];function cAe({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=lAe.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(oAe(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(WH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(fte,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}function bE(e,t){return t[e.key]??e.defaultValue??""}function Wz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function uAe(e,t){return Wz([{env:e}]).specs.map(s=>({...s,value:bE(s,t)}))}function Xz(e,t){const n=new Map;for(const s of e){const i=bE(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function aD(e,t){return e.find(n=>n.required&&!bE(n,t).trim())}function qA(e,t){if(e.format!=="json")return;const n=bE(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function Qz(e,t){for(const n of e){const s=qA(n,t);if(s)return{spec:n,error:s}}}const dAe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function fAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function vs(e,t){e.push(t&255,t>>>8&255)}function Tr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const oD=2048,Zw=20,lD=0;function hAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=fAe(b),y=b.length,x=[];Tr(x,67324752),vs(x,Zw),vs(x,oD),vs(x,lD),vs(x,0),vs(x,0),Tr(x,v),Tr(x,y),Tr(x,y),vs(x,m.length),vs(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];Tr(m,33639248),vs(m,Zw),vs(m,Zw),vs(m,oD),vs(m,lD),vs(m,0),vs(m,0),Tr(m,p.crc),Tr(m,p.size),Tr(m,p.size),vs(m,p.nameBytes.length),vs(m,0),vs(m,0),vs(m,0),vs(m,0),Tr(m,0),Tr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];Tr(c,101010256),vs(c,0),vs(c,0),vs(c,s.length),vs(c,s.length),Tr(c,l),Tr(c,r),vs(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const pAe=g.lazy(()=>cu(()=>import("./CodeEditor-D4sAk5ax.js"),[]));function mAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function gAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function Zz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>mAe(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return gAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(FR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const S=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!S,children:[o.jsx(dc,{className:S?"":"is-open","aria-hidden":"true"}),o.jsx(FB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!S&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return wi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(Kk,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Mi,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(FR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(pAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function bAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(Kk,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(Zz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function B1({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(gn,{className:"spin"}):o.jsx(ote,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(Zee,{}):o.jsx(su,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(za,{}):o.jsx(bx,{})})]})]})}const yAe=5e4;function xAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` `),s=t.split(` `),i=Math.min(n.length,s.length,260);for(let r=i;r>0;r-=1){const a=n.slice(-r).join(` `),l=s.slice(0,r).join(` `);if(a===l){const c=s.slice(r).join(` `);return c?`${e} ${c}`:e}}return`${e} -${t}`}function xAe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const s=n.indexOf(` -`);return s>=0&&(n=n.slice(s+1)),{text:n,omitted:!0}}function cD(e,t,n=bAe){const s=yAe((e==null?void 0:e.text)??"",t.text??""),i=xAe(s,n),r=i.text?i.text.split(` -`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}gr.registerLanguage("python",WF);gr.registerLanguage("typescript",o$);gr.registerLanguage("javascript",zF);gr.registerLanguage("json",VF);gr.registerLanguage("yaml",l$);gr.registerLanguage("markdown",YF);gr.registerLanguage("bash",PF);gr.registerLanguage("ini",BF);gr.registerLanguage("dockerfile",c1e);gr.registerLanguage("makefile",qF);const EAe=g.lazy(()=>lu(()=>import("./CodeEditor-1lm8yIe5.js"),[])),Nl=()=>{};function vAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?wi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(dte,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(Oi,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function Jz({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(S=>S.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(BB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:S=>{u.current[E]=S},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(Ha,{"aria-hidden":"true"})]},x.value)})})]})}function wAe({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),k8(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(Jz,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(yn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const _Ae=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],SAe={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},uD={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function dD(e){return e.replace(/&/g,"&").replace(//g,">")}function NAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(uD[n])return uD[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return SAe[i]??null}function TAe(e,t){try{const n=NAe(t);return n&&gr.getLanguage(n)?gr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?gr.highlightAuto(e).value:dD(e)}catch{return dD(e)}}const kAe=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],AAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],CAe={phase:"update",label:"更新实例配置"},IAe={phase:"evaluation",label:"创建评测集"};function jAe(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function RAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function OAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function MAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function LAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function DAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[wi.createPortal(e,n.left),wi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function yE({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:S,onNetworkChange:_,cloudProvider:T="volcengine",deployRegion:k=Ti(T),onDeployRegionChange:A,deploymentTelemetry:j={source:"unknown",createMode:"unknown",aiAssisted:!1},onBack:R,backLabel:B="返回配置",onExportYaml:z,deploymentPrimaryPane:L,deployDisabled:F=!1}){var rn,an,xs;const C=typeof l=="function",I=f.includes("更新"),D=jAe(s),[$,O]=g.useState(((an=(rn=e==null?void 0:e.files)==null?void 0:rn[0])==null?void 0:an.path)??null),[te,se]=g.useState(new Set),[P,Q]=g.useState(!1),[ee,V]=g.useState(""),[X,K]=g.useState(!1),[ce,he]=g.useState(!1),[be,ue]=g.useState(!1),[we,Le]=g.useState(!1),[Ne,ae]=g.useState(null),[me,_e]=g.useState(null),[Je,Pe]=g.useState({}),[Fe,Ye]=g.useState(null),[Ce,Ve]=g.useState(!1),[Ue,W]=g.useState([]),[oe,Z]=g.useState(!1),Ee=g.useId(),[Me,lt]=g.useState("api_key"),[Ot,ut]=g.useState(""),xn=wx(T),xt=Nf(k,T),[wt,En]=g.useState("1"),[Ut,Pt]=g.useState(D?"1":"5"),[at,ft]=g.useState(!0),He=T!=="byteplus",_t=He&&at,[ye,We]=g.useState(null),Ge=g.useRef(!0),ht=RAe(wt,Ut),Vn=!I&&ht.valid&&(ht.min!==1||ht.max!==5),un=L?AAe:kAe,Ht=Vn?[...un,CAe]:un,sn=_t?[...Ht,IAe]:Ht;g.useEffect(()=>{!A||I||xn.some(de=>de.value===k)||A(Ti(T))},[T,k,xn,I,A]),g.useEffect(()=>{if(!h){We(null);return}We(document.getElementById(h))},[h]);const kn=de=>o.jsxs("div",{className:`pp-network-region${oe?" is-open":""}`,onKeyDown:Ie=>{Ie.key==="Escape"&&Z(!1)},children:[de&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":oe,"aria-describedby":I?Ee:void 0,disabled:X||I||!A,onClick:()=>Z(Ie=>!Ie),children:[o.jsx("span",{children:xt}),o.jsx(BB,{className:`pp-region-chevron${oe?" is-open":""}`})]}),oe&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>Z(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:xn.map(Ie=>{const Be=Ie.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":Be,className:`pp-region-option${Be?" is-selected":""}`,onClick:()=>{A==null||A(Ie.value),Z(!1)},children:[o.jsx("span",{children:Ie.label}),Be&&o.jsx(Ha,{"aria-hidden":"true"})]},Ie.value)})})]}),I&&o.jsx("span",{id:Ee,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(Ge.current=!0,()=>{Ge.current=!1}),[]),g.useEffect(()=>{En("1"),Pt(D?"1":"5")},[D]),g.useEffect(()=>{if(!be)return;const de=document.body.style.overflow;document.body.style.overflow="hidden";const Ie=Be=>{Be.key==="Escape"&&ue(!1)};return window.addEventListener("keydown",Ie),()=>{document.body.style.overflow=de,window.removeEventListener("keydown",Ie)}},[be]);const zt=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:OAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const ot=e.files.find(de=>de.path===$)??null,An=(S==null?void 0:S.mode)??"public",mn=()=>({telemetry:j,action:p?"update":"create",region:k,networkType:An,feishuEnabled:v}),At=cAe(v?[...x,...Qh]:x,E),Os=At.length+Ue.length;function Ms(de){se(Ie=>{const Be=new Set(Ie);return Be.has(de)?Be.delete(de):Be.add(de),Be})}function bs(de,Ie){l&&(l({...e,files:de}),Ie!==void 0&&O(Ie))}function vn(de){ot&&bs(e.files.map(Ie=>Ie.path===ot.path?{...Ie,content:de}:Ie))}function Gn(){const de=ee.trim();if(Q(!1),V(""),!!de){if(e.files.some(Ie=>Ie.path===de)){O(de);return}bs([...e.files,{path:de,content:""}],de)}}function ls(){if(!ot)return;const de=window.prompt("重命名文件",ot.path),Ie=de==null?void 0:de.trim();!Ie||Ie===ot.path||e.files.some(Be=>Be.path===Ie)||bs(e.files.map(Be=>Be.path===ot.path?{...Be,path:Ie}:Be),Ie)}function Kn(){var Ie;if(!ot)return;const de=e.files.filter(Be=>Be.path!==ot.path);bs(de,((Ie=de[0])==null?void 0:Ie.path)??null)}function Ss(de,Ie){W(Be=>Be.map(it=>it.id===de?{...it,...Ie}:it))}function Ns(de){W(Ie=>Ie.filter(Be=>Be.id!==de))}function hi(){W(de=>[...de,LAe()])}function Cn(de){_&&_(de==="public"?void 0:{...S??{mode:de},mode:de})}function Ks(de){_==null||_({...S??{mode:"private"},...de})}function cs(){const de=new Map(Ue.map(Be=>({key:Be.key.trim(),value:Be.value})).filter(Be=>Be.key.length>0).map(Be=>[Be.key,Be.value])),Ie=v?[...x,...Qh]:x;for(const Be of Xz(Ie,E))de.set(Be.key,Be.value);return[...de].map(([Be,it])=>({key:Be,value:it}))}async function qn(){if(!(!y||X||we)){ae(null),Le(!0);try{await y(!v)}catch(de){Ge.current&&ae(`更新飞书配置失败:${de instanceof Error?de.message:String(de)}`)}finally{Ge.current&&Le(!1)}}}async function Yn(){var Be;if(!c||X||F)return;if(!ht.valid){ae(ht.error);return}if(!I&&Me==="user_pool"&&!Ot){ae("请选择用于 Runtime 鉴权的用户池。");return}if(An!=="public"&&!((Be=S==null?void 0:S.vpcId)!=null&&Be.trim())){ae("使用 VPC 网络时,请填写 VPC ID。");return}const de=aD(x,E);if(de){const it=x.find(et=>et.key===de.key);ae(`请返回配置页填写 ${(it==null?void 0:it.comment)||(it==null?void 0:it.key)}(${it==null?void 0:it.key})。`);return}const Ie=Qz(x,E);if(Ie){ae(`${Ie.spec.comment||Ie.spec.key}:${Ie.error}`);return}if(v){const it=aD(Qh,E);if(it){const et=Qh.find(Et=>Et.key===it.key);ae(`启用飞书后,请填写${(et==null?void 0:et.comment)||(et==null?void 0:et.key)}。`);return}}he(!0)}async function Wn(){var Xn;if(!c||X)return;if(!ht.valid){he(!1),ae(ht.error);return}he(!1);const de=cs();Ge.current&&(ae(null),_e(null),Pe({}),Ye(null),K(!0));const Ie=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let Be=(i==null?void 0:i.trim())||e.name||"生成中…";const it=Date.now(),et={id:Ie,runtimeName:Be,runtimeId:p,region:k,startedAt:it,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:Vn?{min:ht.min,max:ht.max}:void 0,createEvaluationSets:_t};b==null||b(et),m==null||m(et);let Et,je=et.phase??"prepare";const Ln=Jt=>Et?{...Et,status:Jt,updatedAt:Date.now()}:void 0,us=Jt=>{const vt=Ln(Jt);return vt?{buildLog:vt}:{}},pi=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),ri=Jt=>{if(je!=="build")return;const vt=["","----- 构建失败 -----",Jt].join(` -`);return Et=cD(Et,{source:"code-pipeline",status:"error",text:vt,lineCount:vt.split(` -`).length,truncated:!1,updatedAt:Date.now()}),Et};try{const Jt=await c(e,vt=>{var Dn;vt.runtimeName&&(Be=vt.runtimeName),je=vt.phase,vt.buildLog?Et=cD(Et,vt.buildLog):vt.phase==="build"&&!Et&&(Et=pi()),Ge.current&&(Pe(mi=>({...mi,[vt.phase]:vt})),Ye(vt.phase)),b==null||b({id:Ie,runtimeName:Be,runtimeId:p,region:k,startedAt:it,status:"running",phase:vt.phase,label:((Dn=sn.find(mi=>mi.phase===vt.phase))==null?void 0:Dn.label)??vt.phase,message:vt.message,pct:vt.pct,...Et?{buildLog:Et}:{}})},{taskId:Ie,sessionStorage:D?"in-memory":"persistent",minInstance:ht.min,maxInstance:ht.max,...I?{}:{authentication:Me==="user_pool"?{type:"user_pool",userPoolUid:Ot}:{type:"api_key"}},createEvaluationSets:_t,...v?{im:{feishu:{enabled:!0}}}:{},envs:de});Ge.current&&(_e(Jt),Ye(null)),OH({...mn(),runtimeId:Jt.runtimeId||p||""}),b==null||b({id:Ie,runtimeName:Jt.agentName||Be,runtimeId:Jt.runtimeId||p,region:Jt.region||k,startedAt:it,status:"success",phase:"complete",label:"部署完成",message:(Xn=Jt.warnings)==null?void 0:Xn.join(";"),...us("complete")});try{await(d==null?void 0:d(Jt))}catch(vt){if(!(vt instanceof Or))throw vt;b==null||b({id:Ie,runtimeName:Jt.agentName||Be,runtimeId:Jt.runtimeId||p,region:Jt.region||k,startedAt:it,status:"success",phase:"complete",label:"部署完成,暂未连接",message:vt.message,...us("complete")})}}catch(Jt){const vt=Jt instanceof Error?Jt.message:String(Jt);if(Jt instanceof DOMException&&Jt.name==="AbortError"){Ge.current&&(ae(null),Ye(null)),b==null||b({id:Ie,runtimeName:Be,runtimeId:p,region:k,startedAt:it,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...us("complete")});return}Ge.current&&ae(vt);const Dn=ri(vt),mi=!!Dn;MH({...mn(),phase:je,error:Jt}),b==null||b({id:Ie,runtimeName:Be,runtimeId:p,region:k,startedAt:it,status:"error",phase:je,label:"部署失败",message:mi?"构建镜像失败,详见构建日志。":vt,...Dn?{buildLog:Dn}:us("complete"),retry:Yn})}finally{Ge.current&&K(!1)}}function Ls(){he(!1)}async function ys(){if(!(!me||Ce)){Ve(!0),ae(null);try{const{addConnection:de,addRuntimeConnection:Ie,remoteAppId:Be,loadConnections:it}=await lu(async()=>{const{addConnection:je,addRuntimeConnection:Ln,remoteAppId:us,loadConnections:pi}=await Promise.resolve().then(()=>m3);return{addConnection:je,addRuntimeConnection:Ln,remoteAppId:us,loadConnections:pi}},void 0),{probeRuntimeApps:et}=await lu(async()=>{const{probeRuntimeApps:je}=await Promise.resolve().then(()=>ene);return{probeRuntimeApps:je}},void 0);let Et;if(me.runtimeId){const je=me.region??k,Ln=await et(me.runtimeId,je,{retryProbe:!0})??[];Et=Ie(me.runtimeId,me.agentName,je,Ln,Ln.length>0?{[Ln[0]]:me.agentName}:void 0,me.version)}else Et=await de(me.agentName,me.url,me.apikey,"");if(Et.apps.length===0)ae("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const je={[Et.apps[0]]:me.agentName},Ln={...Et,appLabels:{...Et.appLabels??{},...je}},pi=it().map(Xn=>Xn.id===Et.id?Ln:Xn);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(pi));const{registerConnections:ri}=await lu(async()=>{const{registerConnections:Xn}=await Promise.resolve().then(()=>m3);return{registerConnections:Xn}},void 0);if(ri(pi),u){const Xn=Be(Et.id,Et.apps[0]);u(Xn,me.agentName)}else alert(`🎉 Agent "${me.agentName}" 已添加到左上角下拉列表!`)}}catch(de){ae(`添加 Agent 失败:${de instanceof Error?de.message:String(de)}`)}finally{Ve(!1)}}}function gn(){const de=Date.now(),Ie=p?"update":"create";try{const Be=fAe(e.files),it=URL.createObjectURL(Be),et=document.createElement("a");et.href=it,et.download=`${e.name||"project"}.zip`,document.body.appendChild(et),et.click(),document.body.removeChild(et),URL.revokeObjectURL(it),wTe({telemetry:j,action:Ie,fileCount:e.files.length,zipSizeBytes:Be.size,durationMs:Date.now()-de})}catch(Be){throw _Te({telemetry:j,action:Ie,fileCount:e.files.length,durationMs:Date.now()-de,error:Be}),Be}}const fn=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[z&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:z,children:[o.jsx(Lee,{className:"pp-ic"}),"导出 YAML"]}),C&&l&&o.jsx(gAe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:gn,children:[o.jsx(yx,{className:"pp-ic"}),"下载源代码"]})]});function dn(de,Ie,Be){return MAe(de).map(it=>{const et=Be?`${Be}/${it.name}`:it.name,Et=it.path!==void 0,je={paddingLeft:8+Ie*14};if(Et){const us=it.path===$;return o.jsxs("button",{type:"button",className:`pp-row pp-file${us?" pp-active":""}`,style:je,onClick:()=>O(it.path),title:it.path,children:[o.jsx(Bee,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:it.name})]},et)}const Ln=te.has(et);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:je,onClick:()=>Ms(et),children:[o.jsx(uc,{className:`pp-ic pp-chevron${Ln?"":" pp-open"}`}),o.jsx(FB,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:it.name})]}),!Ln&&dn(it,Ie+1,et)]},et)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${L?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(DAe,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[R&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:R,children:[o.jsx(Vk,{className:"pp-ic"}),B]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",i||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!L&&o.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:o.jsxs("div",{className:`pp-release-preview${t?" is-embedded":""}`,children:[o.jsxs("div",{className:"pp-flow-thumbnail",children:[s&&o.jsx(zm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:Nl,onAdd:Nl,onInsert:Nl,onDelete:Nl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>ue(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(nu,{"aria-hidden":!0})})]}),t&&fn,!t&&o.jsxs("div",{className:"pp-release-info",children:[o.jsx("div",{className:"pp-release-card-head",children:"Agent 概览"}),o.jsxs("div",{className:"pp-release-info-body",children:[o.jsxs("div",{className:"pp-release-info-main",children:[o.jsx("h2",{children:i||e.name||"未命名 Agent"}),(s==null?void 0:s.description)&&o.jsx("p",{className:"pp-release-description",title:s.description,children:s.description}),o.jsxs("dl",{className:"pp-release-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent 数量"}),o.jsx("dd",{children:r??1})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:a.modelName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"描述"}),o.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"系统提示词"}),o.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化选项"}),o.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),fn]})]})]})}),o.jsxs("div",{className:"pp-files-area",children:[o.jsxs("div",{className:"pp-sidebar",children:[o.jsxs("div",{className:"pp-sidebar-head",children:[o.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),C&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{Q(!0),V("")},children:o.jsx(Dee,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[P&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:ee,onChange:de=>V(de.target.value),onBlur:Gn,onKeyDown:de=>{de.key==="Enter"&&Gn(),de.key==="Escape"&&(Q(!1),V(""))}}),e.files.length===0&&!P?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):dn(zt,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:ot==null?void 0:ot.path,children:(ot==null?void 0:ot.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:C&&ot&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:ls,children:o.jsx(ste,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Kn,children:o.jsx(dc,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:ot==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):C?o.jsx("div",{className:"pp-codemirror",children:o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(EAe,{value:ot.content,path:ot.path,onChange:vn})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:TAe(ot.content,ot.path)}})})]})]}),c&&o.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[o.jsx("div",{className:"pp-config-head",children:o.jsx("div",{className:"pp-config-title",children:"部署配置"})}),o.jsxs("div",{className:"pp-config-scroll",children:[L,!L&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),kn(!1)]}),!L&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),I?o.jsx("p",{className:"pp-config-note pp-auth-preserved-note",children:"更新时保持现有 Runtime 的鉴权方式不变。"}):o.jsxs("div",{className:"pp-auth-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"鉴权方式"}),o.jsx(Jz,{ariaLabel:"部署鉴权方式",value:Me,placeholder:"请选择鉴权方式",options:_Ae,disabled:X,onChange:de=>{ae(null),lt(de)}})]}),Me==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(wAe,{value:Ot,disabled:X,onChange:de=>{ae(null),ut(de)}})]})]})]}),!L&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"消息渠道"}),o.jsx("div",{className:`pp-channel-card${v?" is-flipped":""}`,children:o.jsxs("div",{className:"pp-channel-card-inner",children:[o.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":v,"aria-hidden":v,tabIndex:v?-1:0,onClick:()=>void qn(),disabled:v||X||we||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:_A,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:we?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),o.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!v,children:[o.jsxs("div",{className:"pp-channel-card-head",children:[o.jsx("strong",{children:"飞书配置"}),o.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:v?0:-1,onClick:()=>void qn(),disabled:!v||X||we||!y,children:we?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:Qh.map(de=>o.jsxs("label",{children:[o.jsxs("span",{children:[de.comment||de.key,de.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:de.key.includes("SECRET")?"password":"text",value:E[de.key]??"",placeholder:de.placeholder,tabIndex:v?0:-1,disabled:!v||X||!w,autoComplete:"off",onChange:Ie=>w==null?void 0:w(de.key,Ie.currentTarget.value)})]},de.key))})]})]})})]}),!I&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"实例设置"}),o.jsxs("div",{className:"pp-instance-fields",children:[o.jsxs("label",{htmlFor:"runtime-min-instance",children:[o.jsx("span",{children:"最小实例数"}),o.jsx("input",{id:"runtime-min-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:wt,disabled:X,"aria-invalid":!ht.valid,onChange:de=>En(de.currentTarget.value)})]}),o.jsxs("label",{htmlFor:"runtime-max-instance",children:[o.jsx("span",{children:"最大实例数"}),o.jsx("input",{id:"runtime-max-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:Ut,disabled:X,"aria-invalid":!ht.valid,onChange:de=>Pt(de.currentTarget.value)})]})]}),D&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!ht.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:ht.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),L&&kn(!0),I&&o.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),o.jsxs("div",{className:"pp-network-layout",children:[o.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(de=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:de,checked:An===de,onChange:()=>Cn(de),disabled:X||I||!_}),o.jsx("span",{children:de==="public"?"公网":de==="private"?"VPC":"公网 + VPC"})]},de))}),An!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(S==null?void 0:S.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:X||I,onChange:de=>Ks({vpcId:de.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(S==null?void 0:S.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:X||I,onChange:de=>Ks({subnetIds:de.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(S!=null&&S.enableSharedInternetAccess),disabled:X||I,onChange:de=>Ks({enableSharedInternetAccess:de.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),He&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"评测集"}),o.jsxs("label",{className:"pp-evaluation-set-option",children:[o.jsx("input",{type:"checkbox",checked:at,disabled:X,onChange:de=>ft(de.currentTarget.checked)}),o.jsxs("span",{children:[o.jsx("strong",{children:"自动创建评测集"}),o.jsx("small",{children:"部署成功后,自动创建 Good Case 和 Bad Case 评测集。"})]})]})]}),o.jsxs("section",{className:"pp-config-section pp-env-section",children:[o.jsx("div",{className:"pp-env-head",children:o.jsxs("div",{children:[o.jsxs("div",{className:"pp-config-label",children:["环境变量",o.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[Os," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]})}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:hi,disabled:X,children:[o.jsx(ji,{className:"pp-ic"}),"添加变量"]}),(At.length>0||Ue.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[At.length>0&&o.jsxs("div",{className:"pp-env-group",children:[o.jsxs("div",{className:"pp-env-group-head",children:[o.jsx("span",{children:"组件自动生成"}),o.jsxs("small",{children:[At.length," 项"]})]}),At.map(de=>{const Ie=de.key.startsWith("ENABLE_"),Be=qA(de,E),it=de.multiline||de.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${it?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${de.key} 环境变量名`,"aria-disabled":X,children:[o.jsx("span",{title:de.key,children:de.key}),(de.help||de.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":de.help||de.comment,"aria-label":`${de.key}说明:${de.help||de.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:de.help||de.comment})]}),de.link&&o.jsx("a",{className:"pp-env-link",href:de.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${de.link.label}`,"aria-label":`${de.key}:打开 OpenViking ${de.link.label}`,children:o.jsx(Im,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[it?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:de.value,placeholder:de.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:X||!Ie&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!Be,"aria-label":`${de.key} 环境变量值`,onChange:et=>w==null?void 0:w(de.key,et.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:"text",value:de.value,placeholder:de.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:X||!Ie&&!w,autoComplete:"off","aria-invalid":!!Be,"aria-label":`${de.key} 环境变量值`,onChange:et=>w==null?void 0:w(de.key,et.currentTarget.value)}),Be&&o.jsx("span",{className:"pp-env-error",children:Be})]}),o.jsx("span",{className:"pp-env-source",children:Ie?"自动":"同步"})]},de.key)})]}),Ue.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Ue.length," 项"]})]}),Ue.map(de=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:de.key,placeholder:"名称",disabled:X,autoComplete:"off",onChange:Ie=>Ss(de.id,{key:Ie.currentTarget.value})}),o.jsx("input",{type:"text",value:de.value,placeholder:"值",disabled:X,autoComplete:"off",onChange:Ie=>Ss(de.id,{value:Ie.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:X,onClick:()=>Ns(de.id),children:o.jsx(Oi,{className:"pp-ic"})})]},de.id))]})]}),(X||me||Object.keys(Je).length>0)&&o.jsxs("section",{className:"pp-config-section pp-progress-section",children:[o.jsx("div",{className:"pp-config-label",children:"部署进度"}),o.jsx("ol",{className:"pp-steps",children:sn.map((de,Ie)=>{const Be=Fe?sn.findIndex(je=>je.phase===Fe):-1,it=!!Ne&&(Be===-1?Ie===0:Ie===Be);let et;me?et="done":it?et="failed":Be===-1?et=X?"active":"pending":Iede.phase===Fe))==null?void 0:xs.label)??Fe}阶段):`:""}${Ne}`,onRetry:Yn,retryLabel:I?"重试更新":"重试部署"}),me&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:I?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[me.warnings&&me.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:me.warnings.map(de=>o.jsx("span",{children:de},de))}),me.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:Nf(me.region,T)})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:me.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:me.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:ys,disabled:Ce,children:[Ce?o.jsx(yn,{className:"pp-ic spin"}):o.jsx(zB,{className:"pp-ic"}),Ce?"连接中…":"立即对话"]}),me.consoleUrl&&o.jsxs("a",{href:me.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(Im,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${ye?" is-external":""}`,children:ye?wi.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:Yn,disabled:X||we||F||!!n,title:n,children:X?`${f}中…`:Ne?`重试${f}`:f}),ye):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:Yn,disabled:X||we||F||!!n,title:n,children:X?`${f}中…`:Ne?`重试${f}`:f})})]})]}),be&&s&&wi.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:de=>{de.target===de.currentTarget&&ue(!1)},children:o.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"执行流程"}),o.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),o.jsx("button",{type:"button",onClick:()=>ue(!1),"aria-label":"关闭执行流程预览",children:o.jsx(Oi,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(zm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:Nl,onAdd:Nl,onInsert:Nl,onDelete:Nl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(vAe,{open:ce,isUpdate:I,onCancel:Ls,onConfirm:()=>void Wn()})]})}const fD="dogfooding",Jw="dogfooding",e_="dogfooding_b";let PAe=0;const t_=()=>++PAe;function hD(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function BAe(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function pD(e,t="volcengine"){const n=[],s=BAe(e);n.push(s);const i=s.indexOf("{"),r=s.lastIndexOf("}");i>=0&&r>i&&n.push(s.slice(i,r+1));for(const a of n)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&(typeof l.name=="string"||typeof l.instruction=="string"))return await kx(GA({...l,cloudProvider:t}))}catch{}return null}function UAe({userId:e,cloudProvider:t="volcengine",onBack:n,onCreate:s,onAgentAdded:i,onDeploymentTaskChange:r}){const[a,l]=g.useState([{id:t_(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[c,u]=g.useState(""),[d,f]=g.useState(!1),[h,p]=g.useState(null),[m,b]=g.useState(null),[v,y]=g.useState(!1),[x,E]=g.useState(null),[w,S]=g.useState(null),[_,T]=g.useState(!1),[k,A]=g.useState(!1),[j,R]=g.useState({}),B=g.useRef(null),z=g.useRef(null),L=g.useRef(null),F=g.useRef(null),C=g.useRef(null);g.useEffect(()=>{const V=F.current;V&&V.scrollTo({top:V.scrollHeight,behavior:"smooth"})},[a,d]),g.useEffect(()=>{const V=C.current;V&&(V.style.height="auto",V.style.height=Math.min(V.scrollHeight,160)+"px")},[c]);const I=V=>l(X=>[...X,{id:t_(),role:"assistant",text:V}]);async function D(){if(B.current)return B.current;const V=await a1(fD,e);return B.current=V,V}async function $(V,X){if(X.current)return X.current;const K=await a1(V,e);return X.current=K,K}async function O(V,X){if(!j[V])try{const K=await d2(X);R(ce=>({...ce,[V]:K.model||X}))}catch{R(K=>({...K,[V]:X}))}}async function te(V,X,K){const ce=await $(V,X);let he=Oa();for await(const ue of jm({appName:V,userId:e,sessionId:ce,text:K}))he=Tf(he,ue);const be=hD(he).trim();return{project:await pD(be,t),finalText:be}}const se=async(V,X,K)=>vg(V.name,V.files,{region:"cn-beijing",projectName:"default"},{...K,onStage:X}),P=async()=>{const V=c.trim();if(!(!V||d)){if(l(X=>[...X,{id:t_(),role:"user",text:V}]),u(""),p(null),f(!0),v){E(null),S(null),T(!0),A(!0),O("a",Jw),O("b",e_);const X=te(Jw,z,V).then(({project:ce})=>(E(ce),ce)).catch(ce=>{const he=ce instanceof Error?ce.message:String(ce);return p(he),null}).finally(()=>T(!1)),K=te(e_,L,V).then(({project:ce})=>(S(ce),ce)).catch(ce=>{const he=ce instanceof Error?ce.message:String(ce);return p(he),null}).finally(()=>A(!1));try{const[ce,he]=await Promise.all([X,K]),be=[ce?`方案 A:${ce.name}`:null,he?`方案 B:${he.name}`:null].filter(Boolean);be.length?I(`已生成两个方案(${be.join(",")}),请在右侧对比后采用其一。`):I("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{f(!1)}return}try{const X=await D();let K=Oa();for await(const be of jm({appName:fD,userId:e,sessionId:X,text:V}))K=Tf(K,be);const ce=hD(K).trim(),he=await pD(ce,t);he?(b(he),I(`已生成项目:${he.name}(${he.files.length} 个文件),可在右侧预览和编辑。`)):I(ce||"(助手没有返回内容,请再描述一下你的需求。)")}catch(X){const K=X instanceof Error?X.message:String(X);p(K),I(`抱歉,调用智能构建助手失败:${K}`)}finally{f(!1)}}},Q=V=>{const X=V==="a"?x:w;if(!X)return;b(X),y(!1),E(null),S(null),T(!1),A(!1);const K=V==="a"?"A":"B",ce=V==="a"?j.a:j.b;I(`已采用方案 ${K}(${ce??(V==="a"?Jw:e_)}),可继续编辑。`)},ee=V=>{V.key==="Enter"&&!V.shiftKey&&!V.nativeEvent.isComposing&&(V.preventDefault(),P())};return o.jsx("div",{className:"ic-root",children:o.jsxs("div",{className:"ic-body",children:[o.jsxs("div",{className:"ic-chat",children:[o.jsxs("div",{className:"ic-transcript",ref:F,children:[o.jsx(Ko,{initial:!1,children:a.map(V=>o.jsxs(is.div,{className:`ic-turn ic-turn--${V.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[V.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(pu,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:V.role==="assistant"?o.jsx(ph,{text:V.text}):V.text})]},V.id))}),d&&o.jsxs(is.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[o.jsx("div",{className:"ic-avatar",children:o.jsx(pu,{className:"ic-avatar-icon"})}),o.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"})]})]})]}),h&&o.jsxs("div",{className:"ic-error",children:[o.jsx(Gk,{className:"ic-error-icon"}),h]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:C,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:c,onChange:V=>u(V.target.value),onKeyDown:ee,disabled:d}),o.jsx("button",{className:"ic-send",onClick:()=>void P(),disabled:!c.trim()||d,title:"发送 (Enter)",children:o.jsx(lte,{className:"ic-send-icon"})})]}),o.jsxs("div",{className:"ic-composer-foot",children:[o.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[o.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:v,disabled:d,onChange:V=>y(V.target.checked)}),o.jsx("span",{className:"ic-ab-track",children:o.jsx("span",{className:"ic-ab-thumb"})}),o.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),o.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),o.jsx("aside",{className:"ic-preview",children:v?o.jsxs("div",{className:"ic-compare",children:[o.jsx(mD,{side:"a",project:x,loading:_,model:j.a,onAdopt:()=>Q("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(mD,{side:"b",project:w,loading:k,model:j.b,onAdopt:()=>Q("b")})]}):m?o.jsx(yE,{project:m,onChange:b,onDeploy:se,onAgentAdded:i,onDeploymentTaskChange:r,deploymentTelemetry:{source:"scratch",createMode:"intelligent",aiAssisted:!0}}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(Fee,{className:"ic-preview-empty-glyph"}),o.jsx(mu,{className:"ic-preview-empty-spark"})]}),o.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),o.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function mD({side:e,project:t,loading:n,model:s,onAdopt:i}){const r=e==="a"?"方案 A":"方案 B";return o.jsxs("div",{className:"ic-pane",children:[o.jsxs("div",{className:"ic-pane-head",children:[o.jsxs("div",{className:"ic-pane-title",children:[o.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:r}),s&&o.jsx("span",{className:"ic-pane-model",children:s})]}),o.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${r}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),o.jsx("div",{className:"ic-pane-body",children:n?o.jsxs("div",{className:"ic-pane-loading",children:[o.jsx(yn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(yE,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var FAe=Object.defineProperty,YA=(e,t)=>FAe(e,"name",{value:t,configurable:!0});function zN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}YA(zN,"setRef");function eV(...e){return t=>{let n=!1;const s=e.map(i=>{const r=zN(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i$Ae(e,"name",{value:t,configurable:!0});function Vf(e){const t=g.forwardRef((n,s)=>{let{children:i,...r}=n,a=null,l=!1;const c=[];VN(i)&&typeof vb=="function"&&(i=vb(i._payload)),g.Children.forEach(i,h=>{var p;if(iV(h)){l=!0;const m=h;let b="child"in m.props?m.props.child:m.props.children;VN(b)&&typeof vb=="function"&&(b=vb(b._payload)),a=zAe(m,b),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=g.cloneElement(a,void 0,c):!l&&g.Children.count(i)===1&&g.isValidElement(i)&&(a=i);const u=a?sV(a):void 0,d=br(s,u);if(!a){if(i||i===0)throw new Error(l?KAe(e):GAe(e));return i}const f=nV(r,a.props??{});return a.type!==g.Fragment&&(f.ref=s?d:u),g.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Ka(Vf,"createSlot");var tV=Symbol.for("radix.slottable");function HAe(e){const t=Ka(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=tV,t}Ka(HAe,"createSlottable");var zAe=Ka((e,t)=>{if("child"in e.props){const n=e.props.child;return g.isValidElement(n)?g.cloneElement(n,void 0,e.props.children(n.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function nV(e,t){const n={...t};for(const s in t){const i=e[s],r=t[s];/^on[A-Z]/.test(s)?i&&r?n[s]=(...l)=>{const c=r(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...r}:s==="className"&&(n[s]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}Ka(nV,"mergeProps");function sV(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ka(sV,"getElementRef");function iV(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tV}Ka(iV,"isSlottable");var VAe=Symbol.for("react.lazy");function VN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===VAe&&"_payload"in e&&rV(e._payload)}Ka(VN,"isLazyComponent");function rV(e){return typeof e=="object"&&e!==null&&"then"in e}Ka(rV,"isPromiseLike");var GAe=Ka(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),KAe=Ka(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),vb=qf[" use ".trim().toString()],qAe=Object.defineProperty,YAe=(e,t)=>qAe(e,"name",{value:t,configurable:!0}),WAe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pa=WAe.reduce((e,t)=>{const n=Vf(`Primitive.${t}`),s=g.forwardRef((i,r)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function XAe(e,t){e&&wi.flushSync(()=>e.dispatchEvent(t))}YAe(XAe,"dispatchDiscreteCustomEvent");var QAe=Object.defineProperty,la=(e,t)=>QAe(e,"name",{value:t,configurable:!0});function ZAe(e,t){const n=g.createContext(t);n.displayName=e+"Context";const s=la(r=>{const{children:a,...l}=r,c=g.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function i(r,a={}){const{optional:l=!1}=a,c=g.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return la(i,"useContext"),[s,i]}la(ZAe,"createContext");function vc(e,t=[]){let n=[];function s(r,a){const l=g.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=la(f=>{var y;const{scope:h,children:p,...m}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useMemo(()=>m,Object.values(m));return o.jsx(b.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useContext(b);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return la(d,"useContext"),[u,d]}la(s,"createContext");const i=la(()=>{const r=n.map(a=>g.createContext(a));return la(function(l){const c=(l==null?void 0:l[e])||r;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[s,aV(i,...t)]}la(vc,"createContextScope");function aV(...e){const t=e[0];if(e.length===1)return t;const n=la(()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return la(function(r){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}la(aV,"composeContextScopes");var JAe=Object.defineProperty,xi=(e,t)=>JAe(e,"name",{value:t,configurable:!0});function oV(e){const t=e+"CollectionProvider",[n,s]=vc(t),[i,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=xi(b=>{const{scope:v,children:y}=b,x=g.useRef(null),E=g.useRef(new Map).current;return o.jsx(i,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Vf(l),u=g.forwardRef((b,v)=>{const{scope:y,children:x}=b,E=r(l,y),w=br(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Vf(d),p=g.forwardRef((b,v)=>{const{scope:y,children:x,...E}=b,w=g.useRef(null),S=br(v,w),_=r(d,y);return g.useEffect(()=>(_.itemMap.set(w,{ref:w,...E}),()=>void _.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:x})});p.displayName=d;function m(b){const v=r(e+"CollectionConsumer",b);return g.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((_,T)=>E.indexOf(_.ref.current)-E.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return xi(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,s]}xi(oV,"createCollection");var gD=new WeakMap,Qs,Ar,n_=(Ar=class extends Map{constructor(n){super(n);GC(this,Qs);ZE(this,Qs,[...super.keys()]),gD.set(this,!0)}set(n,s){return gD.get(this)&&(this.has(n)?Li(this,Qs)[Li(this,Qs).indexOf(n)]=n:Li(this,Qs).push(n)),super.set(n,s),this}insert(n,s,i){const r=this.has(s),a=Li(this,Qs).length,l=WA(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(s,i),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...Li(this,Qs)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,s){const i=this.indexOf(n);if(i===-1)return;let r=i+s;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return r;i++}}findIndex(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return i;i++}return-1}filter(n,s){const i=[];let r=0;for(const a of this)Reflect.apply(n,s,[a,r,this])&&i.push(a),r++;return new Ar(i)}map(n,s){const i=[];let r=0;for(const a of this)i.push([a[0],Reflect.apply(n,s,[a,r,this])]),r++;return new Ar(i)}reduce(...n){const[s,i]=n;let r=0,a=i??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(s,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[s,i]=n;let r=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?r=l:r=Reflect.apply(s,this,[r,l,a,this])}return r}toSorted(n){const s=[...this.entries()].sort(n);return new Ar(s)}toReversed(){const n=new Ar;for(let s=this.size-1;s>=0;s--){const i=this.keyAt(s),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new Ar(s)}slice(n,s){const i=new Ar;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),s!==void 0&&s>0&&(r=s-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,s){let i=0;for(const r of this){if(!Reflect.apply(n,s,[r,i,this]))return!1;i++}return!0}some(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return!0;i++}return!1}},Qs=new WeakMap,xi(Ar,"OrderedDict"),Ar);function my(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=lV(e,t);return n===-1?void 0:e[n]}xi(my,"at");function lV(e,t){const n=e.length,s=WA(t),i=s>=0?s:n+s;return i<0||i>=n?-1:i}xi(lV,"toSafeIndex");function WA(e){return e!==e||e===0?0:Math.trunc(e)}xi(WA,"toSafeInteger");function eCe(e){const t=e+"CollectionProvider",[n,s]=vc(t),[i,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new n_,setItemMap:xi(()=>{},"setItemMap")}),a=xi(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=xi(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=xi(E=>{const{scope:w,children:S,state:_}=E,T=g.useRef(null),[k,A]=g.useState(null),j=br(T,A),[R,B]=_;return g.useEffect(()=>{if(!k)return;const z=dV(()=>{});return z.observe(k,{childList:!0,subtree:!0}),()=>{z.disconnect()}},[k]),o.jsx(i,{scope:w,itemMap:R,setItemMap:B,collectionRef:j,collectionRefObject:T,collectionElement:k,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Vf(u),f=g.forwardRef((E,w)=>{const{scope:S,children:_}=E,T=r(u,S),k=br(w,T.collectionRef);return o.jsx(d,{ref:k,children:_})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Vf(h),b=g.forwardRef((E,w)=>{const{scope:S,children:_,...T}=E,k=g.useRef(null),[A,j]=g.useState(null),R=br(w,k,j),B=r(h,S),{setItemMap:z}=B,L=g.useRef(T);cV(L.current,T)||(L.current=T);const F=L.current;return g.useEffect(()=>{const C=F;return z(I=>A?I.has(A)?I.set(A,{...C,element:A}).toSorted(GN):(I.set(A,{...C,element:A}),I.toSorted(GN)):I),()=>{z(I=>!A||!I.has(A)?I:(I.delete(A),new n_(I)))}},[A,F,z]),o.jsx(m,{[p]:"",ref:R,children:_})});b.displayName=h;function v(){return g.useState(new n_)}xi(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return xi(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:s,useCollection:y,useInitCollection:v}]}xi(eCe,"createCollection");function cV(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}xi(cV,"shallowEqual");function uV(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}xi(uV,"isElementPreceding");function GN(e,t){return!e[1].element||!t[1].element?0:uV(e[1].element,t[1].element)?-1:1}xi(GN,"sortByDocumentPosition");function dV(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}xi(dV,"getChildListObserver");var tCe=Object.defineProperty,wh=(e,t)=>tCe(e,"name",{value:t,configurable:!0}),fV=!!(typeof window<"u"&&window.document&&window.document.createElement);function er(e,t,{checkForDefaultPrevented:n=!0}={}){return wh(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}wh(er,"composeEventHandlers");function nCe(e){var t;if(!fV)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}wh(nCe,"getOwnerWindow");function KN(e){if(!fV)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}wh(KN,"getOwnerDocument");function hV(e,t=!1){const{activeElement:n}=KN(e);if(!(n!=null&&n.nodeName))return null;if(pV(n)&&n.contentDocument)return hV(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const i=KN(n).getElementById(s);if(i)return i}}return n}wh(hV,"getActiveElement");function pV(e){return e.tagName==="IFRAME"}wh(pV,"isFrame");var Su=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},sCe=Object.defineProperty,iCe=(e,t)=>sCe(e,"name",{value:t,configurable:!0}),bD=qf[" useEffectEvent ".trim().toString()],yD=qf[" useInsertionEffect ".trim().toString()];function mV(e){if(typeof bD=="function")return bD(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof yD=="function"?yD(()=>{t.current=e}):Su(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}iCe(mV,"useEffectEvent");var rCe=Object.defineProperty,Gg=(e,t)=>rCe(e,"name",{value:t,configurable:!0}),aCe=qf[" useInsertionEffect ".trim().toString()]||Su;function Uu({prop:e,defaultProp:t,onChange:n=Gg(()=>{},"onChange"),caller:s}){const[i,r,a]=gV({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=g.useCallback(d=>{var f;if(l){const h=bV(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Gg(Uu,"useControllableState");function gV({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),r=g.useRef(t);return aCe(()=>{r.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=r.current)==null||a.call(r,n),i.current=n)},[n,i]),[n,s,r]}Gg(gV,"useUncontrolledState");function bV(e){return typeof e=="function"}Gg(bV,"isFunction");var xD=Symbol("RADIX:SYNC_STATE");function oCe(e,t,n,s){const{prop:i,defaultProp:r,onChange:a,caller:l}=t,c=i!==void 0,u=mV(a),d=[{...n,state:r}];s&&d.push(s);const[f,h]=g.useReducer((v,y)=>{if(y.type===xD)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),p=f.state,m=g.useRef(p);g.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const b=g.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return g.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:xD,state:i})},[i,f.state,c]),[b,h]}Gg(oCe,"useControllableStateReducer");var lCe=Object.defineProperty,ul=(e,t)=>lCe(e,"name",{value:t,configurable:!0});function yV(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}ul(yV,"useStateMachine");var xV=ul(e=>{const{present:t,children:n}=e,s=EV(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),r=vV(s.ref,wV(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:r}):null},"Presence");function EV(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),r=g.useRef("none"),a=g.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=yV(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{c==="mounted"?(r.current=a.current??xd(s.current),a.current=void 0):r.current="none"},[c]),Su(()=>{const d=s.current,f=i.current;if(f!==e){const p=r.current,m=xd(d);e?(a.current=m,u("MOUNT")):m==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Su(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=ul(m=>{const v=xd(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=ul(m=>{m.target===t&&(r.current=xd(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,a.current=xd(f)}else s.current=null;n(d)},[])}}ul(EV,"usePresence");function qN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ul(qN,"setRef");function vV(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const s=t.current;let i=!1;const r=s.map(a=>{const l=qN(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;acCe(e,"name",{value:t,configurable:!0}),dCe=qf[" useId ".trim().toString()]||(()=>{}),fCe=0;function _V(e){const[t,n]=g.useState(dCe());return Su(()=>{e||n(s=>s??String(fCe++))},[e]),e||(t?`radix-${t}`:"")}uCe(_V,"useId");var hCe=Object.defineProperty,pCe=(e,t)=>hCe(e,"name",{value:t,configurable:!0}),mCe=g.createContext(void 0);function xE(e){const t=g.useContext(mCe);return e||t||"ltr"}pCe(xE,"useDirection");var gCe=Object.defineProperty,bCe=(e,t)=>gCe(e,"name",{value:t,configurable:!0});function SV(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}bCe(SV,"useCallbackRef");var yCe=Object.defineProperty,xCe=(e,t)=>yCe(e,"name",{value:t,configurable:!0});function XA(e){const[t,n]=g.useState(void 0);return Su(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let a,l;if("borderBoxSize"in r){const c=r.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}xCe(XA,"useSize");var ECe=Object.defineProperty,dl=(e,t)=>ECe(e,"name",{value:t,configurable:!0}),QA="Checkbox",[vCe,uLe]=vc(QA),[wCe,ZA]=vCe(QA);function NV(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Uu({prop:n,defaultProp:i??!1,onChange:c,caller:QA}),[m,b]=g.useState(null),[v,y]=g.useState(null),x=g.useRef(!1),[E,w]=g.useReducer(T=>T+1,0),S=m?!!a||!!m.closest("form"):!0,_={checked:h,disabled:r,setChecked:p,control:m,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:tl(i)?!1:i,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(wCe,{scope:t,..._,children:TV(f)?f(_):s})}dl(NV,"CheckboxProvider");var _Ce="CheckboxTrigger",SCe=g.forwardRef(dl(function({__scopeCheckbox:t,onKeyDown:n,onClick:s,...i},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:b,bubbleInput:v}=ZA(_Ce,t),y=br(r,f),x=g.useRef(u);return g.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=dl(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(pa.button,{type:"button",role:"checkbox","aria-checked":tl(u)?"mixed":u,"aria-required":d,"data-state":JA(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:er(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:er(s,E=>{m(),h(w=>tl(w)?!0:!w),v&&b&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),NCe=g.forwardRef(dl(function(t,n){const{__scopeCheckbox:s,name:i,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(NV,{__scopeCheckbox:s,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(SCe,{...h,ref:n,__scopeCheckbox:s}),p&&o.jsx(CCe,{__scopeCheckbox:s})]})})},"Checkbox")),TCe="CheckboxIndicator",kCe=g.forwardRef(dl(function(t,n){const{__scopeCheckbox:s,forceMount:i,...r}=t,a=ZA(TCe,s);return o.jsx(xV,{present:i||tl(a.checked)||a.checked===!0,children:o.jsx(pa.span,{"data-state":JA(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),ACe="CheckboxBubbleInput",CCe=g.forwardRef(dl(function({__scopeCheckbox:t,onClick:n,...s},i){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=ZA(ACe,t),y=br(i,v),x=XA(r),E=g.useRef(!1),w=g.useRef(c),S=g.useRef(l);g.useEffect(()=>{const T=b;if(!T)return;const k=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(k,"checked").set,R=l!==S.current;S.current=l;const B=w.current!==c;w.current=c;const z=!(R&&a.current);if(B&&j){E.current=!R;const L=new Event("click",{bubbles:z});T.indeterminate=tl(c),j.call(T,tl(c)?!1:c),T.dispatchEvent(L),E.current=!1}},[b,c,a,l]);const _=g.useRef(tl(c)?!1:c);return o.jsx(pa.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??_.current,required:d,disabled:f,name:h,value:p,form:m,...s,tabIndex:-1,ref:y,onClick:er(n,T=>{E.current&&T.stopPropagation()}),style:{...s.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function TV(e){return typeof e=="function"}dl(TV,"isFunction");function tl(e){return e==="indeterminate"}dl(tl,"isIndeterminate");function JA(e){return tl(e)?"indeterminate":e?"checked":"unchecked"}dl(JA,"getState");var ICe=Object.defineProperty,eC=(e,t)=>ICe(e,"name",{value:t,configurable:!0}),s_=!1;function kV(){const[e,t]=g.useState(s_);return g.useEffect(()=>{s_||(s_=!0,t(!0))},[]),e}eC(kV,"useIsHydrated");var AV=qf[" useSyncExternalStore ".trim().toString()];function CV(){return()=>{}}eC(CV,"subscribe");function IV(){return AV(CV,()=>!0,()=>!1)}eC(IV,"useIsHydratedModern");var jCe=typeof AV=="function"?IV:kV,RCe=Object.defineProperty,Fu=(e,t)=>RCe(e,"name",{value:t,configurable:!0}),i_="rovingFocusGroup.onEntryFocus",OCe={bubbles:!1,cancelable:!0},EE="RovingFocusGroup",[YN,jV,MCe]=oV(EE),[LCe,vE]=vc(EE,[MCe]),[DCe,PCe]=LCe(EE),BCe=g.forwardRef(Fu(function(t,n){return o.jsx(YN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(YN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(UCe,{...t,ref:n})})})},"RovingFocusGroup")),UCe=g.forwardRef(Fu(function(t,n){const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=g.useRef(null),m=br(n,p),b=xE(a),[v,y]=Uu({prop:l,defaultProp:c??null,onChange:u,caller:EE}),[x,E]=g.useState(!1),w=SV(d),S=jV(s),_=g.useRef(!1),[T,k]=g.useState(0);return g.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(i_,w),()=>A.removeEventListener(i_,w)},[w]),o.jsx(DCe,{scope:s,orientation:i,dir:b,loop:r,currentTabStopId:v,onItemFocus:g.useCallback(A=>y(A),[y]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:g.useCallback(()=>k(A=>A-1),[]),children:o.jsx(pa.div,{tabIndex:x||T===0?-1:0,"data-orientation":i,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:er(t.onMouseDown,()=>{_.current=!0}),onFocus:er(t.onFocus,A=>{const j=!_.current;if(A.target===A.currentTarget&&j&&!x){const R=new CustomEvent(i_,OCe);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const B=S().filter(I=>I.focusable),z=B.find(I=>I.active),L=B.find(I=>I.id===v),C=[z,L,...B].filter(Boolean).map(I=>I.ref.current);tC(C,f)}}_.current=!1}),onBlur:er(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),FCe="RovingFocusGroupItem",$Ce=g.forwardRef(Fu(function(t,n){const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=_V(),d=a||u,f=PCe(FCe,s),h=f.currentTabStopId===d,p=jV(s),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=f,y=jCe();return Su(()=>{if(!(!y||!i))return m(),()=>b()},[y,i,m,b]),g.useEffect(()=>{if(!(y||!i))return m(),()=>b()},[y,i,m,b]),o.jsx(YN.ItemSlot,{scope:s,id:d,focusable:i,active:r,children:o.jsx(pa.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:er(t.onMouseDown,x=>{i?f.onItemFocus(d):x.preventDefault()}),onFocus:er(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:er(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=OV(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=p().filter(_=>_.focusable).map(_=>_.ref.current);if(E==="last")S.reverse();else if(E==="prev"||E==="next"){E==="prev"&&S.reverse();const _=S.indexOf(x.currentTarget);S=f.loop?MV(S,_+1):S.slice(_+1)}setTimeout(()=>tC(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),HCe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Fu(RV,"getDirectionAwareKey");function OV(e,t,n){const s=RV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return HCe[s]}Fu(OV,"getFocusIntent");function tC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}Fu(tC,"focusFirst");function MV(e,t){return e.map((n,s)=>e[(t+s)%e.length])}Fu(MV,"wrapArray");var LV=BCe,DV=$Ce,zCe=Object.defineProperty,Fi=(e,t)=>zCe(e,"name",{value:t,configurable:!0}),PV="Radio",[VCe,BV]=vc(PV),[GCe,wE]=VCe(PV);function UV(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:i,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=g.useState(null),[p,m]=g.useState(null),b=g.useRef(!1),[v,y]=g.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:i,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Fi(()=>l==null?void 0:l(),"onCheck")};return o.jsx(GCe,{scope:t,...E,children:FV(d)?d(E):s})}Fi(UV,"RadioProvider");var KCe="RadioTrigger",qCe=g.forwardRef(Fi(function({__scopeRadio:t,onClick:n,...s},i){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=wE(KCe,t),m=br(i,c);return o.jsx(pa.button,{type:"button",role:"radio","aria-checked":r,"data-state":nC(r),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:m,onClick:er(n,b=>{r||(f(),u()),p&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),YCe="RadioIndicator",WCe=g.forwardRef(Fi(function(t,n){const{__scopeRadio:s,forceMount:i,...r}=t,a=wE(YCe,s);return o.jsx(xV,{present:i||a.checked,children:o.jsx(pa.span,{"data-state":nC(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),XCe="RadioBubbleInput",QCe=g.forwardRef(Fi(function({__scopeRadio:t,onClick:n,...s},i){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:b}=wE(XCe,t),v=br(i,p),y=XA(r),x=g.useRef(!1),E=g.useRef(a),w=g.useRef(b);g.useEffect(()=>{const _=h;if(!_)return;const T=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(T,"checked").set,j=b!==w.current;w.current=b;const R=E.current!==a;E.current=a;const B=!(j&&m.current);if(R&&A){x.current=!j;const z=new Event("click",{bubbles:B});A.call(_,a),_.dispatchEvent(z),x.current=!1}},[h,a,m,b]);const S=g.useRef(a);return o.jsx(pa.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...s,tabIndex:-1,ref:v,onClick:er(n,_=>{x.current&&_.stopPropagation()}),style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function FV(e){return typeof e=="function"}Fi(FV,"isFunction");function nC(e){return e?"checked":"unchecked"}Fi(nC,"getState");var ZCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],sC="RadioGroup",[JCe,dLe]=vc(sC,[vE,BV]),$V=vE(),_E=BV(),[eIe,tIe]=JCe(sC),nIe=g.forwardRef(Fi(function(t,n){const{__scopeRadioGroup:s,name:i,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,b=$V(s),v=xE(f),[y,x]=Uu({prop:l,defaultProp:a??null,onChange:p,caller:sC}),[E,w]=g.useState(null),S=br(n,w),_=g.useRef(y);return g.useEffect(()=>{const T=r?E==null?void 0:E.ownerDocument.getElementById(r):E==null?void 0:E.closest("form");if(T instanceof HTMLFormElement){const k=Fi(()=>x(_.current),"reset");return T.addEventListener("reset",k),()=>T.removeEventListener("reset",k)}},[E,r,x]),o.jsx(eIe,{scope:s,name:i,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(LV,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(pa.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:S})})})},"RadioGroup")),sIe="RadioGroupItemProvider",iIe="RadioGroupItemTrigger";function HV(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:i,internal_do_not_use_render:r}=e,a=tIe(sIe,t),l=_E(t),c=a.disabled||s;return o.jsx(UV,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:r,children:i})}Fi(HV,"RadioGroupItemProvider");var rIe=g.forwardRef(Fi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=$V(s),a=_E(s),{checked:l,disabled:c}=wE(iIe,a.__scopeRadio),u=g.useRef(null),d=br(n,u),f=g.useRef(!1);return g.useEffect(()=>{const h=Fi(m=>{ZCe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Fi(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(DV,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(qCe,{...a,...i,ref:d,onKeyDown:er(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:er(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),aIe=g.forwardRef(Fi(function(t,n){const{__scopeRadioGroup:s,value:i,disabled:r,...a}=t;return o.jsx(HV,{__scopeRadioGroup:s,value:i,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(rIe,{...a,ref:n,__scopeRadioGroup:s}),l&&o.jsx(oIe,{__scopeRadioGroup:s})]})})},"RadioGroupItem")),oIe=g.forwardRef(Fi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=_E(s);return o.jsx(QCe,{...r,...i,ref:n})},"RadioGroupItemBubbleInput")),lIe=g.forwardRef(Fi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=_E(s);return o.jsx(WCe,{...r,...i,ref:n})},"RadioGroupIndicator")),cIe=Object.defineProperty,uIe=(e,t)=>cIe(e,"name",{value:t,configurable:!0}),dIe="Toggle",fIe=g.forwardRef(uIe(function(t,n){const{pressed:s,defaultPressed:i,onPressedChange:r,...a}=t,[l,c]=Uu({prop:s,onChange:r,defaultProp:i??!1,caller:dIe});return o.jsx(pa.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:er(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),hIe=Object.defineProperty,fc=(e,t)=>hIe(e,"name",{value:t,configurable:!0}),_h="ToggleGroup",[zV,fLe]=vc(_h,[vE]),VV=vE(),pIe=g.forwardRef(fc(function(t,n){const{type:s,...i}=t;if(s==="single"){const r=i;return o.jsx(mIe,{role:"radiogroup",...r,ref:n})}if(s==="multiple"){const r=i;return o.jsx(gIe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${_h}\``)},"ToggleGroup")),[GV,KV]=zV(_h),mIe=g.forwardRef(fc(function(t,n){const{value:s,defaultValue:i,onValueChange:r=fc(()=>{},"onValueChange"),...a}=t,[l,c]=Uu({prop:s,defaultProp:i??"",onChange:r,caller:_h});return o.jsx(GV,{scope:t.__scopeToggleGroup,type:"single",value:g.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:g.useCallback(()=>c(""),[c]),children:o.jsx(qV,{...a,ref:n})})},"ToggleGroupImplSingle")),gIe=g.forwardRef(fc(function(t,n){const{value:s,defaultValue:i,onValueChange:r=fc(()=>{},"onValueChange"),...a}=t,[l,c]=Uu({prop:s,defaultProp:i??[],onChange:r,caller:_h}),u=g.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=g.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(GV,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(qV,{...a,ref:n})})},"ToggleGroupImplMultiple")),[bIe,yIe]=zV(_h),qV=g.forwardRef(fc(function(t,n){const{__scopeToggleGroup:s,disabled:i=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=VV(s),f=xE(l),h={dir:f,...u};return o.jsx(bIe,{scope:s,rovingFocus:r,disabled:i,children:r?o.jsx(LV,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(pa.div,{...h,ref:n})}):o.jsx(pa.div,{...h,ref:n})})},"ToggleGroupImpl")),WN="ToggleGroupItem",xIe=g.forwardRef(fc(function(t,n){const s=KV(WN,t.__scopeToggleGroup),i=yIe(WN,t.__scopeToggleGroup),r=VV(t.__scopeToggleGroup),a=s.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=g.useRef(null);return i.rovingFocus?o.jsx(DV,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(ED,{...c,ref:n})}):o.jsx(ED,{...c,ref:n})},"ToggleGroupItem")),ED=g.forwardRef(fc(function(t,n){const{__scopeToggleGroup:s,value:i,...r}=t,a=KV(WN,s),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(fIe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl"));const EIe="_Container_1tuad_1",vIe="_Checkbox_1tuad_22",wIe="_CheckMark_1tuad_92",_Ie="_Label_1tuad_162",wb={Container:EIe,Checkbox:vIe,CheckMark:wIe,Label:_Ie},YV=({className:e,label:t,id:n,disabled:s,orientation:i="left",...r})=>{const a=g.useId(),l=n??a;return o.jsxs("div",{"data-disabled":s?"":void 0,"data-has-label":t?"":void 0,"data-orientation":i,className:ga(e,wb.Container),children:[o.jsx(NCe,{className:wb.Checkbox,id:l,disabled:s,...r,children:o.jsx(kCe,{className:wb.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:wb.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},SIe="_RadioGroup_onrfm_1",NIe="_RadioLabel_onrfm_9",TIe="_RadioIndicatorWrapper_onrfm_26",kIe="_RadioItem_onrfm_43",AIe="_RadioIndicator_onrfm_26",Tp={RadioGroup:SIe,RadioLabel:NIe,RadioIndicatorWrapper:TIe,RadioItem:kIe,RadioIndicator:AIe},WV=g.createContext(null),CIe=()=>{const e=g.use(WV);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},XN=({onChange:e,children:t,className:n,direction:s="row",disabled:i=!1,...r})=>{const a=g.useMemo(()=>({disabled:i,direction:s}),[i,s]);return o.jsx(WV,{value:a,children:o.jsx(nIe,{className:ga(Tp.RadioGroup,n),"data-direction":s,onValueChange:e,disabled:i,...r,children:t})})},IIe=({value:e,disabled:t=!1,required:n,children:s,className:i,block:r=!1,...a})=>{const{disabled:l}=CIe(),c=l||t,u=g.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ga(Tp.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:Tp.RadioIndicatorWrapper,children:o.jsx(aIe,{id:d,value:e,disabled:c,required:n,className:Tp.RadioItem,children:o.jsx(lIe,{className:Tp.RadioIndicator})})}),s]})})};XN.Item=IIe;function jIe({className:e,...t}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),o.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const Ed={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:jIe},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:$ee},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:ute},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Xk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:xx}},RIe=[Ed.llm,Ed.sequential,Ed.parallel,Ed.loop,Ed.a2a];function XV(e){return Ed[e??"llm"]}const QV=e=>e==="sequential"||e==="parallel"||e==="loop",SE=e=>e==="a2a";function hc(e){return e.trimEnd().replace(/[。.]+$/,"")}function U1(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(s=>s==null?void 0:s.toLocaleLowerCase().includes(n)):!0}function Ic(e,t){return e[t]|e[t+1]<<8}function ud(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function OIe(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function ZV(e,t={}){let s=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(ud(e,u)===101010256){s=u;break}if(s<0)throw new Error("无效的 zip:找不到 EOCD");const i=Ic(e,s+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=ud(e,s+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=Ic(e,v+26),E=Ic(e,v+28),w=v+30+x+E,S=e.subarray(w,w+f);let _;if(d===0)_=S;else if(d===8)_=await OIe(S);else{r+=46+p+m+b;continue}l.push({name:y,text:a.decode(_)}),r+=46+p+m+b}return l}const MIe="/harness/skills/findskill";async function LIe(e,t="public"){const n=e.trim(),s=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),i=`${MIe}?${s.toString()}`,r=await fetch(i,{headers:{accept:"application/json"},signal:Bn(void 0,yc)});if(!r.ok)throw new Error(`搜索失败 (${r.status})`);return((await r.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function DIe({selected:e,onChange:t}){const[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(!1),h=b=>e.some(v=>v.source==="skillhub"&&v.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},m=async b=>{l(!0),u(null),f(!0);try{const v=await LIe(b);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return g.useEffect(()=>{const b=n.trim();if(!b){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(b),300);return()=>clearTimeout(v)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(t1,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?o.jsx(yn,{className:"cw-i cw-spin"}):o.jsx(t1,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(bc,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(yn,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const v=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(b),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(Ha,{className:"cw-i cw-i-sm"}):o.jsx(ji,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:hc(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const QN=/(^|\/)skill\.md$/i;function PIe(e){const t=(e??"").replace(/\r\n?/g,` +${t}`}function EAe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const s=n.indexOf(` +`);return s>=0&&(n=n.slice(s+1)),{text:n,omitted:!0}}function cD(e,t,n=yAe){const s=xAe((e==null?void 0:e.text)??"",t.text??""),i=EAe(s,n),r=i.text?i.text.split(` +`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}br.registerLanguage("python",WF);br.registerLanguage("typescript",o$);br.registerLanguage("javascript",zF);br.registerLanguage("json",VF);br.registerLanguage("yaml",l$);br.registerLanguage("markdown",YF);br.registerLanguage("bash",PF);br.registerLanguage("ini",BF);br.registerLanguage("dockerfile",d1e);br.registerLanguage("makefile",qF);const vAe=g.lazy(()=>cu(()=>import("./CodeEditor-D4sAk5ax.js"),[])),Tl=()=>{};function wAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?wi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(dte,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(Mi,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function Jz({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(S=>S.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(BB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:S=>{u.current[E]=S},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(za,{"aria-hidden":"true"})]},x.value)})})]})}function _Ae({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),k8(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(Jz,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(gn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const SAe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],NAe={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},uD={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function dD(e){return e.replace(/&/g,"&").replace(//g,">")}function TAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(uD[n])return uD[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return NAe[i]??null}function kAe(e,t){try{const n=TAe(t);return n&&br.getLanguage(n)?br.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?br.highlightAuto(e).value:dD(e)}catch{return dD(e)}}const AAe=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],CAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],IAe={phase:"update",label:"更新实例配置"},jAe={phase:"evaluation",label:"创建评测集"};function RAe(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function OAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function MAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function LAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function DAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function PAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[wi.createPortal(e,n.left),wi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function yE({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:S,onNetworkChange:_,cloudProvider:T="volcengine",deployRegion:k=ki(T),onDeployRegionChange:A,deploymentTelemetry:j={source:"unknown",createMode:"unknown",aiAssisted:!1},onBack:R,backLabel:B="返回配置",onExportYaml:z,deploymentPrimaryPane:L,deployDisabled:F=!1}){var an,on,ys;const C=typeof l=="function",I=f.includes("更新"),D=RAe(s),[$,O]=g.useState(((on=(an=e==null?void 0:e.files)==null?void 0:an[0])==null?void 0:on.path)??null),[ne,se]=g.useState(new Set),[P,Z]=g.useState(!1),[te,V]=g.useState(""),[Q,K]=g.useState(!1),[ce,he]=g.useState(!1),[ge,ue]=g.useState(!1),[ve,Me]=g.useState(!1),[Se,ae]=g.useState(null),[me,we]=g.useState(null),[et,De]=g.useState({}),[Ue,Ye]=g.useState(null),[Ae,ze]=g.useState(!1),[Be,X]=g.useState([]),[oe,J]=g.useState(!1),xe=g.useId(),[Oe,lt]=g.useState("api_key"),[Mt,ut]=g.useState(""),bn=wx(T),wt=Tf(k,T),[_t,yn]=g.useState("1"),[Ft,Bt]=g.useState(D?"1":"5"),[at,ft]=g.useState(!0),$e=T!=="byteplus",St=$e&&at,[be,We]=g.useState(null),Ge=g.useRef(!0),ht=OAe(_t,Ft),Gn=!I&&ht.valid&&(ht.min!==1||ht.max!==5),dn=L?CAe:AAe,zt=Gn?[...dn,IAe]:dn,rn=St?[...zt,jAe]:zt;g.useEffect(()=>{!A||I||bn.some(de=>de.value===k)||A(ki(T))},[T,k,bn,I,A]),g.useEffect(()=>{if(!h){We(null);return}We(document.getElementById(h))},[h]);const Sn=de=>o.jsxs("div",{className:`pp-network-region${oe?" is-open":""}`,onKeyDown:Ce=>{Ce.key==="Escape"&&J(!1)},children:[de&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":oe,"aria-describedby":I?xe:void 0,disabled:Q||I||!A,onClick:()=>J(Ce=>!Ce),children:[o.jsx("span",{children:wt}),o.jsx(BB,{className:`pp-region-chevron${oe?" is-open":""}`})]}),oe&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>J(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:bn.map(Ce=>{const Pe=Ce.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":Pe,className:`pp-region-option${Pe?" is-selected":""}`,onClick:()=>{A==null||A(Ce.value),J(!1)},children:[o.jsx("span",{children:Ce.label}),Pe&&o.jsx(za,{"aria-hidden":"true"})]},Ce.value)})})]}),I&&o.jsx("span",{id:xe,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(Ge.current=!0,()=>{Ge.current=!1}),[]),g.useEffect(()=>{yn("1"),Bt(D?"1":"5")},[D]),g.useEffect(()=>{if(!ge)return;const de=document.body.style.overflow;document.body.style.overflow="hidden";const Ce=Pe=>{Pe.key==="Escape"&&ue(!1)};return window.addEventListener("keydown",Ce),()=>{document.body.style.overflow=de,window.removeEventListener("keydown",Ce)}},[ge]);const Vt=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:MAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const ot=e.files.find(de=>de.path===$)??null,Nn=(S==null?void 0:S.mode)??"public",mn=()=>({telemetry:j,action:p?"update":"create",region:k,networkType:Nn,feishuEnabled:v}),Ct=uAe(v?[...x,...Qh]:x,E),ms=Ct.length+Be.length;function Rs(de){se(Ce=>{const Pe=new Set(Ce);return Pe.has(de)?Pe.delete(de):Pe.add(de),Pe})}function gs(de,Ce){l&&(l({...e,files:de}),Ce!==void 0&&O(Ce))}function Mn(de){ot&&gs(e.files.map(Ce=>Ce.path===ot.path?{...Ce,content:de}:Ce))}function zs(){const de=te.trim();if(Z(!1),V(""),!!de){if(e.files.some(Ce=>Ce.path===de)){O(de);return}gs([...e.files,{path:de,content:""}],de)}}function is(){if(!ot)return;const de=window.prompt("重命名文件",ot.path),Ce=de==null?void 0:de.trim();!Ce||Ce===ot.path||e.files.some(Pe=>Pe.path===Ce)||gs(e.files.map(Pe=>Pe.path===ot.path?{...Pe,path:Ce}:Pe),Ce)}function Tn(){var Ce;if(!ot)return;const de=e.files.filter(Pe=>Pe.path!==ot.path);gs(de,((Ce=de[0])==null?void 0:Ce.path)??null)}function rs(de,Ce){X(Pe=>Pe.map(it=>it.id===de?{...it,...Ce}:it))}function bs(de){X(Ce=>Ce.filter(Pe=>Pe.id!==de))}function _i(){X(de=>[...de,DAe()])}function kn(de){_&&_(de==="public"?void 0:{...S??{mode:de},mode:de})}function Vs(de){_==null||_({...S??{mode:"private"},...de})}function Ss(){const de=new Map(Be.map(Pe=>({key:Pe.key.trim(),value:Pe.value})).filter(Pe=>Pe.key.length>0).map(Pe=>[Pe.key,Pe.value])),Ce=v?[...x,...Qh]:x;for(const Pe of Xz(Ce,E))de.set(Pe.key,Pe.value);return[...de].map(([Pe,it])=>({key:Pe,value:it}))}async function Fn(){if(!(!y||Q||ve)){ae(null),Me(!0);try{await y(!v)}catch(de){Ge.current&&ae(`更新飞书配置失败:${de instanceof Error?de.message:String(de)}`)}finally{Ge.current&&Me(!1)}}}async function $n(){var Pe;if(!c||Q||F)return;if(!ht.valid){ae(ht.error);return}if(!I&&Oe==="user_pool"&&!Mt){ae("请选择用于 Runtime 鉴权的用户池。");return}if(Nn!=="public"&&!((Pe=S==null?void 0:S.vpcId)!=null&&Pe.trim())){ae("使用 VPC 网络时,请填写 VPC ID。");return}const de=aD(x,E);if(de){const it=x.find(Ze=>Ze.key===de.key);ae(`请返回配置页填写 ${(it==null?void 0:it.comment)||(it==null?void 0:it.key)}(${it==null?void 0:it.key})。`);return}const Ce=Qz(x,E);if(Ce){ae(`${Ce.spec.comment||Ce.spec.key}:${Ce.error}`);return}if(v){const it=aD(Qh,E);if(it){const Ze=Qh.find(xt=>xt.key===it.key);ae(`启用飞书后,请填写${(Ze==null?void 0:Ze.comment)||(Ze==null?void 0:Ze.key)}。`);return}}he(!0)}async function Gs(){var qn;if(!c||Q)return;if(!ht.valid){he(!1),ae(ht.error);return}he(!1);const de=Ss();Ge.current&&(ae(null),we(null),De({}),Ye(null),K(!0));const Ce=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let Pe=(i==null?void 0:i.trim())||e.name||"生成中…";const it=Date.now(),Ze={id:Ce,runtimeName:Pe,runtimeId:p,region:k,startedAt:it,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:Gn?{min:ht.min,max:ht.max}:void 0,createEvaluationSets:St};b==null||b(Ze),m==null||m(Ze);let xt,Ie=Ze.phase??"prepare";const Kn=en=>xt?{...xt,status:en,updatedAt:Date.now()}:void 0,as=en=>{const Lt=Kn(en);return Lt?{buildLog:Lt}:{}},Ks=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),ai=en=>{if(Ie!=="build")return;const Lt=["","----- 构建失败 -----",en].join(` +`);return xt=cD(xt,{source:"code-pipeline",status:"error",text:Lt,lineCount:Lt.split(` +`).length,truncated:!1,updatedAt:Date.now()}),xt};try{const en=await c(e,Lt=>{var Ms;Lt.runtimeName&&(Pe=Lt.runtimeName),Ie=Lt.phase,Lt.buildLog?xt=cD(xt,Lt.buildLog):Lt.phase==="build"&&!xt&&(xt=Ks()),Ge.current&&(De(os=>({...os,[Lt.phase]:Lt})),Ye(Lt.phase)),b==null||b({id:Ce,runtimeName:Pe,runtimeId:p,region:k,startedAt:it,status:"running",phase:Lt.phase,label:((Ms=rn.find(os=>os.phase===Lt.phase))==null?void 0:Ms.label)??Lt.phase,message:Lt.message,pct:Lt.pct,...xt?{buildLog:xt}:{}})},{taskId:Ce,sessionStorage:D?"in-memory":"persistent",minInstance:ht.min,maxInstance:ht.max,...I?{}:{authentication:Oe==="user_pool"?{type:"user_pool",userPoolUid:Mt}:{type:"api_key"}},createEvaluationSets:St,...v?{im:{feishu:{enabled:!0}}}:{},envs:de});Ge.current&&(we(en),Ye(null)),OH({...mn(),runtimeId:en.runtimeId||p||""}),b==null||b({id:Ce,runtimeName:en.agentName||Pe,runtimeId:en.runtimeId||p,region:en.region||k,startedAt:it,status:"success",phase:"complete",label:"部署完成",message:(qn=en.warnings)==null?void 0:qn.join(";"),...as("complete")});try{await(d==null?void 0:d(en))}catch(Lt){if(!(Lt instanceof Mr))throw Lt;b==null||b({id:Ce,runtimeName:en.agentName||Pe,runtimeId:en.runtimeId||p,region:en.region||k,startedAt:it,status:"success",phase:"complete",label:"部署完成,暂未连接",message:Lt.message,...as("complete")})}}catch(en){const Lt=en instanceof Error?en.message:String(en);if(en instanceof DOMException&&en.name==="AbortError"){Ge.current&&(ae(null),Ye(null)),b==null||b({id:Ce,runtimeName:Pe,runtimeId:p,region:k,startedAt:it,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...as("complete")});return}Ge.current&&ae(Lt);const Ms=ai(Lt),os=!!Ms;MH({...mn(),phase:Ie,error:en}),b==null||b({id:Ce,runtimeName:Pe,runtimeId:p,region:k,startedAt:it,status:"error",phase:Ie,label:"部署失败",message:os?"构建镜像失败,详见构建日志。":Lt,...Ms?{buildLog:Ms}:as("complete"),retry:$n})}finally{Ge.current&&K(!1)}}function Os(){he(!1)}async function An(){if(!(!me||Ae)){ze(!0),ae(null);try{const{addConnection:de,addRuntimeConnection:Ce,remoteAppId:Pe,loadConnections:it}=await cu(async()=>{const{addConnection:Ie,addRuntimeConnection:Kn,remoteAppId:as,loadConnections:Ks}=await Promise.resolve().then(()=>m3);return{addConnection:Ie,addRuntimeConnection:Kn,remoteAppId:as,loadConnections:Ks}},void 0),{probeRuntimeApps:Ze}=await cu(async()=>{const{probeRuntimeApps:Ie}=await Promise.resolve().then(()=>ene);return{probeRuntimeApps:Ie}},void 0);let xt;if(me.runtimeId){const Ie=me.region??k,Kn=await Ze(me.runtimeId,Ie,{retryProbe:!0})??[];xt=Ce(me.runtimeId,me.agentName,Ie,Kn,Kn.length>0?{[Kn[0]]:me.agentName}:void 0,me.version)}else xt=await de(me.agentName,me.url,me.apikey,"");if(xt.apps.length===0)ae("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const Ie={[xt.apps[0]]:me.agentName},Kn={...xt,appLabels:{...xt.appLabels??{},...Ie}},Ks=it().map(qn=>qn.id===xt.id?Kn:qn);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Ks));const{registerConnections:ai}=await cu(async()=>{const{registerConnections:qn}=await Promise.resolve().then(()=>m3);return{registerConnections:qn}},void 0);if(ai(Ks),u){const qn=Pe(xt.id,xt.apps[0]);u(qn,me.agentName)}else alert(`🎉 Agent "${me.agentName}" 已添加到左上角下拉列表!`)}}catch(de){ae(`添加 Agent 失败:${de instanceof Error?de.message:String(de)}`)}finally{ze(!1)}}}function xn(){const de=Date.now(),Ce=p?"update":"create";try{const Pe=hAe(e.files),it=URL.createObjectURL(Pe),Ze=document.createElement("a");Ze.href=it,Ze.download=`${e.name||"project"}.zip`,document.body.appendChild(Ze),Ze.click(),document.body.removeChild(Ze),URL.revokeObjectURL(it),STe({telemetry:j,action:Ce,fileCount:e.files.length,zipSizeBytes:Pe.size,durationMs:Date.now()-de})}catch(Pe){throw NTe({telemetry:j,action:Ce,fileCount:e.files.length,durationMs:Date.now()-de,error:Pe}),Pe}}const fn=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[z&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:z,children:[o.jsx(Lee,{className:"pp-ic"}),"导出 YAML"]}),C&&l&&o.jsx(bAe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:xn,children:[o.jsx(yx,{className:"pp-ic"}),"下载源代码"]})]});function Jt(de,Ce,Pe){return LAe(de).map(it=>{const Ze=Pe?`${Pe}/${it.name}`:it.name,xt=it.path!==void 0,Ie={paddingLeft:8+Ce*14};if(xt){const as=it.path===$;return o.jsxs("button",{type:"button",className:`pp-row pp-file${as?" pp-active":""}`,style:Ie,onClick:()=>O(it.path),title:it.path,children:[o.jsx(Bee,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:it.name})]},Ze)}const Kn=ne.has(Ze);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:Ie,onClick:()=>Rs(Ze),children:[o.jsx(dc,{className:`pp-ic pp-chevron${Kn?"":" pp-open"}`}),o.jsx(FB,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:it.name})]}),!Kn&&Jt(it,Ce+1,Ze)]},Ze)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${L?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(PAe,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[R&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:R,children:[o.jsx(Vk,{className:"pp-ic"}),B]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",i||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!L&&o.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:o.jsxs("div",{className:`pp-release-preview${t?" is-embedded":""}`,children:[o.jsxs("div",{className:"pp-flow-thumbnail",children:[s&&o.jsx(zm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:Tl,onAdd:Tl,onInsert:Tl,onDelete:Tl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>ue(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(su,{"aria-hidden":!0})})]}),t&&fn,!t&&o.jsxs("div",{className:"pp-release-info",children:[o.jsx("div",{className:"pp-release-card-head",children:"Agent 概览"}),o.jsxs("div",{className:"pp-release-info-body",children:[o.jsxs("div",{className:"pp-release-info-main",children:[o.jsx("h2",{children:i||e.name||"未命名 Agent"}),(s==null?void 0:s.description)&&o.jsx("p",{className:"pp-release-description",title:s.description,children:s.description}),o.jsxs("dl",{className:"pp-release-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent 数量"}),o.jsx("dd",{children:r??1})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:a.modelName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"描述"}),o.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"系统提示词"}),o.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化选项"}),o.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),fn]})]})]})}),o.jsxs("div",{className:"pp-files-area",children:[o.jsxs("div",{className:"pp-sidebar",children:[o.jsxs("div",{className:"pp-sidebar-head",children:[o.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),C&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{Z(!0),V("")},children:o.jsx(Dee,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[P&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:te,onChange:de=>V(de.target.value),onBlur:zs,onKeyDown:de=>{de.key==="Enter"&&zs(),de.key==="Escape"&&(Z(!1),V(""))}}),e.files.length===0&&!P?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):Jt(Vt,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:ot==null?void 0:ot.path,children:(ot==null?void 0:ot.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:C&&ot&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:is,children:o.jsx(ste,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Tn,children:o.jsx(fc,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:ot==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):C?o.jsx("div",{className:"pp-codemirror",children:o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(vAe,{value:ot.content,path:ot.path,onChange:Mn})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:kAe(ot.content,ot.path)}})})]})]}),c&&o.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[o.jsx("div",{className:"pp-config-head",children:o.jsx("div",{className:"pp-config-title",children:"部署配置"})}),o.jsxs("div",{className:"pp-config-scroll",children:[L,!L&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),Sn(!1)]}),!L&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),I?o.jsx("p",{className:"pp-config-note pp-auth-preserved-note",children:"更新时保持现有 Runtime 的鉴权方式不变。"}):o.jsxs("div",{className:"pp-auth-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"鉴权方式"}),o.jsx(Jz,{ariaLabel:"部署鉴权方式",value:Oe,placeholder:"请选择鉴权方式",options:SAe,disabled:Q,onChange:de=>{ae(null),lt(de)}})]}),Oe==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(_Ae,{value:Mt,disabled:Q,onChange:de=>{ae(null),ut(de)}})]})]})]}),!L&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"消息渠道"}),o.jsx("div",{className:`pp-channel-card${v?" is-flipped":""}`,children:o.jsxs("div",{className:"pp-channel-card-inner",children:[o.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":v,"aria-hidden":v,tabIndex:v?-1:0,onClick:()=>void Fn(),disabled:v||Q||ve||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:_A,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:ve?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),o.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!v,children:[o.jsxs("div",{className:"pp-channel-card-head",children:[o.jsx("strong",{children:"飞书配置"}),o.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:v?0:-1,onClick:()=>void Fn(),disabled:!v||Q||ve||!y,children:ve?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:Qh.map(de=>o.jsxs("label",{children:[o.jsxs("span",{children:[de.comment||de.key,de.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:de.key.includes("SECRET")?"password":"text",value:E[de.key]??"",placeholder:de.placeholder,tabIndex:v?0:-1,disabled:!v||Q||!w,autoComplete:"off",onChange:Ce=>w==null?void 0:w(de.key,Ce.currentTarget.value)})]},de.key))})]})]})})]}),!I&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"实例设置"}),o.jsxs("div",{className:"pp-instance-fields",children:[o.jsxs("label",{htmlFor:"runtime-min-instance",children:[o.jsx("span",{children:"最小实例数"}),o.jsx("input",{id:"runtime-min-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:_t,disabled:Q,"aria-invalid":!ht.valid,onChange:de=>yn(de.currentTarget.value)})]}),o.jsxs("label",{htmlFor:"runtime-max-instance",children:[o.jsx("span",{children:"最大实例数"}),o.jsx("input",{id:"runtime-max-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:Ft,disabled:Q,"aria-invalid":!ht.valid,onChange:de=>Bt(de.currentTarget.value)})]})]}),D&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!ht.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:ht.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),L&&Sn(!0),I&&o.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),o.jsxs("div",{className:"pp-network-layout",children:[o.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(de=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:de,checked:Nn===de,onChange:()=>kn(de),disabled:Q||I||!_}),o.jsx("span",{children:de==="public"?"公网":de==="private"?"VPC":"公网 + VPC"})]},de))}),Nn!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(S==null?void 0:S.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:Q||I,onChange:de=>Vs({vpcId:de.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(S==null?void 0:S.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:Q||I,onChange:de=>Vs({subnetIds:de.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(S!=null&&S.enableSharedInternetAccess),disabled:Q||I,onChange:de=>Vs({enableSharedInternetAccess:de.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),$e&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"评测集"}),o.jsxs("label",{className:"pp-evaluation-set-option",children:[o.jsx("input",{type:"checkbox",checked:at,disabled:Q,onChange:de=>ft(de.currentTarget.checked)}),o.jsxs("span",{children:[o.jsx("strong",{children:"自动创建评测集"}),o.jsx("small",{children:"部署成功后,自动创建 Good Case 和 Bad Case 评测集。"})]})]})]}),o.jsxs("section",{className:"pp-config-section pp-env-section",children:[o.jsx("div",{className:"pp-env-head",children:o.jsxs("div",{children:[o.jsxs("div",{className:"pp-config-label",children:["环境变量",o.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[ms," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]})}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:_i,disabled:Q,children:[o.jsx(Ri,{className:"pp-ic"}),"添加变量"]}),(Ct.length>0||Be.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[Ct.length>0&&o.jsxs("div",{className:"pp-env-group",children:[o.jsxs("div",{className:"pp-env-group-head",children:[o.jsx("span",{children:"组件自动生成"}),o.jsxs("small",{children:[Ct.length," 项"]})]}),Ct.map(de=>{const Ce=de.key.startsWith("ENABLE_"),Pe=qA(de,E),it=de.multiline||de.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${it?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${de.key} 环境变量名`,"aria-disabled":Q,children:[o.jsx("span",{title:de.key,children:de.key}),(de.help||de.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":de.help||de.comment,"aria-label":`${de.key}说明:${de.help||de.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:de.help||de.comment})]}),de.link&&o.jsx("a",{className:"pp-env-link",href:de.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${de.link.label}`,"aria-label":`${de.key}:打开 OpenViking ${de.link.label}`,children:o.jsx(Im,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[it?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:de.value,placeholder:de.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ce,disabled:Q||!Ce&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!Pe,"aria-label":`${de.key} 环境变量值`,onChange:Ze=>w==null?void 0:w(de.key,Ze.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:"text",value:de.value,placeholder:de.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ce,disabled:Q||!Ce&&!w,autoComplete:"off","aria-invalid":!!Pe,"aria-label":`${de.key} 环境变量值`,onChange:Ze=>w==null?void 0:w(de.key,Ze.currentTarget.value)}),Pe&&o.jsx("span",{className:"pp-env-error",children:Pe})]}),o.jsx("span",{className:"pp-env-source",children:Ce?"自动":"同步"})]},de.key)})]}),Be.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Be.length," 项"]})]}),Be.map(de=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:de.key,placeholder:"名称",disabled:Q,autoComplete:"off",onChange:Ce=>rs(de.id,{key:Ce.currentTarget.value})}),o.jsx("input",{type:"text",value:de.value,placeholder:"值",disabled:Q,autoComplete:"off",onChange:Ce=>rs(de.id,{value:Ce.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:Q,onClick:()=>bs(de.id),children:o.jsx(Mi,{className:"pp-ic"})})]},de.id))]})]}),(Q||me||Object.keys(et).length>0)&&o.jsxs("section",{className:"pp-config-section pp-progress-section",children:[o.jsx("div",{className:"pp-config-label",children:"部署进度"}),o.jsx("ol",{className:"pp-steps",children:rn.map((de,Ce)=>{const Pe=Ue?rn.findIndex(Ie=>Ie.phase===Ue):-1,it=!!Se&&(Pe===-1?Ce===0:Ce===Pe);let Ze;me?Ze="done":it?Ze="failed":Pe===-1?Ze=Q?"active":"pending":Cede.phase===Ue))==null?void 0:ys.label)??Ue}阶段):`:""}${Se}`,onRetry:$n,retryLabel:I?"重试更新":"重试部署"}),me&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:I?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[me.warnings&&me.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:me.warnings.map(de=>o.jsx("span",{children:de},de))}),me.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:Tf(me.region,T)})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:me.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:me.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:An,disabled:Ae,children:[Ae?o.jsx(gn,{className:"pp-ic spin"}):o.jsx(zB,{className:"pp-ic"}),Ae?"连接中…":"立即对话"]}),me.consoleUrl&&o.jsxs("a",{href:me.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(Im,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${be?" is-external":""}`,children:be?wi.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:$n,disabled:Q||ve||F||!!n,title:n,children:Q?`${f}中…`:Se?`重试${f}`:f}),be):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:$n,disabled:Q||ve||F||!!n,title:n,children:Q?`${f}中…`:Se?`重试${f}`:f})})]})]}),ge&&s&&wi.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:de=>{de.target===de.currentTarget&&ue(!1)},children:o.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"执行流程"}),o.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),o.jsx("button",{type:"button",onClick:()=>ue(!1),"aria-label":"关闭执行流程预览",children:o.jsx(Mi,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(zm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:Tl,onAdd:Tl,onInsert:Tl,onDelete:Tl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(wAe,{open:ce,isUpdate:I,onCancel:Os,onConfirm:()=>void Gs()})]})}const fD="dogfooding",Jw="dogfooding",e_="dogfooding_b";let BAe=0;const t_=()=>++BAe;function hD(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function UAe(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function pD(e,t="volcengine"){const n=[],s=UAe(e);n.push(s);const i=s.indexOf("{"),r=s.lastIndexOf("}");i>=0&&r>i&&n.push(s.slice(i,r+1));for(const a of n)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&(typeof l.name=="string"||typeof l.instruction=="string"))return await kx(GA({...l,cloudProvider:t}))}catch{}return null}function FAe({userId:e,cloudProvider:t="volcengine",onBack:n,onCreate:s,onAgentAdded:i,onDeploymentTaskChange:r}){const[a,l]=g.useState([{id:t_(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[c,u]=g.useState(""),[d,f]=g.useState(!1),[h,p]=g.useState(null),[m,b]=g.useState(null),[v,y]=g.useState(!1),[x,E]=g.useState(null),[w,S]=g.useState(null),[_,T]=g.useState(!1),[k,A]=g.useState(!1),[j,R]=g.useState({}),B=g.useRef(null),z=g.useRef(null),L=g.useRef(null),F=g.useRef(null),C=g.useRef(null);g.useEffect(()=>{const V=F.current;V&&V.scrollTo({top:V.scrollHeight,behavior:"smooth"})},[a,d]),g.useEffect(()=>{const V=C.current;V&&(V.style.height="auto",V.style.height=Math.min(V.scrollHeight,160)+"px")},[c]);const I=V=>l(Q=>[...Q,{id:t_(),role:"assistant",text:V}]);async function D(){if(B.current)return B.current;const V=await a1(fD,e);return B.current=V,V}async function $(V,Q){if(Q.current)return Q.current;const K=await a1(V,e);return Q.current=K,K}async function O(V,Q){if(!j[V])try{const K=await d2(Q);R(ce=>({...ce,[V]:K.model||Q}))}catch{R(K=>({...K,[V]:Q}))}}async function ne(V,Q,K){const ce=await $(V,Q);let he=Ma();for await(const ue of jm({appName:V,userId:e,sessionId:ce,text:K}))he=kf(he,ue);const ge=hD(he).trim();return{project:await pD(ge,t),finalText:ge}}const se=async(V,Q,K)=>vg(V.name,V.files,{region:"cn-beijing",projectName:"default"},{...K,onStage:Q}),P=async()=>{const V=c.trim();if(!(!V||d)){if(l(Q=>[...Q,{id:t_(),role:"user",text:V}]),u(""),p(null),f(!0),v){E(null),S(null),T(!0),A(!0),O("a",Jw),O("b",e_);const Q=ne(Jw,z,V).then(({project:ce})=>(E(ce),ce)).catch(ce=>{const he=ce instanceof Error?ce.message:String(ce);return p(he),null}).finally(()=>T(!1)),K=ne(e_,L,V).then(({project:ce})=>(S(ce),ce)).catch(ce=>{const he=ce instanceof Error?ce.message:String(ce);return p(he),null}).finally(()=>A(!1));try{const[ce,he]=await Promise.all([Q,K]),ge=[ce?`方案 A:${ce.name}`:null,he?`方案 B:${he.name}`:null].filter(Boolean);ge.length?I(`已生成两个方案(${ge.join(",")}),请在右侧对比后采用其一。`):I("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{f(!1)}return}try{const Q=await D();let K=Ma();for await(const ge of jm({appName:fD,userId:e,sessionId:Q,text:V}))K=kf(K,ge);const ce=hD(K).trim(),he=await pD(ce,t);he?(b(he),I(`已生成项目:${he.name}(${he.files.length} 个文件),可在右侧预览和编辑。`)):I(ce||"(助手没有返回内容,请再描述一下你的需求。)")}catch(Q){const K=Q instanceof Error?Q.message:String(Q);p(K),I(`抱歉,调用智能构建助手失败:${K}`)}finally{f(!1)}}},Z=V=>{const Q=V==="a"?x:w;if(!Q)return;b(Q),y(!1),E(null),S(null),T(!1),A(!1);const K=V==="a"?"A":"B",ce=V==="a"?j.a:j.b;I(`已采用方案 ${K}(${ce??(V==="a"?Jw:e_)}),可继续编辑。`)},te=V=>{V.key==="Enter"&&!V.shiftKey&&!V.nativeEvent.isComposing&&(V.preventDefault(),P())};return o.jsx("div",{className:"ic-root",children:o.jsxs("div",{className:"ic-body",children:[o.jsxs("div",{className:"ic-chat",children:[o.jsxs("div",{className:"ic-transcript",ref:F,children:[o.jsx(qo,{initial:!1,children:a.map(V=>o.jsxs(es.div,{className:`ic-turn ic-turn--${V.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[V.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(mu,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:V.role==="assistant"?o.jsx(mh,{text:V.text}):V.text})]},V.id))}),d&&o.jsxs(es.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[o.jsx("div",{className:"ic-avatar",children:o.jsx(mu,{className:"ic-avatar-icon"})}),o.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"})]})]})]}),h&&o.jsxs("div",{className:"ic-error",children:[o.jsx(Gk,{className:"ic-error-icon"}),h]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:C,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:c,onChange:V=>u(V.target.value),onKeyDown:te,disabled:d}),o.jsx("button",{className:"ic-send",onClick:()=>void P(),disabled:!c.trim()||d,title:"发送 (Enter)",children:o.jsx(lte,{className:"ic-send-icon"})})]}),o.jsxs("div",{className:"ic-composer-foot",children:[o.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[o.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:v,disabled:d,onChange:V=>y(V.target.checked)}),o.jsx("span",{className:"ic-ab-track",children:o.jsx("span",{className:"ic-ab-thumb"})}),o.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),o.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),o.jsx("aside",{className:"ic-preview",children:v?o.jsxs("div",{className:"ic-compare",children:[o.jsx(mD,{side:"a",project:x,loading:_,model:j.a,onAdopt:()=>Z("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(mD,{side:"b",project:w,loading:k,model:j.b,onAdopt:()=>Z("b")})]}):m?o.jsx(yE,{project:m,onChange:b,onDeploy:se,onAgentAdded:i,onDeploymentTaskChange:r,deploymentTelemetry:{source:"scratch",createMode:"intelligent",aiAssisted:!0}}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(Fee,{className:"ic-preview-empty-glyph"}),o.jsx(gu,{className:"ic-preview-empty-spark"})]}),o.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),o.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function mD({side:e,project:t,loading:n,model:s,onAdopt:i}){const r=e==="a"?"方案 A":"方案 B";return o.jsxs("div",{className:"ic-pane",children:[o.jsxs("div",{className:"ic-pane-head",children:[o.jsxs("div",{className:"ic-pane-title",children:[o.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:r}),s&&o.jsx("span",{className:"ic-pane-model",children:s})]}),o.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${r}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),o.jsx("div",{className:"ic-pane-body",children:n?o.jsxs("div",{className:"ic-pane-loading",children:[o.jsx(gn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(yE,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var $Ae=Object.defineProperty,YA=(e,t)=>$Ae(e,"name",{value:t,configurable:!0});function zN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}YA(zN,"setRef");function eV(...e){return t=>{let n=!1;const s=e.map(i=>{const r=zN(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;iHAe(e,"name",{value:t,configurable:!0});function Gf(e){const t=g.forwardRef((n,s)=>{let{children:i,...r}=n,a=null,l=!1;const c=[];VN(i)&&typeof vb=="function"&&(i=vb(i._payload)),g.Children.forEach(i,h=>{var p;if(iV(h)){l=!0;const m=h;let b="child"in m.props?m.props.child:m.props.children;VN(b)&&typeof vb=="function"&&(b=vb(b._payload)),a=VAe(m,b),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=g.cloneElement(a,void 0,c):!l&&g.Children.count(i)===1&&g.isValidElement(i)&&(a=i);const u=a?sV(a):void 0,d=yr(s,u);if(!a){if(i||i===0)throw new Error(l?qAe(e):KAe(e));return i}const f=nV(r,a.props??{});return a.type!==g.Fragment&&(f.ref=s?d:u),g.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}qa(Gf,"createSlot");var tV=Symbol.for("radix.slottable");function zAe(e){const t=qa(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=tV,t}qa(zAe,"createSlottable");var VAe=qa((e,t)=>{if("child"in e.props){const n=e.props.child;return g.isValidElement(n)?g.cloneElement(n,void 0,e.props.children(n.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function nV(e,t){const n={...t};for(const s in t){const i=e[s],r=t[s];/^on[A-Z]/.test(s)?i&&r?n[s]=(...l)=>{const c=r(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...r}:s==="className"&&(n[s]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}qa(nV,"mergeProps");function sV(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}qa(sV,"getElementRef");function iV(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tV}qa(iV,"isSlottable");var GAe=Symbol.for("react.lazy");function VN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===GAe&&"_payload"in e&&rV(e._payload)}qa(VN,"isLazyComponent");function rV(e){return typeof e=="object"&&e!==null&&"then"in e}qa(rV,"isPromiseLike");var KAe=qa(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),qAe=qa(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),vb=Yf[" use ".trim().toString()],YAe=Object.defineProperty,WAe=(e,t)=>YAe(e,"name",{value:t,configurable:!0}),XAe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ma=XAe.reduce((e,t)=>{const n=Gf(`Primitive.${t}`),s=g.forwardRef((i,r)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function QAe(e,t){e&&wi.flushSync(()=>e.dispatchEvent(t))}WAe(QAe,"dispatchDiscreteCustomEvent");var ZAe=Object.defineProperty,ca=(e,t)=>ZAe(e,"name",{value:t,configurable:!0});function JAe(e,t){const n=g.createContext(t);n.displayName=e+"Context";const s=ca(r=>{const{children:a,...l}=r,c=g.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function i(r,a={}){const{optional:l=!1}=a,c=g.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return ca(i,"useContext"),[s,i]}ca(JAe,"createContext");function wc(e,t=[]){let n=[];function s(r,a){const l=g.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=ca(f=>{var y;const{scope:h,children:p,...m}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useMemo(()=>m,Object.values(m));return o.jsx(b.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useContext(b);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return ca(d,"useContext"),[u,d]}ca(s,"createContext");const i=ca(()=>{const r=n.map(a=>g.createContext(a));return ca(function(l){const c=(l==null?void 0:l[e])||r;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[s,aV(i,...t)]}ca(wc,"createContextScope");function aV(...e){const t=e[0];if(e.length===1)return t;const n=ca(()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return ca(function(r){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ca(aV,"composeContextScopes");var eCe=Object.defineProperty,xi=(e,t)=>eCe(e,"name",{value:t,configurable:!0});function oV(e){const t=e+"CollectionProvider",[n,s]=wc(t),[i,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=xi(b=>{const{scope:v,children:y}=b,x=g.useRef(null),E=g.useRef(new Map).current;return o.jsx(i,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Gf(l),u=g.forwardRef((b,v)=>{const{scope:y,children:x}=b,E=r(l,y),w=yr(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Gf(d),p=g.forwardRef((b,v)=>{const{scope:y,children:x,...E}=b,w=g.useRef(null),S=yr(v,w),_=r(d,y);return g.useEffect(()=>(_.itemMap.set(w,{ref:w,...E}),()=>void _.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:x})});p.displayName=d;function m(b){const v=r(e+"CollectionConsumer",b);return g.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((_,T)=>E.indexOf(_.ref.current)-E.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return xi(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,s]}xi(oV,"createCollection");var gD=new WeakMap,Zs,Cr,n_=(Cr=class extends Map{constructor(n){super(n);GC(this,Zs);ZE(this,Zs,[...super.keys()]),gD.set(this,!0)}set(n,s){return gD.get(this)&&(this.has(n)?Pi(this,Zs)[Pi(this,Zs).indexOf(n)]=n:Pi(this,Zs).push(n)),super.set(n,s),this}insert(n,s,i){const r=this.has(s),a=Pi(this,Zs).length,l=WA(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(s,i),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...Pi(this,Zs)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,s){const i=this.indexOf(n);if(i===-1)return;let r=i+s;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return r;i++}}findIndex(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return i;i++}return-1}filter(n,s){const i=[];let r=0;for(const a of this)Reflect.apply(n,s,[a,r,this])&&i.push(a),r++;return new Cr(i)}map(n,s){const i=[];let r=0;for(const a of this)i.push([a[0],Reflect.apply(n,s,[a,r,this])]),r++;return new Cr(i)}reduce(...n){const[s,i]=n;let r=0,a=i??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(s,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[s,i]=n;let r=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?r=l:r=Reflect.apply(s,this,[r,l,a,this])}return r}toSorted(n){const s=[...this.entries()].sort(n);return new Cr(s)}toReversed(){const n=new Cr;for(let s=this.size-1;s>=0;s--){const i=this.keyAt(s),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new Cr(s)}slice(n,s){const i=new Cr;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),s!==void 0&&s>0&&(r=s-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,s){let i=0;for(const r of this){if(!Reflect.apply(n,s,[r,i,this]))return!1;i++}return!0}some(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return!0;i++}return!1}},Zs=new WeakMap,xi(Cr,"OrderedDict"),Cr);function my(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=lV(e,t);return n===-1?void 0:e[n]}xi(my,"at");function lV(e,t){const n=e.length,s=WA(t),i=s>=0?s:n+s;return i<0||i>=n?-1:i}xi(lV,"toSafeIndex");function WA(e){return e!==e||e===0?0:Math.trunc(e)}xi(WA,"toSafeInteger");function tCe(e){const t=e+"CollectionProvider",[n,s]=wc(t),[i,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new n_,setItemMap:xi(()=>{},"setItemMap")}),a=xi(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=xi(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=xi(E=>{const{scope:w,children:S,state:_}=E,T=g.useRef(null),[k,A]=g.useState(null),j=yr(T,A),[R,B]=_;return g.useEffect(()=>{if(!k)return;const z=dV(()=>{});return z.observe(k,{childList:!0,subtree:!0}),()=>{z.disconnect()}},[k]),o.jsx(i,{scope:w,itemMap:R,setItemMap:B,collectionRef:j,collectionRefObject:T,collectionElement:k,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Gf(u),f=g.forwardRef((E,w)=>{const{scope:S,children:_}=E,T=r(u,S),k=yr(w,T.collectionRef);return o.jsx(d,{ref:k,children:_})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Gf(h),b=g.forwardRef((E,w)=>{const{scope:S,children:_,...T}=E,k=g.useRef(null),[A,j]=g.useState(null),R=yr(w,k,j),B=r(h,S),{setItemMap:z}=B,L=g.useRef(T);cV(L.current,T)||(L.current=T);const F=L.current;return g.useEffect(()=>{const C=F;return z(I=>A?I.has(A)?I.set(A,{...C,element:A}).toSorted(GN):(I.set(A,{...C,element:A}),I.toSorted(GN)):I),()=>{z(I=>!A||!I.has(A)?I:(I.delete(A),new n_(I)))}},[A,F,z]),o.jsx(m,{[p]:"",ref:R,children:_})});b.displayName=h;function v(){return g.useState(new n_)}xi(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return xi(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:s,useCollection:y,useInitCollection:v}]}xi(tCe,"createCollection");function cV(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}xi(cV,"shallowEqual");function uV(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}xi(uV,"isElementPreceding");function GN(e,t){return!e[1].element||!t[1].element?0:uV(e[1].element,t[1].element)?-1:1}xi(GN,"sortByDocumentPosition");function dV(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}xi(dV,"getChildListObserver");var nCe=Object.defineProperty,_h=(e,t)=>nCe(e,"name",{value:t,configurable:!0}),fV=!!(typeof window<"u"&&window.document&&window.document.createElement);function sr(e,t,{checkForDefaultPrevented:n=!0}={}){return _h(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}_h(sr,"composeEventHandlers");function sCe(e){var t;if(!fV)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}_h(sCe,"getOwnerWindow");function KN(e){if(!fV)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}_h(KN,"getOwnerDocument");function hV(e,t=!1){const{activeElement:n}=KN(e);if(!(n!=null&&n.nodeName))return null;if(pV(n)&&n.contentDocument)return hV(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const i=KN(n).getElementById(s);if(i)return i}}return n}_h(hV,"getActiveElement");function pV(e){return e.tagName==="IFRAME"}_h(pV,"isFrame");var Nu=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},iCe=Object.defineProperty,rCe=(e,t)=>iCe(e,"name",{value:t,configurable:!0}),bD=Yf[" useEffectEvent ".trim().toString()],yD=Yf[" useInsertionEffect ".trim().toString()];function mV(e){if(typeof bD=="function")return bD(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof yD=="function"?yD(()=>{t.current=e}):Nu(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}rCe(mV,"useEffectEvent");var aCe=Object.defineProperty,Gg=(e,t)=>aCe(e,"name",{value:t,configurable:!0}),oCe=Yf[" useInsertionEffect ".trim().toString()]||Nu;function Fu({prop:e,defaultProp:t,onChange:n=Gg(()=>{},"onChange"),caller:s}){const[i,r,a]=gV({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=g.useCallback(d=>{var f;if(l){const h=bV(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Gg(Fu,"useControllableState");function gV({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),r=g.useRef(t);return oCe(()=>{r.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=r.current)==null||a.call(r,n),i.current=n)},[n,i]),[n,s,r]}Gg(gV,"useUncontrolledState");function bV(e){return typeof e=="function"}Gg(bV,"isFunction");var xD=Symbol("RADIX:SYNC_STATE");function lCe(e,t,n,s){const{prop:i,defaultProp:r,onChange:a,caller:l}=t,c=i!==void 0,u=mV(a),d=[{...n,state:r}];s&&d.push(s);const[f,h]=g.useReducer((v,y)=>{if(y.type===xD)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),p=f.state,m=g.useRef(p);g.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const b=g.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return g.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:xD,state:i})},[i,f.state,c]),[b,h]}Gg(lCe,"useControllableStateReducer");var cCe=Object.defineProperty,dl=(e,t)=>cCe(e,"name",{value:t,configurable:!0});function yV(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}dl(yV,"useStateMachine");var xV=dl(e=>{const{present:t,children:n}=e,s=EV(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),r=vV(s.ref,wV(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:r}):null},"Presence");function EV(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),r=g.useRef("none"),a=g.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=yV(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{c==="mounted"?(r.current=a.current??Ed(s.current),a.current=void 0):r.current="none"},[c]),Nu(()=>{const d=s.current,f=i.current;if(f!==e){const p=r.current,m=Ed(d);e?(a.current=m,u("MOUNT")):m==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Nu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=dl(m=>{const v=Ed(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=dl(m=>{m.target===t&&(r.current=Ed(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,a.current=Ed(f)}else s.current=null;n(d)},[])}}dl(EV,"usePresence");function qN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}dl(qN,"setRef");function vV(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const s=t.current;let i=!1;const r=s.map(a=>{const l=qN(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;auCe(e,"name",{value:t,configurable:!0}),fCe=Yf[" useId ".trim().toString()]||(()=>{}),hCe=0;function _V(e){const[t,n]=g.useState(fCe());return Nu(()=>{e||n(s=>s??String(hCe++))},[e]),e||(t?`radix-${t}`:"")}dCe(_V,"useId");var pCe=Object.defineProperty,mCe=(e,t)=>pCe(e,"name",{value:t,configurable:!0}),gCe=g.createContext(void 0);function xE(e){const t=g.useContext(gCe);return e||t||"ltr"}mCe(xE,"useDirection");var bCe=Object.defineProperty,yCe=(e,t)=>bCe(e,"name",{value:t,configurable:!0});function SV(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}yCe(SV,"useCallbackRef");var xCe=Object.defineProperty,ECe=(e,t)=>xCe(e,"name",{value:t,configurable:!0});function XA(e){const[t,n]=g.useState(void 0);return Nu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let a,l;if("borderBoxSize"in r){const c=r.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}ECe(XA,"useSize");var vCe=Object.defineProperty,fl=(e,t)=>vCe(e,"name",{value:t,configurable:!0}),QA="Checkbox",[wCe,dLe]=wc(QA),[_Ce,ZA]=wCe(QA);function NV(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Fu({prop:n,defaultProp:i??!1,onChange:c,caller:QA}),[m,b]=g.useState(null),[v,y]=g.useState(null),x=g.useRef(!1),[E,w]=g.useReducer(T=>T+1,0),S=m?!!a||!!m.closest("form"):!0,_={checked:h,disabled:r,setChecked:p,control:m,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:nl(i)?!1:i,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(_Ce,{scope:t,..._,children:TV(f)?f(_):s})}fl(NV,"CheckboxProvider");var SCe="CheckboxTrigger",NCe=g.forwardRef(fl(function({__scopeCheckbox:t,onKeyDown:n,onClick:s,...i},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:b,bubbleInput:v}=ZA(SCe,t),y=yr(r,f),x=g.useRef(u);return g.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=fl(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(ma.button,{type:"button",role:"checkbox","aria-checked":nl(u)?"mixed":u,"aria-required":d,"data-state":JA(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:sr(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:sr(s,E=>{m(),h(w=>nl(w)?!0:!w),v&&b&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),TCe=g.forwardRef(fl(function(t,n){const{__scopeCheckbox:s,name:i,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(NV,{__scopeCheckbox:s,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(NCe,{...h,ref:n,__scopeCheckbox:s}),p&&o.jsx(ICe,{__scopeCheckbox:s})]})})},"Checkbox")),kCe="CheckboxIndicator",ACe=g.forwardRef(fl(function(t,n){const{__scopeCheckbox:s,forceMount:i,...r}=t,a=ZA(kCe,s);return o.jsx(xV,{present:i||nl(a.checked)||a.checked===!0,children:o.jsx(ma.span,{"data-state":JA(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),CCe="CheckboxBubbleInput",ICe=g.forwardRef(fl(function({__scopeCheckbox:t,onClick:n,...s},i){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=ZA(CCe,t),y=yr(i,v),x=XA(r),E=g.useRef(!1),w=g.useRef(c),S=g.useRef(l);g.useEffect(()=>{const T=b;if(!T)return;const k=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(k,"checked").set,R=l!==S.current;S.current=l;const B=w.current!==c;w.current=c;const z=!(R&&a.current);if(B&&j){E.current=!R;const L=new Event("click",{bubbles:z});T.indeterminate=nl(c),j.call(T,nl(c)?!1:c),T.dispatchEvent(L),E.current=!1}},[b,c,a,l]);const _=g.useRef(nl(c)?!1:c);return o.jsx(ma.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??_.current,required:d,disabled:f,name:h,value:p,form:m,...s,tabIndex:-1,ref:y,onClick:sr(n,T=>{E.current&&T.stopPropagation()}),style:{...s.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function TV(e){return typeof e=="function"}fl(TV,"isFunction");function nl(e){return e==="indeterminate"}fl(nl,"isIndeterminate");function JA(e){return nl(e)?"indeterminate":e?"checked":"unchecked"}fl(JA,"getState");var jCe=Object.defineProperty,eC=(e,t)=>jCe(e,"name",{value:t,configurable:!0}),s_=!1;function kV(){const[e,t]=g.useState(s_);return g.useEffect(()=>{s_||(s_=!0,t(!0))},[]),e}eC(kV,"useIsHydrated");var AV=Yf[" useSyncExternalStore ".trim().toString()];function CV(){return()=>{}}eC(CV,"subscribe");function IV(){return AV(CV,()=>!0,()=>!1)}eC(IV,"useIsHydratedModern");var RCe=typeof AV=="function"?IV:kV,OCe=Object.defineProperty,$u=(e,t)=>OCe(e,"name",{value:t,configurable:!0}),i_="rovingFocusGroup.onEntryFocus",MCe={bubbles:!1,cancelable:!0},EE="RovingFocusGroup",[YN,jV,LCe]=oV(EE),[DCe,vE]=wc(EE,[LCe]),[PCe,BCe]=DCe(EE),UCe=g.forwardRef($u(function(t,n){return o.jsx(YN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(YN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(FCe,{...t,ref:n})})})},"RovingFocusGroup")),FCe=g.forwardRef($u(function(t,n){const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=g.useRef(null),m=yr(n,p),b=xE(a),[v,y]=Fu({prop:l,defaultProp:c??null,onChange:u,caller:EE}),[x,E]=g.useState(!1),w=SV(d),S=jV(s),_=g.useRef(!1),[T,k]=g.useState(0);return g.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(i_,w),()=>A.removeEventListener(i_,w)},[w]),o.jsx(PCe,{scope:s,orientation:i,dir:b,loop:r,currentTabStopId:v,onItemFocus:g.useCallback(A=>y(A),[y]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:g.useCallback(()=>k(A=>A-1),[]),children:o.jsx(ma.div,{tabIndex:x||T===0?-1:0,"data-orientation":i,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:sr(t.onMouseDown,()=>{_.current=!0}),onFocus:sr(t.onFocus,A=>{const j=!_.current;if(A.target===A.currentTarget&&j&&!x){const R=new CustomEvent(i_,MCe);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const B=S().filter(I=>I.focusable),z=B.find(I=>I.active),L=B.find(I=>I.id===v),C=[z,L,...B].filter(Boolean).map(I=>I.ref.current);tC(C,f)}}_.current=!1}),onBlur:sr(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),$Ce="RovingFocusGroupItem",HCe=g.forwardRef($u(function(t,n){const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=_V(),d=a||u,f=BCe($Ce,s),h=f.currentTabStopId===d,p=jV(s),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=f,y=RCe();return Nu(()=>{if(!(!y||!i))return m(),()=>b()},[y,i,m,b]),g.useEffect(()=>{if(!(y||!i))return m(),()=>b()},[y,i,m,b]),o.jsx(YN.ItemSlot,{scope:s,id:d,focusable:i,active:r,children:o.jsx(ma.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:sr(t.onMouseDown,x=>{i?f.onItemFocus(d):x.preventDefault()}),onFocus:sr(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:sr(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=OV(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=p().filter(_=>_.focusable).map(_=>_.ref.current);if(E==="last")S.reverse();else if(E==="prev"||E==="next"){E==="prev"&&S.reverse();const _=S.indexOf(x.currentTarget);S=f.loop?MV(S,_+1):S.slice(_+1)}setTimeout(()=>tC(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),zCe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}$u(RV,"getDirectionAwareKey");function OV(e,t,n){const s=RV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return zCe[s]}$u(OV,"getFocusIntent");function tC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}$u(tC,"focusFirst");function MV(e,t){return e.map((n,s)=>e[(t+s)%e.length])}$u(MV,"wrapArray");var LV=UCe,DV=HCe,VCe=Object.defineProperty,Hi=(e,t)=>VCe(e,"name",{value:t,configurable:!0}),PV="Radio",[GCe,BV]=wc(PV),[KCe,wE]=GCe(PV);function UV(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:i,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=g.useState(null),[p,m]=g.useState(null),b=g.useRef(!1),[v,y]=g.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:i,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Hi(()=>l==null?void 0:l(),"onCheck")};return o.jsx(KCe,{scope:t,...E,children:FV(d)?d(E):s})}Hi(UV,"RadioProvider");var qCe="RadioTrigger",YCe=g.forwardRef(Hi(function({__scopeRadio:t,onClick:n,...s},i){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=wE(qCe,t),m=yr(i,c);return o.jsx(ma.button,{type:"button",role:"radio","aria-checked":r,"data-state":nC(r),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:m,onClick:sr(n,b=>{r||(f(),u()),p&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),WCe="RadioIndicator",XCe=g.forwardRef(Hi(function(t,n){const{__scopeRadio:s,forceMount:i,...r}=t,a=wE(WCe,s);return o.jsx(xV,{present:i||a.checked,children:o.jsx(ma.span,{"data-state":nC(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),QCe="RadioBubbleInput",ZCe=g.forwardRef(Hi(function({__scopeRadio:t,onClick:n,...s},i){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:b}=wE(QCe,t),v=yr(i,p),y=XA(r),x=g.useRef(!1),E=g.useRef(a),w=g.useRef(b);g.useEffect(()=>{const _=h;if(!_)return;const T=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(T,"checked").set,j=b!==w.current;w.current=b;const R=E.current!==a;E.current=a;const B=!(j&&m.current);if(R&&A){x.current=!j;const z=new Event("click",{bubbles:B});A.call(_,a),_.dispatchEvent(z),x.current=!1}},[h,a,m,b]);const S=g.useRef(a);return o.jsx(ma.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...s,tabIndex:-1,ref:v,onClick:sr(n,_=>{x.current&&_.stopPropagation()}),style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function FV(e){return typeof e=="function"}Hi(FV,"isFunction");function nC(e){return e?"checked":"unchecked"}Hi(nC,"getState");var JCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],sC="RadioGroup",[eIe,fLe]=wc(sC,[vE,BV]),$V=vE(),_E=BV(),[tIe,nIe]=eIe(sC),sIe=g.forwardRef(Hi(function(t,n){const{__scopeRadioGroup:s,name:i,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,b=$V(s),v=xE(f),[y,x]=Fu({prop:l,defaultProp:a??null,onChange:p,caller:sC}),[E,w]=g.useState(null),S=yr(n,w),_=g.useRef(y);return g.useEffect(()=>{const T=r?E==null?void 0:E.ownerDocument.getElementById(r):E==null?void 0:E.closest("form");if(T instanceof HTMLFormElement){const k=Hi(()=>x(_.current),"reset");return T.addEventListener("reset",k),()=>T.removeEventListener("reset",k)}},[E,r,x]),o.jsx(tIe,{scope:s,name:i,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(LV,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(ma.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:S})})})},"RadioGroup")),iIe="RadioGroupItemProvider",rIe="RadioGroupItemTrigger";function HV(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:i,internal_do_not_use_render:r}=e,a=nIe(iIe,t),l=_E(t),c=a.disabled||s;return o.jsx(UV,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:r,children:i})}Hi(HV,"RadioGroupItemProvider");var aIe=g.forwardRef(Hi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=$V(s),a=_E(s),{checked:l,disabled:c}=wE(rIe,a.__scopeRadio),u=g.useRef(null),d=yr(n,u),f=g.useRef(!1);return g.useEffect(()=>{const h=Hi(m=>{JCe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Hi(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(DV,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(YCe,{...a,...i,ref:d,onKeyDown:sr(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:sr(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),oIe=g.forwardRef(Hi(function(t,n){const{__scopeRadioGroup:s,value:i,disabled:r,...a}=t;return o.jsx(HV,{__scopeRadioGroup:s,value:i,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(aIe,{...a,ref:n,__scopeRadioGroup:s}),l&&o.jsx(lIe,{__scopeRadioGroup:s})]})})},"RadioGroupItem")),lIe=g.forwardRef(Hi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=_E(s);return o.jsx(ZCe,{...r,...i,ref:n})},"RadioGroupItemBubbleInput")),cIe=g.forwardRef(Hi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=_E(s);return o.jsx(XCe,{...r,...i,ref:n})},"RadioGroupIndicator")),uIe=Object.defineProperty,dIe=(e,t)=>uIe(e,"name",{value:t,configurable:!0}),fIe="Toggle",hIe=g.forwardRef(dIe(function(t,n){const{pressed:s,defaultPressed:i,onPressedChange:r,...a}=t,[l,c]=Fu({prop:s,onChange:r,defaultProp:i??!1,caller:fIe});return o.jsx(ma.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:sr(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),pIe=Object.defineProperty,hc=(e,t)=>pIe(e,"name",{value:t,configurable:!0}),Sh="ToggleGroup",[zV,hLe]=wc(Sh,[vE]),VV=vE(),mIe=g.forwardRef(hc(function(t,n){const{type:s,...i}=t;if(s==="single"){const r=i;return o.jsx(gIe,{role:"radiogroup",...r,ref:n})}if(s==="multiple"){const r=i;return o.jsx(bIe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${Sh}\``)},"ToggleGroup")),[GV,KV]=zV(Sh),gIe=g.forwardRef(hc(function(t,n){const{value:s,defaultValue:i,onValueChange:r=hc(()=>{},"onValueChange"),...a}=t,[l,c]=Fu({prop:s,defaultProp:i??"",onChange:r,caller:Sh});return o.jsx(GV,{scope:t.__scopeToggleGroup,type:"single",value:g.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:g.useCallback(()=>c(""),[c]),children:o.jsx(qV,{...a,ref:n})})},"ToggleGroupImplSingle")),bIe=g.forwardRef(hc(function(t,n){const{value:s,defaultValue:i,onValueChange:r=hc(()=>{},"onValueChange"),...a}=t,[l,c]=Fu({prop:s,defaultProp:i??[],onChange:r,caller:Sh}),u=g.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=g.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(GV,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(qV,{...a,ref:n})})},"ToggleGroupImplMultiple")),[yIe,xIe]=zV(Sh),qV=g.forwardRef(hc(function(t,n){const{__scopeToggleGroup:s,disabled:i=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=VV(s),f=xE(l),h={dir:f,...u};return o.jsx(yIe,{scope:s,rovingFocus:r,disabled:i,children:r?o.jsx(LV,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(ma.div,{...h,ref:n})}):o.jsx(ma.div,{...h,ref:n})})},"ToggleGroupImpl")),WN="ToggleGroupItem",EIe=g.forwardRef(hc(function(t,n){const s=KV(WN,t.__scopeToggleGroup),i=xIe(WN,t.__scopeToggleGroup),r=VV(t.__scopeToggleGroup),a=s.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=g.useRef(null);return i.rovingFocus?o.jsx(DV,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(ED,{...c,ref:n})}):o.jsx(ED,{...c,ref:n})},"ToggleGroupItem")),ED=g.forwardRef(hc(function(t,n){const{__scopeToggleGroup:s,value:i,...r}=t,a=KV(WN,s),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(hIe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl"));const vIe="_Container_1tuad_1",wIe="_Checkbox_1tuad_22",_Ie="_CheckMark_1tuad_92",SIe="_Label_1tuad_162",wb={Container:vIe,Checkbox:wIe,CheckMark:_Ie,Label:SIe},YV=({className:e,label:t,id:n,disabled:s,orientation:i="left",...r})=>{const a=g.useId(),l=n??a;return o.jsxs("div",{"data-disabled":s?"":void 0,"data-has-label":t?"":void 0,"data-orientation":i,className:ba(e,wb.Container),children:[o.jsx(TCe,{className:wb.Checkbox,id:l,disabled:s,...r,children:o.jsx(ACe,{className:wb.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:wb.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},NIe="_RadioGroup_onrfm_1",TIe="_RadioLabel_onrfm_9",kIe="_RadioIndicatorWrapper_onrfm_26",AIe="_RadioItem_onrfm_43",CIe="_RadioIndicator_onrfm_26",Tp={RadioGroup:NIe,RadioLabel:TIe,RadioIndicatorWrapper:kIe,RadioItem:AIe,RadioIndicator:CIe},WV=g.createContext(null),IIe=()=>{const e=g.use(WV);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},XN=({onChange:e,children:t,className:n,direction:s="row",disabled:i=!1,...r})=>{const a=g.useMemo(()=>({disabled:i,direction:s}),[i,s]);return o.jsx(WV,{value:a,children:o.jsx(sIe,{className:ba(Tp.RadioGroup,n),"data-direction":s,onValueChange:e,disabled:i,...r,children:t})})},jIe=({value:e,disabled:t=!1,required:n,children:s,className:i,block:r=!1,...a})=>{const{disabled:l}=IIe(),c=l||t,u=g.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ba(Tp.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:Tp.RadioIndicatorWrapper,children:o.jsx(oIe,{id:d,value:e,disabled:c,required:n,className:Tp.RadioItem,children:o.jsx(cIe,{className:Tp.RadioIndicator})})}),s]})})};XN.Item=jIe;function RIe({className:e,...t}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),o.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const vd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:RIe},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:$ee},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:ute},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Xk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:xx}},OIe=[vd.llm,vd.sequential,vd.parallel,vd.loop,vd.a2a];function XV(e){return vd[e??"llm"]}const QV=e=>e==="sequential"||e==="parallel"||e==="loop",SE=e=>e==="a2a";function pc(e){return e.trimEnd().replace(/[。.]+$/,"")}function U1(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(s=>s==null?void 0:s.toLocaleLowerCase().includes(n)):!0}function jc(e,t){return e[t]|e[t+1]<<8}function dd(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function MIe(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function ZV(e,t={}){let s=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(dd(e,u)===101010256){s=u;break}if(s<0)throw new Error("无效的 zip:找不到 EOCD");const i=jc(e,s+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=dd(e,s+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=jc(e,v+26),E=jc(e,v+28),w=v+30+x+E,S=e.subarray(w,w+f);let _;if(d===0)_=S;else if(d===8)_=await MIe(S);else{r+=46+p+m+b;continue}l.push({name:y,text:a.decode(_)}),r+=46+p+m+b}return l}const LIe="/harness/skills/findskill";async function DIe(e,t="public"){const n=e.trim(),s=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),i=`${LIe}?${s.toString()}`,r=await fetch(i,{headers:{accept:"application/json"},signal:Pn(void 0,xc)});if(!r.ok)throw new Error(`搜索失败 (${r.status})`);return((await r.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function PIe({selected:e,onChange:t}){const[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(!1),h=b=>e.some(v=>v.source==="skillhub"&&v.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},m=async b=>{l(!0),u(null),f(!0);try{const v=await DIe(b);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return g.useEffect(()=>{const b=n.trim();if(!b){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(b),300);return()=>clearTimeout(v)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(t1,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?o.jsx(gn,{className:"cw-i cw-spin"}):o.jsx(t1,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(yc,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(gn,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const v=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(b),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(za,{className:"cw-i cw-i-sm"}):o.jsx(Ri,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:pc(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const QN=/(^|\/)skill\.md$/i;function BIe(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function UIe(...e){var t;for(const n of e){const s=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(s)return s.slice(0,64)}return"local-skill"}function FIe(e,t){return t.trim()||e}function JV(e){const t=e.map(s=>({path:s.path.replace(/\\/g,"/").replace(/^\.\//,""),text:s.text})).filter(s=>s.path.length>0&&!s.path.endsWith("/")),n=new Set(t.map(s=>s.path.split("/")[0]));if(n.size===1&&t.every(s=>s.path.includes("/"))){const s=[...n][0]+"/";return t.map(i=>({path:i.path.slice(s.length),text:i.text}))}return t}function $Ie(e){const t=new Map,n=new Set;for(const s of e)if(QN.test("/"+s.path)){const i=s.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const s of e){const i=s.path.split("/");let r="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=QN.test("/"+s.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?s.path.slice(r.length+1):s.path,c=t.get(r)||[];c.push({path:l,text:s.text}),t.set(r,c)}return t}function HIe(e,t,n){const s=`${n}${e?"/"+e:""}`,i=t.find(c=>QN.test("/"+c.path));if(!i)return{hit:null,error:`${s} 缺少 SKILL.md`};const r=PIe(i.text),a=UIe(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${s} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${s} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:FIe(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function zIe(e){const t=new Uint8Array(await e.arrayBuffer()),s=(await ZV(t)).map(i=>({path:i.name,text:i.text}));return eG(JV(s),e.name)}async function VIe(e,t=new Map){const n=[];for(let s=0;se.file(t,n))}async function KIe(e){const t=e.createReader(),n=[];for(;;){const s=await new Promise((i,r)=>t.readEntries(i,r));if(s.length===0)return n;n.push(...s)}}async function tG(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await GIe(e),path:n}];if(!e.isDirectory)return[];const s=await KIe(e);return(await Promise.all(s.map(i=>tG(i,n)))).flat()}function qIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(!1),d=g.useRef(0),f=E=>e.some(w=>w.source==="local"&&w.folder===E),h=E=>{E.localFiles&&(f(E.folder||E.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(E.folder||E.name)))):t([...e,{source:"local",folder:E.folder||E.name,name:E.name,description:E.description,localFiles:E.localFiles}]))},p=g.useRef([]),m=g.useRef(e);g.useEffect(()=>{p.current=i},[i]),g.useEffect(()=>{m.current=e},[e]);const b=E=>{const w=new Set([...p.current.map(k=>k.folder||k.name),...m.current.filter(k=>k.source==="local").map(k=>k.folder)]),S=[],_=[];for(const k of E.hits){const A=k.folder||k.name;if(w.has(A)){S.push(k.name);continue}w.add(A),_.push(k)}r(k=>[...k,..._]);const T=[...E.errors];if(S.length>0&&T.push(`已跳过重复技能:${S.join("、")}`),s(T),_.length===1&&E.errors.length===0&&S.length===0){const k=_[0];k.localFiles&&t([...m.current,{source:"local",folder:k.folder||k.name,name:k.name,description:k.description,localFiles:k.localFiles}])}},v=E=>{E.preventDefault(),d.current+=1,u(!0)},y=E=>{E.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async E=>{if(E.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(E.dataTransfer.items).map(S=>{var _;return(_=S.webkitGetAsEntry)==null?void 0:_.call(S)}).filter(S=>S!==null);if(w.length===0){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const S=(await Promise.all(w.map(k=>tG(k)))).flat(),_=w.some(k=>k.isDirectory);if(!_&&S.length===1&&S[0].file.name.toLowerCase().endsWith(".zip")){b(await zIe(S[0].file));return}if(!_){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const T=new Map(S.map(({file:k,path:A})=>[k,A]));b(await VIe(S.map(({file:k})=>k),T))}catch(S){s([`读取失败:${S instanceof Error?S.message:String(S)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:v,onDragOver:E=>E.preventDefault(),onDragLeave:y,onDrop:E=>void x(E),children:[o.jsx(Yk,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(bc,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(E=>{var S;const w=f(E.folder||E.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Ha,{className:"cw-i cw-i-sm"}):o.jsx(ji,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:E.name}),E.description&&o.jsx("span",{className:"cw-skill-result-desc",children:hc(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((S=E.localFiles)==null?void 0:S.length)??0," 个文件"]})]})]},E.id)})})]})}function YIe({selected:e,onChange:t,cloudProvider:n="volcengine"}){const[s,i]=g.useState([]),[r,a]=g.useState([]),[l,c]=g.useState(""),[u,d]=g.useState(!0),[f,h]=g.useState(!1),[p,m]=g.useState(null);g.useEffect(()=>{let E=!1;return(async()=>{d(!0),m(null);try{const w=await y7();E||(i(w),w.length>0&&c(w[0].id))}catch(w){E||m(w instanceof Error?w.message:"加载失败")}finally{E||d(!1)}})(),()=>{E=!0}},[]),g.useEffect(()=>{if(!l){a([]);return}const E=s.find(S=>S.id===l);let w=!1;return(async()=>{h(!0),m(null);try{const S=await x7(l,E==null?void 0:E.region);w||a(S)}catch(S){w||m(S instanceof Error?S.message:"加载失败")}finally{w||h(!1)}})(),()=>{w=!0}},[l,s]);const b=s.find(E=>E.id===l),v=b?Xfe(b.id,b.region,n):"",y=(E,w)=>e.some(S=>S.source==="skillspace"&&S.skillId===E&&(S.version||"")===w),x=E=>{if(b)if(y(E.skillId,E.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===E.skillId&&(w.version||"")===E.version)));else{const w=Wfe(b,E);t([...e,{source:"skillspace",folder:w.folder||E.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return o.jsx("div",{className:"cw-skillspace",children:u?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(yn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):p?o.jsxs("div",{className:"cw-banner",children:[o.jsx(bc,{className:"cw-i"}),o.jsx("span",{children:p})]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:l,onChange:E=>c(E.target.value),"aria-label":"选择 AgentKit Skills 中心",children:s.map(E=>o.jsxs("option",{value:E.id,children:[E.name||E.id,E.description?` — ${hc(E.description)}`:""]},E.id))}),b&&o.jsxs(o.Fragment,{children:[b.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:b.region,children:Nf(b.region,n)}),v&&o.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(Im,{className:"cw-i cw-i-sm"})})]})]}),f?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(yn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):r.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:r.map(E=>{const w=y(E.skillId,E.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>x(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Ha,{className:"cw-i cw-i-sm"}):o.jsx(ji,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[E.skillName,E.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",E.version]})]}),E.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:hc(E.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(Iee,{className:"cw-i cw-i-sm"})," ",(b==null?void 0:b.name)||l]})]})]},`${E.skillId}/${E.version}`)})})]})})}async function WIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Bn(void 0,yc)});if(t.status===409)throw new Error("服务端未配置云厂商 AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function XIe(e={}){const t=new URLSearchParams({page_size:String(e.pageSize??100),project:e.project||"default"});return e.region&&t.set("region",e.region),(await WIe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function QIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Bn(void 0,yc)});if(t.status===409)throw new Error("服务端未配置云厂商 AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function ZIe(e={}){const t=new URLSearchParams;e.project&&t.set("project",e.project),e.region&&t.set("region",e.region);const n=t.toString();return(await QIe(`/web/viking-knowledgebases${n?`?${n}`:""}`)).items||[]}const vD=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function r_(e){let t=0;for(let n=0;n>>0;return vD[t%vD.length]}function JIe(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,s=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):s.push(u);const i=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>r(f,d+1))}),a=s.sort(i).map(u=>r(u,0)),l=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:l,total:c-l||1}}function eje(e,t){const n=[],s=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(s)};return e.forEach(s),n}function wD(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const tje=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function _D(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const s=String(n);return{key:tje(t),value:s,long:s.length>80||s.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function nG({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let S;if(t)S=z8(t,n);else if(e)S=l1(e,n,s);else{u("缺少调用链路来源");return}S.then(_=>{l(_),p(_.length?_.reduce((T,k)=>T.start_time<=k.start_time?T:k).span_id:null)}).catch(_=>u(_ instanceof Error?_.message:String(_)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>JIe(a??[]),[a]),y=g.useMemo(()=>eje(m,d),[m,d]),x=(a==null?void 0:a.find(S=>S.span_id===h))??null,E=v/1e6,w=S=>f(_=>{const T=new Set(_);return T.has(S)?T.delete(S):T.add(S),T});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(Oi,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(yn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(S=>{const _=S.span,T=(_.start_time-b)/v*100,k=Math.max((_.end_time-_.start_time)/v*100,.6),A=S.children.length>0;return o.jsxs("button",{className:`trace-row ${h===_.span_id?"active":""}`,onClick:()=>p(_.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:S.depth*14},children:[o.jsx("span",{className:`trace-caret ${A?"":"hidden"} ${d.has(_.span_id)?"":"open"}`,onClick:j=>{j.stopPropagation(),A&&w(_.span_id)},children:o.jsx(uc,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:r_(_.name)}}),o.jsx("span",{className:"trace-name",title:_.name,children:_.name})]}),o.jsx("span",{className:"trace-dur",children:wD(_.end_time-_.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${T}%`,width:`${k}%`,background:r_(_.name)}})})]},_.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:r_(x.name)}}),wD(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:_D(x).filter(S=>!S.long).map(S=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:S.key}),o.jsx("span",{className:"td-val",children:S.value})]},S.key))}),_D(x).filter(S=>S.long).map(S=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:S.key}),o.jsx("pre",{className:"td-pre",children:S.value})]},S.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const nje=g.lazy(()=>lu(()=>import("./MarkdownPromptEditor-BdhMqVzS.js"),__vite__mapDeps([0,1]))),ZN="veadk.generatedAgentTestRuns",SD=4;function iC(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(ZN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function sG(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(ZN,JSON.stringify(t)):window.sessionStorage.removeItem(ZN)}catch{}}function sje(e){sG([...iC(),e])}function op(e){sG(iC().filter(t=>t!==e))}function ije(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const rje=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:cte,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:bc,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:Ree},{id:"tools",label:"工具",hint:"可调用的能力",icon:VB},{id:"skills",label:"技能",hint:"声明式技能",icon:mu},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:qb},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:$B},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:Tee},{id:"review",label:"完成",hint:"预览并创建",icon:ate}];function aje({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function ND({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function iG({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function rG({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const oje={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},TD={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},aG="REGISTRY_SPACE_ID",lje=g7.filter(e=>e.key!==aG);function oG(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||Da.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||Da.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||Da.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function _b(e,t){return t!=="byteplus"?e:e.map(n=>n.key==="MODEL_EMBEDDING_NAME"?{...n,placeholder:Fte(t)}:n.key==="MODEL_EMBEDDING_API_BASE"?{...n,placeholder:r1(t)}:n)}function cje({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(YV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function a_({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function uje(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function lp({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=qA(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(Im,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:uje(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function o_(e){return e.name.trim()||"未命名智能体中心"}function l_(e){const t=e.name.trim()||e.id||"未命名知识库",n=[e.sourceLabel,e.projectName].filter(Boolean);return n.length?`${t} · ${n.join(" · ")}`:t}function dje({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||Da.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let A=!1;return c(!0),d(null),XIe({region:i}).then(j=>{A||a(j)}).catch(j=>{A||(a([]),d(j instanceof Error?j.message:"加载失败"))}).finally(()=>{A||c(!1)}),()=>{A=!0}},[i,f]);const x=!e||r.some(A=>A.id===e.trim()),E=r.find(A=>A.id===e.trim()),w=E?o_(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",S=l&&r.length===0,_=g.useMemo(()=>r.filter(A=>U1(b,[o_(A),A.id,A.projectName])),[b,r]),T=!!(e&&!x&&U1(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const A=R=>{const B=R.target;B instanceof Node&&y.current&&!y.current.contains(B)&&m(!1)},j=R=>{R.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",j)}},[p]);const k=A=>{s(A),m(!1)};return o.jsxs("div",{className:`cw-a2a-space-picker${p?" is-open":""}`,ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:S,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(A=>!A)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(iG,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:A=>v(A.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[T&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:"已选择的智能体中心"}),_.map(A=>{const j=o_(A),R=A.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":R,className:`cw-a2a-space-option ${R?"is-selected":""}`,title:`${j} (${A.id})`,onClick:()=>k(A.id),children:j},A.id)}),!T&&_.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(A=>A+1),children:l?o.jsx(yn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(rG,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(bc,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(yn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function fje({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let _=!1;return r(!0),l(null),ZIe().then(T=>{_||s(T)}).catch(T=>{_||(s([]),l(T instanceof Error?T.message:"加载失败"))}).finally(()=>{_||r(!1)}),()=>{_=!0}},[c]);const b=!e||n.some(_=>_.id===e.trim()),v=n.find(_=>_.id===e.trim()),y=v?l_(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(_=>U1(h,[l_(_),_.id,_.description,_.projectName,_.resourceId,_.agentkitKnowledgeId,_.providerKnowledgeId,_.sourceLabel])),[n,h]),w=!!(e&&!b&&U1(h,[e]));g.useEffect(()=>{if(!d)return;const _=k=>{const A=k.target;A instanceof Node&&m.current&&!m.current.contains(A)&&f(!1)},T=k=>{k.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",_),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",_),window.removeEventListener("keydown",T)}},[d]);const S=_=>{t(_),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(yn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:`cw-a2a-space-picker cw-viking-kb-picker${d?" is-open":""}`,ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(_=>!_)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(iG,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:_=>p(_.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S({id:e,name:e,description:"",projectName:"",region:"",sourceKind:"knowledge",sourceLabel:"Knowledge Engine",resourceId:""}),children:e}),E.map(_=>{const T=l_(_),k=_.id===e,A=[_.id,_.resourceId,_.agentkitKnowledgeId,_.providerKnowledgeId].filter(Boolean).join(" / ");return o.jsx("button",{type:"button",role:"option","aria-selected":k,className:`cw-a2a-space-option ${k?"is-selected":""}`,title:A?`${T} (${A})`:T,onClick:()=>S(_),children:T},_.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(_=>_+1),children:i?o.jsx(yn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(rG,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(bc,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function hje({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(Ko,{initial:!1,children:e.map((r,a)=>o.jsxs(is.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(dc,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),iAe(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(bc,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:nAe(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?sAe(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(ji,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function lG({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function pje({s:e,onRemove:t}){let n=mu,s="火山 Find Skill 技能广场";return e.source==="local"?(n=Yk,s="本地"):e.source==="skillspace"&&(n=lG,s="AgentKit Skills 中心"),o.jsxs(is.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${hc(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Oi,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const c_=[{id:"local",label:"本地文件",icon:Yk},{id:"skillspace",label:"AgentKit Skills 中心",icon:lG},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:xx}];function mje({selected:e,onChange:t,cloudProvider:n}){const[s,i]=g.useState("local"),[r,a]=g.useState(!1),l=c_.findIndex(u=>u.id===s),c=u=>t(e.filter(d=>u_(d)!==u));return g.useEffect(()=>{if(!r)return;const u=d=>{d.key==="Escape"&&a(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>a(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(ji,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Ko,{initial:!1,children:e.map(u=>o.jsx(pje,{s:u,onRemove:()=>c(u_(u))},u_(u)))})})]}),o.jsx(Ko,{children:r&&o.jsx(is.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:u=>{u.target===u.currentTarget&&a(!1)},children:o.jsxs(is.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>a(!1),children:o.jsx(Oi,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${c_.length})`,"--cw-active-skill-tab-offset":`calc(${l*100}% + ${l*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),c_.map(({id:u,label:d,icon:f})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${u}`,"aria-controls":"cw-skill-tabpanel","aria-selected":s===u,className:`cw-skill-pickertab ${s===u?"is-on":""}`,onClick:()=>i(u),children:[o.jsx(f,{className:"cw-i cw-i-sm"}),d]},u))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${s}`,children:[s==="skillhub"&&o.jsx(DIe,{selected:e,onChange:t}),s==="local"&&o.jsx(qIe,{selected:e,onChange:t}),s==="skillspace"&&o.jsx(YIe,{selected:e,onChange:t,cloudProvider:n})]})]})]})})})]})}function u_(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Sb({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(is.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function gje(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function Nb(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Kg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Kg(r[s],i,n),{...e,subAgents:r}}function bje(e,t,n="volcengine"){return Kg(e,t,s=>({...s,subAgents:[...s.subAgents,Ci(n)]}))}function yje(e,t,n,s="volcengine"){return Kg(e,t,i=>{const r=i.subAgents.slice();return r.splice(n,0,Ci(s)),{...i,subAgents:r}})}function xje(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Kg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const JN=e=>!SE(e.agentType),kD=3;function Eje(e,t,n=!1){var i;if(SE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=nc(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":QV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function cG(e,t,n=[]){const s=[],i=SE(e.agentType),r=Eje(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:XV(e.agentType).label,problem:r}),JN(e)&&e.subAgents.forEach((a,l)=>s.push(...cG(a,t,[...n,l]))),s}function vje(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function uG(e){return 1+e.subAgents.reduce((t,n)=>t+uG(n),0)}function dG(e){const t=gE(e),n=[],s={...t.envValues},i=t.draft.cloudProvider??"volcengine",r=l=>{var c,u,d,f;for(const h of l.builtinTools??[]){const p=Ou.find(m=>m.id===h);p&&n.push({env:_b(p.env,i)})}for(const h of l.mcpTools??[])h.authTokenEnv&&n.push({env:[{key:h.authTokenEnv,required:!1,comment:`${h.name.trim()||"MCP"} Bearer Token`}]});if((c=l.a2aRegistry)!=null&&c.enabled&&(n.push({env:g7}),Object.assign(s,oG(l.a2aRegistry,{includeDefaults:!0}))),l.memory.shortTerm&&n.push({env:_b(((u=cN.find(h=>h.id===(l.shortTermBackend??"local")))==null?void 0:u.env)??[],i)}),l.memory.longTerm&&n.push({env:_b(((d=uN.find(h=>h.id===(l.longTermBackend??"local")))==null?void 0:d.env)??[],i)}),l.knowledgebase&&n.push({env:_b(((f=dN.find(h=>h.id===(l.knowledgebaseBackend??vu)))==null?void 0:f.env)??[],i)}),l.tracing)for(const h of l.tracingExporters??[]){const p=zfe.find(m=>m.id===h);p&&n.push({env:p.env,enableFlag:p.enableFlag})}l.subAgents.forEach(r)};r(t.draft);const a=Wz(n);return{specs:a.specs,fixedValues:{...a.fixedValues,...s}}}function fG(e){var n;return{...gE(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function eT(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=eT(s);if(i)return i}return""}function hG(e){var s,i;const t=dG(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...fG(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(Xz(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function wje(e){return JSON.stringify(hG(e))}function F1(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Yd(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function _je({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===F1(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),S=x.description.trim(),_=x.instruction.trim(),T=Yd(x),k=!!(w&&S&&_&&n.findIndex(D=>Yd(D)===T)!==E),A=!w||!S||!_||k,j=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==F1(s,x)),R=x.phase==="starting",B=x.phase==="ready"&&!j,z=R||x.phase==="sending",L=B&&x.phase!=="sending"&&x.messages.some(D=>D.role==="assistant"),F=z||x.configOpen||A,C=w?S?_?k?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",I=R?"正在启动":j?"应用配置并重启":B||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(ND,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(B1,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):R?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(yn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):j?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:B?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:C||"启动环境后即可加入本轮测试"})}):x.messages.map((D,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${D.role}`,children:o.jsx("div",{className:"cw-debug-content",children:D.role==="user"?D.content:D.error?o.jsx(B1,{message:D.error,className:"cw-debug-msg-error",defaultExpanded:!0}):D.blocks&&D.blocks.length>0?o.jsx(kA,{blocks:D.blocks,onAction:()=>{}}):D.content?D.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(qH,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!L,title:L?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:C||void 0,onClick:()=>l(x.id),children:[B||j||x.phase==="error"?o.jsx(rte,{className:"cw-i"}):o.jsx(aje,{className:"cw-i cw-debug-run-icon"}),I]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(ND,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${C?" is-disabled":""}`,tabIndex:C?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||A,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),C&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:C})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:D=>p(x.id,"modelName",D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:D=>p(x.id,"description",D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:D=>p(x.id,"instruction",D.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:pG.map(D=>o.jsx(YV,{checked:x.optimizations.includes(D.id),disabled:!0,label:D.label,className:"cw-ab-optimization-checkbox"},D.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{AA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(yn,{className:"cw-i cw-spin"}):o.jsx(DB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(ji,{className:"cw-i"}),"添加对照组"]})]})]})}const Tb=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],pG=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function Sje({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function Nje({mode:e,busy:t,onChange:n,assistant:s}){const i=Tb.findIndex(l=>l.id===e),r=Tb[i-1],a=Tb[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:Tb.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function Tje({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,createMode:a="custom",deploymentTarget:l,cloudProvider:c="volcengine",initialDeployRegion:u=Ti(c),onDeploymentComplete:d,onDeploymentStarted:f,onDraftChange:h,onDiscard:p}){var qa,ba,wc,nr,Hu,qs,ie,Qt,Pn,Ts,en,ks,Vr,Gr;const[m,b]=g.useState(()=>s??Ci(c));g.useEffect(()=>{const ne=c==="byteplus"?t2:YB,Se=c==="byteplus"?e2:qB;b(ge=>{var bn,St;const st=((bn=ge.modelName)==null?void 0:bn.trim())===ne?i1(c):ge.modelName,on=((St=ge.modelApiBase)==null?void 0:St.trim())===Se?r1(c):ge.modelApiBase;return st===ge.modelName&&on===ge.modelApiBase?ge:{...ge,modelName:st,modelApiBase:on}})},[c]);const[v,y]=g.useState(""),[x,E]=g.useState(!1),[w,S]=g.useState(!1),[_,T]=g.useState(!1),[k,A]=g.useState(null),j=v.trim(),R=j.length>0&&j.length{C.current=h},[h]),g.useEffect(()=>{var ne;L!==z.current&&(z.current=L,(ne=C.current)==null||ne.call(C,m,F))},[m,F,L]);const[I,D]=g.useState("build"),[$,O]=g.useState(!1),[te,se]=g.useState(0),[P,Q]=g.useState(null),[ee,V]=g.useState(!1),[X,K]=g.useState((l==null?void 0:l.region)??u),ce=(i==null?void 0:i.generatedAgentTestRun)===!0,he=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[be,ue]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:eT(s??Ci(c)),description:(s??Ci(c)).description,instruction:(s??Ci(c)).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[we,Le]=g.useState("baseline"),Ne=g.useRef(1),ae=g.useRef(!1),me=g.useRef(new Map),[_e,Je]=g.useState(0),[Pe,Fe]=g.useState(""),[Ye,Ce]=g.useState(null),[Ve,Ue]=g.useState(!1),[W,oe]=g.useState(!1),Z=g.useRef(null),[Ee,Me]=g.useState(""),[lt,Ot]=g.useState(!1),[ut,xn]=g.useState(!1),[xt,wt]=g.useState([]),En=g.useRef(null),Ut=g.useRef({});async function Pt(){const ne=new Set([...me.current.values()].map(({run:ge})=>ge.runId)),Se=iC().filter(ge=>!ne.has(ge));Se.length&&await Promise.all(Se.map(async ge=>{try{await md(ge),op(ge)}catch(st){console.warn("清理遗留调试运行失败",st)}}))}g.useEffect(()=>(Pt(),()=>{for(const{run:ne}of me.current.values())md(ne.runId).then(()=>op(ne.runId)).catch(Se=>console.warn("清理调试运行失败",Se));me.current.clear()}),[]),g.useEffect(()=>()=>{var ne;(ne=Z.current)==null||ne.call(Z,!1),Z.current=null},[]);const at=g.useRef(null);at.current||(at.current=({meta:ne,children:Se})=>o.jsxs("section",{ref:ge=>{Ut.current[ne.id]=ge},id:`cw-sec-${ne.id}`,"data-step-id":ne.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:ne.label})}),o.jsx("div",{className:"cw-sec-body",children:Se})]}));const ft=gje(m,xt)?xt:[],He=Nb(m,ft),_t=ft.length===0,ye=`cw-model-advanced-${ft.join("-")||"root"}`,We=`cw-a2a-registry-advanced-${ft.join("-")||"root"}`,Ge=ne=>b(Se=>Kg(Se,ft,ge=>({...ge,...ne}))),ht=(ne,Se)=>b(ge=>{var st;return{...ge,deployment:{...ge.deployment??{feishuEnabled:!1},envValues:{...((st=ge.deployment)==null?void 0:st.envValues)??{},[ne]:Se}}}}),Vn=ne=>Ge({a2aRegistry:{...He.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...ne}}),un=(ne,Se)=>{if(!(ne in TD))return;const ge=TD[ne];Vn({[ge]:Se}),ht(ne,Se)},Ht=ne=>{if(!(_t&&ne==="a2a")){if(ne==="a2a"){Ge({agentType:ne,a2aRegistry:{...He.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Ge({agentType:ne,a2aRegistry:He.a2aRegistry?{...He.a2aRegistry,enabled:!1}:void 0})}},sn=(ne,Se)=>{b(ne),Se&&wt(Se)},kn=async()=>{const ne=v.trim();if(!(!ne||x)&&!(ne.length{const Se=Nb(m,ne);if(!JN(Se)||ne.length>=kD)return;const ge=bje(m,ne,c),st=Nb(ge,ne).subAgents.length-1;sn(ge,[...ne,st])},ot=(ne,Se)=>{const ge=Nb(m,ne);if(!JN(ge)||ne.length>=kD)return;const st=Math.max(0,Math.min(Se,ge.subAgents.length)),on=yje(m,ne,st,c);sn(on,[...ne,st])},An=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(b(Ci(c)),wt([]),O(!1))},mn=ne=>{if(ne.length===0){An();return}sn(xje(m,ne),ne.slice(0,-1))},At=He.builtinTools??[],Os=He.mcpTools??[],Ms=He.selectedSkills??[],bs=ne=>Ge({builtinTools:At.includes(ne)?At.filter(Se=>Se!==ne):[...At,ne]}),vn=QV(He.agentType),Gn=SE(He.agentType),ls=g.useMemo(()=>LH(m),[m]),Kn=Gn?null:nc(He.name)??(ls.has(He.name)?"Agent 名称在当前结构中必须唯一":null),Ss=Kn!==null,Ns=!Gn&&He.description.trim().length===0,hi=He.instruction.trim().length===0,Cn=Gn&&!((qa=He.a2aRegistry)!=null&&qa.registrySpaceId.trim()),Ks=ne=>$&&ne?`is-error cw-error-shake-${te%2}`:"",cs=g.useMemo(()=>cG(m,ls),[m,ls]),qn=cs.length===0,Yn=g.useMemo(()=>wje(m),[m]),Wn=be.find(ne=>ne.id===we)??be[0],Ls=g.useMemo(()=>dG(m),[m]),ys=ne=>{var Se;(Se=Ut.current[ne])==null||Se.scrollIntoView({behavior:"smooth",block:"start"})},gn=()=>qn?!0:(O(!0),se(ne=>ne+1),cs[0]&&(wt(cs[0].path),window.requestAnimationFrame(()=>ys(cs[0].problem==="缺少子 Agent"?"type":"basic"))),!1),fn=async()=>{Ce(null);const ne=[...me.current.values()];me.current.clear(),Je(0),ue(Se=>Se.map(ge=>({...ge,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(ne.map(async({run:Se})=>{try{await md(Se.runId),op(Se.runId)}catch(ge){console.warn("清理调试运行失败",ge)}}))},dn=async ne=>{const Se=me.current.get(ne);if(Se){me.current.delete(ne),Je(me.current.size);try{await md(Se.run.runId),op(Se.run.runId)}catch(ge){console.warn("清理调试运行失败",ge)}}},rn=ne=>{const Se=me.current.get(ne),ge=be.find(st=>st.id===ne);!Se||!ge||Ce({runId:Se.run.runId,sessionId:Se.sessionId,variantName:ge.name})},an=ne=>{const Se=Z.current;Z.current=null,Se==null||Se(ne)},xs=()=>{W||(Ue(!1),an(!1))},de=async()=>{if(!W){oe(!0);try{await fn(),Ue(!1),an(!0)}finally{oe(!1)}}},Ie=async()=>I!=="validate"||_e===0?!0:Z.current?!1:new Promise(ne=>{Z.current=ne,Ue(!0)}),Be=async ne=>{var ge;if(!await Ie())return;if(Me(""),!gn()){D("build");return}const Se=Qz(Ls.specs,((ge=m.deployment)==null?void 0:ge.envValues)??{});if(Se){Me(`${Se.spec.comment||Se.spec.key}:${Se.error}`),D("build");return}V(!0);try{const st=ne?be.find(St=>St.id===ne):Wn;st&&Le(st.id);const on=st?{...m,modelName:st.modelName||m.modelName,description:st.description,instruction:st.instruction}:m,bn=await kx(fG(on));on!==m&&b(on),Q(bn),D("publish")}catch(st){Me(st instanceof Error?st.message:String(st))}finally{V(!1)}},it=async ne=>{if(!ce||ee||!gn())return;const Se=be.find(Qn=>Qn.id===ne);if(!Se||Se.phase==="starting"||Se.phase==="sending")return;const ge=Se.modelName.trim(),st=Se.description.trim(),on=Se.instruction.trim(),bn=Yd(Se),St=be.findIndex(Qn=>Qn.id===ne),qt=be.findIndex(Qn=>Yd(Qn)===bn);if(!ge||!st||!on||qt!==St)return;const wn=F1(Yn,Se);ue(Qn=>Qn.map(ir=>ir.id===ne?{...ir,configOpen:!1,phase:"starting",messages:[],error:null}:ir)),Fe("");let Ds=null,sr;const zi=Date.now(),wr=ne==="baseline"?"baseline":"comparison";try{await dn(ne),await Pt();const Qn={...m,modelName:Se.modelName||m.modelName,description:Se.description,instruction:Se.instruction};sr="create_test_run",Ds=await $8(hG(Qn),l?{runtimeId:l.runtimeId,region:l.region}:void 0),sje(Ds.runId),sr="create_test_session";const ir=await H8(Ds.runId,"test_user");me.current.set(ne,{run:Ds,sessionId:ir}),Je(me.current.size),ue(Dt=>Dt.map(Ps=>Ps.id===ne?{...Ps,phase:"ready",runtimeSnapshot:wn}:Ps)),ETe({durationMs:Date.now()-zi,variantType:wr})}catch(Qn){if(Ds)try{await md(Ds.runId),op(Ds.runId)}catch(ir){console.warn("清理调试运行失败",ir)}ue(ir=>ir.map(Dt=>Dt.id===ne?{...Dt,phase:"error",runtimeSnapshot:"",error:Qn instanceof Error?Qn.message:String(Qn)}:Dt)),vTe({durationMs:Date.now()-zi,variantType:wr,phase:sr,error:Qn})}},et=async()=>{const ne=Pe.trim(),Se=be.filter(st=>st.phase==="ready"&&st.runtimeSnapshot===F1(Yn,st)&&me.current.has(st.id));if(!ne||Se.length===0)return;Fe("");const ge=new Set(Se.map(st=>st.id));ue(st=>st.map(on=>ge.has(on.id)?{...on,phase:"sending",messages:[...on.messages,{role:"user",content:ne},{role:"assistant",content:"",blocks:[]}]}:on)),await Promise.all(Se.map(async st=>{const on=me.current.get(st.id);if(on)try{let bn=Oa();for await(const St of V8({runId:on.run.runId,userId:"test_user",sessionId:on.sessionId,text:ne})){const qt=St.error||St.errorMessage||St.error_message;if(qt||(bn=Tf(bn,St)),ue(wn=>wn.map(Ds=>{if(Ds.id!==st.id)return Ds;const sr=[...Ds.messages],zi={...sr[sr.length-1]};return qt?zi.error=String(qt):(zi.content=bn.blocks.filter(wr=>wr.kind==="text").map(wr=>wr.text).join(""),zi.blocks=bn.blocks),sr[sr.length-1]=zi,{...Ds,messages:sr}})),qt)break}}catch(bn){ue(St=>St.map(qt=>{if(qt.id!==st.id)return qt;const wn=[...qt.messages],Ds={...wn[wn.length-1]};return Ds.error=bn instanceof Error?bn.message:String(bn),wn[wn.length-1]=Ds,{...qt,messages:wn}}))}finally{ue(bn=>bn.map(St=>St.id===st.id?{...St,phase:"ready"}:St))}}))},Et=()=>{ue(ne=>{if(ne.length>=3)return ne;const Se=Ne.current++,ge=`variant-${Se}`;return[...ne,{id:ge,name:`对照组 ${Se}`,modelName:m.modelName??"",description:m.description,instruction:m.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},je=async ne=>{await dn(ne),ue(Se=>Se.filter(ge=>ge.id!==ne)),we===ne&&Le("baseline")},Ln=(ne,Se)=>ue(ge=>ge.map(st=>st.id===ne?{...st,...Se}:st)),us=(ne,Se,ge)=>{ne==="baseline"&&Se==="modelName"&&(ae.current=!0),Ln(ne,{[Se]:ge}),!(we!==ne||ne==="baseline")&&Le("baseline")},pi=ne=>{const Se=be.find(wn=>wn.id===ne);if(!Se)return;const ge=Se.modelName.trim(),st=Se.description.trim(),on=Se.instruction.trim(),bn=Yd(Se),St=be.findIndex(wn=>wn.id===ne),qt=be.findIndex(wn=>Yd(wn)===bn);if(!(!ge||!st||!on||qt!==St)){if(ne==="baseline"){Ln(ne,{configOpen:!1});return}it(ne)}},ri=async(ne,Se,ge)=>{var bn;const st=(bn=m.deployment)==null?void 0:bn.network,on=st&&st.mode&&st.mode!=="public"?{mode:st.mode,vpc_id:st.vpcId,subnet_ids:st.subnetIds,enable_shared_internet_access:st.enableSharedInternetAccess}:void 0;return vg(ne.name,ne.files,{region:(l==null?void 0:l.region)??X,projectName:"default",network:on},{...ge,onStage:Se,runtimeId:l==null?void 0:l.runtimeId,appName:l==null?void 0:l.appName,description:m.description})},Xn=()=>{gn()&&(ue(ne=>ne.map(Se=>Se.id==="baseline"&&!me.current.has(Se.id)?{...Se,modelName:ae.current?Se.modelName:eT(m),description:m.description,instruction:m.instruction}:Se)),D("validate"))},Jt=async ne=>{if(ne==="publish"){if(!gn())return;P?D("publish"):Be();return}if(ne==="validate"){Xn();return}await Ie()&&D(ne)},vt=at.current,Dn=ne=>rje.find(Se=>Se.id===ne),mi=o.jsx("section",{className:`cw-ai-compose${x?" is-generating":""}${w?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Ko,{initial:!1,mode:"wait",children:w?o.jsxs(is.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>S(!1),children:"重新生成"})]},"success"):o.jsxs(is.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:ne=>{ne.preventDefault(),kn()},children:[o.jsx("input",{type:"text",value:v,maxLength:8e3,disabled:x,placeholder:`描述目标,使用 ${$te(c)} 模型一键生成配置`,"aria-invalid":!!R,"aria-describedby":R?"ai-requirement-error":void 0,onChange:ne=>y(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),kn())}}),o.jsx("button",{type:"submit",disabled:x||!j||!!R,"aria-label":x?"正在智能生成":"智能生成",children:x?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),R&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:R})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${I}`,children:[o.jsx(Sje,{mode:I}),Ee&&o.jsx(B1,{className:"cw-workspace-alert",message:Ee}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[I==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(zm,{draft:m,direction:"horizontal",selectedPath:ft,onSelect:wt,onAdd:zt,onInsert:ot,onDelete:mn}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:En,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(vt,{meta:Dn("type"),children:[o.jsx(XN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:He.agentType??"llm",onChange:Ht,children:RIe.map(ne=>{const Se=(He.agentType??"llm")===ne.id,ge=_t&&ne.id==="a2a",st=ge?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":ne.id,className:`cw-agent-type-option ${Se?"is-on":""} ${ge?"is-disabled":""}`,tabIndex:ge?0:void 0,"aria-describedby":st,children:[o.jsx(XN.Item,{value:ne.id,disabled:ge,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:oje[ne.id]})})}),ge&&o.jsx("span",{id:st,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},ne.id)})}),$&&vn&&He.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:vje({name:He.name.trim()||"未命名",typeLabel:XV(He.agentType).label})})]}),o.jsx(vt,{meta:Dn("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Gn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[_t?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Ks(Ss)}`,value:He.name,placeholder:"assistant",onChange:ne=>Ge({name:ne.target.value})}),$&&Kn?o.jsx("span",{className:"cw-error-text",children:Kn}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[_t?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Ks(Ns)}`,value:He.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:ne=>Ge({description:ne.target.value})}),$&&Ns?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:_t?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),vn?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),He.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:He.maxIterations??3,onChange:ne=>Ge({maxIterations:Math.max(1,Number(ne.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Gn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(dje,{value:((ba=He.a2aRegistry)==null?void 0:ba.registrySpaceId)??"",region:((wc=He.a2aRegistry)==null?void 0:wc.registryRegion)||Da.region,invalid:$&&Cn,onChange:ne=>un(aG,ne)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":ut,"aria-controls":We,onClick:()=>xn(ne=>!ne),children:[o.jsx("span",{children:"更多选项"}),o.jsx(uc,{className:`cw-more-options-chevron ${ut?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ko,{initial:!1,children:ut&&o.jsx(is.div,{id:We,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:o.jsx(lp,{env:lje,values:oG(He.a2aRegistry,{includeDefaults:!1}),onChange:un})})}),$&&Cn&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(nje,{value:He.instruction,invalid:hi,onChange:ne=>Ge({instruction:ne})})}),$&&hi?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!vn&&!Gn&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{meta:Dn("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:He.modelName??"",placeholder:i1(c),onChange:ne=>Ge({modelName:ne.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":lt,"aria-controls":ye,onClick:()=>Ot(ne=>!ne),children:[o.jsx("span",{children:"更多选项"}),o.jsx(uc,{className:`cw-more-options-chevron ${lt?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ko,{initial:!1,children:lt&&o.jsxs(is.div,{id:ye,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:He.modelProvider??"",placeholder:"openai",onChange:ne=>Ge({modelProvider:ne.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:He.modelApiBase??"",placeholder:r1(c),onChange:ne=>Ge({modelApiBase:ne.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(vt,{meta:Dn("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(cje,{items:b7,selected:At,onToggle:bs,scrollRows:6})}),o.jsx(Ko,{initial:!1,children:At.includes("run_code")&&o.jsxs(is.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(lp,{env:((nr=Ou.find(ne=>ne.id==="run_code"))==null?void 0:nr.env)??[],values:((Hu=m.deployment)==null?void 0:Hu.envValues)??{},onChange:ht})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(hje,{tools:Os,onChange:ne=>Ge({mcpTools:ne})})]})]})}),o.jsx(vt,{meta:Dn("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(mje,{selected:Ms,onChange:ne=>Ge({selectedSkills:ne}),cloudProvider:c})})}),o.jsx(vt,{meta:Dn("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Sb,{checked:He.knowledgebase,onChange:ne=>Ge({knowledgebase:ne}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:qb}),He.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(a_,{options:dN,value:He.knowledgebaseBackend,onChange:ne=>Ge({knowledgebaseBackend:ne,knowledgebaseIndex:ne==="viking"?He.knowledgebaseIndex:""})}),(He.knowledgebaseBackend??vu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(fje,{value:He.knowledgebaseIndex??"",onChange:ne=>{Ge({knowledgebaseIndex:ne.id}),ne.projectName&&ht("DATABASE_VIKING_PROJECT",ne.projectName),ne.region&&ht("DATABASE_VIKING_REGION",ne.region),ne.sourceKind&&ht("DATABASE_VIKING_COLLECTION_KIND",ne.sourceKind),ht("DATABASE_VIKING_RESOURCE_ID",ne.resourceId??"")}})]}),o.jsx(lp,{env:((qs=dN.find(ne=>ne.id===(He.knowledgebaseBackend??vu)))==null?void 0:qs.env)??[],values:((ie=m.deployment)==null?void 0:ie.envValues)??{},onChange:ht})]})]})}),_t&&o.jsx(vt,{meta:Dn("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Sb,{checked:He.memory.shortTerm,onChange:ne=>Ge({memory:{...He.memory,shortTerm:ne}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:$B}),He.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(a_,{options:cN,value:He.shortTermBackend,onChange:ne=>Ge({shortTermBackend:ne})}),o.jsx(lp,{env:((Qt=cN.find(ne=>ne.id===(He.shortTermBackend??"local")))==null?void 0:Qt.env)??[],values:((Pn=m.deployment)==null?void 0:Pn.envValues)??{},onChange:ht})]}),o.jsx(Sb,{checked:He.memory.longTerm,onChange:ne=>Ge({memory:{...He.memory,longTerm:ne}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:qb}),He.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(a_,{options:uN,value:He.longTermBackend,onChange:ne=>Ge({longTermBackend:ne})}),o.jsx(lp,{env:((Ts=uN.find(ne=>ne.id===(He.longTermBackend??"local")))==null?void 0:Ts.env)??[],values:((en=m.deployment)==null?void 0:en.envValues)??{},onChange:ht}),o.jsx(Sb,{checked:!!He.autoSaveSession,onChange:ne=>Ge({autoSaveSession:ne}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:qb})]})]})})]})]})})})})})]})}),I==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(_je,{enabled:ce,disabledReason:he,variants:be,draftSnapshot:Yn,input:Pe,onInput:Fe,onSend:et,onStartVariant:it,onDeployVariant:ne=>void Be(ne),onAddVariant:Et,onRemoveVariant:je,onToggleConfig:ne=>{const Se=be.find(ge=>ge.id===ne);Se&&Ln(ne,{configOpen:!Se.configOpen})},onCompleteConfig:pi,onConfigChange:us,onOpenTrace:rn})})}),I==="publish"&&o.jsx("div",{className:"cw-preview-body",children:P?o.jsx(yE,{embedded:!0,cloudProvider:c,project:P,agentDraft:m,agentName:m.name||"未命名 Agent",agentCount:uG(m),releaseConfiguration:Wn?{modelName:Wn.modelName||m.modelName||"默认模型",description:Wn.description,instruction:Wn.instruction,optimizations:Wn.optimizations.flatMap(ne=>{const Se=pG.find(ge=>ge.id===ne);return Se?[Se.label]:[]})}:void 0,onChange:Q,onDeploy:ri,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:l?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:l==null?void 0:l.runtimeId,onDeploymentStarted:f,onDeploymentComplete:d,feishuEnabled:!!((ks=m.deployment)!=null&&ks.feishuEnabled),onFeishuEnabledChange:ne=>{const Se={...m,deployment:{...m.deployment??{feishuEnabled:!1},feishuEnabled:ne}};b(Se)},deploymentEnv:Ls.specs,deploymentEnvValues:{...(Vr=m.deployment)==null?void 0:Vr.envValues,...Ls.fixedValues},onDeploymentEnvChange:ht,network:(Gr=m.deployment)==null?void 0:Gr.network,onNetworkChange:ne=>b(Se=>({...Se,deployment:{...Se.deployment??{feishuEnabled:!1},network:ne}})),deployRegion:X,onDeployRegionChange:K,deploymentTelemetry:{source:"scratch",createMode:a,aiAssisted:_},onExportYaml:()=>ije(`${m.name||"agent"}.yaml`,rAe(m),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(yn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(Nje,{mode:I,busy:ee,onChange:Jt,assistant:I==="build"?mi:void 0}),Ye&&o.jsx(nG,{testRunId:Ye.runId,sessionId:Ye.sessionId,title:`调用链路 · ${Ye.variantName}`,onClose:()=>Ce(null)}),Ve&&o.jsx(mA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:W?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:W,onCancel:xs,onConfirm:()=>void de()}),k&&o.jsx("div",{className:"confirm-scrim",onClick:()=>A(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:ne=>ne.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:k}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>A(null),children:"关闭"})})]})})]})}function Do(e){return{...Ci(),...e}}const kje=[{id:"support",icon:Vee,draft:Do({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:Aee,draft:Do({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:Gee,draft:Do({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Kk,draft:Do({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:Qee,draft:Do({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:hte,draft:Do({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[Do({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),Do({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),Do({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function mG(e,t){if(t!=="byteplus")return e;const n=i1(t);return{...e,model:e.model==="doubao-1.5-pro-32k"?n:e.model,modelName:e.modelName===t2?n:e.modelName,modelApiBase:!e.modelApiBase||e.modelApiBase===e2?r1(t):e.modelApiBase,subAgents:e.subAgents.map(s=>mG(s,t))}}function Aje(e){const t=[];return e.tools.length&&t.push({icon:VB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:kee,label:"记忆"}),e.knowledgebase&&t.push({icon:Nee,label:"知识库"}),e.tracing&&t.push({icon:See,label:"观测"}),e.subAgents.length&&t.push({icon:ete,label:`子Agent ${e.subAgents.length}`}),t}function Cje({cloudProvider:e="volcengine",onBack:t,onCreate:n}){const[s,i]=g.useState(null),r=g.useMemo(()=>kje.map(a=>({...a,draft:mG(a.draft,e)})),[e]);return o.jsx("div",{className:"tpl-root",children:s?o.jsx(jje,{template:s,onBack:()=>i(null),onCreate:n}):o.jsx(Ije,{templates:r,onPick:i})})}function Ije({templates:e,onPick:t}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:e.map((n,s)=>o.jsxs(is.button,{type:"button",className:"tpl-card",onClick:()=>t(n),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:s*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(n.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:n.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:hc(n.draft.description)})]},n.id))})]})}function jje({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=Aje(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(Vk,{className:"icon"})," 返回模板列表"]}),o.jsxs(is.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:hc(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:Rje(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:hc(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(uc,{className:"icon"})]})]})]})}function Rje(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const Oje=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:HB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:LB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Xk}];let tT=0;function d_(){return tT+=1,`node_${tT}`}function f_(e,t,n="volcengine",s){const i=Ci(n);return{id:e,type:"agentNode",position:t,data:{agent:{...i,name:(s==null?void 0:s.name)??`agent_${e.replace("node_","")}`,...s}}}}function Mje({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Bi,{type:"target",position:Qe.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(pu,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Bi,{type:"source",position:Qe.Right,className:"wfb-handle"})]})}const Lje={agentNode:Mje},AD={type:"smoothstep",markerEnd:{type:If.ArrowClosed,width:16,height:16}};function Dje({cloudProvider:e="volcengine",onBack:t,onCreate:n}){const s=g.useRef(null),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState("sequential"),d=g.useMemo(()=>{tT=0;const I=d_();return f_(I,{x:80,y:120},e,{name:"agent_1"})},[e]),[f,h,p]=DU([d]),[m,b,v]=PU([]),[y,x]=g.useState(d.id),E=f.find(I=>I.id===y)??null,w=i.trim()||"workflow_agent",S=g.useMemo(()=>LH({name:w,subAgents:f.map(I=>I.data.agent)}),[w,f]),_=nc(w)??(S.has(w)?"名称须与 Agent 节点名称保持唯一":null),T=E?nc(E.data.agent.name)??(S.has(E.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=f.length>0&&_===null&&f.every(I=>nc(I.data.agent.name)===null&&!S.has(I.data.agent.name)),A=g.useCallback(I=>b(D=>uU({...I,...AD},D)),[b]),j=g.useCallback(()=>{const I=d_(),D=f.length*28,$=f_(I,{x:80+D,y:120+D},e);h(O=>O.concat($)),x(I)},[e,f.length,h]),R=I=>{I.dataTransfer.setData("application/wfb-node","agentNode"),I.dataTransfer.effectAllowed="move"},B=g.useCallback(I=>{I.preventDefault(),I.dataTransfer.dropEffect="move"},[]),z=g.useCallback(I=>{if(I.preventDefault(),I.dataTransfer.getData("application/wfb-node")!=="agentNode"||!s.current)return;const $=s.current.screenToFlowPosition({x:I.clientX,y:I.clientY}),O=d_(),te=f_(O,$,e);h(se=>se.concat(te)),x(O)},[e,h]),L=g.useCallback(I=>{y&&h(D=>D.map($=>$.id===y?{...$,data:{...$.data,agent:{...$.data.agent,...I}}}:$))},[y,h]),F=g.useCallback(()=>{y&&(h(I=>I.filter(D=>D.id!==y)),b(I=>I.filter(D=>D.source!==y&&D.target!==y)),x(null))},[y,h,b]),C=g.useCallback(()=>{if(!k)return;const I=f.map($=>$.data.agent),D={...Ci(e),name:w,description:a.trim(),instruction:a.trim(),subAgents:I,workflow:{type:c,nodes:f.map($=>({id:$.id,agent:$.data.agent})),edges:m.map($=>({from:$.source,to:$.target}))}};n(D)},[k,e,f,m,w,a,c,n]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:i,onChange:I=>r(I.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:a,onChange:I=>l(I.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:Oje.map(({type:I,label:D,desc:$,Icon:O})=>o.jsxs("button",{type:"button",className:`wfb-type ${c===I?"wfb-type--active":""}`,onClick:()=>u(I),children:[o.jsx(O,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:D}),o.jsx("span",{className:"wfb-type-desc",children:$})]})]},I))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:R,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(zee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(pu,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:j,children:[o.jsx(ji,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:C,disabled:!k,type:"button",children:[o.jsx(mu,{className:"icon"}),"创建工作流"]}),o.jsxs(LU,{nodes:f,edges:m,onNodesChange:p,onEdgesChange:v,onConnect:A,onInit:I=>s.current=I,nodeTypes:Lje,defaultEdgeOptions:AD,onDrop:z,onDragOver:B,onNodeClick:(I,D)=>x(D.id),onPaneClick:()=>x(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(UU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx($U,{showInteractive:!1}),o.jsx(Xce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:F,title:"删除节点",children:o.jsx(dc,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${T?"wfb-input--error":""}`,value:E.data.agent.name,onChange:I=>L({name:I.target.value}),placeholder:"agent_name"}),T?o.jsx("span",{className:"wfb-field-error",children:T}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:E.data.agent.description,onChange:I=>L({description:I.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:E.data.agent.instruction,onChange:I=>L({instruction:I.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:E.data.agent.tools.join(", "),onChange:I=>L({tools:I.target.value.split(",").map(D=>D.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:E.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(pu,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",f.length," 个节点 · ",m.length," 条连线"]})]})})]})})}function Pje(e){return o.jsx(L2,{children:o.jsx(Dje,{...e})})}const CD=50*1024*1024,nT=800,Bje={name:"code_package",files:[]};function Uje(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function Fje(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function $je(e){const t=e.flatMap(a=>{const l=Fje(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>nT)throw new Error(`代码包文件数不能超过 ${nT} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function Hje({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,cloudProvider:r="volcengine",initialDeployRegion:a=Ti(r)}){const l=g.useRef(null),c=g.useRef(0),[u,d]=g.useState(null),[f,h]=g.useState(""),[p,m]=g.useState(!1),[b,v]=g.useState(!1),[y,x]=g.useState(!1),[E,w]=g.useState(""),[S,_]=g.useState(a),[T,k]=g.useState();g.useEffect(()=>()=>{c.current+=1},[]);async function A(z){const L=++c.current;if(w(""),!z.name.toLowerCase().endsWith(".zip")){w("请选择 .zip 格式的代码包。");return}if(z.size>CD){w("代码包不能超过 50 MB。");return}v(!0);try{const F=await ZV(new Uint8Array(await z.arrayBuffer()),{maxEntries:nT,maxUncompressedBytes:CD}),C=$je(F);if(L!==c.current)return;h(z.name),d({name:Uje(z.name),files:C})}catch(F){if(L!==c.current)return;h(""),d(null),w(F instanceof Error?F.message:String(F))}finally{L===c.current&&v(!1)}}function j(z){var F;const L=(F=z.currentTarget.files)==null?void 0:F[0];z.currentTarget.value="",L&&A(L)}function R(z){var F;z.preventDefault(),x(!1);const L=(F=z.dataTransfer.files)==null?void 0:F[0];L&&A(L)}async function B(z,L,F){const C=T&&T.mode!=="public"?{mode:T.mode,vpc_id:T.vpcId,subnet_ids:T.subnetIds,enable_shared_internet_access:T.enableSharedInternetAccess}:void 0;return vg(z.name,z.files,{region:S,projectName:"default",network:C},{...F,onStage:L})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(yE,{cloudProvider:r,project:u??Bje,agentName:(u==null?void 0:u.name)||"代码包",onChange:u?d:void 0,onDeploy:B,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:T,onNetworkChange:k,deployRegion:S,onDeployRegionChange:_,deploymentTelemetry:{source:"code_package",createMode:"code_package",aiAssisted:!1},onBack:e,backLabel:"返回创建方式",deployDisabled:!u||b,deployDisabledReason:b?"正在读取代码包":u?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${y?" is-dragging":""}${u?" is-ready":""}`,onDragEnter:z=>{z.preventDefault(),x(!0)},onDragOver:z=>z.preventDefault(),onDragLeave:z=>{z.currentTarget.contains(z.relatedTarget)||x(!1)},onDrop:R,onClick:()=>{var z;b||(z=l.current)==null||z.click()},onKeyDown:z=>{var L;!b&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),(L=l.current)==null||L.click())},role:"button",tabIndex:b?-1:0,"aria-label":u?"重新上传代码包":"上传代码包","aria-disabled":b,children:[o.jsx("strong",{children:b?"正在读取代码包…":u?f:"请上传代码包"}),o.jsx("span",{children:u?`已识别 ${u.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:u&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:z=>{z.stopPropagation(),m(!0)},onKeyDown:z=>z.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:l,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:j})]}),E&&o.jsx("div",{className:"package-create-error",role:"alert",children:E})]})}),u&&o.jsx(Zz,{project:u,open:p,onClose:()=>m(!1),onChange:d})]})}const gG=1;function $1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zje(e){return $1(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&$1(e.draft)}function NE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function Vje(e){var s;const t=gE(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function bG(e){return{...e,draft:Vje(e.draft)}}function Gje(e){const t=Array.isArray(e)?e:$1(e)&&e.version===gG?e.drafts:void 0;if(!Array.isArray(t)||!t.every(zje))throw $1(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(bG)}function Kje(e,t){if(!t)return[];const n=e.getItem(NE(t));if(!n)return[];try{return Gje(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function ID(e,t,n){if(!t)return;const s={version:gG,drafts:n.map(bG)};try{e.setItem(NE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const qje="/web/skill-creator";class rC extends Error{constructor(n,s){super(n);zC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function $u(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function ps(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function yG(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function qg(e,t){return fetch(Rn(`${qje}${e}`),{...t,headers:Ex({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function aC(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=$u(await e.json(),"错误响应");return ps(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function oC(e,t){if(!e.ok)throw new rC(await aC(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function Yje(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function Wje(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function Xje(e){return Array.isArray(e)?e.map((t,n)=>{const s=$u(t,`文件 ${n+1}`),i=ps(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=yG(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function Qje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function Zje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=$u(t,`活动 ${n+1}`),i=ps(s,"id"),r=ps(s,"kind"),a=ps(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=ps(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=ps(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function Jje(e,t){const n=$u(e,`候选方案 ${t+1}`),s=ps(n,"id","candidate_id","candidateId"),i=ps(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:ps(n,"modelLabel","model_label")??i,status:Yje(n.status),stage:Wje(n.stage),name:ps(n,"name","skill_name","skillName"),description:ps(n,"description"),skillMd:ps(n,"skillMd","skill_md"),files:Xje(n.files),activities:Zje(n.activities),validation:Qje(n.validation),durationMs:yG(n,"elapsedMs","elapsed_ms"),error:ps(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:ps(n,"skill_id","skillId"),version:ps(n,"version")}}function sT(e,t=""){const n=$u(e,"Skill 创建任务"),s=ps(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(Jje):[],r=ps(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:ps(n,"prompt")??t,status:r,candidates:i}}async function eRe(e,t){const n=await qg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new rC(await aC(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=sT(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=$u(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(ps(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=sT(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` -`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!l)throw new Error("创建 Skill 任务失败:服务端未返回任务");return l}async function tRe(e){const t=await qg(`/jobs/${encodeURIComponent(e)}`);return sT(await oC(t,"读取 Skill 任务失败"))}async function nRe(e){const t=await qg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await oC(t,"清理 Skill 任务失败")}async function sRe(e,t){var l;const n=await qg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await aC(n,"下载 Skill 失败"));const i=((l=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:l[1])??"skill.zip",r=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=r,a.download=i,a.click(),URL.revokeObjectURL(r)}async function iRe(e,t,n){const s=await qg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=$u(await oC(s,"添加到 AgentKit 失败"),"发布结果"),r=ps(i,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:ps(i,"name"),version:ps(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:ps(i,"message")}}const rRe=()=>{};function aRe(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function oRe({activities:e}){const t=g.useMemo(()=>e.filter(n=>n.kind!=="status").map(aRe),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(kA,{blocks:t,onAction:rRe})})}const jD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},RD=12e4;function lRe({status:e}){return e==="succeeded"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):o.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function cRe(){return o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),o.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function uRe(){return o.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:o.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function dRe({candidate:e}){var c,u;const[t,n]=g.useState("SKILL.md"),s=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!s?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=i.find(d=>d.path===t)??i[0],a=(c=e.skillMd)==null?void 0:c.slice(0,RD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>RD;return i.length===0?null:o.jsxs("div",{className:"skill-files",children:[o.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>o.jsx("button",{type:"button",role:"tab","aria-selected":(r==null?void 0:r.path)===d.path,className:(r==null?void 0:r.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(r!=null&&r.path.endsWith("SKILL.md"))?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"skill-files__content",children:o.jsx("code",{children:a})}),l?o.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):o.jsx("div",{className:"skill-files__unavailable",children:r?`${r.path} · ${r.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function fRe({label:e,jobId:t,candidate:n,selected:s,publishing:i,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=g.useState("conversation"),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState(""),[S,_]=g.useState(""),T=g.useRef(null),k=g.useRef(null),A=n.status==="queued"||n.status==="running",j=n.status==="succeeded",R=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${s?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),s?o.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[o.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[o.jsx("span",{className:"skill-candidate__status-icon",children:o.jsx(lRe,{status:n.status})}),A?o.jsx(Pa,{duration:2.2,spread:16,children:jD[n.stage]}):o.jsx("span",{children:jD[n.stage]}),n.durationMs!==void 0&&j?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(oRe,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,j?o.jsx("div",{className:"skill-candidate__view-actions",children:o.jsxs("button",{ref:T,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var B;return(B=k.current)==null?void 0:B.focus()})},children:[o.jsx(cRe,{}),"查看 Skill"]})}):null]}):o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[o.jsx("div",{className:"skill-candidate__preview-nav",children:o.jsxs("button",{ref:k,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var B;return(B=T.current)==null?void 0:B.focus()})},children:[o.jsx(uRe,{}),"返回对话"]})}),o.jsxs("div",{className:"skill-candidate__result",children:[o.jsxs("div",{className:"skill-candidate__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Skill"}),o.jsx("strong",{children:n.name??"未命名 Skill"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"文件"}),o.jsx("strong",{children:n.files.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"校验"}),o.jsx("strong",{className:(R==null?void 0:R.valid)===!1?"is-invalid":"is-valid",children:(R==null?void 0:R.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,R&&(R.errors.length>0||R.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...R.errors,...R.warnings].map((B,z)=>o.jsx("div",{children:B},`${B}-${z}`))]}):null,o.jsx(dRe,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":s,onClick:l,children:s?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),sRe(t,n.id).catch(B=>{v(B instanceof Error?B.message:String(B))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!s||i||r||n.published,title:s?void 0:"请先采用此方案",onClick:()=>h(B=>!B),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),b?o.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&s&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:B=>{B.preventDefault();const z=y.split(",").map(L=>L.trim()).filter(Boolean);c({skillSpaceIds:z,...E.trim()?{projectName:E.trim()}:{},...S.trim()?{skillId:S.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:B=>x(B.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),o.jsxs("div",{className:"skill-publish-form__optional",children:[o.jsxs("label",{children:[o.jsx("span",{children:"项目名称(可选)"}),o.jsx("input",{value:E,onChange:B=>w(B.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:S,onChange:B=>_(B.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const OD=new Set(["completed"]),kb=1100,hRe=3e4;function pRe(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function mRe({initialJob:e}){const[t,n]=g.useState(e),[s,i]=g.useState(""),[r,a]=g.useState(!1),[l,c]=g.useState(),[u,d]=g.useState(),[f,h]=g.useState(()=>new Set),[p,m]=g.useState({});g.useEffect(()=>{n(e),i(""),a(!1)},[e]),g.useEffect(()=>{if(OD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+hRe,w=async()=>{try{const S=await tRe(e.id);y||(n({...S,prompt:S.prompt||e.prompt}),i(""),OD.has(S.status)||(x=window.setTimeout(w,kb)))}catch(S){if(!y){const _=S instanceof rC?S:void 0;if((_==null?void 0:_.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const b=CA.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??pRe(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await iRe(t.id,y.id,x),h(E=>new Set(E).add(y.id))}catch(E){m(w=>({...w,[y.id]:E instanceof Error?E.message:String(E)}))}finally{d(void 0)}}return o.jsxs("section",{className:"skill-workspace",children:[o.jsx("header",{className:"skill-workspace__intro",children:o.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),s?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",s,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:b.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(fRe,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:w,selected:l===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:S=>void v(y,S)},`${y.model}-${y.id}`)})})]})}function gRe(e){return Object.prototype.toString.call(e)==="[object Object]"}function MD(e){return gRe(e)||Array.isArray(e)}function bRe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function lC(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const i=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return i!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!MD(l)||!MD(c)?l===c:lC(l,c)})}function LD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function yRe(e,t){if(e.length!==t.length)return!1;const n=LD(e),s=LD(t);return n.every((i,r)=>{const a=s[r];return lC(i,a)})}function cC(e){return typeof e=="number"}function iT(e){return typeof e=="string"}function TE(e){return typeof e=="boolean"}function DD(e){return Object.prototype.toString.call(e)==="[object Object]"}function _s(e){return Math.abs(e)}function uC(e){return Math.sign(e)}function cm(e,t){return _s(e-t)}function xRe(e,t){if(e===0||t===0||_s(e)<=_s(t))return 0;const n=cm(_s(e),_s(t));return _s(n/e)}function ERe(e){return Math.round(e*100)/100}function tg(e){return ng(e).map(Number)}function Ua(e){return e[Yg(e)]}function Yg(e){return Math.max(0,e.length-1)}function dC(e,t){return t===Yg(e)}function PD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function ng(e){return Object.keys(e)}function xG(e,t){return[e,t].reduce((n,s)=>(ng(s).forEach(i=>{const r=n[i],a=s[i],l=DD(r)&&DD(a);n[i]=l?xG(r,a):a}),n),{})}function rT(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function vRe(e,t){const n={start:s,center:i,end:r};function s(){return 0}function i(c){return r(c)/2}function r(c){return t-c}function a(c,u){return iT(e)?n[e](c):e(t,c,u)}return{measure:a}}function sg(){let e=[];function t(i,r,a,l={passive:!0}){let c;if("addEventListener"in i)i.addEventListener(r,a,l),c=()=>i.removeEventListener(r,a,l);else{const u=i;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),s}function n(){e=e.filter(i=>i())}const s={add:t,clear:n};return s}function wRe(e,t,n,s){const i=sg(),r=1e3/60;let a=null,l=0,c=0;function u(){i.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),i.clear()}function f(v){if(!c)return;a||(a=v,n(),n());const y=v-a;for(a=v,l+=y;l>=r;)n(),l-=r;const x=l/r;s(x),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),a=null,l=0,c=0}function m(){a=null,l=0}return{init:u,destroy:d,start:h,stop:p,update:n,render:s}}function _Re(e,t){const n=t==="rtl",s=e==="y",i=s?"y":"x",r=s?"x":"y",a=!s&&n?-1:1,l=d(),c=f();function u(m){const{height:b,width:v}=m;return s?b:v}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:i,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function Nu(e=0,t=0){const n=_s(e-t);function s(u){return ut}function r(u){return s(u)||i(u)}function a(u){return r(u)?s(u)?e:t:u}function l(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:a,reachedAny:r,reachedMax:i,reachedMin:s,removeOffset:l}}function EG(e,t,n){const{constrain:s}=Nu(0,e),i=e+1;let r=a(t);function a(h){return n?_s((i+h)%i):s(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return EG(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function SRe(e,t,n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x){const{cross:E,direction:w}=e,S=["INPUT","SELECT","TEXTAREA"],_={passive:!1},T=sg(),k=sg(),A=Nu(50,225).constrain(p.measure(20)),j={mouse:300,touch:400},R={mouse:500,touch:600},B=m?43:25;let z=!1,L=0,F=0,C=!1,I=!1,D=!1,$=!1;function O(ue){if(!x)return;function we(Ne){(TE(x)||x(ue,Ne))&&V(Ne)}const Le=t;T.add(Le,"dragstart",Ne=>Ne.preventDefault(),_).add(Le,"touchmove",()=>{},_).add(Le,"touchend",()=>{}).add(Le,"touchstart",we).add(Le,"mousedown",we).add(Le,"touchcancel",K).add(Le,"contextmenu",K).add(Le,"click",ce,!0)}function te(){T.clear(),k.clear()}function se(){const ue=$?n:t;k.add(ue,"touchmove",X,_).add(ue,"touchend",K).add(ue,"mousemove",X,_).add(ue,"mouseup",K)}function P(ue){const we=ue.nodeName||"";return S.includes(we)}function Q(){return(m?R:j)[$?"mouse":"touch"]}function ee(ue,we){const Le=f.add(uC(ue)*-1),Ne=d.byDistance(ue,!m).distance;return m||_s(ue)=2,!(we&&ue.button!==0)&&(P(ue.target)||(C=!0,r.pointerDown(ue),u.useFriction(0).useDuration(0),i.set(a),se(),L=r.readPoint(ue),F=r.readPoint(ue,E),h.emit("pointerDown")))}function X(ue){if(!rT(ue,s)&&ue.touches.length>=2)return K(ue);const Le=r.readPoint(ue),Ne=r.readPoint(ue,E),ae=cm(Le,L),me=cm(Ne,F);if(!I&&!$&&(!ue.cancelable||(I=ae>me,!I)))return K(ue);const _e=r.pointerMove(ue);ae>b&&(D=!0),u.useFriction(.3).useDuration(.75),l.start(),i.add(w(_e)),ue.preventDefault()}function K(ue){const Le=d.byDistance(0,!1).index!==f.get(),Ne=r.pointerUp(ue)*Q(),ae=ee(w(Ne),Le),me=xRe(Ne,ae),_e=B-10*me,Je=y+me/50;I=!1,C=!1,k.clear(),u.useDuration(_e).useFriction(Je),c.distance(ae,!m),$=!1,h.emit("pointerUp")}function ce(ue){D&&(ue.stopPropagation(),ue.preventDefault(),D=!1)}function he(){return C}return{init:O,destroy:te,pointerDown:he}}function NRe(e,t){let s,i;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(rT(f,t)?f:f.touches[0])[m]}function l(f){return s=f,i=f,a(f)}function c(f){const h=a(f)-a(i),p=r(f)-r(s)>170;return i=f,p&&(s=f),h}function u(f){if(!s||!i)return 0;const h=a(i)-a(s),p=r(f)-r(s),m=r(f)-r(i)>170,b=h/p;return p&&!m&&_s(b)>.1?b:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function TRe(){function e(n){const{offsetTop:s,offsetLeft:i,offsetWidth:r,offsetHeight:a}=n;return{top:s,right:i+r,bottom:s+a,left:i,width:r,height:a}}return{measure:e}}function kRe(e){function t(s){return e*(s/100)}return{measure:t}}function ARe(e,t,n,s,i,r,a){const l=[e].concat(s);let c,u,d=[],f=!1;function h(v){return i.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=s.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,S=s.indexOf(E.target),_=w?u:d[S],T=h(w?e:s[S]);if(_s(T-_)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(TE(r)||r(v,x))&&y(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function m(){f=!0,c&&c.disconnect()}return{init:p,destroy:m}}function CRe(e,t,n,s,i,r){let a=0,l=0,c=i,u=r,d=e.get(),f=0;function h(){const _=s.get()-e.get(),T=!c;let k=0;return T?(a=0,n.set(s),e.set(s),k=_):(n.set(e),a+=_/c,a*=u,d+=a,e.add(a),k=d-f),l=uC(k),f=d,S}function p(){const _=s.get()-t.get();return _s(_)<.001}function m(){return c}function b(){return l}function v(){return a}function y(){return E(i)}function x(){return w(r)}function E(_){return c=_,S}function w(_){return u=_,S}const S={direction:b,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return S}function IRe(e,t,n,s,i){const r=i.measure(10),a=i.measure(50),l=Nu(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(p){if(!u())return;const m=e.reachedMin(t.get())?"min":"max",b=_s(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(b/a);n.subtract(v*y),!p&&_s(v){const{min:v,max:y}=r,x=r.constrain(m),E=!b,w=dC(n,b);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+i)return[r.max];if(s==="keepSnaps")return a;const{min:m,max:b}=l;return a.slice(m,b)}return{snapsContained:c,scrollContainLimit:l}}function RRe(e,t,n){const s=t[0],i=n?s-e:Ua(t);return{limit:Nu(i,s)}}function ORe(e,t,n,s){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=Nu(r,a);function u(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function d(h){if(!u(h))return;const p=e*(h*-1);s.forEach(m=>m.add(p))}return{loop:d}}function MRe(e){const{max:t,length:n}=e;function s(r){const a=r-t;return n?a/-n:0}return{get:s}}function LRe(e,t,n,s,i){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=i,c=f().map(t.measure),u=h(),d=p();function f(){return l(s).map(b=>Ua(b)[a]-b[0][r]).map(_s)}function h(){return s.map(b=>n[r]-b[r]).map(b=>-_s(b))}function p(){return l(u).map(b=>b[0]).map((b,v)=>b+c[v])}return{snaps:u,snapsAligned:d}}function DRe(e,t,n,s,i,r){const{groupSlides:a}=i,{min:l,max:c}=s,u=d();function d(){const h=a(r),p=!e||t==="keepSnaps";return n.length===1?[r]:p?h:h.slice(l,c).map((m,b,v)=>{const y=!b,x=dC(v,b);if(y){const E=Ua(v[0])+1;return PD(E)}if(x){const E=Yg(r)-Ua(v)[0]+1;return PD(E,Ua(v)[0])}return m})}return{slideRegistry:u}}function PRe(e,t,n,s,i){const{reachedAny:r,removeOffset:a,constrain:l}=s;function c(m){return m.concat().sort((b,v)=>_s(b)-_s(v))[0]}function u(m){const b=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-b,0),index:E})).sort((x,E)=>_s(x.diff)-_s(E.diff)),{index:y}=v[0];return{index:y,distance:b}}function d(m,b){const v=[m,m+n,m-n];if(!e)return m;if(!b)return c(v);const y=v.filter(x=>uC(x)===b);return y.length?c(y):Ua(v)-n}function f(m,b){const v=t[m]-i.get(),y=d(v,b);return{index:m,distance:y}}function h(m,b){const v=i.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!b||E)return{index:y,distance:m};const w=t[y]-x,S=m+d(w,0);return{index:y,distance:S}}return{byDistance:h,byIndex:f,shortcut:d}}function BRe(e,t,n,s,i,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),a.emit("select"))}function c(f,h){const p=i.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=i.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function URe(e,t,n,s,i,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(b){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(b));cC(x)&&(i.useDuration(0),s.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((b,v)=>{r.add(b,"focus",y=>{(TE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function kp(e){let t=e;function n(){return t}function s(c){t=a(c)}function i(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return cC(c)?c:c.get()}return{get:n,set:s,add:i,subtract:r}}function vG(e,t){const n=e.scroll==="x"?a:l,s=t.style;let i=null,r=!1;function a(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(r)return;const p=ERe(e.direction(h));p!==i&&(s.transform=n(p),i=p)}function u(h){r=!h}function d(){r||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function FRe(e,t,n,s,i,r,a,l,c){const d=tg(i),f=tg(i).reverse(),h=y().concat(x());function p(T,k){return T.reduce((A,j)=>A-i[j],k)}function m(T,k){return T.reduce((A,j)=>p(A,k)>0?A.concat([j]):A,[])}function b(T){return r.map((k,A)=>({start:k-s[A]+.5+T,end:k+t-.5+T}))}function v(T,k,A){const j=b(k);return T.map(R=>{const B=A?0:-n,z=A?n:0,L=A?"end":"start",F=j[R][L];return{index:R,loopPoint:F,slideLocation:kp(-1),translate:vG(e,c[R]),target:()=>l.get()>F?B:z}})}function y(){const T=a[0],k=m(f,T);return v(k,n,!1)}function x(){const T=t-a[0]-1,k=m(d,T);return v(k,-n,!0)}function E(){return h.every(({index:T})=>{const k=d.filter(A=>A!==T);return p(k,t)<=.1})}function w(){h.forEach(T=>{const{target:k,translate:A,slideLocation:j}=T,R=k();R!==j.get()&&(A.to(R),j.set(R))})}function S(){h.forEach(T=>T.translate.clear())}return{canLoop:E,clear:S,loop:w,loopPoints:h}}function $Re(e,t,n){let s,i=!1;function r(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{i||(TE(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function a(){s&&s.disconnect(),i=!0}return{init:r,destroy:a}}function HRe(e,t,n,s){const i={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(b=>{const v=t.indexOf(b.target);i[v]=b}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return ng(i).reduce((b,v)=>{const y=parseInt(v),{isIntersecting:x}=i[y];return(m&&x||!m&&!x)&&b.push(y),b},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const b=f(m);return m&&(r=b),m||(a=b),b}return{init:u,destroy:d,get:h}}function zRe(e,t,n,s,i,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&i,d=m(),f=b(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return _s(t[l]-x[l])}function b(){if(!u)return 0;const x=r.getComputedStyle(Ua(s));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const S=!E,_=dC(w,E);return S?h[E]+d:_?h[E]+f:w[E+1][l]-x[l]}).map(_s)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function VRe(e,t,n,s,i,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=cC(n);function p(y,x){return tg(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?tg(y).reduce((x,E,w)=>{const S=Ua(x)||0,_=S===0,T=E===Yg(y),k=i[u]-r[S][u],A=i[u]-r[E][d],j=!s&&_?f(a):0,R=!s&&T?f(l):0,B=_s(A-R-(k+j));return w&&B>t+c&&x.push(E),T&&x.push(y.length),x},[]).map((x,E,w)=>{const S=Math.max(w[E-1]||0);return y.slice(S,x)}):[]}function b(y){return h?p(y,n):m(y)}return{groupSlides:b}}function GRe(e,t,n,s,i,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:b,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:S,watchFocus:_}=r,T=2,k=TRe(),A=k.measure(t),j=n.map(k.measure),R=_Re(c,u),B=R.measureSize(A),z=kRe(B),L=vRe(l,B),F=!f&&!!x,C=f||!!x,{slideSizes:I,slideSizesWithGaps:D,startGap:$,endGap:O}=zRe(R,A,j,n,C,i),te=VRe(R,B,v,f,A,j,$,O,T),{snaps:se,snapsAligned:P}=LRe(R,L,A,j,te),Q=-Ua(se)+Ua(D),{snapsContained:ee,scrollContainLimit:V}=jRe(B,Q,P,x,T),X=F?ee:P,{limit:K}=RRe(Q,X,f),ce=EG(Yg(X),d,f),he=ce.clone(),be=tg(n),ue=({dragHandler:Me,scrollBody:lt,scrollBounds:Ot,options:{loop:ut}})=>{ut||Ot.constrain(Me.pointerDown()),lt.seek()},we=({scrollBody:Me,translate:lt,location:Ot,offsetLocation:ut,previousLocation:xn,scrollLooper:xt,slideLooper:wt,dragHandler:En,animation:Ut,eventHandler:Pt,scrollBounds:at,options:{loop:ft}},He)=>{const _t=Me.settled(),ye=!at.shouldConstrain(),We=ft?_t:_t&&ye,Ge=We&&!En.pointerDown();Ge&&Ut.stop();const ht=Ot.get()*He+xn.get()*(1-He);ut.set(ht),ft&&(xt.loop(Me.direction()),wt.loop()),lt.to(ut.get()),Ge&&Pt.emit("settle"),We||Pt.emit("scroll")},Le=wRe(s,i,()=>ue(Ee),Me=>we(Ee,Me)),Ne=.68,ae=X[ce.get()],me=kp(ae),_e=kp(ae),Je=kp(ae),Pe=kp(ae),Fe=CRe(me,Je,_e,Pe,h,Ne),Ye=PRe(f,X,Q,K,Pe),Ce=BRe(Le,ce,he,Fe,Ye,Pe,a),Ve=MRe(K),Ue=sg(),W=HRe(t,n,a,b),{slideRegistry:oe}=DRe(F,x,X,V,te,be),Z=URe(e,n,oe,Ce,Fe,Ue,a,_),Ee={ownerDocument:s,ownerWindow:i,eventHandler:a,containerRect:A,slideRects:j,animation:Le,axis:R,dragHandler:SRe(R,e,s,i,Pe,NRe(R,i),me,Le,Ce,Fe,Ye,ce,a,z,p,m,y,Ne,S),eventStore:Ue,percentOfView:z,index:ce,indexPrevious:he,limit:K,location:me,offsetLocation:Je,previousLocation:_e,options:r,resizeHandler:ARe(t,a,i,n,R,E,k),scrollBody:Fe,scrollBounds:IRe(K,Je,Pe,Fe,z),scrollLooper:ORe(Q,K,Je,[me,Je,_e,Pe]),scrollProgress:Ve,scrollSnapList:X.map(Ve.get),scrollSnaps:X,scrollTarget:Ye,scrollTo:Ce,slideLooper:FRe(R,B,Q,I,D,se,X,Je,n),slideFocus:Z,slidesHandler:$Re(t,a,w),slidesInView:W,slideIndexes:be,slideRegistry:oe,slidesToScroll:te,target:Pe,translate:vG(R,t)};return Ee}function KRe(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function i(u){return s(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=s(u).concat([d]),c}function a(u,d){return e[u]=s(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:i,off:a,on:r,clear:l};return c}const qRe={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function YRe(e){function t(r,a){return xG(r,a||{})}function n(r){const a=r.breakpoints||{},l=ng(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function s(r){return r.map(a=>ng(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function WRe(e){let t=[];function n(r,a){return t=a.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(r,e)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(r=>r.destroy())}return{init:n,destroy:s}}function H1(e,t,n){const s=e.ownerDocument,i=s.defaultView,r=YRe(i),a=WRe(r),l=sg(),c=KRe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,b=R;let v=!1,y,x=u(qRe,H1.globalOptions),E=u(x),w=[],S,_,T;function k(){const{container:be,slides:ue}=E;_=(iT(be)?e.querySelector(be):be)||e.children[0];const Le=iT(ue)?_.querySelectorAll(ue):ue;T=[].slice.call(Le||_.children)}function A(be){const ue=GRe(e,_,T,s,i,be,c);if(be.loop&&!ue.slideLooper.canLoop()){const we=Object.assign({},be,{loop:!1});return A(we)}return ue}function j(be,ue){v||(x=u(x,be),E=d(x),w=ue||w,k(),y=A(E),f([x,...w.map(({options:we})=>we)]).forEach(we=>l.add(we,"change",R)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(he),y.eventHandler.init(he),y.resizeHandler.init(he),y.slidesHandler.init(he),y.options.loop&&y.slideLooper.loop(),_.offsetParent&&T.length&&y.dragHandler.init(he),S=a.init(he,w)))}function R(be,ue){const we=te();B(),j(u({startIndex:we},be),ue),c.emit("reInit")}function B(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),a.destroy(),l.clear()}function z(){v||(v=!0,l.clear(),B(),c.emit("destroy"),c.clear())}function L(be,ue,we){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(ue===!0?0:E.duration),y.scrollTo.index(be,we||0))}function F(be){const ue=y.index.add(1).get();L(ue,be,-1)}function C(be){const ue=y.index.add(-1).get();L(ue,be,1)}function I(){return y.index.add(1).get()!==te()}function D(){return y.index.add(-1).get()!==te()}function $(){return y.scrollSnapList}function O(){return y.scrollProgress.get(y.offsetLocation.get())}function te(){return y.index.get()}function se(){return y.indexPrevious.get()}function P(){return y.slidesInView.get()}function Q(){return y.slidesInView.get(!1)}function ee(){return S}function V(){return y}function X(){return e}function K(){return _}function ce(){return T}const he={canScrollNext:I,canScrollPrev:D,containerNode:K,internalEngine:V,destroy:z,off:p,on:h,emit:m,plugins:ee,previousScrollSnap:se,reInit:b,rootNode:X,scrollNext:F,scrollPrev:C,scrollProgress:O,scrollSnapList:$,scrollTo:L,selectedScrollSnap:te,slideNodes:ce,slidesInView:P,slidesNotInView:Q};return j(t,n),setTimeout(()=>c.emit("init"),0),he}H1.globalOptions=void 0;function fC(e={},t=[]){const n=g.useRef(e),s=g.useRef(t),[i,r]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{i&&i.reInit(n.current,s.current)},[i]);return g.useEffect(()=>{lC(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{yRe(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(bRe()&&a){H1.globalOptions=fC.globalOptions;const u=H1(a,n.current,s.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,i]}fC.globalOptions=void 0;const wG=g.createContext(null);function Wg(...e){return e.filter(Boolean).join(" ")}function kE(){const e=g.useContext(wG);if(!e)throw new Error("useCarousel must be used within a ");return e}function XRe({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:i,children:r,...a}){const[l,c]=fC({...t,axis:e==="horizontal"?"x":"y"},s),[u,d]=g.useState(!1),[f,h]=g.useState(!1),p=g.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=g.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),b=g.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=g.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),b())},[b,m]);return g.useEffect(()=>{c&&n&&n(c)},[c,n]),g.useEffect(()=>{if(c)return p(c),c.on("reInit",p),c.on("select",p),()=>{c.off("reInit",p),c.off("select",p)}},[c,p]),o.jsx(wG.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:s,setApi:n,scrollPrev:m,scrollNext:b,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Wg("ui-carousel",i),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function QRe({className:e,...t}){const{carouselRef:n,orientation:s}=kE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Wg("ui-carousel__track",s==="vertical"?"is-vertical":void 0,e),...t})})}function ZRe({className:e,...t}){const{orientation:n}=kE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Wg("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function _G({direction:e}){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:e==="left"?"m10 3.75-4.25 4.25L10 12.25":"m6 3.75 4.25 4.25L6 12.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function JRe({className:e,...t}){const{orientation:n,scrollPrev:s,canScrollPrev:i}=kE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Wg("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"上一张",...t,children:o.jsx(_G,{direction:"left"})})}function eOe({className:e,...t}){const{orientation:n,scrollNext:s,canScrollNext:i}=kE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Wg("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"下一张",...t,children:o.jsx(_G,{direction:"right"})})}const BD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function tOe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function nOe({kind:e}){return e==="agents"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M43 27.5V33.5H22V38.5M43 33.5H64V38.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"33",y:"6.5",width:"20",height:"21",rx:"6"}),o.jsx("rect",{x:"9",y:"38.5",width:"26",height:"19",rx:"6"}),o.jsx("rect",{x:"51",y:"38.5",width:"26",height:"19",rx:"6"})]}),o.jsxs("g",{className:"new-chat-feature-card__illustration-details",children:[o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"40",cy:"14.5",r:"1.25"}),o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"46",cy:"14.5",r:"1.25"}),o.jsx("path",{d:"M39.5 21h7M17 46.5h10M17 51.5h7M59 46.5h10M59 51.5h7"})]})]}):e==="build"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M26.5 39H36M50 39h9.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"5.5",y:"7.5",width:"75",height:"49",rx:"7.5"}),o.jsx("rect",{x:"12.5",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"36",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"59.5",y:"31.5",width:"14",height:"15",rx:"4"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M6 20.5h74M13.5 14h.01m6 0h.01m6 0h.01M17 39h5m18.5 0h5m18-1 2.5 2.5 4-5"})})]}):e==="search"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"7.5",y:"9.5",width:"41",height:"16",rx:"5"}),o.jsx("rect",{x:"7.5",y:"35.5",width:"34",height:"18",rx:"5"}),o.jsx("circle",{cx:"61",cy:"33",r:"10.5"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M14.5 16h21M14.5 21h14M14.5 42.5h17M14.5 47.5h11M68.5 40.5 77 49"})})]}):o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"8.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"8.5",y:"35.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"35.5",width:"29",height:"21",rx:"6"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M23 13.5v9m-4.5-4.5h9M56.5 14.5h13M56.5 21.5h13M16.5 42.5h13M16.5 49.5h9M56.5 42.5h13M56.5 49.5h13"})})]})}function sOe(){const[e,t]=g.useState(),[n,s]=g.useState(!1),[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!0);return g.useEffect(()=>{if(!c)return;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>l(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),g.useEffect(()=>{if(!c||!e||n||i||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,i,n,a,c]),c?o.jsxs(XRe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(JRe,{"aria-label":"上一张新特性"}),o.jsx(QRe,{children:BD.map((d,f)=>o.jsx(ZRe,{"aria-label":`${f+1} / ${BD.length}`,children:o.jsxs("article",{className:"new-chat-feature-card",children:[o.jsxs("div",{className:"new-chat-feature-card__copy",children:[o.jsx("strong",{children:d.title}),o.jsx("span",{children:d.description})]}),o.jsx(nOe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(tOe,{})}),o.jsx(eOe,{"aria-label":"下一张新特性"})]}):null}const iOe=3*60*1e3,rOe=3e3,aOe=10*60*1e3,z1="veadk.studio.pending-update",UD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],oOe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function lOe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function cOe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function uOe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(z1);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(z1),null}function h_(e,t){window.localStorage.setItem(z1,JSON.stringify({targetVersion:e,startedAt:t}))}function Ab(){window.localStorage.removeItem(z1)}function FD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),o.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),o.jsx("path",{d:"M12 7.8v7.7"}),o.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function dOe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function fOe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function $D({lines:e,phase:t,copyState:n,onCopy:s}){const i=g.useRef(null),r=g.useRef(!0);return g.useEffect(()=>{const a=i.current;a&&r.current&&(a.scrollTop=a.scrollHeight)},[e]),o.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[o.jsxs("div",{className:"studio-update-log-header",children:[o.jsxs("span",{children:[o.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",o.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),o.jsx("button",{type:"button",onClick:s,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:i,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const l=a.currentTarget;r.current=l.scrollHeight-l.scrollTop-l.clientHeight<24},children:e.length?e.map((a,l)=>o.jsx("div",{children:a},`${l}-${a}`)):o.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function hOe({variant:e="default"}){var L,F;const[t]=g.useState(uOe),[n,s]=g.useState(null),[i,r]=g.useState(t?"submitting":"idle"),[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState((t==null?void 0:t.targetVersion)??""),[h,p]=g.useState(!1),[m,b]=g.useState("idle"),[v,y]=g.useState(0),x=g.useRef(null),E=g.useRef((t==null?void 0:t.targetVersion)??""),w=g.useRef((t==null?void 0:t.startedAt)??0);g.useEffect(()=>{if(!h)return;const C=D=>{var $;D.target instanceof Node&&!(($=x.current)!=null&&$.contains(D.target))&&p(!1)},I=D=>{D.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[h]);const S=g.useCallback(async()=>{const C=await R8(E.current||void 0,w.current||void 0);return s(C),C},[]);if(g.useEffect(()=>{let C=!0;const I=()=>{S().catch(()=>{C&&s($=>$)})};I();const D=window.setInterval(I,iOe);return()=>{C=!1,window.clearInterval(D)}},[S]),g.useEffect(()=>{if(i!=="submitting")return;const C=window.setInterval(()=>{S().then(I=>{const D=E.current;if(D&&cOe(I.currentVersion,D)||!D&&!I.available&&I.latestVersion){window.clearInterval(C),Ab(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(I.state==="error"){window.clearInterval(C),Ab(),r("error"),u(I.message||"Studio 更新失败");return}Date.now()-w.current>aOe&&(window.clearInterval(C),Ab(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},rOe);return()=>window.clearInterval(C)},[i,S]),g.useEffect(()=>{i!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),h_(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[i,n]),g.useEffect(()=>{if(i!=="submitting"){y(0);return}const C=()=>{const D=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-D)/1e3)))};C();const I=window.setInterval(C,1e3);return()=>window.clearInterval(I)},[i]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||i!=="idle"))return null;const T=n.releases??[],k=d||((L=T[0])==null?void 0:L.version)||n.latestVersion,A=T.find(C=>C.version===k),j=async()=>{E.current=k,w.current=Date.now(),h_(k,w.current),r("submitting"),u(""),b("idle");try{const C=await O8(k);E.current=C.version,h_(C.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(C){if(C instanceof TypeError){u("连接已切换,正在确认新版本状态");return}Ab(),r("error");const I=C instanceof Error?C.message:"Studio 更新失败";try{const D=await S();u(D.message||I)}catch{u(I)}}},R=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function FIe(...e){var t;for(const n of e){const s=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(s)return s.slice(0,64)}return"local-skill"}function $Ie(e,t){return t.trim()||e}function JV(e){const t=e.map(s=>({path:s.path.replace(/\\/g,"/").replace(/^\.\//,""),text:s.text})).filter(s=>s.path.length>0&&!s.path.endsWith("/")),n=new Set(t.map(s=>s.path.split("/")[0]));if(n.size===1&&t.every(s=>s.path.includes("/"))){const s=[...n][0]+"/";return t.map(i=>({path:i.path.slice(s.length),text:i.text}))}return t}function HIe(e){const t=new Map,n=new Set;for(const s of e)if(QN.test("/"+s.path)){const i=s.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const s of e){const i=s.path.split("/");let r="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=QN.test("/"+s.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?s.path.slice(r.length+1):s.path,c=t.get(r)||[];c.push({path:l,text:s.text}),t.set(r,c)}return t}function zIe(e,t,n){const s=`${n}${e?"/"+e:""}`,i=t.find(c=>QN.test("/"+c.path));if(!i)return{hit:null,error:`${s} 缺少 SKILL.md`};const r=BIe(i.text),a=FIe(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${s} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${s} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:$Ie(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function VIe(e){const t=new Uint8Array(await e.arrayBuffer()),s=(await ZV(t)).map(i=>({path:i.name,text:i.text}));return eG(JV(s),e.name)}async function GIe(e,t=new Map){const n=[];for(let s=0;se.file(t,n))}async function qIe(e){const t=e.createReader(),n=[];for(;;){const s=await new Promise((i,r)=>t.readEntries(i,r));if(s.length===0)return n;n.push(...s)}}async function tG(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await KIe(e),path:n}];if(!e.isDirectory)return[];const s=await qIe(e);return(await Promise.all(s.map(i=>tG(i,n)))).flat()}function YIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(!1),d=g.useRef(0),f=E=>e.some(w=>w.source==="local"&&w.folder===E),h=E=>{E.localFiles&&(f(E.folder||E.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(E.folder||E.name)))):t([...e,{source:"local",folder:E.folder||E.name,name:E.name,description:E.description,localFiles:E.localFiles}]))},p=g.useRef([]),m=g.useRef(e);g.useEffect(()=>{p.current=i},[i]),g.useEffect(()=>{m.current=e},[e]);const b=E=>{const w=new Set([...p.current.map(k=>k.folder||k.name),...m.current.filter(k=>k.source==="local").map(k=>k.folder)]),S=[],_=[];for(const k of E.hits){const A=k.folder||k.name;if(w.has(A)){S.push(k.name);continue}w.add(A),_.push(k)}r(k=>[...k,..._]);const T=[...E.errors];if(S.length>0&&T.push(`已跳过重复技能:${S.join("、")}`),s(T),_.length===1&&E.errors.length===0&&S.length===0){const k=_[0];k.localFiles&&t([...m.current,{source:"local",folder:k.folder||k.name,name:k.name,description:k.description,localFiles:k.localFiles}])}},v=E=>{E.preventDefault(),d.current+=1,u(!0)},y=E=>{E.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async E=>{if(E.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(E.dataTransfer.items).map(S=>{var _;return(_=S.webkitGetAsEntry)==null?void 0:_.call(S)}).filter(S=>S!==null);if(w.length===0){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const S=(await Promise.all(w.map(k=>tG(k)))).flat(),_=w.some(k=>k.isDirectory);if(!_&&S.length===1&&S[0].file.name.toLowerCase().endsWith(".zip")){b(await VIe(S[0].file));return}if(!_){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const T=new Map(S.map(({file:k,path:A})=>[k,A]));b(await GIe(S.map(({file:k})=>k),T))}catch(S){s([`读取失败:${S instanceof Error?S.message:String(S)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:v,onDragOver:E=>E.preventDefault(),onDragLeave:y,onDrop:E=>void x(E),children:[o.jsx(Yk,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(yc,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(E=>{var S;const w=f(E.folder||E.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(za,{className:"cw-i cw-i-sm"}):o.jsx(Ri,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:E.name}),E.description&&o.jsx("span",{className:"cw-skill-result-desc",children:pc(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((S=E.localFiles)==null?void 0:S.length)??0," 个文件"]})]})]},E.id)})})]})}function WIe({selected:e,onChange:t,cloudProvider:n="volcengine"}){const[s,i]=g.useState([]),[r,a]=g.useState([]),[l,c]=g.useState(""),[u,d]=g.useState(!0),[f,h]=g.useState(!1),[p,m]=g.useState(null);g.useEffect(()=>{let E=!1;return(async()=>{d(!0),m(null);try{const w=await y7();E||(i(w),w.length>0&&c(w[0].id))}catch(w){E||m(w instanceof Error?w.message:"加载失败")}finally{E||d(!1)}})(),()=>{E=!0}},[]),g.useEffect(()=>{if(!l){a([]);return}const E=s.find(S=>S.id===l);let w=!1;return(async()=>{h(!0),m(null);try{const S=await x7(l,E==null?void 0:E.region);w||a(S)}catch(S){w||m(S instanceof Error?S.message:"加载失败")}finally{w||h(!1)}})(),()=>{w=!0}},[l,s]);const b=s.find(E=>E.id===l),v=b?Zfe(b.id,b.region,n):"",y=(E,w)=>e.some(S=>S.source==="skillspace"&&S.skillId===E&&(S.version||"")===w),x=E=>{if(b)if(y(E.skillId,E.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===E.skillId&&(w.version||"")===E.version)));else{const w=Qfe(b,E);t([...e,{source:"skillspace",folder:w.folder||E.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return o.jsx("div",{className:"cw-skillspace",children:u?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(gn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):p?o.jsxs("div",{className:"cw-banner",children:[o.jsx(yc,{className:"cw-i"}),o.jsx("span",{children:p})]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:l,onChange:E=>c(E.target.value),"aria-label":"选择 AgentKit Skills 中心",children:s.map(E=>o.jsxs("option",{value:E.id,children:[E.name||E.id,E.description?` — ${pc(E.description)}`:""]},E.id))}),b&&o.jsxs(o.Fragment,{children:[b.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:b.region,children:Tf(b.region,n)}),v&&o.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(Im,{className:"cw-i cw-i-sm"})})]})]}),f?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(gn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):r.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:r.map(E=>{const w=y(E.skillId,E.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>x(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(za,{className:"cw-i cw-i-sm"}):o.jsx(Ri,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[E.skillName,E.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",E.version]})]}),E.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:pc(E.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(Iee,{className:"cw-i cw-i-sm"})," ",(b==null?void 0:b.name)||l]})]})]},`${E.skillId}/${E.version}`)})})]})})}async function XIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Pn(void 0,xc)});if(t.status===409)throw new Error("服务端未配置云厂商 AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function QIe(e={}){const t=new URLSearchParams({page_size:String(e.pageSize??100),project:e.project||"default"});return e.region&&t.set("region",e.region),(await XIe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function ZIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Pn(void 0,xc)});if(t.status===409)throw new Error("服务端未配置云厂商 AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function JIe(e={}){const t=new URLSearchParams;e.project&&t.set("project",e.project),e.region&&t.set("region",e.region);const n=t.toString();return(await ZIe(`/web/viking-knowledgebases${n?`?${n}`:""}`)).items||[]}const vD=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function r_(e){let t=0;for(let n=0;n>>0;return vD[t%vD.length]}function eje(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,s=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):s.push(u);const i=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>r(f,d+1))}),a=s.sort(i).map(u=>r(u,0)),l=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:l,total:c-l||1}}function tje(e,t){const n=[],s=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(s)};return e.forEach(s),n}function wD(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const nje=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function _D(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const s=String(n);return{key:nje(t),value:s,long:s.length>80||s.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function nG({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let S;if(t)S=z8(t,n);else if(e)S=l1(e,n,s);else{u("缺少调用链路来源");return}S.then(_=>{l(_),p(_.length?_.reduce((T,k)=>T.start_time<=k.start_time?T:k).span_id:null)}).catch(_=>u(_ instanceof Error?_.message:String(_)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>eje(a??[]),[a]),y=g.useMemo(()=>tje(m,d),[m,d]),x=(a==null?void 0:a.find(S=>S.span_id===h))??null,E=v/1e6,w=S=>f(_=>{const T=new Set(_);return T.has(S)?T.delete(S):T.add(S),T});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(Mi,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(gn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(S=>{const _=S.span,T=(_.start_time-b)/v*100,k=Math.max((_.end_time-_.start_time)/v*100,.6),A=S.children.length>0;return o.jsxs("button",{className:`trace-row ${h===_.span_id?"active":""}`,onClick:()=>p(_.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:S.depth*14},children:[o.jsx("span",{className:`trace-caret ${A?"":"hidden"} ${d.has(_.span_id)?"":"open"}`,onClick:j=>{j.stopPropagation(),A&&w(_.span_id)},children:o.jsx(dc,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:r_(_.name)}}),o.jsx("span",{className:"trace-name",title:_.name,children:_.name})]}),o.jsx("span",{className:"trace-dur",children:wD(_.end_time-_.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${T}%`,width:`${k}%`,background:r_(_.name)}})})]},_.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:r_(x.name)}}),wD(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:_D(x).filter(S=>!S.long).map(S=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:S.key}),o.jsx("span",{className:"td-val",children:S.value})]},S.key))}),_D(x).filter(S=>S.long).map(S=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:S.key}),o.jsx("pre",{className:"td-pre",children:S.value})]},S.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const sje=g.lazy(()=>cu(()=>import("./MarkdownPromptEditor-By6xKu66.js"),__vite__mapDeps([0,1]))),ZN="veadk.generatedAgentTestRuns",SD=4;function iC(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(ZN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function sG(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(ZN,JSON.stringify(t)):window.sessionStorage.removeItem(ZN)}catch{}}function ije(e){sG([...iC(),e])}function op(e){sG(iC().filter(t=>t!==e))}function rje(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const aje=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:cte,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:yc,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:Ree},{id:"tools",label:"工具",hint:"可调用的能力",icon:VB},{id:"skills",label:"技能",hint:"声明式技能",icon:gu},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:qb},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:$B},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:Tee},{id:"review",label:"完成",hint:"预览并创建",icon:ate}];function oje({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function ND({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function iG({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function rG({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const lje={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},TD={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},aG="REGISTRY_SPACE_ID",cje=g7.filter(e=>e.key!==aG);function oG(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||Pa.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||Pa.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||Pa.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function _b(e,t){return t!=="byteplus"?e:e.map(n=>n.key==="MODEL_EMBEDDING_NAME"?{...n,placeholder:Fte(t)}:n.key==="MODEL_EMBEDDING_API_BASE"?{...n,placeholder:r1(t)}:n)}function uje({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(YV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function a_({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function dje(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function lp({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=qA(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(Im,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:dje(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function o_(e){return e.name.trim()||"未命名智能体中心"}function l_(e){const t=e.name.trim()||e.id||"未命名知识库",n=[e.sourceLabel,e.projectName].filter(Boolean);return n.length?`${t} · ${n.join(" · ")}`:t}function fje({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||Pa.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let A=!1;return c(!0),d(null),QIe({region:i}).then(j=>{A||a(j)}).catch(j=>{A||(a([]),d(j instanceof Error?j.message:"加载失败"))}).finally(()=>{A||c(!1)}),()=>{A=!0}},[i,f]);const x=!e||r.some(A=>A.id===e.trim()),E=r.find(A=>A.id===e.trim()),w=E?o_(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",S=l&&r.length===0,_=g.useMemo(()=>r.filter(A=>U1(b,[o_(A),A.id,A.projectName])),[b,r]),T=!!(e&&!x&&U1(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const A=R=>{const B=R.target;B instanceof Node&&y.current&&!y.current.contains(B)&&m(!1)},j=R=>{R.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",j)}},[p]);const k=A=>{s(A),m(!1)};return o.jsxs("div",{className:`cw-a2a-space-picker${p?" is-open":""}`,ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:S,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(A=>!A)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(iG,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:A=>v(A.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[T&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:"已选择的智能体中心"}),_.map(A=>{const j=o_(A),R=A.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":R,className:`cw-a2a-space-option ${R?"is-selected":""}`,title:`${j} (${A.id})`,onClick:()=>k(A.id),children:j},A.id)}),!T&&_.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(A=>A+1),children:l?o.jsx(gn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(rG,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(yc,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(gn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function hje({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let _=!1;return r(!0),l(null),JIe().then(T=>{_||s(T)}).catch(T=>{_||(s([]),l(T instanceof Error?T.message:"加载失败"))}).finally(()=>{_||r(!1)}),()=>{_=!0}},[c]);const b=!e||n.some(_=>_.id===e.trim()),v=n.find(_=>_.id===e.trim()),y=v?l_(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(_=>U1(h,[l_(_),_.id,_.description,_.projectName,_.resourceId,_.agentkitKnowledgeId,_.providerKnowledgeId,_.sourceLabel])),[n,h]),w=!!(e&&!b&&U1(h,[e]));g.useEffect(()=>{if(!d)return;const _=k=>{const A=k.target;A instanceof Node&&m.current&&!m.current.contains(A)&&f(!1)},T=k=>{k.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",_),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",_),window.removeEventListener("keydown",T)}},[d]);const S=_=>{t(_),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(gn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:`cw-a2a-space-picker cw-viking-kb-picker${d?" is-open":""}`,ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(_=>!_)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(iG,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:_=>p(_.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S({id:e,name:e,description:"",projectName:"",region:"",sourceKind:"knowledge",sourceLabel:"Knowledge Engine",resourceId:""}),children:e}),E.map(_=>{const T=l_(_),k=_.id===e,A=[_.id,_.resourceId,_.agentkitKnowledgeId,_.providerKnowledgeId].filter(Boolean).join(" / ");return o.jsx("button",{type:"button",role:"option","aria-selected":k,className:`cw-a2a-space-option ${k?"is-selected":""}`,title:A?`${T} (${A})`:T,onClick:()=>S(_),children:T},_.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(_=>_+1),children:i?o.jsx(gn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(rG,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(yc,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function pje({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(qo,{initial:!1,children:e.map((r,a)=>o.jsxs(es.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(fc,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),rAe(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(yc,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:sAe(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?iAe(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(Ri,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function lG({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function mje({s:e,onRemove:t}){let n=gu,s="火山 Find Skill 技能广场";return e.source==="local"?(n=Yk,s="本地"):e.source==="skillspace"&&(n=lG,s="AgentKit Skills 中心"),o.jsxs(es.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${pc(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Mi,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const c_=[{id:"local",label:"本地文件",icon:Yk},{id:"skillspace",label:"AgentKit Skills 中心",icon:lG},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:xx}];function gje({selected:e,onChange:t,cloudProvider:n}){const[s,i]=g.useState("local"),[r,a]=g.useState(!1),l=c_.findIndex(u=>u.id===s),c=u=>t(e.filter(d=>u_(d)!==u));return g.useEffect(()=>{if(!r)return;const u=d=>{d.key==="Escape"&&a(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>a(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(Ri,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(qo,{initial:!1,children:e.map(u=>o.jsx(mje,{s:u,onRemove:()=>c(u_(u))},u_(u)))})})]}),o.jsx(qo,{children:r&&o.jsx(es.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:u=>{u.target===u.currentTarget&&a(!1)},children:o.jsxs(es.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>a(!1),children:o.jsx(Mi,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${c_.length})`,"--cw-active-skill-tab-offset":`calc(${l*100}% + ${l*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),c_.map(({id:u,label:d,icon:f})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${u}`,"aria-controls":"cw-skill-tabpanel","aria-selected":s===u,className:`cw-skill-pickertab ${s===u?"is-on":""}`,onClick:()=>i(u),children:[o.jsx(f,{className:"cw-i cw-i-sm"}),d]},u))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${s}`,children:[s==="skillhub"&&o.jsx(PIe,{selected:e,onChange:t}),s==="local"&&o.jsx(YIe,{selected:e,onChange:t}),s==="skillspace"&&o.jsx(WIe,{selected:e,onChange:t,cloudProvider:n})]})]})]})})})]})}function u_(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Sb({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(es.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function bje(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function Nb(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Kg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Kg(r[s],i,n),{...e,subAgents:r}}function yje(e,t,n="volcengine"){return Kg(e,t,s=>({...s,subAgents:[...s.subAgents,Ii(n)]}))}function xje(e,t,n,s="volcengine"){return Kg(e,t,i=>{const r=i.subAgents.slice();return r.splice(n,0,Ii(s)),{...i,subAgents:r}})}function Eje(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Kg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const JN=e=>!SE(e.agentType),kD=3;function vje(e,t,n=!1){var i;if(SE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=sc(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":QV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function cG(e,t,n=[]){const s=[],i=SE(e.agentType),r=vje(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:XV(e.agentType).label,problem:r}),JN(e)&&e.subAgents.forEach((a,l)=>s.push(...cG(a,t,[...n,l]))),s}function wje(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function uG(e){return 1+e.subAgents.reduce((t,n)=>t+uG(n),0)}function dG(e){const t=gE(e),n=[],s={...t.envValues},i=t.draft.cloudProvider??"volcengine",r=l=>{var c,u,d,f;for(const h of l.builtinTools??[]){const p=Mu.find(m=>m.id===h);p&&n.push({env:_b(p.env,i)})}for(const h of l.mcpTools??[])h.authTokenEnv&&n.push({env:[{key:h.authTokenEnv,required:!1,comment:`${h.name.trim()||"MCP"} Bearer Token`}]});if((c=l.a2aRegistry)!=null&&c.enabled&&(n.push({env:g7}),Object.assign(s,oG(l.a2aRegistry,{includeDefaults:!0}))),l.memory.shortTerm&&n.push({env:_b(((u=cN.find(h=>h.id===(l.shortTermBackend??"local")))==null?void 0:u.env)??[],i)}),l.memory.longTerm&&n.push({env:_b(((d=uN.find(h=>h.id===(l.longTermBackend??"local")))==null?void 0:d.env)??[],i)}),l.knowledgebase&&n.push({env:_b(((f=dN.find(h=>h.id===(l.knowledgebaseBackend??wu)))==null?void 0:f.env)??[],i)}),l.tracing)for(const h of l.tracingExporters??[]){const p=Gfe.find(m=>m.id===h);p&&n.push({env:p.env,enableFlag:p.enableFlag})}l.subAgents.forEach(r)};r(t.draft);const a=Wz(n);return{specs:a.specs,fixedValues:{...a.fixedValues,...s}}}function fG(e){var n;return{...gE(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function eT(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=eT(s);if(i)return i}return""}function hG(e){var s,i;const t=dG(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...fG(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(Xz(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function _je(e){return JSON.stringify(hG(e))}function F1(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Wd(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function Sje({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===F1(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),S=x.description.trim(),_=x.instruction.trim(),T=Wd(x),k=!!(w&&S&&_&&n.findIndex(D=>Wd(D)===T)!==E),A=!w||!S||!_||k,j=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==F1(s,x)),R=x.phase==="starting",B=x.phase==="ready"&&!j,z=R||x.phase==="sending",L=B&&x.phase!=="sending"&&x.messages.some(D=>D.role==="assistant"),F=z||x.configOpen||A,C=w?S?_?k?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",I=R?"正在启动":j?"应用配置并重启":B||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(ND,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(B1,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):R?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(gn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):j?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:B?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:C||"启动环境后即可加入本轮测试"})}):x.messages.map((D,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${D.role}`,children:o.jsx("div",{className:"cw-debug-content",children:D.role==="user"?D.content:D.error?o.jsx(B1,{message:D.error,className:"cw-debug-msg-error",defaultExpanded:!0}):D.blocks&&D.blocks.length>0?o.jsx(kA,{blocks:D.blocks,onAction:()=>{}}):D.content?D.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(qH,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!L,title:L?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:C||void 0,onClick:()=>l(x.id),children:[B||j||x.phase==="error"?o.jsx(rte,{className:"cw-i"}):o.jsx(oje,{className:"cw-i cw-debug-run-icon"}),I]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(ND,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${C?" is-disabled":""}`,tabIndex:C?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||A,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),C&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:C})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:D=>p(x.id,"modelName",D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:D=>p(x.id,"description",D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:D=>p(x.id,"instruction",D.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:pG.map(D=>o.jsx(YV,{checked:x.optimizations.includes(D.id),disabled:!0,label:D.label,className:"cw-ab-optimization-checkbox"},D.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{AA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(gn,{className:"cw-i cw-spin"}):o.jsx(DB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(Ri,{className:"cw-i"}),"添加对照组"]})]})]})}const Tb=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],pG=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function Nje({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function Tje({mode:e,busy:t,onChange:n,assistant:s}){const i=Tb.findIndex(l=>l.id===e),r=Tb[i-1],a=Tb[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:Tb.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function kje({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,createMode:a="custom",deploymentTarget:l,cloudProvider:c="volcengine",initialDeployRegion:u=ki(c),onDeploymentComplete:d,onDeploymentStarted:f,onDraftChange:h,onDiscard:p}){var _c,rr,zu,qs,ie,Qt,Ln,Ns,tn,Ts,Gr,Kr,ls,_r;const[m,b]=g.useState(()=>s??Ii(c));g.useEffect(()=>{const q=c==="byteplus"?t2:YB,_e=c==="byteplus"?e2:qB;b(Ve=>{var Nt,ln;const st=((Nt=Ve.modelName)==null?void 0:Nt.trim())===q?i1(c):Ve.modelName,bt=((ln=Ve.modelApiBase)==null?void 0:ln.trim())===_e?r1(c):Ve.modelApiBase;return st===Ve.modelName&&bt===Ve.modelApiBase?Ve:{...Ve,modelName:st,modelApiBase:bt}})},[c]);const[v,y]=g.useState(""),[x,E]=g.useState(!1),[w,S]=g.useState(!1),[_,T]=g.useState(!1),[k,A]=g.useState(null),j=v.trim(),R=j.length>0&&j.length{C.current=h},[h]),g.useEffect(()=>{var q;L!==z.current&&(z.current=L,(q=C.current)==null||q.call(C,m,F))},[m,F,L]);const[I,D]=g.useState("build"),[$,O]=g.useState(!1),[ne,se]=g.useState(0),[P,Z]=g.useState(null),[te,V]=g.useState(!1),[Q,K]=g.useState((l==null?void 0:l.region)??u),ce=(i==null?void 0:i.generatedAgentTestRun)===!0,he=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[ge,ue]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:eT(s??Ii(c)),description:(s??Ii(c)).description,instruction:(s??Ii(c)).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ve,Me]=g.useState("baseline"),Se=g.useRef(1),ae=g.useRef(!1),me=g.useRef(new Map),[we,et]=g.useState(0),[De,Ue]=g.useState(""),[Ye,Ae]=g.useState(null),[ze,Be]=g.useState(!1),[X,oe]=g.useState(!1),J=g.useRef(null),[xe,Oe]=g.useState(""),[lt,Mt]=g.useState(!1),[ut,bn]=g.useState(!1),[wt,_t]=g.useState([]),yn=g.useRef(null),Ft=g.useRef({});async function Bt(){const q=new Set([...me.current.values()].map(({run:Ve})=>Ve.runId)),_e=iC().filter(Ve=>!q.has(Ve));_e.length&&await Promise.all(_e.map(async Ve=>{try{await gd(Ve),op(Ve)}catch(st){console.warn("清理遗留调试运行失败",st)}}))}g.useEffect(()=>(Bt(),()=>{for(const{run:q}of me.current.values())gd(q.runId).then(()=>op(q.runId)).catch(_e=>console.warn("清理调试运行失败",_e));me.current.clear()}),[]),g.useEffect(()=>()=>{var q;(q=J.current)==null||q.call(J,!1),J.current=null},[]);const at=g.useRef(null);at.current||(at.current=({meta:q,children:_e})=>o.jsxs("section",{ref:Ve=>{Ft.current[q.id]=Ve},id:`cw-sec-${q.id}`,"data-step-id":q.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:q.label})}),o.jsx("div",{className:"cw-sec-body",children:_e})]}));const ft=bje(m,wt)?wt:[],$e=Nb(m,ft),St=ft.length===0,be=`cw-model-advanced-${ft.join("-")||"root"}`,We=`cw-a2a-registry-advanced-${ft.join("-")||"root"}`,Ge=q=>b(_e=>Kg(_e,ft,Ve=>({...Ve,...q}))),ht=(q,_e)=>b(Ve=>{var st;return{...Ve,deployment:{...Ve.deployment??{feishuEnabled:!1},envValues:{...((st=Ve.deployment)==null?void 0:st.envValues)??{},[q]:_e}}}}),Gn=q=>Ge({a2aRegistry:{...$e.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...q}}),dn=(q,_e)=>{if(!(q in TD))return;const Ve=TD[q];Gn({[Ve]:_e}),ht(q,_e)},zt=q=>{if(!(St&&q==="a2a")){if(q==="a2a"){Ge({agentType:q,a2aRegistry:{...$e.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Ge({agentType:q,a2aRegistry:$e.a2aRegistry?{...$e.a2aRegistry,enabled:!1}:void 0})}},rn=(q,_e)=>{b(q),_e&&_t(_e)},Sn=async()=>{const q=v.trim();if(!(!q||x)&&!(q.length{const _e=Nb(m,q);if(!JN(_e)||q.length>=kD)return;const Ve=yje(m,q,c),st=Nb(Ve,q).subAgents.length-1;rn(Ve,[...q,st])},ot=(q,_e)=>{const Ve=Nb(m,q);if(!JN(Ve)||q.length>=kD)return;const st=Math.max(0,Math.min(_e,Ve.subAgents.length)),bt=xje(m,q,st,c);rn(bt,[...q,st])},Nn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(b(Ii(c)),_t([]),O(!1))},mn=q=>{if(q.length===0){Nn();return}rn(Eje(m,q),q.slice(0,-1))},Ct=$e.builtinTools??[],ms=g.useMemo(()=>b7(c),[c]),Rs=g.useMemo(()=>new Set(ms.map(q=>q.id)),[ms]),gs=$e.mcpTools??[],Mn=$e.selectedSkills??[],zs=q=>{Rs.has(q)&&Ge({builtinTools:Ct.includes(q)?Ct.filter(_e=>_e!==q):[...Ct,q]})},is=QV($e.agentType),Tn=SE($e.agentType),rs=g.useMemo(()=>LH(m),[m]),bs=Tn?null:sc($e.name)??(rs.has($e.name)?"Agent 名称在当前结构中必须唯一":null),_i=bs!==null,kn=!Tn&&$e.description.trim().length===0,Vs=$e.instruction.trim().length===0,Ss=Tn&&!((_c=$e.a2aRegistry)!=null&&_c.registrySpaceId.trim()),Fn=q=>$&&q?`is-error cw-error-shake-${ne%2}`:"",$n=g.useMemo(()=>cG(m,rs),[m,rs]),Gs=$n.length===0,Os=g.useMemo(()=>_je(m),[m]),An=ge.find(q=>q.id===ve)??ge[0],xn=g.useMemo(()=>dG(m),[m]),fn=q=>{var _e;(_e=Ft.current[q])==null||_e.scrollIntoView({behavior:"smooth",block:"start"})},Jt=()=>Gs?!0:(O(!0),se(q=>q+1),$n[0]&&(_t($n[0].path),window.requestAnimationFrame(()=>fn($n[0].problem==="缺少子 Agent"?"type":"basic"))),!1),an=async()=>{Ae(null);const q=[...me.current.values()];me.current.clear(),et(0),ue(_e=>_e.map(Ve=>({...Ve,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(q.map(async({run:_e})=>{try{await gd(_e.runId),op(_e.runId)}catch(Ve){console.warn("清理调试运行失败",Ve)}}))},on=async q=>{const _e=me.current.get(q);if(_e){me.current.delete(q),et(me.current.size);try{await gd(_e.run.runId),op(_e.run.runId)}catch(Ve){console.warn("清理调试运行失败",Ve)}}},ys=q=>{const _e=me.current.get(q),Ve=ge.find(st=>st.id===q);!_e||!Ve||Ae({runId:_e.run.runId,sessionId:_e.sessionId,variantName:Ve.name})},de=q=>{const _e=J.current;J.current=null,_e==null||_e(q)},Ce=()=>{X||(Be(!1),de(!1))},Pe=async()=>{if(!X){oe(!0);try{await an(),Be(!1),de(!0)}finally{oe(!1)}}},it=async()=>I!=="validate"||we===0?!0:J.current?!1:new Promise(q=>{J.current=q,Be(!0)}),Ze=async q=>{var Ve;if(!await it())return;if(Oe(""),!Jt()){D("build");return}const _e=Qz(xn.specs,((Ve=m.deployment)==null?void 0:Ve.envValues)??{});if(_e){Oe(`${_e.spec.comment||_e.spec.key}:${_e.error}`),D("build");return}V(!0);try{const st=q?ge.find(ln=>ln.id===q):An;st&&Me(st.id);const bt=st?{...m,modelName:st.modelName||m.modelName,description:st.description,instruction:st.instruction}:m,Nt=await kx(fG(bt));bt!==m&&b(bt),Z(Nt),D("publish")}catch(st){Oe(st instanceof Error?st.message:String(st))}finally{V(!1)}},xt=async q=>{if(!ce||te||!Jt())return;const _e=ge.find(yt=>yt.id===q);if(!_e||_e.phase==="starting"||_e.phase==="sending")return;const Ve=_e.modelName.trim(),st=_e.description.trim(),bt=_e.instruction.trim(),Nt=Wd(_e),ln=ge.findIndex(yt=>yt.id===q),oi=ge.findIndex(yt=>Wd(yt)===Nt);if(!Ve||!st||!bt||oi!==ln)return;const Ys=F1(Os,_e);ue(yt=>yt.map(Dn=>Dn.id===q?{...Dn,configOpen:!1,phase:"starting",messages:[],error:null}:Dn)),Ue("");let xs=null,Li;const mi=Date.now(),ya=q==="baseline"?"baseline":"comparison";try{await on(q),await Bt();const yt={...m,modelName:_e.modelName||m.modelName,description:_e.description,instruction:_e.instruction};Li="create_test_run",xs=await $8(hG(yt),l?{runtimeId:l.runtimeId,region:l.region}:void 0),ije(xs.runId),Li="create_test_session";const Dn=await H8(xs.runId,"test_user");me.current.set(q,{run:xs,sessionId:Dn}),et(me.current.size),ue(Ki=>Ki.map(vo=>vo.id===q?{...vo,phase:"ready",runtimeSnapshot:Ys}:vo)),wTe({durationMs:Date.now()-mi,variantType:ya})}catch(yt){if(xs)try{await gd(xs.runId),op(xs.runId)}catch(Dn){console.warn("清理调试运行失败",Dn)}ue(Dn=>Dn.map(Ki=>Ki.id===q?{...Ki,phase:"error",runtimeSnapshot:"",error:yt instanceof Error?yt.message:String(yt)}:Ki)),_Te({durationMs:Date.now()-mi,variantType:ya,phase:Li,error:yt})}},Ie=async()=>{const q=De.trim(),_e=ge.filter(st=>st.phase==="ready"&&st.runtimeSnapshot===F1(Os,st)&&me.current.has(st.id));if(!q||_e.length===0)return;Ue("");const Ve=new Set(_e.map(st=>st.id));ue(st=>st.map(bt=>Ve.has(bt.id)?{...bt,phase:"sending",messages:[...bt.messages,{role:"user",content:q},{role:"assistant",content:"",blocks:[]}]}:bt)),await Promise.all(_e.map(async st=>{const bt=me.current.get(st.id);if(bt)try{let Nt=Ma();for await(const ln of V8({runId:bt.run.runId,userId:"test_user",sessionId:bt.sessionId,text:q})){const oi=ln.error||ln.errorMessage||ln.error_message;if(oi||(Nt=kf(Nt,ln)),ue(Ys=>Ys.map(xs=>{if(xs.id!==st.id)return xs;const Li=[...xs.messages],mi={...Li[Li.length-1]};return oi?mi.error=String(oi):(mi.content=Nt.blocks.filter(ya=>ya.kind==="text").map(ya=>ya.text).join(""),mi.blocks=Nt.blocks),Li[Li.length-1]=mi,{...xs,messages:Li}})),oi)break}}catch(Nt){ue(ln=>ln.map(oi=>{if(oi.id!==st.id)return oi;const Ys=[...oi.messages],xs={...Ys[Ys.length-1]};return xs.error=Nt instanceof Error?Nt.message:String(Nt),Ys[Ys.length-1]=xs,{...oi,messages:Ys}}))}finally{ue(Nt=>Nt.map(ln=>ln.id===st.id?{...ln,phase:"ready"}:ln))}}))},Kn=()=>{ue(q=>{if(q.length>=3)return q;const _e=Se.current++,Ve=`variant-${_e}`;return[...q,{id:Ve,name:`对照组 ${_e}`,modelName:m.modelName??"",description:m.description,instruction:m.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},as=async q=>{await on(q),ue(_e=>_e.filter(Ve=>Ve.id!==q)),ve===q&&Me("baseline")},Ks=(q,_e)=>ue(Ve=>Ve.map(st=>st.id===q?{...st,..._e}:st)),ai=(q,_e,Ve)=>{q==="baseline"&&_e==="modelName"&&(ae.current=!0),Ks(q,{[_e]:Ve}),!(ve!==q||q==="baseline")&&Me("baseline")},qn=q=>{const _e=ge.find(Ys=>Ys.id===q);if(!_e)return;const Ve=_e.modelName.trim(),st=_e.description.trim(),bt=_e.instruction.trim(),Nt=Wd(_e),ln=ge.findIndex(Ys=>Ys.id===q),oi=ge.findIndex(Ys=>Wd(Ys)===Nt);if(!(!Ve||!st||!bt||oi!==ln)){if(q==="baseline"){Ks(q,{configOpen:!1});return}xt(q)}},en=async(q,_e,Ve)=>{var Nt;const st=(Nt=m.deployment)==null?void 0:Nt.network,bt=st&&st.mode&&st.mode!=="public"?{mode:st.mode,vpc_id:st.vpcId,subnet_ids:st.subnetIds,enable_shared_internet_access:st.enableSharedInternetAccess}:void 0;return vg(q.name,q.files,{region:(l==null?void 0:l.region)??Q,projectName:"default",network:bt},{...Ve,onStage:_e,runtimeId:l==null?void 0:l.runtimeId,appName:l==null?void 0:l.appName,description:m.description})},Lt=()=>{Jt()&&(ue(q=>q.map(_e=>_e.id==="baseline"&&!me.current.has(_e.id)?{..._e,modelName:ae.current?_e.modelName:eT(m),description:m.description,instruction:m.instruction}:_e)),D("validate"))},Ms=async q=>{if(q==="publish"){if(!Jt())return;P?D("publish"):Ze();return}if(q==="validate"){Lt();return}await it()&&D(q)},os=at.current,Gi=q=>aje.find(_e=>_e.id===q),Ya=o.jsx("section",{className:`cw-ai-compose${x?" is-generating":""}${w?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(qo,{initial:!1,mode:"wait",children:w?o.jsxs(es.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>S(!1),children:"重新生成"})]},"success"):o.jsxs(es.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:q=>{q.preventDefault(),Sn()},children:[o.jsx("input",{type:"text",value:v,maxLength:8e3,disabled:x,placeholder:`描述目标,使用 ${$te(c)} 模型一键生成配置`,"aria-invalid":!!R,"aria-describedby":R?"ai-requirement-error":void 0,onChange:q=>y(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),Sn())}}),o.jsx("button",{type:"submit",disabled:x||!j||!!R,"aria-label":x?"正在智能生成":"智能生成",children:x?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),R&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:R})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${I}`,children:[o.jsx(Nje,{mode:I}),xe&&o.jsx(B1,{className:"cw-workspace-alert",message:xe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[I==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(zm,{draft:m,direction:"horizontal",selectedPath:ft,onSelect:_t,onAdd:Vt,onInsert:ot,onDelete:mn}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:yn,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(os,{meta:Gi("type"),children:[o.jsx(XN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:$e.agentType??"llm",onChange:zt,children:OIe.map(q=>{const _e=($e.agentType??"llm")===q.id,Ve=St&&q.id==="a2a",st=Ve?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":q.id,className:`cw-agent-type-option ${_e?"is-on":""} ${Ve?"is-disabled":""}`,tabIndex:Ve?0:void 0,"aria-describedby":st,children:[o.jsx(XN.Item,{value:q.id,disabled:Ve,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:lje[q.id]})})}),Ve&&o.jsx("span",{id:st,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},q.id)})}),$&&is&&$e.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:wje({name:$e.name.trim()||"未命名",typeLabel:XV($e.agentType).label})})]}),o.jsx(os,{meta:Gi("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Tn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[St?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Fn(_i)}`,value:$e.name,placeholder:"assistant",onChange:q=>Ge({name:q.target.value})}),$&&bs?o.jsx("span",{className:"cw-error-text",children:bs}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[St?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Fn(kn)}`,value:$e.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:q=>Ge({description:q.target.value})}),$&&kn?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:St?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),is?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),$e.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:$e.maxIterations??3,onChange:q=>Ge({maxIterations:Math.max(1,Number(q.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Tn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(fje,{value:((rr=$e.a2aRegistry)==null?void 0:rr.registrySpaceId)??"",region:((zu=$e.a2aRegistry)==null?void 0:zu.registryRegion)||Pa.region,invalid:$&&Ss,onChange:q=>dn(aG,q)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":ut,"aria-controls":We,onClick:()=>bn(q=>!q),children:[o.jsx("span",{children:"更多选项"}),o.jsx(dc,{className:`cw-more-options-chevron ${ut?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(qo,{initial:!1,children:ut&&o.jsx(es.div,{id:We,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:o.jsx(lp,{env:cje,values:oG($e.a2aRegistry,{includeDefaults:!1}),onChange:dn})})}),$&&Ss&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(sje,{value:$e.instruction,invalid:Vs,onChange:q=>Ge({instruction:q})})}),$&&Vs?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!is&&!Tn&&o.jsxs(o.Fragment,{children:[o.jsx(os,{meta:Gi("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:$e.modelName??"",placeholder:i1(c),onChange:q=>Ge({modelName:q.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":lt,"aria-controls":be,onClick:()=>Mt(q=>!q),children:[o.jsx("span",{children:"更多选项"}),o.jsx(dc,{className:`cw-more-options-chevron ${lt?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(qo,{initial:!1,children:lt&&o.jsxs(es.div,{id:be,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:$e.modelProvider??"",placeholder:"openai",onChange:q=>Ge({modelProvider:q.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:$e.modelApiBase??"",placeholder:r1(c),onChange:q=>Ge({modelApiBase:q.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(os,{meta:Gi("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(uje,{items:ms,selected:Ct,onToggle:zs,scrollRows:6})}),o.jsx(qo,{initial:!1,children:Ct.includes("run_code")&&o.jsxs(es.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(lp,{env:((qs=Mu.find(q=>q.id==="run_code"))==null?void 0:qs.env)??[],values:((ie=m.deployment)==null?void 0:ie.envValues)??{},onChange:ht})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(pje,{tools:gs,onChange:q=>Ge({mcpTools:q})})]})]})}),o.jsx(os,{meta:Gi("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(gje,{selected:Mn,onChange:q=>Ge({selectedSkills:q}),cloudProvider:c})})}),o.jsx(os,{meta:Gi("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Sb,{checked:$e.knowledgebase,onChange:q=>Ge({knowledgebase:q}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:qb}),$e.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(a_,{options:dN,value:$e.knowledgebaseBackend,onChange:q=>Ge({knowledgebaseBackend:q,knowledgebaseIndex:q==="viking"?$e.knowledgebaseIndex:""})}),($e.knowledgebaseBackend??wu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(hje,{value:$e.knowledgebaseIndex??"",onChange:q=>{Ge({knowledgebaseIndex:q.id}),q.projectName&&ht("DATABASE_VIKING_PROJECT",q.projectName),q.region&&ht("DATABASE_VIKING_REGION",q.region),q.sourceKind&&ht("DATABASE_VIKING_COLLECTION_KIND",q.sourceKind),ht("DATABASE_VIKING_RESOURCE_ID",q.resourceId??"")}})]}),o.jsx(lp,{env:((Qt=dN.find(q=>q.id===($e.knowledgebaseBackend??wu)))==null?void 0:Qt.env)??[],values:((Ln=m.deployment)==null?void 0:Ln.envValues)??{},onChange:ht})]})]})}),St&&o.jsx(os,{meta:Gi("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Sb,{checked:$e.memory.shortTerm,onChange:q=>Ge({memory:{...$e.memory,shortTerm:q}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:$B}),$e.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(a_,{options:cN,value:$e.shortTermBackend,onChange:q=>Ge({shortTermBackend:q})}),o.jsx(lp,{env:((Ns=cN.find(q=>q.id===($e.shortTermBackend??"local")))==null?void 0:Ns.env)??[],values:((tn=m.deployment)==null?void 0:tn.envValues)??{},onChange:ht})]}),o.jsx(Sb,{checked:$e.memory.longTerm,onChange:q=>Ge({memory:{...$e.memory,longTerm:q}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:qb}),$e.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(a_,{options:uN,value:$e.longTermBackend,onChange:q=>Ge({longTermBackend:q})}),o.jsx(lp,{env:((Ts=uN.find(q=>q.id===($e.longTermBackend??"local")))==null?void 0:Ts.env)??[],values:((Gr=m.deployment)==null?void 0:Gr.envValues)??{},onChange:ht}),o.jsx(Sb,{checked:!!$e.autoSaveSession,onChange:q=>Ge({autoSaveSession:q}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:qb})]})]})})]})]})})})})})]})}),I==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(Sje,{enabled:ce,disabledReason:he,variants:ge,draftSnapshot:Os,input:De,onInput:Ue,onSend:Ie,onStartVariant:xt,onDeployVariant:q=>void Ze(q),onAddVariant:Kn,onRemoveVariant:as,onToggleConfig:q=>{const _e=ge.find(Ve=>Ve.id===q);_e&&Ks(q,{configOpen:!_e.configOpen})},onCompleteConfig:qn,onConfigChange:ai,onOpenTrace:ys})})}),I==="publish"&&o.jsx("div",{className:"cw-preview-body",children:P?o.jsx(yE,{embedded:!0,cloudProvider:c,project:P,agentDraft:m,agentName:m.name||"未命名 Agent",agentCount:uG(m),releaseConfiguration:An?{modelName:An.modelName||m.modelName||"默认模型",description:An.description,instruction:An.instruction,optimizations:An.optimizations.flatMap(q=>{const _e=pG.find(Ve=>Ve.id===q);return _e?[_e.label]:[]})}:void 0,onChange:Z,onDeploy:en,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:l?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:l==null?void 0:l.runtimeId,onDeploymentStarted:f,onDeploymentComplete:d,feishuEnabled:!!((Kr=m.deployment)!=null&&Kr.feishuEnabled),onFeishuEnabledChange:q=>{const _e={...m,deployment:{...m.deployment??{feishuEnabled:!1},feishuEnabled:q}};b(_e)},deploymentEnv:xn.specs,deploymentEnvValues:{...(ls=m.deployment)==null?void 0:ls.envValues,...xn.fixedValues},onDeploymentEnvChange:ht,network:(_r=m.deployment)==null?void 0:_r.network,onNetworkChange:q=>b(_e=>({..._e,deployment:{..._e.deployment??{feishuEnabled:!1},network:q}})),deployRegion:Q,onDeployRegionChange:K,deploymentTelemetry:{source:"scratch",createMode:a,aiAssisted:_},onExportYaml:()=>rje(`${m.name||"agent"}.yaml`,aAe(m),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(gn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(Tje,{mode:I,busy:te,onChange:Ms,assistant:I==="build"?Ya:void 0}),Ye&&o.jsx(nG,{testRunId:Ye.runId,sessionId:Ye.sessionId,title:`调用链路 · ${Ye.variantName}`,onClose:()=>Ae(null)}),ze&&o.jsx(mA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:X?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:X,onCancel:Ce,onConfirm:()=>void Pe()}),k&&o.jsx("div",{className:"confirm-scrim",onClick:()=>A(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:q=>q.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:k}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>A(null),children:"关闭"})})]})})]})}function Po(e){return{...Ii(),...e}}const Aje=[{id:"support",icon:Vee,draft:Po({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:Aee,draft:Po({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:Gee,draft:Po({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Kk,draft:Po({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:Qee,draft:Po({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:hte,draft:Po({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[Po({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),Po({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),Po({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function mG(e,t){if(t!=="byteplus")return e;const n=i1(t);return{...e,model:e.model==="doubao-1.5-pro-32k"?n:e.model,modelName:e.modelName===t2?n:e.modelName,modelApiBase:!e.modelApiBase||e.modelApiBase===e2?r1(t):e.modelApiBase,subAgents:e.subAgents.map(s=>mG(s,t))}}function Cje(e){const t=[];return e.tools.length&&t.push({icon:VB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:kee,label:"记忆"}),e.knowledgebase&&t.push({icon:Nee,label:"知识库"}),e.tracing&&t.push({icon:See,label:"观测"}),e.subAgents.length&&t.push({icon:ete,label:`子Agent ${e.subAgents.length}`}),t}function Ije({cloudProvider:e="volcengine",onBack:t,onCreate:n}){const[s,i]=g.useState(null),r=g.useMemo(()=>Aje.map(a=>({...a,draft:mG(a.draft,e)})),[e]);return o.jsx("div",{className:"tpl-root",children:s?o.jsx(Rje,{template:s,onBack:()=>i(null),onCreate:n}):o.jsx(jje,{templates:r,onPick:i})})}function jje({templates:e,onPick:t}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:e.map((n,s)=>o.jsxs(es.button,{type:"button",className:"tpl-card",onClick:()=>t(n),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:s*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(n.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:n.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:pc(n.draft.description)})]},n.id))})]})}function Rje({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=Cje(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(Vk,{className:"icon"})," 返回模板列表"]}),o.jsxs(es.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:pc(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:Oje(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:pc(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(dc,{className:"icon"})]})]})]})}function Oje(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const Mje=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:HB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:LB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Xk}];let tT=0;function d_(){return tT+=1,`node_${tT}`}function f_(e,t,n="volcengine",s){const i=Ii(n);return{id:e,type:"agentNode",position:t,data:{agent:{...i,name:(s==null?void 0:s.name)??`agent_${e.replace("node_","")}`,...s}}}}function Lje({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Fi,{type:"target",position:Qe.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(mu,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Fi,{type:"source",position:Qe.Right,className:"wfb-handle"})]})}const Dje={agentNode:Lje},AD={type:"smoothstep",markerEnd:{type:jf.ArrowClosed,width:16,height:16}};function Pje({cloudProvider:e="volcengine",onBack:t,onCreate:n}){const s=g.useRef(null),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState("sequential"),d=g.useMemo(()=>{tT=0;const I=d_();return f_(I,{x:80,y:120},e,{name:"agent_1"})},[e]),[f,h,p]=DU([d]),[m,b,v]=PU([]),[y,x]=g.useState(d.id),E=f.find(I=>I.id===y)??null,w=i.trim()||"workflow_agent",S=g.useMemo(()=>LH({name:w,subAgents:f.map(I=>I.data.agent)}),[w,f]),_=sc(w)??(S.has(w)?"名称须与 Agent 节点名称保持唯一":null),T=E?sc(E.data.agent.name)??(S.has(E.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=f.length>0&&_===null&&f.every(I=>sc(I.data.agent.name)===null&&!S.has(I.data.agent.name)),A=g.useCallback(I=>b(D=>uU({...I,...AD},D)),[b]),j=g.useCallback(()=>{const I=d_(),D=f.length*28,$=f_(I,{x:80+D,y:120+D},e);h(O=>O.concat($)),x(I)},[e,f.length,h]),R=I=>{I.dataTransfer.setData("application/wfb-node","agentNode"),I.dataTransfer.effectAllowed="move"},B=g.useCallback(I=>{I.preventDefault(),I.dataTransfer.dropEffect="move"},[]),z=g.useCallback(I=>{if(I.preventDefault(),I.dataTransfer.getData("application/wfb-node")!=="agentNode"||!s.current)return;const $=s.current.screenToFlowPosition({x:I.clientX,y:I.clientY}),O=d_(),ne=f_(O,$,e);h(se=>se.concat(ne)),x(O)},[e,h]),L=g.useCallback(I=>{y&&h(D=>D.map($=>$.id===y?{...$,data:{...$.data,agent:{...$.data.agent,...I}}}:$))},[y,h]),F=g.useCallback(()=>{y&&(h(I=>I.filter(D=>D.id!==y)),b(I=>I.filter(D=>D.source!==y&&D.target!==y)),x(null))},[y,h,b]),C=g.useCallback(()=>{if(!k)return;const I=f.map($=>$.data.agent),D={...Ii(e),name:w,description:a.trim(),instruction:a.trim(),subAgents:I,workflow:{type:c,nodes:f.map($=>({id:$.id,agent:$.data.agent})),edges:m.map($=>({from:$.source,to:$.target}))}};n(D)},[k,e,f,m,w,a,c,n]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:i,onChange:I=>r(I.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:a,onChange:I=>l(I.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:Mje.map(({type:I,label:D,desc:$,Icon:O})=>o.jsxs("button",{type:"button",className:`wfb-type ${c===I?"wfb-type--active":""}`,onClick:()=>u(I),children:[o.jsx(O,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:D}),o.jsx("span",{className:"wfb-type-desc",children:$})]})]},I))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:R,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(zee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(mu,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:j,children:[o.jsx(Ri,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:C,disabled:!k,type:"button",children:[o.jsx(gu,{className:"icon"}),"创建工作流"]}),o.jsxs(LU,{nodes:f,edges:m,onNodesChange:p,onEdgesChange:v,onConnect:A,onInit:I=>s.current=I,nodeTypes:Dje,defaultEdgeOptions:AD,onDrop:z,onDragOver:B,onNodeClick:(I,D)=>x(D.id),onPaneClick:()=>x(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(UU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx($U,{showInteractive:!1}),o.jsx(Xce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:F,title:"删除节点",children:o.jsx(fc,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${T?"wfb-input--error":""}`,value:E.data.agent.name,onChange:I=>L({name:I.target.value}),placeholder:"agent_name"}),T?o.jsx("span",{className:"wfb-field-error",children:T}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:E.data.agent.description,onChange:I=>L({description:I.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:E.data.agent.instruction,onChange:I=>L({instruction:I.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:E.data.agent.tools.join(", "),onChange:I=>L({tools:I.target.value.split(",").map(D=>D.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:E.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(mu,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",f.length," 个节点 · ",m.length," 条连线"]})]})})]})})}function Bje(e){return o.jsx(L2,{children:o.jsx(Pje,{...e})})}const CD=50*1024*1024,nT=800,Uje={name:"code_package",files:[]};function Fje(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function $je(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function Hje(e){const t=e.flatMap(a=>{const l=$je(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>nT)throw new Error(`代码包文件数不能超过 ${nT} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function zje({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,cloudProvider:r="volcengine",initialDeployRegion:a=ki(r)}){const l=g.useRef(null),c=g.useRef(0),[u,d]=g.useState(null),[f,h]=g.useState(""),[p,m]=g.useState(!1),[b,v]=g.useState(!1),[y,x]=g.useState(!1),[E,w]=g.useState(""),[S,_]=g.useState(a),[T,k]=g.useState();g.useEffect(()=>()=>{c.current+=1},[]);async function A(z){const L=++c.current;if(w(""),!z.name.toLowerCase().endsWith(".zip")){w("请选择 .zip 格式的代码包。");return}if(z.size>CD){w("代码包不能超过 50 MB。");return}v(!0);try{const F=await ZV(new Uint8Array(await z.arrayBuffer()),{maxEntries:nT,maxUncompressedBytes:CD}),C=Hje(F);if(L!==c.current)return;h(z.name),d({name:Fje(z.name),files:C})}catch(F){if(L!==c.current)return;h(""),d(null),w(F instanceof Error?F.message:String(F))}finally{L===c.current&&v(!1)}}function j(z){var F;const L=(F=z.currentTarget.files)==null?void 0:F[0];z.currentTarget.value="",L&&A(L)}function R(z){var F;z.preventDefault(),x(!1);const L=(F=z.dataTransfer.files)==null?void 0:F[0];L&&A(L)}async function B(z,L,F){const C=T&&T.mode!=="public"?{mode:T.mode,vpc_id:T.vpcId,subnet_ids:T.subnetIds,enable_shared_internet_access:T.enableSharedInternetAccess}:void 0;return vg(z.name,z.files,{region:S,projectName:"default",network:C},{...F,onStage:L})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(yE,{cloudProvider:r,project:u??Uje,agentName:(u==null?void 0:u.name)||"代码包",onChange:u?d:void 0,onDeploy:B,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:T,onNetworkChange:k,deployRegion:S,onDeployRegionChange:_,deploymentTelemetry:{source:"code_package",createMode:"code_package",aiAssisted:!1},onBack:e,backLabel:"返回创建方式",deployDisabled:!u||b,deployDisabledReason:b?"正在读取代码包":u?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${y?" is-dragging":""}${u?" is-ready":""}`,onDragEnter:z=>{z.preventDefault(),x(!0)},onDragOver:z=>z.preventDefault(),onDragLeave:z=>{z.currentTarget.contains(z.relatedTarget)||x(!1)},onDrop:R,onClick:()=>{var z;b||(z=l.current)==null||z.click()},onKeyDown:z=>{var L;!b&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),(L=l.current)==null||L.click())},role:"button",tabIndex:b?-1:0,"aria-label":u?"重新上传代码包":"上传代码包","aria-disabled":b,children:[o.jsx("strong",{children:b?"正在读取代码包…":u?f:"请上传代码包"}),o.jsx("span",{children:u?`已识别 ${u.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:u&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:z=>{z.stopPropagation(),m(!0)},onKeyDown:z=>z.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:l,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:j})]}),E&&o.jsx("div",{className:"package-create-error",role:"alert",children:E})]})}),u&&o.jsx(Zz,{project:u,open:p,onClose:()=>m(!1),onChange:d})]})}const gG=1;function $1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vje(e){return $1(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&$1(e.draft)}function NE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function Gje(e){var s;const t=gE(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function bG(e){return{...e,draft:Gje(e.draft)}}function Kje(e){const t=Array.isArray(e)?e:$1(e)&&e.version===gG?e.drafts:void 0;if(!Array.isArray(t)||!t.every(Vje))throw $1(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(bG)}function qje(e,t){if(!t)return[];const n=e.getItem(NE(t));if(!n)return[];try{return Kje(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function ID(e,t,n){if(!t)return;const s={version:gG,drafts:n.map(bG)};try{e.setItem(NE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const Yje="/web/skill-creator";class rC extends Error{constructor(n,s){super(n);zC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function Hu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function fs(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function yG(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function qg(e,t){return fetch(jn(`${Yje}${e}`),{...t,headers:Ex({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function aC(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=Hu(await e.json(),"错误响应");return fs(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function oC(e,t){if(!e.ok)throw new rC(await aC(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function Wje(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function Xje(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function Qje(e){return Array.isArray(e)?e.map((t,n)=>{const s=Hu(t,`文件 ${n+1}`),i=fs(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=yG(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function Zje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function Jje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=Hu(t,`活动 ${n+1}`),i=fs(s,"id"),r=fs(s,"kind"),a=fs(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=fs(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=fs(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function eRe(e,t){const n=Hu(e,`候选方案 ${t+1}`),s=fs(n,"id","candidate_id","candidateId"),i=fs(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:fs(n,"modelLabel","model_label")??i,status:Wje(n.status),stage:Xje(n.stage),name:fs(n,"name","skill_name","skillName"),description:fs(n,"description"),skillMd:fs(n,"skillMd","skill_md"),files:Qje(n.files),activities:Jje(n.activities),validation:Zje(n.validation),durationMs:yG(n,"elapsedMs","elapsed_ms"),error:fs(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:fs(n,"skill_id","skillId"),version:fs(n,"version")}}function sT(e,t=""){const n=Hu(e,"Skill 创建任务"),s=fs(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(eRe):[],r=fs(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:fs(n,"prompt")??t,status:r,candidates:i}}async function tRe(e,t){const n=await qg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new rC(await aC(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=sT(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Hu(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(fs(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=sT(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` +`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!l)throw new Error("创建 Skill 任务失败:服务端未返回任务");return l}async function nRe(e){const t=await qg(`/jobs/${encodeURIComponent(e)}`);return sT(await oC(t,"读取 Skill 任务失败"))}async function sRe(e){const t=await qg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await oC(t,"清理 Skill 任务失败")}async function iRe(e,t){var l;const n=await qg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await aC(n,"下载 Skill 失败"));const i=((l=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:l[1])??"skill.zip",r=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=r,a.download=i,a.click(),URL.revokeObjectURL(r)}async function rRe(e,t,n){const s=await qg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=Hu(await oC(s,"添加到 AgentKit 失败"),"发布结果"),r=fs(i,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:fs(i,"name"),version:fs(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:fs(i,"message")}}const aRe=()=>{};function oRe(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function lRe({activities:e}){const t=g.useMemo(()=>e.filter(n=>n.kind!=="status").map(oRe),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(kA,{blocks:t,onAction:aRe})})}const jD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},RD=12e4;function cRe({status:e}){return e==="succeeded"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):o.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function uRe(){return o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),o.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function dRe(){return o.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:o.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function fRe({candidate:e}){var c,u;const[t,n]=g.useState("SKILL.md"),s=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!s?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=i.find(d=>d.path===t)??i[0],a=(c=e.skillMd)==null?void 0:c.slice(0,RD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>RD;return i.length===0?null:o.jsxs("div",{className:"skill-files",children:[o.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>o.jsx("button",{type:"button",role:"tab","aria-selected":(r==null?void 0:r.path)===d.path,className:(r==null?void 0:r.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(r!=null&&r.path.endsWith("SKILL.md"))?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"skill-files__content",children:o.jsx("code",{children:a})}),l?o.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):o.jsx("div",{className:"skill-files__unavailable",children:r?`${r.path} · ${r.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function hRe({label:e,jobId:t,candidate:n,selected:s,publishing:i,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=g.useState("conversation"),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState(""),[S,_]=g.useState(""),T=g.useRef(null),k=g.useRef(null),A=n.status==="queued"||n.status==="running",j=n.status==="succeeded",R=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${s?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),s?o.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[o.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[o.jsx("span",{className:"skill-candidate__status-icon",children:o.jsx(cRe,{status:n.status})}),A?o.jsx(Ba,{duration:2.2,spread:16,children:jD[n.stage]}):o.jsx("span",{children:jD[n.stage]}),n.durationMs!==void 0&&j?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(lRe,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,j?o.jsx("div",{className:"skill-candidate__view-actions",children:o.jsxs("button",{ref:T,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var B;return(B=k.current)==null?void 0:B.focus()})},children:[o.jsx(uRe,{}),"查看 Skill"]})}):null]}):o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[o.jsx("div",{className:"skill-candidate__preview-nav",children:o.jsxs("button",{ref:k,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var B;return(B=T.current)==null?void 0:B.focus()})},children:[o.jsx(dRe,{}),"返回对话"]})}),o.jsxs("div",{className:"skill-candidate__result",children:[o.jsxs("div",{className:"skill-candidate__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Skill"}),o.jsx("strong",{children:n.name??"未命名 Skill"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"文件"}),o.jsx("strong",{children:n.files.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"校验"}),o.jsx("strong",{className:(R==null?void 0:R.valid)===!1?"is-invalid":"is-valid",children:(R==null?void 0:R.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,R&&(R.errors.length>0||R.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...R.errors,...R.warnings].map((B,z)=>o.jsx("div",{children:B},`${B}-${z}`))]}):null,o.jsx(fRe,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":s,onClick:l,children:s?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),iRe(t,n.id).catch(B=>{v(B instanceof Error?B.message:String(B))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!s||i||r||n.published,title:s?void 0:"请先采用此方案",onClick:()=>h(B=>!B),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),b?o.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&s&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:B=>{B.preventDefault();const z=y.split(",").map(L=>L.trim()).filter(Boolean);c({skillSpaceIds:z,...E.trim()?{projectName:E.trim()}:{},...S.trim()?{skillId:S.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:B=>x(B.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),o.jsxs("div",{className:"skill-publish-form__optional",children:[o.jsxs("label",{children:[o.jsx("span",{children:"项目名称(可选)"}),o.jsx("input",{value:E,onChange:B=>w(B.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:S,onChange:B=>_(B.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const OD=new Set(["completed"]),kb=1100,pRe=3e4;function mRe(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function gRe({initialJob:e}){const[t,n]=g.useState(e),[s,i]=g.useState(""),[r,a]=g.useState(!1),[l,c]=g.useState(),[u,d]=g.useState(),[f,h]=g.useState(()=>new Set),[p,m]=g.useState({});g.useEffect(()=>{n(e),i(""),a(!1)},[e]),g.useEffect(()=>{if(OD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+pRe,w=async()=>{try{const S=await nRe(e.id);y||(n({...S,prompt:S.prompt||e.prompt}),i(""),OD.has(S.status)||(x=window.setTimeout(w,kb)))}catch(S){if(!y){const _=S instanceof rC?S:void 0;if((_==null?void 0:_.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const b=CA.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??mRe(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await rRe(t.id,y.id,x),h(E=>new Set(E).add(y.id))}catch(E){m(w=>({...w,[y.id]:E instanceof Error?E.message:String(E)}))}finally{d(void 0)}}return o.jsxs("section",{className:"skill-workspace",children:[o.jsx("header",{className:"skill-workspace__intro",children:o.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),s?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",s,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:b.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(hRe,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:w,selected:l===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:S=>void v(y,S)},`${y.model}-${y.id}`)})})]})}function bRe(e){return Object.prototype.toString.call(e)==="[object Object]"}function MD(e){return bRe(e)||Array.isArray(e)}function yRe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function lC(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const i=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return i!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!MD(l)||!MD(c)?l===c:lC(l,c)})}function LD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function xRe(e,t){if(e.length!==t.length)return!1;const n=LD(e),s=LD(t);return n.every((i,r)=>{const a=s[r];return lC(i,a)})}function cC(e){return typeof e=="number"}function iT(e){return typeof e=="string"}function TE(e){return typeof e=="boolean"}function DD(e){return Object.prototype.toString.call(e)==="[object Object]"}function _s(e){return Math.abs(e)}function uC(e){return Math.sign(e)}function cm(e,t){return _s(e-t)}function ERe(e,t){if(e===0||t===0||_s(e)<=_s(t))return 0;const n=cm(_s(e),_s(t));return _s(n/e)}function vRe(e){return Math.round(e*100)/100}function tg(e){return ng(e).map(Number)}function Fa(e){return e[Yg(e)]}function Yg(e){return Math.max(0,e.length-1)}function dC(e,t){return t===Yg(e)}function PD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function ng(e){return Object.keys(e)}function xG(e,t){return[e,t].reduce((n,s)=>(ng(s).forEach(i=>{const r=n[i],a=s[i],l=DD(r)&&DD(a);n[i]=l?xG(r,a):a}),n),{})}function rT(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function wRe(e,t){const n={start:s,center:i,end:r};function s(){return 0}function i(c){return r(c)/2}function r(c){return t-c}function a(c,u){return iT(e)?n[e](c):e(t,c,u)}return{measure:a}}function sg(){let e=[];function t(i,r,a,l={passive:!0}){let c;if("addEventListener"in i)i.addEventListener(r,a,l),c=()=>i.removeEventListener(r,a,l);else{const u=i;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),s}function n(){e=e.filter(i=>i())}const s={add:t,clear:n};return s}function _Re(e,t,n,s){const i=sg(),r=1e3/60;let a=null,l=0,c=0;function u(){i.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),i.clear()}function f(v){if(!c)return;a||(a=v,n(),n());const y=v-a;for(a=v,l+=y;l>=r;)n(),l-=r;const x=l/r;s(x),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),a=null,l=0,c=0}function m(){a=null,l=0}return{init:u,destroy:d,start:h,stop:p,update:n,render:s}}function SRe(e,t){const n=t==="rtl",s=e==="y",i=s?"y":"x",r=s?"x":"y",a=!s&&n?-1:1,l=d(),c=f();function u(m){const{height:b,width:v}=m;return s?b:v}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:i,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function Tu(e=0,t=0){const n=_s(e-t);function s(u){return ut}function r(u){return s(u)||i(u)}function a(u){return r(u)?s(u)?e:t:u}function l(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:a,reachedAny:r,reachedMax:i,reachedMin:s,removeOffset:l}}function EG(e,t,n){const{constrain:s}=Tu(0,e),i=e+1;let r=a(t);function a(h){return n?_s((i+h)%i):s(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return EG(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function NRe(e,t,n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x){const{cross:E,direction:w}=e,S=["INPUT","SELECT","TEXTAREA"],_={passive:!1},T=sg(),k=sg(),A=Tu(50,225).constrain(p.measure(20)),j={mouse:300,touch:400},R={mouse:500,touch:600},B=m?43:25;let z=!1,L=0,F=0,C=!1,I=!1,D=!1,$=!1;function O(ue){if(!x)return;function ve(Se){(TE(x)||x(ue,Se))&&V(Se)}const Me=t;T.add(Me,"dragstart",Se=>Se.preventDefault(),_).add(Me,"touchmove",()=>{},_).add(Me,"touchend",()=>{}).add(Me,"touchstart",ve).add(Me,"mousedown",ve).add(Me,"touchcancel",K).add(Me,"contextmenu",K).add(Me,"click",ce,!0)}function ne(){T.clear(),k.clear()}function se(){const ue=$?n:t;k.add(ue,"touchmove",Q,_).add(ue,"touchend",K).add(ue,"mousemove",Q,_).add(ue,"mouseup",K)}function P(ue){const ve=ue.nodeName||"";return S.includes(ve)}function Z(){return(m?R:j)[$?"mouse":"touch"]}function te(ue,ve){const Me=f.add(uC(ue)*-1),Se=d.byDistance(ue,!m).distance;return m||_s(ue)=2,!(ve&&ue.button!==0)&&(P(ue.target)||(C=!0,r.pointerDown(ue),u.useFriction(0).useDuration(0),i.set(a),se(),L=r.readPoint(ue),F=r.readPoint(ue,E),h.emit("pointerDown")))}function Q(ue){if(!rT(ue,s)&&ue.touches.length>=2)return K(ue);const Me=r.readPoint(ue),Se=r.readPoint(ue,E),ae=cm(Me,L),me=cm(Se,F);if(!I&&!$&&(!ue.cancelable||(I=ae>me,!I)))return K(ue);const we=r.pointerMove(ue);ae>b&&(D=!0),u.useFriction(.3).useDuration(.75),l.start(),i.add(w(we)),ue.preventDefault()}function K(ue){const Me=d.byDistance(0,!1).index!==f.get(),Se=r.pointerUp(ue)*Z(),ae=te(w(Se),Me),me=ERe(Se,ae),we=B-10*me,et=y+me/50;I=!1,C=!1,k.clear(),u.useDuration(we).useFriction(et),c.distance(ae,!m),$=!1,h.emit("pointerUp")}function ce(ue){D&&(ue.stopPropagation(),ue.preventDefault(),D=!1)}function he(){return C}return{init:O,destroy:ne,pointerDown:he}}function TRe(e,t){let s,i;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(rT(f,t)?f:f.touches[0])[m]}function l(f){return s=f,i=f,a(f)}function c(f){const h=a(f)-a(i),p=r(f)-r(s)>170;return i=f,p&&(s=f),h}function u(f){if(!s||!i)return 0;const h=a(i)-a(s),p=r(f)-r(s),m=r(f)-r(i)>170,b=h/p;return p&&!m&&_s(b)>.1?b:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function kRe(){function e(n){const{offsetTop:s,offsetLeft:i,offsetWidth:r,offsetHeight:a}=n;return{top:s,right:i+r,bottom:s+a,left:i,width:r,height:a}}return{measure:e}}function ARe(e){function t(s){return e*(s/100)}return{measure:t}}function CRe(e,t,n,s,i,r,a){const l=[e].concat(s);let c,u,d=[],f=!1;function h(v){return i.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=s.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,S=s.indexOf(E.target),_=w?u:d[S],T=h(w?e:s[S]);if(_s(T-_)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(TE(r)||r(v,x))&&y(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function m(){f=!0,c&&c.disconnect()}return{init:p,destroy:m}}function IRe(e,t,n,s,i,r){let a=0,l=0,c=i,u=r,d=e.get(),f=0;function h(){const _=s.get()-e.get(),T=!c;let k=0;return T?(a=0,n.set(s),e.set(s),k=_):(n.set(e),a+=_/c,a*=u,d+=a,e.add(a),k=d-f),l=uC(k),f=d,S}function p(){const _=s.get()-t.get();return _s(_)<.001}function m(){return c}function b(){return l}function v(){return a}function y(){return E(i)}function x(){return w(r)}function E(_){return c=_,S}function w(_){return u=_,S}const S={direction:b,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return S}function jRe(e,t,n,s,i){const r=i.measure(10),a=i.measure(50),l=Tu(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(p){if(!u())return;const m=e.reachedMin(t.get())?"min":"max",b=_s(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(b/a);n.subtract(v*y),!p&&_s(v){const{min:v,max:y}=r,x=r.constrain(m),E=!b,w=dC(n,b);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+i)return[r.max];if(s==="keepSnaps")return a;const{min:m,max:b}=l;return a.slice(m,b)}return{snapsContained:c,scrollContainLimit:l}}function ORe(e,t,n){const s=t[0],i=n?s-e:Fa(t);return{limit:Tu(i,s)}}function MRe(e,t,n,s){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=Tu(r,a);function u(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function d(h){if(!u(h))return;const p=e*(h*-1);s.forEach(m=>m.add(p))}return{loop:d}}function LRe(e){const{max:t,length:n}=e;function s(r){const a=r-t;return n?a/-n:0}return{get:s}}function DRe(e,t,n,s,i){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=i,c=f().map(t.measure),u=h(),d=p();function f(){return l(s).map(b=>Fa(b)[a]-b[0][r]).map(_s)}function h(){return s.map(b=>n[r]-b[r]).map(b=>-_s(b))}function p(){return l(u).map(b=>b[0]).map((b,v)=>b+c[v])}return{snaps:u,snapsAligned:d}}function PRe(e,t,n,s,i,r){const{groupSlides:a}=i,{min:l,max:c}=s,u=d();function d(){const h=a(r),p=!e||t==="keepSnaps";return n.length===1?[r]:p?h:h.slice(l,c).map((m,b,v)=>{const y=!b,x=dC(v,b);if(y){const E=Fa(v[0])+1;return PD(E)}if(x){const E=Yg(r)-Fa(v)[0]+1;return PD(E,Fa(v)[0])}return m})}return{slideRegistry:u}}function BRe(e,t,n,s,i){const{reachedAny:r,removeOffset:a,constrain:l}=s;function c(m){return m.concat().sort((b,v)=>_s(b)-_s(v))[0]}function u(m){const b=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-b,0),index:E})).sort((x,E)=>_s(x.diff)-_s(E.diff)),{index:y}=v[0];return{index:y,distance:b}}function d(m,b){const v=[m,m+n,m-n];if(!e)return m;if(!b)return c(v);const y=v.filter(x=>uC(x)===b);return y.length?c(y):Fa(v)-n}function f(m,b){const v=t[m]-i.get(),y=d(v,b);return{index:m,distance:y}}function h(m,b){const v=i.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!b||E)return{index:y,distance:m};const w=t[y]-x,S=m+d(w,0);return{index:y,distance:S}}return{byDistance:h,byIndex:f,shortcut:d}}function URe(e,t,n,s,i,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),a.emit("select"))}function c(f,h){const p=i.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=i.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function FRe(e,t,n,s,i,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(b){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(b));cC(x)&&(i.useDuration(0),s.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((b,v)=>{r.add(b,"focus",y=>{(TE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function kp(e){let t=e;function n(){return t}function s(c){t=a(c)}function i(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return cC(c)?c:c.get()}return{get:n,set:s,add:i,subtract:r}}function vG(e,t){const n=e.scroll==="x"?a:l,s=t.style;let i=null,r=!1;function a(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(r)return;const p=vRe(e.direction(h));p!==i&&(s.transform=n(p),i=p)}function u(h){r=!h}function d(){r||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function $Re(e,t,n,s,i,r,a,l,c){const d=tg(i),f=tg(i).reverse(),h=y().concat(x());function p(T,k){return T.reduce((A,j)=>A-i[j],k)}function m(T,k){return T.reduce((A,j)=>p(A,k)>0?A.concat([j]):A,[])}function b(T){return r.map((k,A)=>({start:k-s[A]+.5+T,end:k+t-.5+T}))}function v(T,k,A){const j=b(k);return T.map(R=>{const B=A?0:-n,z=A?n:0,L=A?"end":"start",F=j[R][L];return{index:R,loopPoint:F,slideLocation:kp(-1),translate:vG(e,c[R]),target:()=>l.get()>F?B:z}})}function y(){const T=a[0],k=m(f,T);return v(k,n,!1)}function x(){const T=t-a[0]-1,k=m(d,T);return v(k,-n,!0)}function E(){return h.every(({index:T})=>{const k=d.filter(A=>A!==T);return p(k,t)<=.1})}function w(){h.forEach(T=>{const{target:k,translate:A,slideLocation:j}=T,R=k();R!==j.get()&&(A.to(R),j.set(R))})}function S(){h.forEach(T=>T.translate.clear())}return{canLoop:E,clear:S,loop:w,loopPoints:h}}function HRe(e,t,n){let s,i=!1;function r(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{i||(TE(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function a(){s&&s.disconnect(),i=!0}return{init:r,destroy:a}}function zRe(e,t,n,s){const i={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(b=>{const v=t.indexOf(b.target);i[v]=b}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return ng(i).reduce((b,v)=>{const y=parseInt(v),{isIntersecting:x}=i[y];return(m&&x||!m&&!x)&&b.push(y),b},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const b=f(m);return m&&(r=b),m||(a=b),b}return{init:u,destroy:d,get:h}}function VRe(e,t,n,s,i,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&i,d=m(),f=b(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return _s(t[l]-x[l])}function b(){if(!u)return 0;const x=r.getComputedStyle(Fa(s));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const S=!E,_=dC(w,E);return S?h[E]+d:_?h[E]+f:w[E+1][l]-x[l]}).map(_s)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function GRe(e,t,n,s,i,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=cC(n);function p(y,x){return tg(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?tg(y).reduce((x,E,w)=>{const S=Fa(x)||0,_=S===0,T=E===Yg(y),k=i[u]-r[S][u],A=i[u]-r[E][d],j=!s&&_?f(a):0,R=!s&&T?f(l):0,B=_s(A-R-(k+j));return w&&B>t+c&&x.push(E),T&&x.push(y.length),x},[]).map((x,E,w)=>{const S=Math.max(w[E-1]||0);return y.slice(S,x)}):[]}function b(y){return h?p(y,n):m(y)}return{groupSlides:b}}function KRe(e,t,n,s,i,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:b,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:S,watchFocus:_}=r,T=2,k=kRe(),A=k.measure(t),j=n.map(k.measure),R=SRe(c,u),B=R.measureSize(A),z=ARe(B),L=wRe(l,B),F=!f&&!!x,C=f||!!x,{slideSizes:I,slideSizesWithGaps:D,startGap:$,endGap:O}=VRe(R,A,j,n,C,i),ne=GRe(R,B,v,f,A,j,$,O,T),{snaps:se,snapsAligned:P}=DRe(R,L,A,j,ne),Z=-Fa(se)+Fa(D),{snapsContained:te,scrollContainLimit:V}=RRe(B,Z,P,x,T),Q=F?te:P,{limit:K}=ORe(Z,Q,f),ce=EG(Yg(Q),d,f),he=ce.clone(),ge=tg(n),ue=({dragHandler:Oe,scrollBody:lt,scrollBounds:Mt,options:{loop:ut}})=>{ut||Mt.constrain(Oe.pointerDown()),lt.seek()},ve=({scrollBody:Oe,translate:lt,location:Mt,offsetLocation:ut,previousLocation:bn,scrollLooper:wt,slideLooper:_t,dragHandler:yn,animation:Ft,eventHandler:Bt,scrollBounds:at,options:{loop:ft}},$e)=>{const St=Oe.settled(),be=!at.shouldConstrain(),We=ft?St:St&&be,Ge=We&&!yn.pointerDown();Ge&&Ft.stop();const ht=Mt.get()*$e+bn.get()*(1-$e);ut.set(ht),ft&&(wt.loop(Oe.direction()),_t.loop()),lt.to(ut.get()),Ge&&Bt.emit("settle"),We||Bt.emit("scroll")},Me=_Re(s,i,()=>ue(xe),Oe=>ve(xe,Oe)),Se=.68,ae=Q[ce.get()],me=kp(ae),we=kp(ae),et=kp(ae),De=kp(ae),Ue=IRe(me,et,we,De,h,Se),Ye=BRe(f,Q,Z,K,De),Ae=URe(Me,ce,he,Ue,Ye,De,a),ze=LRe(K),Be=sg(),X=zRe(t,n,a,b),{slideRegistry:oe}=PRe(F,x,Q,V,ne,ge),J=FRe(e,n,oe,Ae,Ue,Be,a,_),xe={ownerDocument:s,ownerWindow:i,eventHandler:a,containerRect:A,slideRects:j,animation:Me,axis:R,dragHandler:NRe(R,e,s,i,De,TRe(R,i),me,Me,Ae,Ue,Ye,ce,a,z,p,m,y,Se,S),eventStore:Be,percentOfView:z,index:ce,indexPrevious:he,limit:K,location:me,offsetLocation:et,previousLocation:we,options:r,resizeHandler:CRe(t,a,i,n,R,E,k),scrollBody:Ue,scrollBounds:jRe(K,et,De,Ue,z),scrollLooper:MRe(Z,K,et,[me,et,we,De]),scrollProgress:ze,scrollSnapList:Q.map(ze.get),scrollSnaps:Q,scrollTarget:Ye,scrollTo:Ae,slideLooper:$Re(R,B,Z,I,D,se,Q,et,n),slideFocus:J,slidesHandler:HRe(t,a,w),slidesInView:X,slideIndexes:ge,slideRegistry:oe,slidesToScroll:ne,target:De,translate:vG(R,t)};return xe}function qRe(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function i(u){return s(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=s(u).concat([d]),c}function a(u,d){return e[u]=s(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:i,off:a,on:r,clear:l};return c}const YRe={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function WRe(e){function t(r,a){return xG(r,a||{})}function n(r){const a=r.breakpoints||{},l=ng(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function s(r){return r.map(a=>ng(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function XRe(e){let t=[];function n(r,a){return t=a.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(r,e)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(r=>r.destroy())}return{init:n,destroy:s}}function H1(e,t,n){const s=e.ownerDocument,i=s.defaultView,r=WRe(i),a=XRe(r),l=sg(),c=qRe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,b=R;let v=!1,y,x=u(YRe,H1.globalOptions),E=u(x),w=[],S,_,T;function k(){const{container:ge,slides:ue}=E;_=(iT(ge)?e.querySelector(ge):ge)||e.children[0];const Me=iT(ue)?_.querySelectorAll(ue):ue;T=[].slice.call(Me||_.children)}function A(ge){const ue=KRe(e,_,T,s,i,ge,c);if(ge.loop&&!ue.slideLooper.canLoop()){const ve=Object.assign({},ge,{loop:!1});return A(ve)}return ue}function j(ge,ue){v||(x=u(x,ge),E=d(x),w=ue||w,k(),y=A(E),f([x,...w.map(({options:ve})=>ve)]).forEach(ve=>l.add(ve,"change",R)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(he),y.eventHandler.init(he),y.resizeHandler.init(he),y.slidesHandler.init(he),y.options.loop&&y.slideLooper.loop(),_.offsetParent&&T.length&&y.dragHandler.init(he),S=a.init(he,w)))}function R(ge,ue){const ve=ne();B(),j(u({startIndex:ve},ge),ue),c.emit("reInit")}function B(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),a.destroy(),l.clear()}function z(){v||(v=!0,l.clear(),B(),c.emit("destroy"),c.clear())}function L(ge,ue,ve){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(ue===!0?0:E.duration),y.scrollTo.index(ge,ve||0))}function F(ge){const ue=y.index.add(1).get();L(ue,ge,-1)}function C(ge){const ue=y.index.add(-1).get();L(ue,ge,1)}function I(){return y.index.add(1).get()!==ne()}function D(){return y.index.add(-1).get()!==ne()}function $(){return y.scrollSnapList}function O(){return y.scrollProgress.get(y.offsetLocation.get())}function ne(){return y.index.get()}function se(){return y.indexPrevious.get()}function P(){return y.slidesInView.get()}function Z(){return y.slidesInView.get(!1)}function te(){return S}function V(){return y}function Q(){return e}function K(){return _}function ce(){return T}const he={canScrollNext:I,canScrollPrev:D,containerNode:K,internalEngine:V,destroy:z,off:p,on:h,emit:m,plugins:te,previousScrollSnap:se,reInit:b,rootNode:Q,scrollNext:F,scrollPrev:C,scrollProgress:O,scrollSnapList:$,scrollTo:L,selectedScrollSnap:ne,slideNodes:ce,slidesInView:P,slidesNotInView:Z};return j(t,n),setTimeout(()=>c.emit("init"),0),he}H1.globalOptions=void 0;function fC(e={},t=[]){const n=g.useRef(e),s=g.useRef(t),[i,r]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{i&&i.reInit(n.current,s.current)},[i]);return g.useEffect(()=>{lC(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{xRe(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(yRe()&&a){H1.globalOptions=fC.globalOptions;const u=H1(a,n.current,s.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,i]}fC.globalOptions=void 0;const wG=g.createContext(null);function Wg(...e){return e.filter(Boolean).join(" ")}function kE(){const e=g.useContext(wG);if(!e)throw new Error("useCarousel must be used within a ");return e}function QRe({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:i,children:r,...a}){const[l,c]=fC({...t,axis:e==="horizontal"?"x":"y"},s),[u,d]=g.useState(!1),[f,h]=g.useState(!1),p=g.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=g.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),b=g.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=g.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),b())},[b,m]);return g.useEffect(()=>{c&&n&&n(c)},[c,n]),g.useEffect(()=>{if(c)return p(c),c.on("reInit",p),c.on("select",p),()=>{c.off("reInit",p),c.off("select",p)}},[c,p]),o.jsx(wG.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:s,setApi:n,scrollPrev:m,scrollNext:b,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Wg("ui-carousel",i),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function ZRe({className:e,...t}){const{carouselRef:n,orientation:s}=kE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Wg("ui-carousel__track",s==="vertical"?"is-vertical":void 0,e),...t})})}function JRe({className:e,...t}){const{orientation:n}=kE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Wg("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function _G({direction:e}){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:e==="left"?"m10 3.75-4.25 4.25L10 12.25":"m6 3.75 4.25 4.25L6 12.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function eOe({className:e,...t}){const{orientation:n,scrollPrev:s,canScrollPrev:i}=kE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Wg("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"上一张",...t,children:o.jsx(_G,{direction:"left"})})}function tOe({className:e,...t}){const{orientation:n,scrollNext:s,canScrollNext:i}=kE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Wg("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"下一张",...t,children:o.jsx(_G,{direction:"right"})})}const BD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function nOe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function sOe({kind:e}){return e==="agents"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M43 27.5V33.5H22V38.5M43 33.5H64V38.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"33",y:"6.5",width:"20",height:"21",rx:"6"}),o.jsx("rect",{x:"9",y:"38.5",width:"26",height:"19",rx:"6"}),o.jsx("rect",{x:"51",y:"38.5",width:"26",height:"19",rx:"6"})]}),o.jsxs("g",{className:"new-chat-feature-card__illustration-details",children:[o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"40",cy:"14.5",r:"1.25"}),o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"46",cy:"14.5",r:"1.25"}),o.jsx("path",{d:"M39.5 21h7M17 46.5h10M17 51.5h7M59 46.5h10M59 51.5h7"})]})]}):e==="build"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M26.5 39H36M50 39h9.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"5.5",y:"7.5",width:"75",height:"49",rx:"7.5"}),o.jsx("rect",{x:"12.5",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"36",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"59.5",y:"31.5",width:"14",height:"15",rx:"4"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M6 20.5h74M13.5 14h.01m6 0h.01m6 0h.01M17 39h5m18.5 0h5m18-1 2.5 2.5 4-5"})})]}):e==="search"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"7.5",y:"9.5",width:"41",height:"16",rx:"5"}),o.jsx("rect",{x:"7.5",y:"35.5",width:"34",height:"18",rx:"5"}),o.jsx("circle",{cx:"61",cy:"33",r:"10.5"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M14.5 16h21M14.5 21h14M14.5 42.5h17M14.5 47.5h11M68.5 40.5 77 49"})})]}):o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"8.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"8.5",y:"35.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"35.5",width:"29",height:"21",rx:"6"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M23 13.5v9m-4.5-4.5h9M56.5 14.5h13M56.5 21.5h13M16.5 42.5h13M16.5 49.5h9M56.5 42.5h13M56.5 49.5h13"})})]})}function iOe(){const[e,t]=g.useState(),[n,s]=g.useState(!1),[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!0);return g.useEffect(()=>{if(!c)return;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>l(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),g.useEffect(()=>{if(!c||!e||n||i||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,i,n,a,c]),c?o.jsxs(QRe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(eOe,{"aria-label":"上一张新特性"}),o.jsx(ZRe,{children:BD.map((d,f)=>o.jsx(JRe,{"aria-label":`${f+1} / ${BD.length}`,children:o.jsxs("article",{className:"new-chat-feature-card",children:[o.jsxs("div",{className:"new-chat-feature-card__copy",children:[o.jsx("strong",{children:d.title}),o.jsx("span",{children:d.description})]}),o.jsx(sOe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(nOe,{})}),o.jsx(tOe,{"aria-label":"下一张新特性"})]}):null}const rOe=3*60*1e3,aOe=3e3,oOe=10*60*1e3,z1="veadk.studio.pending-update",UD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],lOe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function cOe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function uOe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function dOe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(z1);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(z1),null}function h_(e,t){window.localStorage.setItem(z1,JSON.stringify({targetVersion:e,startedAt:t}))}function Ab(){window.localStorage.removeItem(z1)}function FD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),o.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),o.jsx("path",{d:"M12 7.8v7.7"}),o.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function fOe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function hOe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function $D({lines:e,phase:t,copyState:n,onCopy:s}){const i=g.useRef(null),r=g.useRef(!0);return g.useEffect(()=>{const a=i.current;a&&r.current&&(a.scrollTop=a.scrollHeight)},[e]),o.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[o.jsxs("div",{className:"studio-update-log-header",children:[o.jsxs("span",{children:[o.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",o.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),o.jsx("button",{type:"button",onClick:s,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:i,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const l=a.currentTarget;r.current=l.scrollHeight-l.scrollTop-l.clientHeight<24},children:e.length?e.map((a,l)=>o.jsx("div",{children:a},`${l}-${a}`)):o.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function pOe({variant:e="default"}){var L,F;const[t]=g.useState(dOe),[n,s]=g.useState(null),[i,r]=g.useState(t?"submitting":"idle"),[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState((t==null?void 0:t.targetVersion)??""),[h,p]=g.useState(!1),[m,b]=g.useState("idle"),[v,y]=g.useState(0),x=g.useRef(null),E=g.useRef((t==null?void 0:t.targetVersion)??""),w=g.useRef((t==null?void 0:t.startedAt)??0);g.useEffect(()=>{if(!h)return;const C=D=>{var $;D.target instanceof Node&&!(($=x.current)!=null&&$.contains(D.target))&&p(!1)},I=D=>{D.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[h]);const S=g.useCallback(async()=>{const C=await R8(E.current||void 0,w.current||void 0);return s(C),C},[]);if(g.useEffect(()=>{let C=!0;const I=()=>{S().catch(()=>{C&&s($=>$)})};I();const D=window.setInterval(I,rOe);return()=>{C=!1,window.clearInterval(D)}},[S]),g.useEffect(()=>{if(i!=="submitting")return;const C=window.setInterval(()=>{S().then(I=>{const D=E.current;if(D&&uOe(I.currentVersion,D)||!D&&!I.available&&I.latestVersion){window.clearInterval(C),Ab(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(I.state==="error"){window.clearInterval(C),Ab(),r("error"),u(I.message||"Studio 更新失败");return}Date.now()-w.current>oOe&&(window.clearInterval(C),Ab(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},aOe);return()=>window.clearInterval(C)},[i,S]),g.useEffect(()=>{i!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),h_(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[i,n]),g.useEffect(()=>{if(i!=="submitting"){y(0);return}const C=()=>{const D=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-D)/1e3)))};C();const I=window.setInterval(C,1e3);return()=>window.clearInterval(I)},[i]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||i!=="idle"))return null;const T=n.releases??[],k=d||((L=T[0])==null?void 0:L.version)||n.latestVersion,A=T.find(C=>C.version===k),j=async()=>{E.current=k,w.current=Date.now(),h_(k,w.current),r("submitting"),u(""),b("idle");try{const C=await O8(k);E.current=C.version,h_(C.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(C){if(C instanceof TypeError){u("连接已切换,正在确认新版本状态");return}Ab(),r("error");const I=C instanceof Error?C.message:"Studio 更新失败";try{const D=await S();u(D.message||I)}catch{u(I)}}},R=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` `).filter(Boolean),B=async()=>{try{await navigator.clipboard.writeText(R.join(` -`)),b("copied")}catch{b("error")}},z=()=>{var C;p(!1),b("idle"),u(""),f(E.current||((C=T[0])==null?void 0:C.version)||""),r("confirm")};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:e==="feature-link"?"welcome-feature-link studio-update-trigger--feature":`studio-update-trigger is-${i}`,title:i==="submitting"?"正在更新 Studio":i==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var C;i==="published"?window.location.reload():(i==="submitting"||i==="error"||(f(((C=T[0])==null?void 0:C.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(FD,{className:"studio-update-icon"}),i==="submitting"?o.jsx(Pa,{as:"span",children:"正在更新"}):i==="published"?o.jsx("span",{children:"刷新使用新版"}):i==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&i!=="idle"&&o.jsx("div",{className:"confirm-scrim",role:"presentation",children:o.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[o.jsx("div",{className:"studio-update-dialog-mark",children:o.jsx(FD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:i==="error"?"Studio 更新失败":i==="submitting"?"正在更新 Studio":i==="published"?"Studio 更新完成":"发现新版本"}),i==="error"?o.jsxs("div",{className:"studio-update-error-panel",children:[o.jsx("p",{className:"confirm-text studio-update-error",children:c}),o.jsxs("dl",{className:"studio-update-error-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"失败阶段"}),o.jsx("dd",{children:oOe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx($D,{lines:R,phase:"error",copyState:m,onCopy:()=>void B()}),n.consoleUrl&&o.jsxs("a",{className:"studio-update-console-link",href:n.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",o.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):i==="submitting"||i==="published"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"studio-update-progress-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"目标版本"}),o.jsx("strong",{children:E.current||k})]}),o.jsxs("div",{children:[o.jsx("span",{children:i==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:i==="published"?"已完成":lOe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:UD.map((C,I)=>{const D=UD.findIndex(te=>te.id===n.progressStage),$=i==="published"||Ivoid B()}),o.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),o.jsxs("div",{className:"studio-update-field",ref:x,children:[o.jsx("span",{children:"选择版本"}),o.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":h,onClick:()=>p(C=>!C),onKeyDown:C=>{(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),p(!0))},children:[o.jsx("span",{children:k}),o.jsx(dOe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:T.map(C=>{const I=C.version===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":I,className:`studio-update-version-option${I?" is-selected":""}`,onClick:()=>{f(C.version),p(!1)},children:[o.jsx("span",{children:C.version}),I&&o.jsx(fOe,{})]},C.version)})})]}),o.jsxs("dl",{className:"studio-update-versions",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:n.currentVersion})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"目标版本"}),o.jsx("dd",{children:k})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Commit"}),o.jsx("dd",{children:((A==null?void 0:A.gitSha)||n.latestGitSha).slice(0,8)})]})]}),o.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[o.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),A!=null&&A.changelog.length?o.jsx("ul",{children:A.changelog.map(C=>o.jsx("li",{children:C},C))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),i==="confirm"&&(r("idle"),u(""))},children:i==="submitting"?"后台运行":i==="confirm"?"取消":"关闭"}),i==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void j(),children:"立即更新"}),i==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:z,children:"重新尝试"})]})]})})]})}const pOe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function mOe({canUpdate:e=!1}){return o.jsxs("div",{className:"welcome-feature-pill",children:[o.jsx("span",{children:"焕然一新"}),o.jsx("span",{className:"welcome-feature-divider","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"welcome-feature-link","aria-describedby":"welcome-feature-popover",children:"查看新特性"}),o.jsxs("section",{id:"welcome-feature-popover",className:"welcome-feature-popover",role:"tooltip",children:[o.jsx("strong",{children:"本次更新"}),o.jsx("ul",{children:pOe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(hOe,{variant:"feature-link"})]})}const gOe=1e4;async function SG(e){const t=await fetch(Rn(e),{headers:Ex({Accept:"application/json"}),signal:Bn(void 0,gOe)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function bOe(){return SG("/web/sandbox/capabilities")}async function yOe(){return SG("/web/skill-creator/capabilities")}const xOe="我的智能体";function EOe({open:e,state:t,agentKind:n="codex",error:s,onCancel:i,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?xOe:`我的 ${a}`,c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1),h=g.useRef(i),[p,m]=g.useState(l);if(h.current=i,g.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var S,_;(S=u.current)==null||S.focus(),(_=u.current)==null||_.select()}),w=S=>{var A;if(S.key==="Escape"){S.preventDefault(),h.current();return}if(S.key!=="Tab")return;const _=(A=c.current)==null?void 0:A.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(_!=null&&_.length))return;const T=_[0],k=_[_.length-1];S.shiftKey&&document.activeElement===T?(S.preventDefault(),k.focus()):!S.shiftKey&&document.activeElement===k&&(S.preventDefault(),T.focus())};return window.addEventListener("keydown",w),()=>{window.cancelAnimationFrame(E),document.body.style.overflow=x,window.removeEventListener("keydown",w)}},[l,e]),!e)return null;const b=t==="loading",v=p.trim(),y=b?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return wi.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!b&&i()},children:o.jsxs("form",{ref:c,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":t==="confirm"?void 0:"sandbox-dialog-description",onSubmit:x=>{x.preventDefault(),!b&&!f.current&&v&&r(v)},children:[o.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[o.jsx("span",{className:"sandbox-dialog-orbit"}),o.jsx("span",{className:"sandbox-dialog-icon",children:b?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Qm,{kind:n})})]}),o.jsxs("div",{className:"sandbox-dialog-copy",children:[o.jsx("h2",{id:"sandbox-dialog-title",children:y}),t==="error"?o.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:s||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):b?o.jsxs("p",{id:"sandbox-dialog-description","aria-live":"polite",children:["正在创建并等待 ",a," 智能体就绪,这通常需要半分钟"]}):null,o.jsxs("label",{className:"sandbox-dialog-field",children:[o.jsxs("span",{className:"sandbox-dialog-field-label",children:[o.jsx("span",{children:"智能体名称"}),o.jsxs("span",{"aria-hidden":"true",children:[p.length,"/",T3]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:T3,disabled:b,placeholder:l,autoComplete:"off",onChange:x=>m(x.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:x=>{const{nativeEvent:E}=x;x.key==="Enter"&&(f.current||E.isComposing||E.keyCode===229)&&x.preventDefault()}})]})]}),o.jsxs("footer",{className:"sandbox-dialog-actions",children:[o.jsx("button",{ref:d,type:"button",onClick:i,children:b?"取消创建":"取消"}),!b&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function vOe({agentName:e,onExit:t}){return o.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[o.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),o.jsxs("span",{className:"sandbox-session-warning-copy",children:["当前您在使用 ",e," 智能体"]}),o.jsx("button",{type:"button",onClick:t,children:"退出内置智能体"})]})}function wOe({activity:e,time:t}){var n;return o.jsxs("aside",{className:"sandbox-activity-record",role:"status","aria-label":"Sandbox 操作记录",children:[o.jsxs("div",{className:"sandbox-activity-summary",children:[o.jsx("span",{className:"sandbox-activity-dot","aria-hidden":"true"}),o.jsx("span",{className:"sandbox-activity-label",children:"操作记录"}),o.jsx("strong",{children:e.title}),t?o.jsx("time",{children:t}):null]}),(n=e.details)!=null&&n.length?o.jsx("dl",{className:"sandbox-activity-details",children:e.details.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{title:s.value,children:s.code?o.jsx("code",{children:s.value}):s.value})]},`${s.label}:${s.value}`))}):null]})}function _Oe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function SOe({usage:e}){const t=[["Total",e.totalTokens],["Input",e.inputTokens],...e.cachedInputTokens>0?[["Cached input",e.cachedInputTokens]]:[],["Output",e.outputTokens],...e.reasoningOutputTokens>0?[["Reasoning output",e.reasoningOutputTokens]]:[]];return o.jsx("div",{className:"sandbox-token-usage","aria-label":"Codex Token 用量",children:t.map(([n,s])=>o.jsxs("span",{title:`${n}: ${s.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:_Oe(s)})]},n))})}function NG(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function TG(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function hC(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function gy(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function NOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function TOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function kOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function AOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function COe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function IOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function jOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function aT(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function ROe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function nl(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function Xg({open:e,title:t,subtitle:n,icon:s,className:i="",onClose:r,children:a}){const l=g.useId(),c=g.useRef(null),u=g.useRef(null),d=g.useRef(r);return d.current=r,g.useEffect(()=>{var p;if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const f=document.body.style.overflow;document.body.style.overflow="hidden",(p=c.current)==null||p.focus();const h=m=>{var E;if(m.key==="Escape"){m.preventDefault(),d.current();return}if(m.key!=="Tab")return;const b=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((b==null?void 0:b.querySelectorAll('button:not(:disabled), input:not(:disabled), iframe, [tabindex]:not([tabindex="-1"])'))??[]);if(v.length===0)return;const y=v[0],x=v[v.length-1];m.shiftKey&&document.activeElement===y?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{var m;document.body.style.overflow=f,window.removeEventListener("keydown",h),(m=u.current)==null||m.focus()}},[e]),e?wi.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${i}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"sandbox-control-head",children:[o.jsx("span",{className:"sandbox-control-head-icon","aria-hidden":"true",children:s}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:t}),o.jsx("p",{children:n})]}),o.jsx("button",{ref:c,type:"button",className:"sandbox-control-close","aria-label":`关闭${t}`,onClick:r,children:o.jsx(jOe,{})})]}),a]})}),document.body):null}function OOe({open:e,kind:t,launch:n,loading:s,error:i,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Xg,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(NG,{}):o.jsx(TG,{}),className:`sandbox-tool-dialog sandbox-tool-dialog--${t}`,onClose:a,children:[o.jsx("div",{className:"sandbox-tool-toolbar",children:o.jsxs("span",{children:[o.jsx("i",{className:s?"is-loading":n?"is-ready":""}),s?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(nl,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:i}),o.jsx("button",{type:"button",onClick:r,children:"重试"})]}):n?o.jsx("iframe",{src:n.url,title:c,allow:"clipboard-read; clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"}):null})]})}function MOe({open:e,threads:t,currentThreadId:n,loading:s,error:i,onSelect:r,onClose:a}){return o.jsx(Xg,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(ROe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(nl,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:i})]}):t.length===0?o.jsx("div",{className:"sandbox-control-state",children:o.jsx("strong",{children:"暂无可恢复的对话"})}):t.map(l=>{const c=l.id===n,u=l.name||l.preview||`Thread ${l.id.slice(0,8)}`;return o.jsxs("button",{type:"button",className:c?"is-active":"",disabled:c,onClick:()=>r(l.id),children:[o.jsxs("span",{children:[o.jsx("strong",{children:u}),o.jsx("small",{children:l.preview||l.cwd||l.id})]}),o.jsx("time",{children:l.updatedAt?new Date(l.updatedAt*1e3).toLocaleString():""}),o.jsx(aT,{})]},l.id)})})})}const LOe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],DOe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],POe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function BOe({open:e,value:t,busy:n,error:s,onSave:i,onClose:r}){const[a,l]=g.useState(t);return g.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Xg,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(hC,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(p_,{label:"沙箱模式",choices:LOe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(p_,{label:"审批策略",choices:DOe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(p_,{label:"审批方式",choices:POe,value:a.approvalsReviewer,disabled:n,onChange:c=>l(u=>({...u,approvalsReviewer:c}))}),o.jsxs("label",{className:`sandbox-network-toggle${a.sandboxMode==="danger-full-access"?" is-disabled":""}`,children:[o.jsxs("span",{children:[o.jsx("strong",{children:"允许网络访问"}),o.jsx("small",{children:"控制 workspace-write 与只读模式中的外部网络访问。"})]}),o.jsx("input",{type:"checkbox",checked:a.networkAccess,disabled:n||a.sandboxMode==="danger-full-access",onChange:c=>l(u=>({...u,networkAccess:c.target.checked}))})]}),a.sandboxMode==="danger-full-access"?o.jsx("div",{className:"sandbox-control-note is-danger",children:"完全访问会关闭文件系统与网络隔离,请只在可信任务中使用。"}):null,s?o.jsx("div",{className:"sandbox-control-error",children:s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:n,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:n,onClick:()=>i(a),children:[n?o.jsx(nl,{className:"spin"}):null,"保存权限"]})]})]})}function p_({label:e,choices:t,value:n,disabled:s,onChange:i}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:s,role:"radiogroup","aria-label":e,children:[o.jsx("legend",{children:e}),o.jsx("div",{className:"sandbox-choice-list",children:t.map(r=>o.jsxs("button",{type:"button",role:"radio",className:`${n===r.value?"is-active":""}${r.danger?" is-danger":""}`.trim(),"aria-checked":n===r.value,onClick:()=>i(r.value),onKeyDown:a=>{var d,f;const l=t.findIndex(h=>h.value===r.value);let c=l;if(a.key==="ArrowRight"||a.key==="ArrowDown")c=(l+1)%t.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")c=(l-1+t.length)%t.length;else if(a.key==="Home")c=0;else if(a.key==="End")c=t.length-1;else return;a.preventDefault(),i(t[c].value);const u=(d=a.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="radio"]');(f=u==null?void 0:u[c])==null||f.focus()},children:[o.jsx("i",{}),o.jsxs("span",{children:[o.jsx("strong",{children:r.label}),o.jsx("small",{children:r.detail})]})]},r.value))})]})}function UOe({open:e,cwd:t,locked:n,busy:s,error:i,browse:r,onSave:a,onClose:l}){const[c,u]=g.useState(t||"/"),[d,f]=g.useState(null),[h,p]=g.useState(!1),[m,b]=g.useState("");g.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),b("");try{const x=await r(y);f(x),u(x.path)}catch(x){b(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Xg,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(gy,{}),className:"sandbox-workspace-dialog",onClose:l,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsxs("label",{className:"sandbox-workspace-input",children:[o.jsx("span",{children:"绝对路径"}),o.jsxs("div",{children:[o.jsx("input",{value:c,disabled:s||n,spellCheck:!1,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.startsWith("/")&&(y.preventDefault(),v(c))}}),o.jsx("button",{type:"button",disabled:s||h||!c.startsWith("/"),onClick:()=>void v(c),children:"浏览"})]})]}),o.jsxs("div",{className:"sandbox-directory-browser",children:[o.jsxs("div",{className:"sandbox-directory-head",children:[o.jsx("span",{title:d==null?void 0:d.path,children:(d==null?void 0:d.path)??c}),h?o.jsx(nl,{className:"spin"}):null]}),o.jsxs("div",{className:"sandbox-directory-list",children:[d!=null&&d.parent?o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(d.parent??"/"),children:[o.jsx(gy,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(aT,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(gy,{}),o.jsx("span",{children:y.name}),o.jsx(aT,{})]},y.path)),!h&&(d==null?void 0:d.directories.length)===0?o.jsx("div",{className:"sandbox-directory-empty",children:"当前目录没有子目录"}):null]})]}),n?o.jsx("div",{className:"sandbox-control-note",children:"当前对话已经开始,工作空间已锁定。新建 Sandbox 会话后可重新选择。"}):null,m||i?o.jsx("div",{className:"sandbox-control-error",children:m||i}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:s,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:s||n||!c.startsWith("/"),onClick:()=>a(c),children:[s?o.jsx(nl,{className:"spin"}):null,"使用此目录"]})]})]})}function FOe({approval:e,busy:t,error:n,onDecision:s}){var a;const i=(a=e==null?void 0:e.command)==null?void 0:a.trim(),r=(e==null?void 0:e.changes)===void 0?"":JSON.stringify(e.changes,null,2);return o.jsxs(Xg,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(hC,{}),className:"sandbox-approval-dialog",onClose:()=>{t||s("cancel")},children:[o.jsxs("div",{className:"sandbox-control-body",children:[e!=null&&e.reason?o.jsx("div",{className:"sandbox-approval-reason",children:e.reason}):null,i?o.jsx("pre",{children:i}):null,r?o.jsx("pre",{children:r}):null,e!=null&&e.cwd?o.jsxs("div",{className:"sandbox-approval-meta",children:["执行目录 ",o.jsx("code",{children:e.cwd})]}):null,n?o.jsx("div",{className:"sandbox-control-error",children:n}):null]}),o.jsxs("footer",{className:"sandbox-control-actions sandbox-approval-actions",children:[o.jsx("button",{type:"button",disabled:t,onClick:()=>s("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>s("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>s("acceptForSession"),children:[t?o.jsx(nl,{className:"spin"}):null,"本会话允许"]})]})]})}const $Oe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function HD(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function HOe({session:e,onBack:t,onOpen:n,onDelete:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=$Oe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(b){f(b instanceof Error?b.message:String(b))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await s()}catch(b){f(b instanceof Error?b.message:String(b)),r(!1)}finally{u(!1)}}};return o.jsxs("section",{className:"sandbox-agent-details",children:[o.jsxs("header",{className:"sandbox-agent-details-header",children:[o.jsxs("button",{type:"button",className:"sandbox-agent-back",onClick:t,children:[o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"返回智能体"]}),o.jsxs("div",{children:[o.jsx("h1",{children:e.displayName||`${h} 智能体`}),o.jsxs("p",{children:[h," AgentKit Session 详情"]})]})]}),d?o.jsx("div",{className:"sandbox-agent-detail-error",role:"alert",children:d}):null,o.jsxs("div",{className:"sandbox-agent-detail-panel",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"智能体类型"}),o.jsx("dd",{children:h})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:iE(e.status)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建人"}),o.jsx("dd",{children:e.createdBy||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具类型"}),o.jsx("dd",{children:e.toolType||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:HD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:HD(e.expireAt)})]}),o.jsxs("div",{className:"is-wide",children:[o.jsx("dt",{children:"Session ID"}),o.jsx("dd",{children:e.id})]})]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"sandbox-agent-delete",disabled:a||c,onClick:()=>r(!0),children:"删除智能体"}),o.jsx("button",{type:"button",className:"sandbox-agent-open",disabled:a||c,"aria-busy":a||void 0,onClick:()=>void p(),children:a?"打开中…":"打开智能体"})]})]}),i?o.jsx("div",{className:"confirm-scrim",onClick:()=>!c&&r(!1),children:o.jsxs("div",{className:"confirm-box",role:"alertdialog","aria-modal":"true","aria-labelledby":"sandbox-agent-delete-title",onClick:b=>b.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"sandbox-agent-delete-title",children:"删除智能体?"}),o.jsxs("div",{className:"confirm-text",children:["将删除“",e.displayName||`${h} 智能体`,"”及其 AgentKit Session,此操作无法撤销。"]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",disabled:c,onClick:()=>r(!1),children:"取消"}),o.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",disabled:c,onClick:()=>void m(),children:c?"删除中…":"确认删除"})]})]})}):null]})}const zOe="_SegmentedControl_1sl7d_1",VOe="_SegmentedControlOption_1sl7d_140",GOe="_SegmentedControlThumb_1sl7d_219",oT={SegmentedControl:zOe,SegmentedControlOption:VOe,SegmentedControlThumb:GOe},by=({value:e,onChange:t,children:n,block:s,pill:i=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=g.useRef(null),f=g.useRef(null),h=g.useCallback(m=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let E=Math.floor(y.clientWidth);const w=y.offsetLeft;if(x-(E+w)<2&&(E=E-1),v.style.width=`${Math.floor(E)}px`,v.style.transform=`translateX(${w}px)`,b.scrollWidth>x){const S=x*.15,_=b.scrollLeft,T=y.offsetLeft,k=T+E;(T<_+S||k>_+x-S)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);ASe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const b=m.style.transition;m.style.transition="",h(!1),m.style.transition=b}}),g.useLayoutEffect(()=>{const m=d.current,b=f.current;!m||!b||(h(!!b.style.transition),b.style.transition||MN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,i]);const p=m=>{m&&t&&t(m)};return o.jsxs(pIe,{ref:d,className:ga(oT.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":s?"":void 0,"data-pill":i?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:oT.SegmentedControlThumb,ref:f}),n]})},KOe=({children:e,...t})=>o.jsx(xIe,{className:oT.SegmentedControlOption,...t,onPointerEnter:yH,children:o.jsx("span",{className:"relative",children:e})});by.Option=KOe;function qOe({workspace:e,onBack:t}){const[n,s]=g.useState("main"),[i,r]=g.useState(""),[a,l]=g.useState(!1),[c,u]=g.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";g.useEffect(()=>{s("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(s("terminal"),!(i||a)){l(!0),u("");try{const h=await cn.launchAgentTerminal(e.kind,e.session.id);r(h.url)}catch(h){u(h instanceof Error?h.message:String(h))}finally{l(!1)}}};return o.jsxs("section",{className:"sandbox-agent-workspace",children:[o.jsxs("header",{children:[o.jsxs("div",{className:"sandbox-agent-workspace-title",children:[o.jsx("button",{type:"button",onClick:t,"aria-label":"返回智能体列表",children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.session.displayName||`${d} 智能体`}),o.jsxs("p",{children:[o.jsxs("span",{children:["创建人 ",e.session.createdBy||"未知"]}),o.jsx("span",{className:"sandbox-agent-workspace-status","data-ready":e.session.status.toLowerCase()==="ready"||void 0,children:iE(e.session.status)})]})]})]}),o.jsxs(by,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():s("main")},children:[o.jsx(by.Option,{value:"main",children:"主界面"}),o.jsx(by.Option,{value:"terminal",children:"终端"})]})]}),o.jsx("div",{className:"sandbox-agent-workspace-surface",children:n==="main"?o.jsx("iframe",{src:e.webuiUrl,title:`${d} 主界面`,allow:"clipboard-read; clipboard-write"}):a?o.jsx("div",{className:"sandbox-agent-workspace-state",role:"status",children:"正在打开终端…"}):c?o.jsxs("div",{className:"sandbox-agent-workspace-state is-error",role:"alert",children:[o.jsx("p",{children:c}),o.jsx("button",{type:"button",onClick:()=>void f(),children:"重新尝试"})]}):i?o.jsx("iframe",{src:i,title:`${d} 终端`}):null})]})}const AE=[{name:"model",usage:"/model [model]",description:"显示或切换当前对话模型",keywords:["模型","switch"]},{name:"models",usage:"/models",description:"列出 app-server 可用模型",keywords:["模型列表","list"]},{name:"skill",usage:"/skill",description:"浏览并调用当前工作区可用的 Skill",keywords:["技能","workflow"]},{name:"skills",usage:"/skills",description:"浏览并调用当前工作区可用的 Skills",keywords:["技能列表","workflow","list"]},{name:"new",usage:"/new",description:"开始一个新对话",keywords:["新建","对话"]},{name:"resume",usage:"/resume [thread]",description:"打开历史会话或恢复指定 thread",keywords:["历史","恢复","session"]},{name:"fork",usage:"/fork",description:"从当前上下文分叉一个新对话",keywords:["分叉","branch"]},{name:"compact",usage:"/compact",description:"压缩当前对话上下文",keywords:["压缩","上下文"]},{name:"archive",usage:"/archive",description:"归档当前对话并新建对话",keywords:["归档","关闭"]},{name:"status",usage:"/status",description:"显示当前连接、thread、模型与 token 状态",keywords:["状态","连接","token"]},{name:"clear",usage:"/clear",description:"清空当前视图并开始新对话",keywords:["清空","重置"]},{name:"help",usage:"/help",description:"显示 Sandbox 支持的快捷命令",keywords:["帮助","命令"]}];function YOe(e){var n;const t=e.trim().match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(t)return{name:t[1].toLocaleLowerCase(),argument:((n=t[2])==null?void 0:n.trim())??""}}function WOe(e){const t=e.toLocaleLowerCase();return AE.filter(n=>!t||[n.name,n.description,...n.keywords].some(s=>s.toLocaleLowerCase().includes(t))).sort((n,s)=>zD(n,t)-zD(s,t)).slice(0,12)}function zD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:AE.indexOf(e)}function XOe(e,t){const n=t.toLocaleLowerCase();return e.filter(s=>!n||`${s.id} ${s.displayName} ${s.description}`.toLocaleLowerCase().includes(n)).sort((s,i)=>{if(!n)return Number(i.isDefault)-Number(s.isDefault);const r=s.id.toLocaleLowerCase(),a=i.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,s.displayName)-l(a,i.displayName)}).slice(0,12)}function QOe(){return AE.map(e=>({label:e.usage,value:e.description}))}function ZOe(e,t){return e.map(n=>{const s=n.displayName.trim(),i=s&&s!==n.id?`${s} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${i} — ${n.description}`:i,code:!1}})}function JOe(e){const t=[{label:"Thread",value:e.threadId,code:!0},{label:"工作空间",value:e.cwd||"未设置",code:!!e.cwd}];return e.model&&t.push({label:"模型",value:e.model,code:!0}),t.push({label:"状态",value:e.busy?"运行中":"空闲"}),e.threadTotal&&t.push({label:"累计 Token",value:e.threadTotal.totalTokens.toLocaleString()}),e.modelContextWindow!==void 0&&t.push({label:"上下文窗口",value:e.modelContextWindow.toLocaleString()}),t}function eMe(e){return e.messages.map(t=>{var s;const n=[];return t.role==="user"&&((s=t.skillNames)!=null&&s.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(i=>({name:i,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function tMe({appName:e,value:t,onChange:n,onSubmit:s,disabled:i,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:b,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const S=g.useRef(null),_=g.useRef(null),T=g.useRef(null),k=g.useRef(null),[A,j]=g.useState(!1),[R,B]=g.useState(0),[z,L]=g.useState(!1);g.useLayoutEffect(()=>{const V=S.current;V&&(V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,200)}px`)},[t]);const F=g.useMemo(()=>{if(!t.startsWith("/")||t.includes(` -`))return;const V=t.slice(1),X=V.search(/\s/),K=(X<0?V:V.slice(0,X)).toLocaleLowerCase(),ce=X<0?"":V.slice(X).trim();if(!(X>=0&&K!=="model"))return{command:K,argument:ce,modelMode:X>=0}},[t]),C=g.useMemo(()=>{const V=/(^|\s)\$([^\s$]*)$/.exec(t);if(V)return{query:V[2],start:t.length-V[2].length-1,end:t.length}},[t]),I=g.useMemo(()=>{if(C){const V=C.query.toLocaleLowerCase();return b.filter(X=>!x.some(K=>K.id===X.id||K.name===X.name)).filter(X=>`${X.name} ${X.description}`.toLocaleLowerCase().includes(V)).slice(0,12).map(X=>({kind:"skill",skill:X}))}return F!=null&&F.modelMode?XOe(d,F.argument).map(V=>({kind:"model",model:V})):F?WOe(F.command).map(V=>({kind:"command",command:V})):[]},[C,d,x,b,F]),D=!z&&!!(C||F);g.useEffect(()=>{B(0)},[t]),g.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),g.useEffect(()=>{C&&!y&&!v&&E()},[C,E,y,v]);const $=a.some(V=>V.status!=="ready"),O=!i&&!r&&!$&&(t.trim().length>0||a.length>0);function te(V){L(!1),j(!1),n(V)}function se(V){if(V.kind==="skill"){if(!C)return;const X=t.slice(0,C.start)+t.slice(C.end);w([...x,V.skill]),te(X),L(!0),requestAnimationFrame(()=>{var K,ce;(K=S.current)==null||K.focus(),(ce=S.current)==null||ce.setSelectionRange(C.start,C.start)});return}if(V.kind==="model"){te(`/model ${V.model.id}`),L(!0),requestAnimationFrame(()=>{var X;return(X=S.current)==null?void 0:X.focus()});return}if(V.command.name==="model"){te("/model "),m(),requestAnimationFrame(()=>{var X;return(X=S.current)==null?void 0:X.focus()});return}if(V.command.name==="skill"||V.command.name==="skills"){te(`/${V.command.name}`),L(!0),requestAnimationFrame(()=>{var X;return(X=S.current)==null?void 0:X.focus()});return}te(`/${V.command.name}`),L(!0),requestAnimationFrame(()=>{var X;return(X=S.current)==null?void 0:X.focus()})}function P(V){var X;j(!1),(X=V.current)==null||X.click()}function Q(V){const X=V.target.files?Array.from(V.target.files):[];X.length&&l(X),V.target.value=""}const ee=C?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx(oE,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[D?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":ee,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx(IOe,{}),o.jsx("span",{children:ee}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:C?"$":"/"})]}),C&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(nl,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(nl,{className:"spin"})," 正在读取模型…"]}):I.length===0?o.jsx("div",{className:"composer-command-empty",children:C?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:I.map((V,X)=>{const K=V.kind==="command"?`command:${V.command.name}`:V.kind==="model"?`model:${V.model.id}`:`skill:${V.skill.id}`,ce=V.kind==="command"?V.command.usage:V.kind==="model"?V.model.displayName:`$${V.skill.name}`,he=V.kind==="command"?V.command.description:V.kind==="model"?V.model.description||V.model.id:V.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":X===R,className:`composer-command-item${X===R?" is-active":""}`,onMouseDown:be=>{be.preventDefault(),se(V)},onMouseEnter:()=>B(X),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${V.kind}`,"aria-hidden":"true",children:V.kind==="command"?"/":V.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ce}),o.jsx("span",{children:he})]}),X===R?o.jsx("kbd",{children:"↵"}):null]},K)})})]}):null,o.jsxs("div",{className:"composer-left-controls",children:[o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:i,onClick:()=>j(V=>!V),children:o.jsx(NOe,{className:"icon"})}),A?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>j(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(_),children:[o.jsx(kOe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(T),children:[o.jsx(AOe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(k),children:[o.jsx(COe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{j(!1),u.onOpenTerminal()},children:[o.jsx(NG,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{j(!1),u.onOpenBrowser()},children:[o.jsx(TG,{className:"icon"}),"查看浏览器"]})]})]}):null]}),o.jsx("button",{type:"button",className:"comp-icon sandbox-composer-control",title:"Codex 权限","aria-label":"Codex 权限",disabled:u.settingsBusy||r,onClick:u.onOpenPermissions,children:o.jsx(hC,{})}),o.jsx("button",{type:"button",className:`comp-icon sandbox-composer-control${u.workspaceLocked?" is-locked":""}`,title:u.workspaceLocked?"对话已开始,工作空间已锁定":"选择工作空间","aria-label":"Codex 工作空间",disabled:u.settingsBusy||r,onClick:u.onOpenWorkspace,children:o.jsx(gy,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(aE,{skillPrefix:"$",value:{skills:x.map(({name:V,description:X})=>({name:V,description:X}))},onRemoveSkill:V=>w(x.filter(X=>X.name!==V))}):null,o.jsx("textarea",{ref:S,className:"comp-input scroll",rows:1,value:t,disabled:i,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":D,onChange:V=>te(V.target.value),onBlur:()=>window.setTimeout(()=>L(!0),0),onKeyDown:V=>{if(!AA(V.nativeEvent)){if(D){if((V.key==="ArrowDown"||V.key==="Tab"&&!V.shiftKey)&&I.length>0){V.preventDefault(),B(X=>(X+1)%I.length);return}if((V.key==="ArrowUp"||V.key==="Tab"&&V.shiftKey)&&I.length>0){V.preventDefault(),B(X=>(X-1+I.length)%I.length);return}if(V.key==="Enter"&&!V.shiftKey&&I[R]){V.preventDefault(),se(I[R]);return}if(V.key==="Escape"){V.preventDefault(),L(!0);return}}if(V.key==="Backspace"&&!t&&V.currentTarget.selectionStart===0&&x.length>0){V.preventDefault(),w(x.slice(0,-1));return}V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),O&&s(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!O,onClick:()=>s(t),"aria-label":"发送",children:r?o.jsx(nl,{className:"icon spin"}):o.jsx(TOe,{className:"icon"})})]}),o.jsx("input",{ref:_,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:Q}),o.jsx("input",{ref:T,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:Q}),o.jsx("input",{ref:k,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:Q})]})}function nMe({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:s,onSnapshot:i,onActivity:r,onError:a}){const l=g.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=g.useState(!1),[d,f]=g.useState([]),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState([]),[x,E]=g.useState(!1),[w,S]=g.useState(!1),[_,T]=g.useState([]),[k,A]=g.useState(!1),[j,R]=g.useState([]),[B,z]=g.useState(!1),[L,F]=g.useState("");g.useEffect(()=>{u(!1),f([]),p(!1),b(!1),y([]),E(!1),S(!1),T([]),A(!1),R([]),z(!1),F("")},[e==null?void 0:e.id]);const C=g.useCallback(async()=>{const P=l.current;if(!P)return[];p(!0);try{const Q=await cn.listModels(P);return l.current===P&&(f(Q),b(!0)),Q}catch(Q){return l.current===P&&(b(!0),a(Q instanceof Error?Q.message:String(Q))),[]}finally{l.current===P&&p(!1)}},[a]),I=g.useCallback(async()=>{const P=l.current;if(!P)return[];E(!0);try{const Q=await cn.listSkills(P);return l.current===P&&(y(Q),S(!0)),Q}catch(Q){return l.current===P&&(S(!0),a(Q instanceof Error?Q.message:String(Q))),[]}finally{l.current===P&&E(!1)}},[a]),D=g.useCallback(async()=>{const P=l.current;if(P){A(!0),z(!0),F("");try{const Q=await cn.listThreads(P);l.current===P&&R(Q.threads)}catch(Q){l.current===P&&F(Q instanceof Error?Q.message:String(Q))}finally{l.current===P&&z(!1)}}},[]);function $(P){i(P),T([]),y([]),S(!1),A(!1)}async function O(P){const Q=l.current;if(!(!Q||c||t)){if(P===(e==null?void 0:e.threadId)){A(!1);return}u(!0),a("");try{const ee=await cn.resumeThread(Q,P);if(l.current!==Q)return;$(ee),r("已恢复 Codex 对话",[{label:"Thread",value:ee.threadId,code:!0}])}catch(ee){l.current===Q&&a(ee instanceof Error?ee.message:String(ee))}finally{l.current===Q&&u(!1)}}}async function te(P){const Q=e,ee=P.trim();if(!ee.startsWith("/"))return!1;if(!Q||t||c)return!0;const V=YOe(ee),X=V&&AE.find(K=>K.name===V.name);if(!V||!X)return a(`未知快捷命令:${ee.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),T([]),X.name==="model"&&!V.argument)return n("/model "),m||await C(),!0;if(X.name==="skill"||X.name==="skills")return n("$"),w||(await I()).length===0&&n(""),!0;if(X.name==="resume"&&!V.argument)return n(""),await D(),!0;n(""),u(!0);try{if(X.name==="model"){const K=await cn.setModel(Q.id,V.argument);if(l.current!==Q.id)return!0;s({model:K}),r("已切换 Codex 模型",[{label:"模型",value:K,code:!0}])}else if(X.name==="models"){const K=m?d:await C();if(l.current!==Q.id)return!0;r(K.length>0?"Codex 可用模型":"当前没有可用模型",ZOe(K,Q.model))}else if(X.name==="new"||X.name==="clear"){const K=await cn.newThread(Q.id);if(l.current!==Q.id)return!0;$(K),r("已新建 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(X.name==="resume"){const K=await cn.resumeThread(Q.id,V.argument);if(l.current!==Q.id)return!0;$(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(X.name==="fork"){const K=await cn.forkThread(Q.id);if(l.current!==Q.id)return!0;$(K),r("已分叉 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(X.name==="compact"){if(await cn.compactThread(Q.id),l.current!==Q.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:Q.threadId,code:!0}])}else if(X.name==="archive"){const K=Q.threadId,ce=await cn.archiveThread(Q.id,K);if(l.current!==Q.id)return!0;ce.snapshot&&$(ce.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:K,code:!0}])}else if(X.name==="status"){const K=await cn.getStatus(Q.id);if(l.current!==Q.id)return!0;s(K),r("Codex 当前状态",JOe(K))}else X.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",QOe())}catch(K){l.current===Q.id&&(n(ee),a(K instanceof Error?K.message:String(K)))}finally{l.current===Q.id&&u(!1)}return!0}function se(){y([]),S(!1),T([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:C,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:I,selectedSkills:_,setSelectedSkills:T,invalidateSkills:se,threadsOpen:k,threads:j,threadsLoading:B,threadsError:L,openThreads:D,closeThreads:()=>{c||(A(!1),F(""))},resumeThread:O,executeSlash:te}}const sMe={volcengine:"火山引擎 AgentKit 提供企业级 Agent 解决方案",byteplus:"BytePlus AgentKit 提供企业级 Agent 解决方案"},iMe={volcengine:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",byteplus:"https://docs.byteplus.com/en/docs/legal"};function rMe(e){return e.toLowerCase()==="github"?o.jsx(Hee,{className:"icon"}):o.jsx(qee,{className:"icon"})}function aMe({branding:e,cloudProvider:t,onUsername:n}){const[s,i]=g.useState(null),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(""),f=g.useRef(null);g.useEffect(()=>{let v=!0;return i(null),a(""),KB().then(y=>{v&&i(y)}).catch(y=>{v&&a(y instanceof Error?y.message:String(y))}),()=>{v=!1}},[l]);const h=s!==null&&s.length===0;g.useEffect(()=>{var v;h&&((v=f.current)==null||v.focus())},[h]);const p=bte.test(u),m=t==="byteplus"?m2:p2,b=()=>{p&&n(u)};return o.jsxs("div",{className:"login",children:[o.jsx("header",{className:"login-top",children:o.jsxs("span",{className:"login-brand",children:[o.jsx("img",{className:"login-brand-logo",src:e.logoUrl||m,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),o.jsx("main",{className:"login-main",children:o.jsxs("div",{className:"login-card",children:[o.jsx(Pa,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),r?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(v=>v+1),children:"重试"})]}):s===null?null:s.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:s.map(v=>o.jsxs("button",{className:"login-btn",onClick:()=>xte(v.loginUrl),children:[rMe(v.id),o.jsxs("span",{children:["使用 ",v.label," 登录"]})]},v.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:v=>{v.preventDefault(),b()},children:[o.jsx("input",{ref:f,className:"login-name-input",value:u,onChange:v=>d(v.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!p,"aria-label":"进入",children:o.jsx(Kp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:u&&!p?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:sMe[t]}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:iMe[t],target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function oMe({open:e,checking:t,error:n,onLogin:s}){const i=g.useRef(null);return g.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=i.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?wi.createPortal(o.jsx("div",{className:"auth-expired-backdrop",children:o.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[o.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:o.jsx(Gk,{})}),o.jsxs("div",{className:"auth-expired-copy",children:[o.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),o.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&o.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),o.jsx("footer",{className:"auth-expired-actions",children:o.jsx("button",{ref:i,type:"button",onClick:s,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}const lMe=[{value:"slow",label:"执行速度慢"},{value:"crash",label:"运行崩溃"},{value:"incorrect",label:"结果不准确"},{value:"tool_error",label:"工具调用失败"},{value:"other",label:"其他问题"}];function cMe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function uMe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function dMe({onClose:e,onSubmit:t}){const n=g.useId(),s=g.useId(),i=g.useRef(null),r=g.useRef(null),a=g.useRef(!1),l=g.useRef(e),[c,u]=g.useState(()=>new Set),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(""),[v,y]=g.useState(!1);a.current=h,l.current=e,g.useEffect(()=>{var k;const S=document.body.style.overflow,_=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(k=r.current)==null||k.focus();const T=A=>{var z;if(A.key==="Escape"&&!a.current){A.preventDefault(),l.current();return}if(A.key!=="Tab")return;const j=Array.from(((z=i.current)==null?void 0:z.querySelectorAll("button:not(:disabled), textarea:not(:disabled)"))??[]);if(j.length===0)return;const R=j[0],B=j[j.length-1];A.shiftKey&&document.activeElement===R?(A.preventDefault(),B.focus()):!A.shiftKey&&document.activeElement===B&&(A.preventDefault(),R.focus())};return window.addEventListener("keydown",T),()=>{document.body.style.overflow=S,window.removeEventListener("keydown",T),_!=null&&_.isConnected&&_.focus()}},[]);const x=S=>{u(_=>{const T=new Set(_);return T.has(S)?T.delete(S):T.add(S),T})},E=async()=>{if(!(h||v)){p(!0),b("");try{await t({issues:[...c],description:d.trim()}),y(!0)}catch(S){b(S instanceof Error?S.message:String(S))}finally{p(!1)}}},w=c.size>0||d.trim().length>0;return wi.createPortal(o.jsx("div",{className:"issue-feedback-backdrop",onMouseDown:S=>{S.target===S.currentTarget&&!h&&e()},children:o.jsxs("section",{ref:i,className:"issue-feedback-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":v?`${s}-success`:s,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"issue-feedback-head",children:[o.jsx("h2",{id:n,children:"问题反馈"}),o.jsx("button",{type:"button",className:"issue-feedback-close",onClick:e,disabled:h,"aria-label":"关闭问题反馈",children:o.jsx(cMe,{})})]}),v?o.jsxs("div",{className:"issue-feedback-success",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"issue-feedback-success-mark","aria-hidden":"true",children:o.jsx(uMe,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:"上报成功,感谢您的反馈"}),o.jsx("p",{id:`${s}-success`,children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("div",{className:"issue-feedback-body",children:[o.jsx("p",{id:s,className:"issue-feedback-intro",children:"请选择遇到的问题,也可以补充具体表现。"}),o.jsx("p",{className:"issue-feedback-privacy",role:"alert",children:"您的对话数据将会上报到 AgentKit 团队,请注意隐私保护。"}),o.jsx("div",{className:"issue-feedback-chips","aria-label":"常见问题",children:lMe.map(S=>o.jsx("button",{type:"button",className:"issue-feedback-chip","aria-pressed":c.has(S.value),onClick:()=>x(S.value),disabled:h,children:S.label},S.value))}),o.jsxs("label",{className:"issue-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:r,value:d,onChange:S=>f(S.target.value),placeholder:"请描述问题发生时的表现(选填)",maxLength:4e3,rows:5,disabled:h})]}),m&&o.jsx("p",{className:"issue-feedback-error",role:"alert",children:m})]}),o.jsx("footer",{className:"issue-feedback-actions",children:v?o.jsx("button",{type:"button",className:"is-primary",onClick:e,children:"完成"}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:e,disabled:h,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:()=>void E(),disabled:!w||h,children:h?"正在上报…":"提交反馈"})]})})]})}),document.body)}const fMe=[{value:"conversation",label:"对话"},{value:"agents",label:"智能体"},{value:"applications",label:"自动化"},{value:"search",label:"搜索"},{value:"other",label:"其他"}],hMe=[{value:"page_slow",label:"页面加载慢"},{value:"feature_unavailable",label:"功能无法使用"},{value:"display_error",label:"页面显示异常"},{value:"no_response",label:"操作无响应"},{value:"other",label:"其他问题"}],pMe=["点击后没有反应","页面一直处于加载状态","部分内容显示不完整","操作后出现错误提示"];function mMe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function gMe({initialModule:e,onSubmit:t}){const n=g.useRef(null),[s,i]=g.useState(()=>new Set),[r,a]=g.useState(e),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(""),[p,m]=g.useState(!1),b=E=>{i(w=>{const S=new Set(w);return S.has(E)?S.delete(E):S.add(E),S})},v=E=>{var w;c(S=>S.trim()?S.includes(E)?S:`${S.trimEnd()} -${E}`:E),(w=n.current)==null||w.focus()},y=async E=>{if(E.preventDefault(),!(u||p)){d(!0),h("");try{await t({module:r,issues:[...s],description:l.trim()}),m(!0)}catch(w){h(w instanceof Error?w.message:String(w))}finally{d(!1)}}},x=s.size>0||l.trim().length>0;return o.jsxs("div",{className:"platform-feedback-page",children:[o.jsxs("header",{className:"platform-feedback-header",children:[o.jsx("h1",{children:"问题反馈"}),o.jsx("p",{children:"告诉我们您在使用 AgentKit Studio 时遇到的问题。"})]}),o.jsx("div",{className:"platform-feedback-scroll",children:p?o.jsxs("section",{className:"platform-feedback-success","aria-labelledby":"feedback-success-title","aria-live":"polite",role:"status",children:[o.jsx("span",{className:"platform-feedback-success-icon","aria-hidden":"true",children:o.jsx(mMe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"feedback-success-title",children:"上报成功,感谢您的反馈"}),o.jsx("p",{children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("form",{className:"platform-feedback-form",onSubmit:E=>void y(E),children:[o.jsxs("section",{className:"platform-feedback-section",children:[o.jsx("div",{className:"platform-feedback-section-heading",children:o.jsx("h2",{children:"所属模块"})}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"所属模块",children:fMe.map(E=>o.jsx("button",{type:"button","aria-pressed":r===E.value,onClick:()=>a(E.value),disabled:u,children:E.label},E.value))})]}),o.jsx("section",{className:"platform-feedback-section",children:o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"常见问题(可多选)"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题类型",children:hMe.map(E=>o.jsx("button",{type:"button","aria-pressed":s.has(E.value),onClick:()=>b(E.value),disabled:u,children:E.label},E.value))})]})}),o.jsxs("section",{className:"platform-feedback-section",children:[o.jsxs("label",{className:"platform-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:n,value:l,onChange:E=>c(E.target.value),placeholder:"请描述问题发生时的页面、操作和表现",maxLength:4e3,rows:6,disabled:u})]}),o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"快捷补充"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题描述推荐",children:pMe.map(E=>o.jsx("button",{type:"button",onClick:()=>v(E),disabled:u,children:E},E))})]})]}),o.jsx("p",{className:"platform-feedback-privacy",role:"alert",children:"您的数据将会上报到 AgentKit 团队,请注意隐私保护。"}),f&&o.jsx("p",{className:"platform-feedback-error",role:"alert",children:f}),o.jsx("div",{className:"platform-feedback-actions",children:o.jsx("button",{type:"submit",disabled:!x||u,children:u?"正在上报…":"提交反馈"})})]})})]})}function bMe({node:e,ctx:t}){const n=e.variant??"default";return o.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}Bu("Button",bMe);function yMe({node:e,ctx:t}){return o.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}Bu("Card",yMe);const xMe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},EMe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function kG(e){return xMe[e]??"flex-start"}function AG(e){return EMe[e]??"stretch"}function vMe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:kG(e.justify),alignItems:AG(e.align)},children:n.map(s=>t.render(s))})}Bu("Column",vMe);function wMe({node:e}){const t=e.axis==="vertical";return o.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}Bu("Divider",wMe);const _Me={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function SMe({node:e}){const t=e.name??"";return o.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:_Me[t]??"•"})}Bu("Icon",SMe);function NMe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:kG(e.justify),alignItems:AG(e.align??"center")},children:n.map(s=>t.render(s))})}Bu("Row",NMe);const TMe=new Set(["h1","h2","h3","h4","h5"]);function kMe({node:e,ctx:t}){const n=e.variant??"body",s=t.resolveString(e.text),i=TMe.has(n)?n:"p";return o.jsx(i,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:s})}Bu("Text",kMe);function AMe(e){return e==="agents"?"agents":e==="applications"?"applications":e==="search"?"search":["conversation","new-chat","sandbox"].includes(e)?"conversation":"other"}async function m_(e){const[t,n,s]=await Promise.allSettled([bOe(),yOe(),u2(e)]);return{agentId:e,ready:!0,harnessEnabled:s.status==="fulfilled",builtinTools:s.status==="fulfilled"?s.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const Na={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},CMe=600,IMe=1e3,jMe=5e3,RMe=500,OMe=new Set,MMe=[];function Sa(){return{skills:[]}}function g_(e){return`${NE(e)}.active`}function lT(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function LMe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(lT(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function cT(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const s=cT(n,t);if(s)return s}}function CG(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...CG(n)));return t}function VD(){const e=typeof localStorage<"u"?localStorage.getItem(Na.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function DMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.75",y:"3.75",width:"16.5",height:"16.5",rx:"3.25"}),o.jsx("path",{d:"M12 8.5v7M8.5 12h7"}),o.jsx("path",{d:"M6.75 6.75h1M16.25 17.25h1",opacity:"0.6"})]})}function PMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14.75",rx:"2.25"}),o.jsx("path",{d:"M3.5 9h17M9.25 12.25 7.1 14.4l2.15 2.15M14.75 12.25l2.15 2.15-2.15 2.15M12.8 11.85l-1.6 5.1"})]})}function BMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M5.25 8.5h1.5M5.25 11.5h1.5"}),o.jsx("rect",{x:"14.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M17.25 15.5h1.5M17.25 12.5h1.5M8.75 12h6.5m-2.5-2.5 2.5 2.5-2.5 2.5"})]})}function UMe(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),o.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function uT(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function FMe(e){if(!e)return"";const t=[];return e.ts&&t.push(uT(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function $c(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function GD(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return $c(e[n]);return""}const $Me="send_a2ui_json_to_client";function HMe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"||t.kind==="artifact"?t.files.length>0:t.kind==="tool"?!(t.name===$Me&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?BH(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function zMe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function VMe(e){return new Promise((t,n)=>{let s="";try{s=new URL(e,window.location.href).protocol}catch{}if(s!=="http:"&&s!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const i=window.open(e,"veadk_oauth","width=520,height=720");if(!i){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{i.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&l(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!r){if(i.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=i.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&l(d)}catch{}}},500)})}function GMe(e,t){const n=JSON.parse(JSON.stringify(e??{})),s=n.exchangedAuthCredential??n.exchanged_auth_credential??{},i=s.oauth2??{};return i.authResponseUri=t,i.auth_response_uri=t,s.oauth2=i,n.exchangedAuthCredential=s,n}function KD({text:e}){const[t,n]=g.useState(!1);return o.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?o.jsx(Ha,{className:"icon"}):o.jsx(bx,{className:"icon"})})}const qD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],YD=()=>qD[Math.floor(Math.random()*qD.length)];function b_(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function WD(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function XD(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}const KMe={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},qMe={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},YMe={user:"由我审批",auto_review:"自动审查"};function WMe(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function XMe(e){var n,s,i;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(s=e.grantRoot)!=null&&s.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(i=e.cwd)!=null&&i.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function QD(e){return e.flatMap(t=>t.apps.map(n=>ho(t.id,n)))}function QMe(e,t){var n;return((n=e.find(s=>s.runtimeId&&s.apps.some(i=>ho(s.id,i)===t)))==null?void 0:n.runtimeId)??""}function ZMe(e,t){for(const n of e){const s=n.apps.find(i=>ho(n.id,i)===t);if(s&&n.runtimeId)return{runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:s}}return null}function JMe(){const[e,t]=g.useState([]),[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(""),c=g.useRef(null),[u,d]=g.useState(!1),[f,h]=g.useState([]),[p,m]=g.useState(null),[b,v]=g.useState([]),[y,x]=g.useState(!1),[E,w]=g.useState(!1),[S,_]=g.useState(""),[T,k]=g.useState(!1),[A,j]=g.useState(!1),[R,B]=g.useState(null),[z,L]=g.useState(null),[F,C]=g.useState(!1),[I,D]=g.useState(""),[$,O]=g.useState(null),[te,se]=g.useState(!1),[P,Q]=g.useState(""),[ee,V]=g.useState(!1),[X,K]=g.useState(!1),[ce,he]=g.useState("confirm"),[be,ue]=g.useState(""),[we,Le]=g.useState("codex"),[Ne,ae]=g.useState(!1),[me,_e]=g.useState(0),[Je,Pe]=g.useState(null),[Fe,Ye]=g.useState(null),Ce=g.useRef(null),Ve=g.useRef(null),Ue=g.useRef((p==null?void 0:p.id)??""),W=g.useRef(""),oe=g.useRef(0),Z=g.useRef(new Set);Ue.current=(p==null?void 0:p.id)??"",g.useEffect(()=>()=>{for(const M of Z.current)URL.revokeObjectURL(M);Z.current.clear()},[]);function Ee(M){const U=URL.createObjectURL(M);return Z.current.add(U),U}function Me(M){!M||!Z.current.delete(M)||URL.revokeObjectURL(M)}function lt(){for(const M of Z.current)URL.revokeObjectURL(M);Z.current.clear()}const[Ot,ut]=g.useState({}),xn=a?Ot[a]??[]:f,xt=p?b:xn,wt=(M,U)=>ut(Y=>({...Y,[M]:typeof U=="function"?U(Y[M]??[]):U}));function En(M,U,Y=[],re=""){if(Ue.current!==M)return;const xe=crypto.randomUUID(),ke={role:"system",blocks:[],activity:{id:xe,title:U,...Y.length>0?{details:Y}:{}},meta:{localId:xe,ts:Date.now()/1e3}};v(ze=>{if(!re)return[...ze,ke];const nt=ze.findIndex(Xe=>{var ct;return((ct=Xe.meta)==null?void 0:ct.localId)===re});return nt<0?[...ze,ke]:[...ze.slice(0,nt),ke,...ze.slice(nt)]})}const[Ut,Pt]=g.useState(""),[at,ft]=g.useState("agent"),[He,_t]=g.useState(null),[ye,We]=g.useState({}),Ge=g.useRef(new Map),ht=!n||ye.ready===!0&&ye.agentId===n,[Vn,un]=g.useState(null),[Ht,sn]=g.useState(!1),kn=g.useRef(0),[zt,ot]=g.useState([]),[An,mn]=g.useState(Sa),[At,Os]=g.useState(null),[Ms,bs]=g.useState(0),[vn,Gn]=g.useState(!1),[ls,Kn]=g.useState(null),[Ss,Ns]=g.useState(!1),[hi,Cn]=g.useState([]),[Ks,cs]=g.useState(!1),qn=g.useRef(new Set),[Yn,Wn]=g.useState(()=>new Set),[Ls,ys]=g.useState(()=>new Set),[gn,fn]=g.useState(()=>new Set),dn=g.useRef(new Map),rn=g.useRef(new Map),an=g.useRef(void 0),xs=g.useRef(()=>{}),de=(M,U)=>Wn(Y=>{const re=new Set(Y);return U?re.add(M):re.delete(M),re}),Ie=M=>{const U=rn.current.get(M);U!==void 0&&window.clearTimeout(U),rn.current.delete(M),ys(Y=>new Set(Y).add(M))},Be=M=>{const U=rn.current.get(M);U!==void 0&&window.clearTimeout(U);const Y=window.setTimeout(()=>{rn.current.delete(M),ys(re=>{const xe=new Set(re);return xe.delete(M),xe})},2400);rn.current.set(M,Y)},it=(M,U)=>{fn(Y=>{if(Y.has(M)===U)return Y;const re=new Set(Y);return re.delete(M),re})},et=g.useRef(""),[Et,je]=g.useState(""),[Ln,us]=g.useState(""),[pi,ri]=g.useState(()=>new Set),[Xn,Jt]=g.useState(null),[vt,Dn]=g.useState(null),[mi,qa]=g.useState(!1),[ba,wc]=g.useState(),[nr,Hu]=g.useState(YD),[qs,ie]=g.useState(null),[Qt,Pn]=g.useState(!1),[Ts,en]=g.useState(!1),[ks,Vr]=g.useState(""),Gr=g.useRef(!1),[ne,Se]=g.useState(null),[ge,st]=g.useState(""),[on,bn]=g.useState(),[St,qt]=g.useState(null),wn=(St==null?void 0:St.capabilities.runtimeScope)??"mine",[Ds,sr]=g.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[zi,wr]=g.useState("cloud"),[Qn,ir]=g.useState(Rm),[Dt,Ps]=g.useState("volcengine"),[Eo,Sh]=g.useState(""),[Qg,Zg]=g.useState(!1),[vo,ai]=g.useState(!1),[CE,Jg]=g.useState(!1),[e0,Ya]=g.useState({}),[IE,t0]=g.useState({}),[n0,wo]=g.useState({}),s0=Yn.has(a),_o=Ls.has(a),So=s0||u,ml=!!a&&Ss,Wa=p?y:So,i0=Wa||!p&&_o,Zn=nMe({session:p,conversationBusy:y,onInputChange:Pt,onSessionPatch:M=>{const U=Ue.current;m(Y=>(Y==null?void 0:Y.id)===U?{...Y,...M}:Y)},onSnapshot:M=>{const U=Ue.current;lt(),v(eMe(M)),m(Y=>(Y==null?void 0:Y.id)===U?{...Y,threadId:M.threadId,cwd:M.cwd??Y.cwd,model:M.model??Y.model,workspaceLocked:M.workspaceLocked,permissions:M.permissions,busy:!1}:Y)},onActivity:(M,U=[])=>{const Y=Ue.current;Y&&En(Y,M,U)},onError:je}),jE=e0[a]??"",RE=IE[a]??OMe,OE=n0[a]??MMe,Vi=At==null?void 0:At.graph,r0=[At==null?void 0:At.name,Vi==null?void 0:Vi.name,Vi==null?void 0:Vi.id].filter(M=>!!M),zu=An.targetAgent&&Vi?cT(Vi,An.targetAgent.name):Vi,a0=(zu==null?void 0:zu.skills)??(An.targetAgent?[]:(At==null?void 0:At.skills)??[]),o0=Vi?CG(Vi):[];function Nh(M){b_(M);for(const U of M)U.status==="uploading"?qn.current.add(U.id):U.uri&&Qb(n,U.uri).catch(Y=>je(String(Y)))}function Vu(){kn.current+=1;const M=Vn;un(null),sn(!1),M&&!M.id.startsWith("pending-")&&nRe(M.id).catch(U=>{je(U instanceof Error?U.message:String(U))})}async function Gu(M){try{await PS(n,ge,M),await DS(n,ge,M),r(U=>U.filter(Y=>Y.id!==M)),ut(U=>{const{[M]:Y,...re}=U;return re})}catch(U){je(String(U))}}function ME(M){const U=zt.find(xe=>xe.id===M);if(!U)return;const Y=zt.filter(xe=>xe.id!==M);b_([U]),U.status==="uploading"&&qn.current.add(M),ot(Y),Y.length===0&&!Ut.trim()&&!!a&&xt.length===0?(et.current="",l(""),Gu(a)):U.uri&&Qb(n,U.uri).catch(xe=>je(String(xe)))}const l0=(M,U)=>{var ke,ze,nt,Xe,ct;const Y=U.author&&U.author!=="user"?U.author:void 0;Y&&(Ya(Ze=>({...Ze,[M]:Y})),t0(Ze=>({...Ze,[M]:new Set(Ze[M]??[]).add(Y)})),wo(Ze=>{var Ke;return(Ke=Ze[M])!=null&&Ke.length?Ze:{...Ze,[M]:[Y]}}));const re=((ke=U.actions)==null?void 0:ke.transferToAgent)??((ze=U.actions)==null?void 0:ze.transfer_to_agent);re&&wo(Ze=>{const Ke=Ze[M]??[];return Ke[Ke.length-1]===re?Ze:{...Ze,[M]:[...Ke,re]}}),(((nt=U.actions)==null?void 0:nt.endOfAgent)??((Xe=U.actions)==null?void 0:Xe.end_of_agent)??((ct=U.actions)==null?void 0:ct.escalate))&&wo(Ze=>{const Ke=Ze[M]??[];return Ke.length<=1?Ze:{...Ze,[M]:Ke.slice(0,-1)}})},[No,Bt]=g.useState(VD),[c0,u0]=g.useState([]),[LE,Th]=g.useState({}),kh=g.useCallback(M=>{u0(U=>{const Y=U.findIndex(xe=>xe.id===M.id);if(Y===-1)return[M,...U];const re=[...U];return re[Y]={...re[Y],...M},re})},[]),[DE,d0]=g.useState(!0),[Ku,oi]=g.useState(!1),[Ah,As]=g.useState(!1),[Ch,H]=g.useState(!1),[le,fe]=g.useState(null),[Ae,tt]=g.useState("custom"),[bt,ds]=g.useState([]),_r=g.useRef([]),Yt=g.useRef(null),Gi=g.useRef(null),[pC,f0]=g.useState([]),[Ys,Kr]=g.useState(""),Sr=g.useRef(null),[PE,_i]=g.useState(!1),[qu,_n]=g.useState(!1),[mC,BE]=g.useState(""),[IG,jG]=g.useState("good"),[RG,h0]=g.useState("basic"),[OG,MG]=g.useState("good"),[Ih,p0]=g.useState(""),[LG,DG]=g.useState(null),[gl,Es]=g.useState(!1),[_c,qr]=g.useState(null),UE=g.useRef(null),[Xa,jh]=g.useState(()=>{const M=Ia();return mh(M),M}),[PG,gC]=g.useState(!1),[BG,bC]=g.useState(""),[yC,m0]=g.useState(null),[UG,xC]=g.useState({}),[FG,EC]=g.useState(()=>new Set),[Yu,ya]=g.useState(null),[g0,b0]=g.useState(Ti(Dt)),[vC,Ki]=g.useState(""),[wC,Mi]=g.useState(""),[Sn,rr]=g.useState(null),[$G,FE]=g.useState(!1),y0=g.useRef(!1),Wu=g.useRef(!1),Qa=g.useCallback(M=>{if(!ge)return!1;try{ID(localStorage,ge,M)}catch(U){return us(U instanceof Error?U.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return _r.current=M,ds(M),us(""),!0},[ge]),Za=g.useCallback(M=>{var U;M&&((U=Yt.current)==null?void 0:U.id)!==M||(Yt.current=null,Gi.current!==null&&(window.clearTimeout(Gi.current),Gi.current=null))},[]),Xu=g.useCallback(()=>{const M=Yt.current;M&&(Za(),Qa([M,..._r.current.filter(U=>U.id!==M.id)]))},[Za,Qa]),HG=g.useCallback((M,U,Y)=>{!M||!ge||(Yt.current&&Yt.current.id!==M&&Xu(),Yt.current={id:M,draft:U,updatedAt:Date.now(),deploymentTarget:Y},Gi.current!==null&&window.clearTimeout(Gi.current),Gi.current=window.setTimeout(Xu,CMe))},[Xu,ge]),$E=g.useCallback(M=>{!M||!ge||(Za(M),Qa(_r.current.filter(U=>U.id!==M)))},[Za,Qa,ge]),_C=g.useCallback(M=>{if(!ge||M.length===0)return;const U=new Set(M.map(Y=>Y.id));Yt.current&&U.has(Yt.current.id)&&Za(),Qa(_r.current.filter(Y=>!U.has(Y.id))),Th(Y=>Object.fromEntries(Object.entries(Y).filter(([re])=>!U.has(re)))),U.has(Ys)&&(Kr(""),fe(null),ya(null),Sr.current=null,localStorage.removeItem(g_(ge)))},[Za,Qa,Ys,ge]),SC=g.useCallback(M=>{if(!M||!ge)return;Za(M);const U=Sr.current,Y=_r.current.filter(re=>re.id!==M);Qa((U==null?void 0:U.id)===M?[U,...Y]:Y)},[Za,Qa,ge]);g.useEffect(()=>(window.addEventListener("pagehide",Xu),()=>{window.removeEventListener("pagehide",Xu)}),[Xu]),g.useEffect(()=>{if(!ge){Za(),_r.current=[],ds([]),f0([]),Kr(""),us(""),Sr.current=null;return}let M=[],U="";try{M=Kje(localStorage,ge),localStorage.getItem(NE(ge))!==null&&ID(localStorage,ge,M),U=localStorage.getItem(g_(ge))||"",us("")}catch(re){us(re instanceof Error?re.message:"无法读取本机草稿,请稍后重试。")}_r.current=M,ds(M),f0(LMe(ge));const Y=M.find(re=>re.id===U);Sr.current=Y??null,No==="custom"&&Y&&(Kr(Y.id),fe(Y.draft),ya(Y.deploymentTarget??null))},[Za,ge]),g.useEffect(()=>{if(!ge)return;const M=g_(ge);try{No==="custom"&&Ys?localStorage.setItem(M,Ys):localStorage.removeItem(M)}catch{us("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[No,Ys,ge]);const zG=g.useCallback(M=>{if(!ge)return;const U=[...new Set(M.filter(Boolean))];f0(U),localStorage.setItem(lT(ge),JSON.stringify(U))},[ge]),VG=g.useCallback(async M=>{const U=M.filter(Xe=>!!Xe.runtimeId&&Xe.canDelete===!0);if(U.length===0)return;const Y=QMe(Xa,n),re=new Set(U.map(Xe=>Xe.runtimeId));EC(Xe=>{const ct=new Set(Xe);for(const Ze of re)ct.add(Ze);return ct}),pb(re);const xe=new Set,ke=new Set,ze=new Set,nt=[];for(const Xe of U)try{if(!Xe.region)throw new Error("Runtime 缺少地域信息,无法删除");await D8(Xe.runtimeId,Xe.region),O1(Xe.runtimeId),xe.add(Xe.runtimeId),ke.add(Xe.id)}catch(ct){const Ze=ct instanceof Error?ct.message:String(ct);ze.add(Xe.runtimeId),nt.push(`${Xe.label}: ${Ze}`)}if(xe.size>0&&(pb(xe),jh(Ia()),m0(ct=>{if(!ct)return ct;const Ze=new Set(ct);for(const Ke of xe)Ze.delete(Ke);return Ze}),xC(ct=>Object.fromEntries(Object.entries(ct).filter(([Ze])=>!xe.has(Ze)))),f0(ct=>{const Ze=ct.filter(Ke=>!ke.has(Ke));return ge&&localStorage.setItem(lT(ge),JSON.stringify(Ze)),Ze}),Qa(_r.current.filter(ct=>{var Ze;return!((Ze=ct.deploymentTarget)!=null&&Ze.runtimeId)||!xe.has(ct.deploymentTarget.runtimeId)})),(Y?xe.has(Y):U.some(ct=>ct.id===n))&&(uK(),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Ki(""),Mi(""),Es(!0),je("")),Sn!=null&&Sn.runtime&&xe.has(Sn.runtime.runtimeId)&&(Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Ki(""),Mi(""),Es(!0),je(""))),ze.size>0&&EC(Xe=>{const ct=new Set(Xe);for(const Ze of ze)ct.delete(Ze);return ct}),nt.length>0){const Xe=nt.slice(0,3).join(";"),ct=nt.length>3?`;另有 ${nt.length-3} 个失败`:"";throw new Error(`${nt.length} 个 Agent 删除失败:${Xe}${ct}`)}},[Sn,n,Qa,Xa,ge]),HE=g.useCallback(async()=>{gC(!0),bC("");try{const M=[];let U="";do{const Y=await Tx({scope:wn,region:"all",pageSize:100,nextToken:U});M.push(...Y.runtimes),U=Y.nextToken}while(U&&M.length<2e3);m0(new Set(M.map(Y=>Y.runtimeId))),xC(Object.fromEntries(M.map(Y=>[Y.runtimeId,{canDelete:Y.canDelete}])))}catch(M){bC(M instanceof Error?M.message:String(M))}finally{gC(!1)}},[wn]);function x0(M){console.log("create agent draft:",M),Bt(null),yl()}function zE(M,U){console.log("Agent added, navigating to:",M,U),jh(Ia()),m0(null),pb(),$E(Ys),Kr(""),Sr.current=null,ya(null),Ki(""),Mi(M),h0("basic"),Bt(null),_n(!0),s(M)}const VE=g.useCallback(M=>{Bt(null),H(!1),Es(!1),rr(null),_n(!0),Mi(""),h0("basic"),Ki(M.id),je("")},[]),NC=g.useCallback(M=>{Ys&&Th(U=>({...U,[Ys]:M.id})),VE(M)},[Ys,VE]),TC=g.useCallback(async M=>{if(!M.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const U=(Yu==null?void 0:Yu.region)??g0,Y=await dy(M.runtimeId,M.agentName,M.region??U,M.version);jh(Ia()),bs(xe=>xe+1);const re=await m_(Y);Ge.current.set(Y,re),We(re),m0(xe=>{const ke=new Set(xe??[]);return ke.add(M.runtimeId),ke}),pb(),ya(null),$E(Ys),Th(xe=>{if(!Ys||!xe[Ys])return xe;const ke={...xe};return delete ke[Ys],ke}),Kr(""),Sr.current=null,Mi(Y),h0("basic"),Bt(null),_n(!0),s(Y)},[Ys,g0,$E,Yu]),Rh=g.useRef(null),GE=g.useRef(new Map),Sc=g.useRef(!0),bl=g.useRef(!1),Nc=g.useRef(null),kC=g.useRef({key:"",turnCount:0}),KE=(p==null?void 0:p.id)??a;g.useLayoutEffect(()=>{const M=Rh.current,U=kC.current,Y=U.key!==KE,re=!Y&&xt.length>U.turnCount;if(kC.current={key:KE,turnCount:xt.length},!M||xt.length===0||!Y&&!re)return;Sc.current=!0,bl.current=!1,Nc.current!==null&&(window.clearTimeout(Nc.current),Nc.current=null);const xe=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(Y||xe){M.scrollTop=M.scrollHeight;return}bl.current=!0,M.scrollTo({top:M.scrollHeight,behavior:"smooth"}),Nc.current=window.setTimeout(()=>{bl.current=!1,Nc.current=null},450)},[KE,xt.length]),g.useLayoutEffect(()=>{const M=Rh.current;!M||!Sc.current||bl.current||(M.scrollTop=M.scrollHeight)},[Wa,xt]),g.useEffect(()=>{if(!Ih||qu||xt.length===0)return;const M=GE.current.get(Ih);if(!M)return;Sc.current=!1,M.scrollIntoView({behavior:"smooth",block:"center"});const U=window.setTimeout(()=>{p0("")},2600);return()=>window.clearTimeout(U)},[Ih,qu,xt]),g.useEffect(()=>()=>{Nc.current!==null&&window.clearTimeout(Nc.current)},[]);const GG=g.useCallback(()=>{const M=Rh.current;!M||bl.current||(Sc.current=M.scrollHeight-M.scrollTop-M.clientHeight<32)},[]),KG=g.useCallback(M=>{M.deltaY<0&&(bl.current=!1,Sc.current=!1)},[]),qG=g.useCallback(()=>{bl.current=!1,Sc.current=!1},[]),YG=g.useCallback(()=>{const M=Rh.current;!M||!Sc.current||bl.current||(M.scrollTop=M.scrollHeight)},[]),qE=g.useCallback(()=>{Se(null),OS().then(M=>{st(M.userId),bn(M.info),ai(!!M.local),ie(M.status),M.status==="authenticated"&&(y0.current=!0,Wu.current=!0,localStorage.removeItem(Na.app),s(""),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),Es(!1))}).catch(M=>{Se(M instanceof Error?M.message:String(M))})},[]);g.useEffect(()=>{qE()},[qE]),g.useEffect(()=>{const M=()=>{Vr(""),Pn(!0)};return window.addEventListener(MS,M),kte()&&M(),()=>window.removeEventListener(MS,M)},[]);const WG=g.useCallback(async()=>{if(Gr.current)return;Gr.current=!0;const M=Ete();if(!M){Gr.current=!1,Vr("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}en(!0),Vr("");try{for(;;){await new Promise(U=>window.setTimeout(U,1e3));try{const U=await OS();if(U.status==="authenticated"){st(U.userId),bn(U.info),ai(!!U.local),ie(U.status),Pn(!1),Ate(),M.close();return}}catch{}if(M.closed){Vr("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{Gr.current=!1,en(!1)}},[]);g.useEffect(()=>{vo&&ge&&zR(ge)},[vo,ge]),g.useEffect(()=>{if(qs!=="authenticated"||!ge||!n){We({});return}const M=Ge.current.get(n);if(M){We(M);return}let U=!1;return We({}),m_(n).then(Y=>{U||(Ge.current.set(n,Y),We(Y))}),()=>{U=!0}},[n,qs,ge]),g.useEffect(()=>{if(qs!=="authenticated"||!ge){qt(null);return}let M=!1;return qt(null),j8().then(U=>{M||qt(U)}).catch(U=>{console.warn("[app] /web/access failed; using ordinary-user access:",U),M||qt(I8)}),()=>{M=!0}},[qs,ge]),g.useEffect(()=>{C8().then(M=>{mTe(M.telemetry),bTe({agentsSource:M.agentsSource}),sr(M.features),wr(M.agentsSource),Ps(M.provider),ir(M.branding),Sh(M.version),Zg(!0)})},[]),g.useEffect(()=>{qs!=="authenticated"||!on||!St||gTe({userId:St.telemetry.userId,role:St.role,local:vo})},[St,qs,vo,on]),g.useEffect(()=>{b0(M=>{const U=Ti(Dt);return!M||Dt==="byteplus"&&M.startsWith("cn-")||Dt==="volcengine"&&M.startsWith("ap-")?U:M})},[Dt]),g.useEffect(()=>{St&&(St.capabilities.createAgents||(Bt(null),fe(null),As(!1),H(!1),u0([])),St.capabilities.manageAgents||_n(!1))},[St]),g.useEffect(()=>{qs!=="authenticated"||zi!=="cloud"||!Qg||!qu||Sn||HE()},[Sn,zi,qs,qu,HE,Qg]),g.useEffect(()=>{document.title=Qn.title;let M=document.querySelector('link[rel~="icon"]');M||(M=document.createElement("link"),M.rel="icon",document.head.appendChild(M)),M.removeAttribute("type"),M.href=Qn.logoUrl||(Dt==="byteplus"?m2:p2)},[Dt,Qn]),g.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(M=>M.ok?M.json():null).then(M=>{M&&d0(!!M.credentials)}).catch(M=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",M)})},[]);function XG(M){zR(M),y0.current=!0,Wu.current=!0,localStorage.removeItem(Na.app),qt(null),Bt(null),fe(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),yl(),s(""),Es(!1),st(M),bn({name:M}),ai(!0),ie("authenticated")}function QG(){qt(null),vo?(yte(),st(""),bn(void 0),ie("unauthenticated")):wte()}g.useEffect(()=>{if(qs==="authenticated"){if(zi==="cloud"){const M=QD(Xa);s(U=>U&&M.includes(U)?U:(U&&(Wu.current=!0,localStorage.removeItem(Na.app)),""));return}t8().then(M=>{t(M);const U=QD(Xa);s(Y=>Y&&(M.includes(Y)||U.includes(Y))?Y:(Y&&(Wu.current=!0,localStorage.removeItem(Na.app)),""))}).catch(M=>je(String(M)))}},[qs,zi,Xa]),g.useEffect(()=>{n?(Wu.current=!1,localStorage.setItem(Na.app,n)):localStorage.removeItem(Na.app)},[n]),g.useEffect(()=>{let M=!1;if(Kn(null),Cn([]),gl||Sn||!n||!ge||!a){Ns(!1);return}return Ns(!0),US(n,ge,a).then(U=>{M||(Kn(U),u2(n).then(Y=>{M||Cn(Y)}).catch(()=>{M||Cn([])}))}).catch(()=>{M||Kn(null)}).finally(()=>{M||Ns(!1)}),()=>{M=!0}},[Sn,n,gl,ge,a]),g.useEffect(()=>{let M=!1;if(Os(null),mn(Sa()),qs!=="authenticated"||gl||Sn||!n){Gn(!1);return}return Gn(!0),d2(n).then(U=>{M||Os(U)}).catch(()=>{M||Os(null)}).finally(()=>{M||Gn(!1)}),()=>{M=!0}},[Sn,n,Ms,qs,gl]),g.useEffect(()=>{St&&localStorage.setItem(Na.view,St.capabilities.createAgents?No??"chat":"chat")},[St,No]),g.useEffect(()=>{localStorage.setItem(Na.session,a),et.current=a},[a]),g.useEffect(()=>{const M=ZMe(Xa,n);if(!M||!ge){xs.current=()=>{},fn(Ze=>Ze.size===0?Ze:new Set);return}const{runtimeId:U,region:Y,appName:re}=M;let xe=!1,ke=0;function ze(){an.current!==void 0&&(window.clearTimeout(an.current),an.current=void 0)}function nt(Ze){ze(),an.current=window.setTimeout(()=>void Xe(),Ze)}async function Xe(){const Ze=++ke;try{const Ke=await l8({runtimeId:U,region:Y,appName:re,userId:ge});if(xe||Ze!==ke)return;const tn=new Set(Ke.items.filter(rt=>rt.state==="running").map(rt=>rt.sessionId));if(fn(rt=>rt.size===tn.size&&[...tn].every(Ws=>rt.has(Ws))?rt:tn),tn.size>0){nt(IMe);return}const ln=Ke.items.filter(rt=>rt.state==="pending").map(rt=>Date.parse(rt.dueAt)).filter(Number.isFinite);ln.length>0&&nt(Math.max(RMe,Math.min(...ln)-Date.now()))}catch{!xe&&Ze===ke&&nt(jMe)}}const ct=()=>{ze(),Xe()};return xs.current=ct,ct(),()=>{xe=!0,ke+=1,ze(),xs.current===ct&&(xs.current=()=>{})}},[n,Xa,ge]),g.useEffect(()=>()=>dn.current.forEach(M=>M.abort()),[]),g.useEffect(()=>()=>rn.current.forEach(M=>{window.clearTimeout(M)}),[]),g.useEffect(()=>()=>{var M,U;(M=Ce.current)==null||M.abort(),(U=Ve.current)==null||U.abort()},[]),g.useEffect(()=>{if(gl||Sn||p||!n||!ge)return;let M=!1;return(async()=>{const U=await E0(n);if(!M){if(!y0.current){y0.current=!0;const Y=localStorage.getItem(Na.session)||"";if(VD()===null&&Y&&U.some(re=>re.id===Y)){Oh(Y);return}}yl()}})(),()=>{M=!0}},[Sn,n,gl,p,ge]),g.useEffect(()=>{const M=UE.current;M&&M.app===n&&(UE.current=null,Oh(M.sid))},[n]);function ZG(M,U){_i(!1),M===n?Oh(U):(UE.current={app:M,sid:U},s(M))}async function E0(M){try{const U=await o2(M,ge),Y=await Promise.allSettled(U.map(ke=>{var ze;return(ze=ke.events)!=null&&ze.length?Promise.resolve(ke):o1(M,ge,ke.id)})),re=Y.find(ke=>ke.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(ke.reason)));if((re==null?void 0:re.status)==="rejected")throw re.reason;const xe=Y.flatMap(ke=>ke.status==="fulfilled"?[ke.value]:[]);return r(xe),xe}catch(U){return je(String(U)),[]}}function AC(M="codex",U=!1){p||(je(""),ue(""),he("confirm"),Le(M),ae(U),K(!0))}function JG(){var M;(M=Ce.current)==null||M.abort(),Ce.current=null,K(!1),he("confirm"),ue(""),!p&&at==="temporary"&&!Ne&&ft("agent")}async function eK(M){var Y;(Y=Ce.current)==null||Y.abort();const U=new AbortController;Ce.current=U,he("loading"),ue("");try{const re=we==="codex"?await cn.startSession({displayName:M,signal:U.signal}):await cn.startAgentSession(we,{displayName:M,signal:U.signal});if(Ce.current!==U)return;if(yTe({kind:we,source:Ne?"my_agents":"new_chat",sessionId:re.id}),Ne){_e(ke=>ke+1),K(!1),he("confirm"),Es(!0);return}if(we!=="codex")return;const xe=await cn.connectSession(re.id,{signal:U.signal});if(Ce.current!==U)return;et.current="",l(""),h([]),Pt(""),mn(Sa()),ft("temporary"),Vu(),sn(!1),Nh(zt),ot([]),lt(),v([]),m(xe),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Es(!1),Pe(null),Ye(null),K(!1),he("confirm")}catch(re){if((re==null?void 0:re.name)==="AbortError"||Ce.current!==U)return;xTe({kind:we,source:Ne?"my_agents":"new_chat",error:re}),ue(re instanceof Error?re.message:String(re)),he("error")}finally{Ce.current===U&&(Ce.current=null)}}async function YE(M,U="my_agents"){je("");const Y=Date.now();try{if(M.toolName==="codex"){const xe=await cn.connectSession(M.id);mb({kind:M.toolName,source:U,durationMs:Date.now()-Y,sandboxStatus:xe.status}),et.current="",l(""),h([]),Pt(""),mn(Sa()),lt(),v([]),m(xe),Pe(null),Ye(null),Es(!1),_n(!1);return}const re=await cn.openAgentSession(M.toolName,M.id);mb({kind:M.toolName,source:U,durationMs:Date.now()-Y,sandboxStatus:re.session.status}),Ye(re),Pe(null),Es(!1),_n(!1)}catch(re){throw Vw({kind:M.toolName,source:U,durationMs:Date.now()-Y,error:re}),je(re instanceof Error?re.message:String(re)),re}}function tK(M){Pe(M),Ye(null),Es(!1),_n(!1),je("")}async function nK(M){(p==null?void 0:p.id)===M.id&&To(),M.toolName==="codex"?await cn.deleteSession(M.id):await cn.deleteAgentSession(M.toolName,M.id),Pe(null),Ye(null),_e(U=>U+1),Es(!0)}function To(){var U;(U=Ve.current)==null||U.abort(),Ve.current=null,Ue.current="",W.current="",x(!1),lt(),v([]),ot([]),Pt(""),je(""),ft("agent"),w(!1),_(""),k(!1),j(!1),B(null),L(null),C(!1),D(""),O(null),se(!1),Q(""),V(!1),oe.current+=1;const M=p;m(null),M&&cn.closeSession(M.id).catch(Y=>je(String(Y)))}async function WE(M){const U=p;if(U){B(M),L(null),D(""),C(!0);try{const Y=M==="terminal"?await cn.launchTerminal(U.id):await cn.launchBrowser(U.id);L(Y)}catch(Y){D(Y instanceof Error?Y.message:String(Y))}finally{C(!1)}}}async function sK(M){const U=p;if(!(!U||E)){w(!0),_("");try{const Y=await cn.updatePermissions(U.id,M);m(re=>(re==null?void 0:re.id)===U.id?{...re,permissions:Y}:re),En(U.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:KMe[Y.sandboxMode]},{label:"审批策略",value:qMe[Y.approvalPolicy]},{label:"审批方式",value:YMe[Y.approvalsReviewer]},{label:"网络访问",value:Y.networkAccess?"允许":"关闭"}]),Ue.current===U.id&&k(!1)}catch(Y){_(Y instanceof Error?Y.message:String(Y))}finally{w(!1)}}}const iK=g.useCallback(async M=>{const U=p==null?void 0:p.id;if(!U)throw new Error("当前没有已连接的 Sandbox。");return cn.listDirectories(U,M)},[p==null?void 0:p.id]);async function rK(M){const U=p;if(!(!U||U.workspaceLocked||E)){w(!0),_("");try{const Y=await cn.updateWorkspace(U.id,M);m(re=>(re==null?void 0:re.id)===U.id?{...re,cwd:Y}:re),Zn.invalidateSkills(),En(U.id,"已更新工作空间",[{label:"工作目录",value:Y,code:!0}]),Ue.current===U.id&&j(!1)}catch(Y){_(Y instanceof Error?Y.message:String(Y))}finally{w(!1)}}}async function aK(M){const U=p,Y=$;if(!(!U||!Y||te)){se(!0),Q("");try{await cn.resolveApproval(U.id,Y.id,M),En(U.id,WMe(Y,M),XMe(Y),W.current),O(re=>(re==null?void 0:re.id)===Y.id?null:re)}catch(re){Q(re instanceof Error?re.message:String(re))}finally{se(!1)}}}async function oK(M){const U=p;if(!U||ee)return;const Y=++oe.current;je(""),V(!0);const re=Array.from(M).map(xe=>{const ke={id:WD(),mimeType:XD(xe),name:xe.name,sizeBytes:xe.size,status:"uploading",previewUrl:Ee(xe)};return{file:xe,attachment:ke}});ot(xe=>[...xe,...re.map(({attachment:ke})=>ke)]);try{const ke=(await Promise.all(re.map(async({file:ze,attachment:nt})=>{try{const Xe=await cn.uploadFile(U.id,ze);return oe.current!==Y?null:(ot(ct=>ct.map(Ze=>Ze.id===nt.id?{...Ze,id:Xe.id,uri:Xe.path,name:Xe.name,mimeType:Xe.mimeType,sizeBytes:Xe.sizeBytes,status:"ready"}:Ze)),Xe)}catch(Xe){if(oe.current!==Y)return null;const ct=Xe instanceof Error?Xe.message:String(Xe);return ot(Ze=>Ze.map(Ke=>Ke.id===nt.id?{...Ke,status:"error",error:ct}:Ke)),je(ct),null}}))).filter(ze=>ze!==null);oe.current===Y&&ke.length>0&&En(U.id,ke.length===1?"已上传文件到 Sandbox":`已上传 ${ke.length} 个文件到 Sandbox`,ke.map((ze,nt)=>({label:ke.length===1?"文件":`文件 ${nt+1}`,value:ze.path,code:!0})))}finally{if(oe.current===Y)V(!1);else for(const{attachment:xe}of re)Me(xe.previewUrl)}}function lK(M){const U=zt.find(Y=>Y.id===M);U&&(Me(U.previewUrl),ot(Y=>Y.filter(re=>re.id!==M)))}async function CC(M,U=[],Y=[]){var Ws;const re=p,xe=U.filter(qe=>qe.status==="ready"&&qe.uri);if(!re||y||!M.trim()&&xe.length===0)return;je(""),O(null),Q("");const ke=Date.now(),ze=new AbortController;(Ws=Ve.current)==null||Ws.abort(),Ve.current=ze;const nt=[];Y.length>0&&nt.push({kind:"invocation",value:{skills:Y.map(({name:qe,description:Nt})=>({name:qe,description:Nt}))}}),xe.length>0&&nt.push({kind:"attachment",files:xe.map(qe=>({id:qe.id,mimeType:qe.mimeType,name:qe.name,sizeBytes:qe.sizeBytes,previewUrl:qe.previewUrl}))}),M.trim()&&nt.push({kind:"text",text:M});const Xe=xe.map(qe=>qe.uri).filter(qe=>!!qe),Ze=[Y.map(qe=>`$${qe.name}`).join(" "),M.trim()].filter(Boolean).join(" "),Ke=Xe.length>0?[Ze,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...Xe.map(qe=>`- ${qe}`)].filter(Boolean).join(` +`)),b("copied")}catch{b("error")}},z=()=>{var C;p(!1),b("idle"),u(""),f(E.current||((C=T[0])==null?void 0:C.version)||""),r("confirm")};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:e==="feature-link"?"welcome-feature-link studio-update-trigger--feature":`studio-update-trigger is-${i}`,title:i==="submitting"?"正在更新 Studio":i==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var C;i==="published"?window.location.reload():(i==="submitting"||i==="error"||(f(((C=T[0])==null?void 0:C.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(FD,{className:"studio-update-icon"}),i==="submitting"?o.jsx(Ba,{as:"span",children:"正在更新"}):i==="published"?o.jsx("span",{children:"刷新使用新版"}):i==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&i!=="idle"&&o.jsx("div",{className:"confirm-scrim",role:"presentation",children:o.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[o.jsx("div",{className:"studio-update-dialog-mark",children:o.jsx(FD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:i==="error"?"Studio 更新失败":i==="submitting"?"正在更新 Studio":i==="published"?"Studio 更新完成":"发现新版本"}),i==="error"?o.jsxs("div",{className:"studio-update-error-panel",children:[o.jsx("p",{className:"confirm-text studio-update-error",children:c}),o.jsxs("dl",{className:"studio-update-error-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"失败阶段"}),o.jsx("dd",{children:lOe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx($D,{lines:R,phase:"error",copyState:m,onCopy:()=>void B()}),n.consoleUrl&&o.jsxs("a",{className:"studio-update-console-link",href:n.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",o.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):i==="submitting"||i==="published"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"studio-update-progress-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"目标版本"}),o.jsx("strong",{children:E.current||k})]}),o.jsxs("div",{children:[o.jsx("span",{children:i==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:i==="published"?"已完成":cOe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:UD.map((C,I)=>{const D=UD.findIndex(ne=>ne.id===n.progressStage),$=i==="published"||Ivoid B()}),o.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),o.jsxs("div",{className:"studio-update-field",ref:x,children:[o.jsx("span",{children:"选择版本"}),o.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":h,onClick:()=>p(C=>!C),onKeyDown:C=>{(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),p(!0))},children:[o.jsx("span",{children:k}),o.jsx(fOe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:T.map(C=>{const I=C.version===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":I,className:`studio-update-version-option${I?" is-selected":""}`,onClick:()=>{f(C.version),p(!1)},children:[o.jsx("span",{children:C.version}),I&&o.jsx(hOe,{})]},C.version)})})]}),o.jsxs("dl",{className:"studio-update-versions",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:n.currentVersion})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"目标版本"}),o.jsx("dd",{children:k})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Commit"}),o.jsx("dd",{children:((A==null?void 0:A.gitSha)||n.latestGitSha).slice(0,8)})]})]}),o.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[o.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),A!=null&&A.changelog.length?o.jsx("ul",{children:A.changelog.map(C=>o.jsx("li",{children:C},C))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),i==="confirm"&&(r("idle"),u(""))},children:i==="submitting"?"后台运行":i==="confirm"?"取消":"关闭"}),i==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void j(),children:"立即更新"}),i==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:z,children:"重新尝试"})]})]})})]})}const mOe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function gOe({canUpdate:e=!1}){return o.jsxs("div",{className:"welcome-feature-pill",children:[o.jsx("span",{children:"焕然一新"}),o.jsx("span",{className:"welcome-feature-divider","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"welcome-feature-link","aria-describedby":"welcome-feature-popover",children:"查看新特性"}),o.jsxs("section",{id:"welcome-feature-popover",className:"welcome-feature-popover",role:"tooltip",children:[o.jsx("strong",{children:"本次更新"}),o.jsx("ul",{children:mOe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(pOe,{variant:"feature-link"})]})}const bOe=1e4;async function SG(e){const t=await fetch(jn(e),{headers:Ex({Accept:"application/json"}),signal:Pn(void 0,bOe)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function yOe(){return SG("/web/sandbox/capabilities")}async function xOe(){return SG("/web/skill-creator/capabilities")}const EOe="我的智能体";function vOe({open:e,state:t,agentKind:n="codex",error:s,onCancel:i,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?EOe:`我的 ${a}`,c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1),h=g.useRef(i),[p,m]=g.useState(l);if(h.current=i,g.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var S,_;(S=u.current)==null||S.focus(),(_=u.current)==null||_.select()}),w=S=>{var A;if(S.key==="Escape"){S.preventDefault(),h.current();return}if(S.key!=="Tab")return;const _=(A=c.current)==null?void 0:A.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(_!=null&&_.length))return;const T=_[0],k=_[_.length-1];S.shiftKey&&document.activeElement===T?(S.preventDefault(),k.focus()):!S.shiftKey&&document.activeElement===k&&(S.preventDefault(),T.focus())};return window.addEventListener("keydown",w),()=>{window.cancelAnimationFrame(E),document.body.style.overflow=x,window.removeEventListener("keydown",w)}},[l,e]),!e)return null;const b=t==="loading",v=p.trim(),y=b?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return wi.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!b&&i()},children:o.jsxs("form",{ref:c,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":t==="confirm"?void 0:"sandbox-dialog-description",onSubmit:x=>{x.preventDefault(),!b&&!f.current&&v&&r(v)},children:[o.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[o.jsx("span",{className:"sandbox-dialog-orbit"}),o.jsx("span",{className:"sandbox-dialog-icon",children:b?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Qm,{kind:n})})]}),o.jsxs("div",{className:"sandbox-dialog-copy",children:[o.jsx("h2",{id:"sandbox-dialog-title",children:y}),t==="error"?o.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:s||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):b?o.jsxs("p",{id:"sandbox-dialog-description","aria-live":"polite",children:["正在创建并等待 ",a," 智能体就绪,这通常需要半分钟"]}):null,o.jsxs("label",{className:"sandbox-dialog-field",children:[o.jsxs("span",{className:"sandbox-dialog-field-label",children:[o.jsx("span",{children:"智能体名称"}),o.jsxs("span",{"aria-hidden":"true",children:[p.length,"/",T3]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:T3,disabled:b,placeholder:l,autoComplete:"off",onChange:x=>m(x.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:x=>{const{nativeEvent:E}=x;x.key==="Enter"&&(f.current||E.isComposing||E.keyCode===229)&&x.preventDefault()}})]})]}),o.jsxs("footer",{className:"sandbox-dialog-actions",children:[o.jsx("button",{ref:d,type:"button",onClick:i,children:b?"取消创建":"取消"}),!b&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function wOe({agentName:e,onExit:t}){return o.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[o.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),o.jsxs("span",{className:"sandbox-session-warning-copy",children:["当前您在使用 ",e," 智能体"]}),o.jsx("button",{type:"button",onClick:t,children:"退出内置智能体"})]})}function _Oe({activity:e,time:t}){var n;return o.jsxs("aside",{className:"sandbox-activity-record",role:"status","aria-label":"Sandbox 操作记录",children:[o.jsxs("div",{className:"sandbox-activity-summary",children:[o.jsx("span",{className:"sandbox-activity-dot","aria-hidden":"true"}),o.jsx("span",{className:"sandbox-activity-label",children:"操作记录"}),o.jsx("strong",{children:e.title}),t?o.jsx("time",{children:t}):null]}),(n=e.details)!=null&&n.length?o.jsx("dl",{className:"sandbox-activity-details",children:e.details.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{title:s.value,children:s.code?o.jsx("code",{children:s.value}):s.value})]},`${s.label}:${s.value}`))}):null]})}function SOe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function NOe({usage:e}){const t=[["Total",e.totalTokens],["Input",e.inputTokens],...e.cachedInputTokens>0?[["Cached input",e.cachedInputTokens]]:[],["Output",e.outputTokens],...e.reasoningOutputTokens>0?[["Reasoning output",e.reasoningOutputTokens]]:[]];return o.jsx("div",{className:"sandbox-token-usage","aria-label":"Codex Token 用量",children:t.map(([n,s])=>o.jsxs("span",{title:`${n}: ${s.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:SOe(s)})]},n))})}function NG(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function TG(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function hC(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function gy(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function TOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function kOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function AOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function COe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function IOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function jOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function ROe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function aT(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function OOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function sl(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function Xg({open:e,title:t,subtitle:n,icon:s,className:i="",onClose:r,children:a}){const l=g.useId(),c=g.useRef(null),u=g.useRef(null),d=g.useRef(r);return d.current=r,g.useEffect(()=>{var p;if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const f=document.body.style.overflow;document.body.style.overflow="hidden",(p=c.current)==null||p.focus();const h=m=>{var E;if(m.key==="Escape"){m.preventDefault(),d.current();return}if(m.key!=="Tab")return;const b=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((b==null?void 0:b.querySelectorAll('button:not(:disabled), input:not(:disabled), iframe, [tabindex]:not([tabindex="-1"])'))??[]);if(v.length===0)return;const y=v[0],x=v[v.length-1];m.shiftKey&&document.activeElement===y?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{var m;document.body.style.overflow=f,window.removeEventListener("keydown",h),(m=u.current)==null||m.focus()}},[e]),e?wi.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${i}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"sandbox-control-head",children:[o.jsx("span",{className:"sandbox-control-head-icon","aria-hidden":"true",children:s}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:t}),o.jsx("p",{children:n})]}),o.jsx("button",{ref:c,type:"button",className:"sandbox-control-close","aria-label":`关闭${t}`,onClick:r,children:o.jsx(ROe,{})})]}),a]})}),document.body):null}function MOe({open:e,kind:t,launch:n,loading:s,error:i,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Xg,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(NG,{}):o.jsx(TG,{}),className:`sandbox-tool-dialog sandbox-tool-dialog--${t}`,onClose:a,children:[o.jsx("div",{className:"sandbox-tool-toolbar",children:o.jsxs("span",{children:[o.jsx("i",{className:s?"is-loading":n?"is-ready":""}),s?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(sl,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:i}),o.jsx("button",{type:"button",onClick:r,children:"重试"})]}):n?o.jsx("iframe",{src:n.url,title:c,allow:"clipboard-read; clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"}):null})]})}function LOe({open:e,threads:t,currentThreadId:n,loading:s,error:i,onSelect:r,onClose:a}){return o.jsx(Xg,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(OOe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(sl,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:i})]}):t.length===0?o.jsx("div",{className:"sandbox-control-state",children:o.jsx("strong",{children:"暂无可恢复的对话"})}):t.map(l=>{const c=l.id===n,u=l.name||l.preview||`Thread ${l.id.slice(0,8)}`;return o.jsxs("button",{type:"button",className:c?"is-active":"",disabled:c,onClick:()=>r(l.id),children:[o.jsxs("span",{children:[o.jsx("strong",{children:u}),o.jsx("small",{children:l.preview||l.cwd||l.id})]}),o.jsx("time",{children:l.updatedAt?new Date(l.updatedAt*1e3).toLocaleString():""}),o.jsx(aT,{})]},l.id)})})})}const DOe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],POe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],BOe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function UOe({open:e,value:t,busy:n,error:s,onSave:i,onClose:r}){const[a,l]=g.useState(t);return g.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Xg,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(hC,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(p_,{label:"沙箱模式",choices:DOe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(p_,{label:"审批策略",choices:POe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(p_,{label:"审批方式",choices:BOe,value:a.approvalsReviewer,disabled:n,onChange:c=>l(u=>({...u,approvalsReviewer:c}))}),o.jsxs("label",{className:`sandbox-network-toggle${a.sandboxMode==="danger-full-access"?" is-disabled":""}`,children:[o.jsxs("span",{children:[o.jsx("strong",{children:"允许网络访问"}),o.jsx("small",{children:"控制 workspace-write 与只读模式中的外部网络访问。"})]}),o.jsx("input",{type:"checkbox",checked:a.networkAccess,disabled:n||a.sandboxMode==="danger-full-access",onChange:c=>l(u=>({...u,networkAccess:c.target.checked}))})]}),a.sandboxMode==="danger-full-access"?o.jsx("div",{className:"sandbox-control-note is-danger",children:"完全访问会关闭文件系统与网络隔离,请只在可信任务中使用。"}):null,s?o.jsx("div",{className:"sandbox-control-error",children:s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:n,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:n,onClick:()=>i(a),children:[n?o.jsx(sl,{className:"spin"}):null,"保存权限"]})]})]})}function p_({label:e,choices:t,value:n,disabled:s,onChange:i}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:s,role:"radiogroup","aria-label":e,children:[o.jsx("legend",{children:e}),o.jsx("div",{className:"sandbox-choice-list",children:t.map(r=>o.jsxs("button",{type:"button",role:"radio",className:`${n===r.value?"is-active":""}${r.danger?" is-danger":""}`.trim(),"aria-checked":n===r.value,onClick:()=>i(r.value),onKeyDown:a=>{var d,f;const l=t.findIndex(h=>h.value===r.value);let c=l;if(a.key==="ArrowRight"||a.key==="ArrowDown")c=(l+1)%t.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")c=(l-1+t.length)%t.length;else if(a.key==="Home")c=0;else if(a.key==="End")c=t.length-1;else return;a.preventDefault(),i(t[c].value);const u=(d=a.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="radio"]');(f=u==null?void 0:u[c])==null||f.focus()},children:[o.jsx("i",{}),o.jsxs("span",{children:[o.jsx("strong",{children:r.label}),o.jsx("small",{children:r.detail})]})]},r.value))})]})}function FOe({open:e,cwd:t,locked:n,busy:s,error:i,browse:r,onSave:a,onClose:l}){const[c,u]=g.useState(t||"/"),[d,f]=g.useState(null),[h,p]=g.useState(!1),[m,b]=g.useState("");g.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),b("");try{const x=await r(y);f(x),u(x.path)}catch(x){b(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Xg,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(gy,{}),className:"sandbox-workspace-dialog",onClose:l,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsxs("label",{className:"sandbox-workspace-input",children:[o.jsx("span",{children:"绝对路径"}),o.jsxs("div",{children:[o.jsx("input",{value:c,disabled:s||n,spellCheck:!1,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.startsWith("/")&&(y.preventDefault(),v(c))}}),o.jsx("button",{type:"button",disabled:s||h||!c.startsWith("/"),onClick:()=>void v(c),children:"浏览"})]})]}),o.jsxs("div",{className:"sandbox-directory-browser",children:[o.jsxs("div",{className:"sandbox-directory-head",children:[o.jsx("span",{title:d==null?void 0:d.path,children:(d==null?void 0:d.path)??c}),h?o.jsx(sl,{className:"spin"}):null]}),o.jsxs("div",{className:"sandbox-directory-list",children:[d!=null&&d.parent?o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(d.parent??"/"),children:[o.jsx(gy,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(aT,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(gy,{}),o.jsx("span",{children:y.name}),o.jsx(aT,{})]},y.path)),!h&&(d==null?void 0:d.directories.length)===0?o.jsx("div",{className:"sandbox-directory-empty",children:"当前目录没有子目录"}):null]})]}),n?o.jsx("div",{className:"sandbox-control-note",children:"当前对话已经开始,工作空间已锁定。新建 Sandbox 会话后可重新选择。"}):null,m||i?o.jsx("div",{className:"sandbox-control-error",children:m||i}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:s,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:s||n||!c.startsWith("/"),onClick:()=>a(c),children:[s?o.jsx(sl,{className:"spin"}):null,"使用此目录"]})]})]})}function $Oe({approval:e,busy:t,error:n,onDecision:s}){var a;const i=(a=e==null?void 0:e.command)==null?void 0:a.trim(),r=(e==null?void 0:e.changes)===void 0?"":JSON.stringify(e.changes,null,2);return o.jsxs(Xg,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(hC,{}),className:"sandbox-approval-dialog",onClose:()=>{t||s("cancel")},children:[o.jsxs("div",{className:"sandbox-control-body",children:[e!=null&&e.reason?o.jsx("div",{className:"sandbox-approval-reason",children:e.reason}):null,i?o.jsx("pre",{children:i}):null,r?o.jsx("pre",{children:r}):null,e!=null&&e.cwd?o.jsxs("div",{className:"sandbox-approval-meta",children:["执行目录 ",o.jsx("code",{children:e.cwd})]}):null,n?o.jsx("div",{className:"sandbox-control-error",children:n}):null]}),o.jsxs("footer",{className:"sandbox-control-actions sandbox-approval-actions",children:[o.jsx("button",{type:"button",disabled:t,onClick:()=>s("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>s("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>s("acceptForSession"),children:[t?o.jsx(sl,{className:"spin"}):null,"本会话允许"]})]})]})}const HOe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function HD(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function zOe({session:e,onBack:t,onOpen:n,onDelete:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=HOe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(b){f(b instanceof Error?b.message:String(b))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await s()}catch(b){f(b instanceof Error?b.message:String(b)),r(!1)}finally{u(!1)}}};return o.jsxs("section",{className:"sandbox-agent-details",children:[o.jsxs("header",{className:"sandbox-agent-details-header",children:[o.jsxs("button",{type:"button",className:"sandbox-agent-back",onClick:t,children:[o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"返回智能体"]}),o.jsxs("div",{children:[o.jsx("h1",{children:e.displayName||`${h} 智能体`}),o.jsxs("p",{children:[h," AgentKit Session 详情"]})]})]}),d?o.jsx("div",{className:"sandbox-agent-detail-error",role:"alert",children:d}):null,o.jsxs("div",{className:"sandbox-agent-detail-panel",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"智能体类型"}),o.jsx("dd",{children:h})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:iE(e.status)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建人"}),o.jsx("dd",{children:e.createdBy||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具类型"}),o.jsx("dd",{children:e.toolType||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:HD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:HD(e.expireAt)})]}),o.jsxs("div",{className:"is-wide",children:[o.jsx("dt",{children:"Session ID"}),o.jsx("dd",{children:e.id})]})]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"sandbox-agent-delete",disabled:a||c,onClick:()=>r(!0),children:"删除智能体"}),o.jsx("button",{type:"button",className:"sandbox-agent-open",disabled:a||c,"aria-busy":a||void 0,onClick:()=>void p(),children:a?"打开中…":"打开智能体"})]})]}),i?o.jsx("div",{className:"confirm-scrim",onClick:()=>!c&&r(!1),children:o.jsxs("div",{className:"confirm-box",role:"alertdialog","aria-modal":"true","aria-labelledby":"sandbox-agent-delete-title",onClick:b=>b.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"sandbox-agent-delete-title",children:"删除智能体?"}),o.jsxs("div",{className:"confirm-text",children:["将删除“",e.displayName||`${h} 智能体`,"”及其 AgentKit Session,此操作无法撤销。"]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",disabled:c,onClick:()=>r(!1),children:"取消"}),o.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",disabled:c,onClick:()=>void m(),children:c?"删除中…":"确认删除"})]})]})}):null]})}const VOe="_SegmentedControl_1sl7d_1",GOe="_SegmentedControlOption_1sl7d_140",KOe="_SegmentedControlThumb_1sl7d_219",oT={SegmentedControl:VOe,SegmentedControlOption:GOe,SegmentedControlThumb:KOe},by=({value:e,onChange:t,children:n,block:s,pill:i=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=g.useRef(null),f=g.useRef(null),h=g.useCallback(m=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let E=Math.floor(y.clientWidth);const w=y.offsetLeft;if(x-(E+w)<2&&(E=E-1),v.style.width=`${Math.floor(E)}px`,v.style.transform=`translateX(${w}px)`,b.scrollWidth>x){const S=x*.15,_=b.scrollLeft,T=y.offsetLeft,k=T+E;(T<_+S||k>_+x-S)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);ISe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const b=m.style.transition;m.style.transition="",h(!1),m.style.transition=b}}),g.useLayoutEffect(()=>{const m=d.current,b=f.current;!m||!b||(h(!!b.style.transition),b.style.transition||MN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,i]);const p=m=>{m&&t&&t(m)};return o.jsxs(mIe,{ref:d,className:ba(oT.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":s?"":void 0,"data-pill":i?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:oT.SegmentedControlThumb,ref:f}),n]})},qOe=({children:e,...t})=>o.jsx(EIe,{className:oT.SegmentedControlOption,...t,onPointerEnter:yH,children:o.jsx("span",{className:"relative",children:e})});by.Option=qOe;function YOe({workspace:e,onBack:t}){const[n,s]=g.useState("main"),[i,r]=g.useState(""),[a,l]=g.useState(!1),[c,u]=g.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";g.useEffect(()=>{s("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(s("terminal"),!(i||a)){l(!0),u("");try{const h=await un.launchAgentTerminal(e.kind,e.session.id);r(h.url)}catch(h){u(h instanceof Error?h.message:String(h))}finally{l(!1)}}};return o.jsxs("section",{className:"sandbox-agent-workspace",children:[o.jsxs("header",{children:[o.jsxs("div",{className:"sandbox-agent-workspace-title",children:[o.jsx("button",{type:"button",onClick:t,"aria-label":"返回智能体列表",children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.session.displayName||`${d} 智能体`}),o.jsxs("p",{children:[o.jsxs("span",{children:["创建人 ",e.session.createdBy||"未知"]}),o.jsx("span",{className:"sandbox-agent-workspace-status","data-ready":e.session.status.toLowerCase()==="ready"||void 0,children:iE(e.session.status)})]})]})]}),o.jsxs(by,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():s("main")},children:[o.jsx(by.Option,{value:"main",children:"主界面"}),o.jsx(by.Option,{value:"terminal",children:"终端"})]})]}),o.jsx("div",{className:"sandbox-agent-workspace-surface",children:n==="main"?o.jsx("iframe",{src:e.webuiUrl,title:`${d} 主界面`,allow:"clipboard-read; clipboard-write"}):a?o.jsx("div",{className:"sandbox-agent-workspace-state",role:"status",children:"正在打开终端…"}):c?o.jsxs("div",{className:"sandbox-agent-workspace-state is-error",role:"alert",children:[o.jsx("p",{children:c}),o.jsx("button",{type:"button",onClick:()=>void f(),children:"重新尝试"})]}):i?o.jsx("iframe",{src:i,title:`${d} 终端`}):null})]})}const AE=[{name:"model",usage:"/model [model]",description:"显示或切换当前对话模型",keywords:["模型","switch"]},{name:"models",usage:"/models",description:"列出 app-server 可用模型",keywords:["模型列表","list"]},{name:"skill",usage:"/skill",description:"浏览并调用当前工作区可用的 Skill",keywords:["技能","workflow"]},{name:"skills",usage:"/skills",description:"浏览并调用当前工作区可用的 Skills",keywords:["技能列表","workflow","list"]},{name:"new",usage:"/new",description:"开始一个新对话",keywords:["新建","对话"]},{name:"resume",usage:"/resume [thread]",description:"打开历史会话或恢复指定 thread",keywords:["历史","恢复","session"]},{name:"fork",usage:"/fork",description:"从当前上下文分叉一个新对话",keywords:["分叉","branch"]},{name:"compact",usage:"/compact",description:"压缩当前对话上下文",keywords:["压缩","上下文"]},{name:"archive",usage:"/archive",description:"归档当前对话并新建对话",keywords:["归档","关闭"]},{name:"status",usage:"/status",description:"显示当前连接、thread、模型与 token 状态",keywords:["状态","连接","token"]},{name:"clear",usage:"/clear",description:"清空当前视图并开始新对话",keywords:["清空","重置"]},{name:"help",usage:"/help",description:"显示 Sandbox 支持的快捷命令",keywords:["帮助","命令"]}];function WOe(e){var n;const t=e.trim().match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(t)return{name:t[1].toLocaleLowerCase(),argument:((n=t[2])==null?void 0:n.trim())??""}}function XOe(e){const t=e.toLocaleLowerCase();return AE.filter(n=>!t||[n.name,n.description,...n.keywords].some(s=>s.toLocaleLowerCase().includes(t))).sort((n,s)=>zD(n,t)-zD(s,t)).slice(0,12)}function zD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:AE.indexOf(e)}function QOe(e,t){const n=t.toLocaleLowerCase();return e.filter(s=>!n||`${s.id} ${s.displayName} ${s.description}`.toLocaleLowerCase().includes(n)).sort((s,i)=>{if(!n)return Number(i.isDefault)-Number(s.isDefault);const r=s.id.toLocaleLowerCase(),a=i.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,s.displayName)-l(a,i.displayName)}).slice(0,12)}function ZOe(){return AE.map(e=>({label:e.usage,value:e.description}))}function JOe(e,t){return e.map(n=>{const s=n.displayName.trim(),i=s&&s!==n.id?`${s} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${i} — ${n.description}`:i,code:!1}})}function eMe(e){const t=[{label:"Thread",value:e.threadId,code:!0},{label:"工作空间",value:e.cwd||"未设置",code:!!e.cwd}];return e.model&&t.push({label:"模型",value:e.model,code:!0}),t.push({label:"状态",value:e.busy?"运行中":"空闲"}),e.threadTotal&&t.push({label:"累计 Token",value:e.threadTotal.totalTokens.toLocaleString()}),e.modelContextWindow!==void 0&&t.push({label:"上下文窗口",value:e.modelContextWindow.toLocaleString()}),t}function tMe(e){return e.messages.map(t=>{var s;const n=[];return t.role==="user"&&((s=t.skillNames)!=null&&s.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(i=>({name:i,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function nMe({appName:e,value:t,onChange:n,onSubmit:s,disabled:i,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:b,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const S=g.useRef(null),_=g.useRef(null),T=g.useRef(null),k=g.useRef(null),[A,j]=g.useState(!1),[R,B]=g.useState(0),[z,L]=g.useState(!1);g.useLayoutEffect(()=>{const V=S.current;V&&(V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,200)}px`)},[t]);const F=g.useMemo(()=>{if(!t.startsWith("/")||t.includes(` +`))return;const V=t.slice(1),Q=V.search(/\s/),K=(Q<0?V:V.slice(0,Q)).toLocaleLowerCase(),ce=Q<0?"":V.slice(Q).trim();if(!(Q>=0&&K!=="model"))return{command:K,argument:ce,modelMode:Q>=0}},[t]),C=g.useMemo(()=>{const V=/(^|\s)\$([^\s$]*)$/.exec(t);if(V)return{query:V[2],start:t.length-V[2].length-1,end:t.length}},[t]),I=g.useMemo(()=>{if(C){const V=C.query.toLocaleLowerCase();return b.filter(Q=>!x.some(K=>K.id===Q.id||K.name===Q.name)).filter(Q=>`${Q.name} ${Q.description}`.toLocaleLowerCase().includes(V)).slice(0,12).map(Q=>({kind:"skill",skill:Q}))}return F!=null&&F.modelMode?QOe(d,F.argument).map(V=>({kind:"model",model:V})):F?XOe(F.command).map(V=>({kind:"command",command:V})):[]},[C,d,x,b,F]),D=!z&&!!(C||F);g.useEffect(()=>{B(0)},[t]),g.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),g.useEffect(()=>{C&&!y&&!v&&E()},[C,E,y,v]);const $=a.some(V=>V.status!=="ready"),O=!i&&!r&&!$&&(t.trim().length>0||a.length>0);function ne(V){L(!1),j(!1),n(V)}function se(V){if(V.kind==="skill"){if(!C)return;const Q=t.slice(0,C.start)+t.slice(C.end);w([...x,V.skill]),ne(Q),L(!0),requestAnimationFrame(()=>{var K,ce;(K=S.current)==null||K.focus(),(ce=S.current)==null||ce.setSelectionRange(C.start,C.start)});return}if(V.kind==="model"){ne(`/model ${V.model.id}`),L(!0),requestAnimationFrame(()=>{var Q;return(Q=S.current)==null?void 0:Q.focus()});return}if(V.command.name==="model"){ne("/model "),m(),requestAnimationFrame(()=>{var Q;return(Q=S.current)==null?void 0:Q.focus()});return}if(V.command.name==="skill"||V.command.name==="skills"){ne(`/${V.command.name}`),L(!0),requestAnimationFrame(()=>{var Q;return(Q=S.current)==null?void 0:Q.focus()});return}ne(`/${V.command.name}`),L(!0),requestAnimationFrame(()=>{var Q;return(Q=S.current)==null?void 0:Q.focus()})}function P(V){var Q;j(!1),(Q=V.current)==null||Q.click()}function Z(V){const Q=V.target.files?Array.from(V.target.files):[];Q.length&&l(Q),V.target.value=""}const te=C?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx(oE,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[D?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":te,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx(jOe,{}),o.jsx("span",{children:te}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:C?"$":"/"})]}),C&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(sl,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(sl,{className:"spin"})," 正在读取模型…"]}):I.length===0?o.jsx("div",{className:"composer-command-empty",children:C?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:I.map((V,Q)=>{const K=V.kind==="command"?`command:${V.command.name}`:V.kind==="model"?`model:${V.model.id}`:`skill:${V.skill.id}`,ce=V.kind==="command"?V.command.usage:V.kind==="model"?V.model.displayName:`$${V.skill.name}`,he=V.kind==="command"?V.command.description:V.kind==="model"?V.model.description||V.model.id:V.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":Q===R,className:`composer-command-item${Q===R?" is-active":""}`,onMouseDown:ge=>{ge.preventDefault(),se(V)},onMouseEnter:()=>B(Q),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${V.kind}`,"aria-hidden":"true",children:V.kind==="command"?"/":V.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ce}),o.jsx("span",{children:he})]}),Q===R?o.jsx("kbd",{children:"↵"}):null]},K)})})]}):null,o.jsxs("div",{className:"composer-left-controls",children:[o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:i,onClick:()=>j(V=>!V),children:o.jsx(TOe,{className:"icon"})}),A?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>j(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(_),children:[o.jsx(AOe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(T),children:[o.jsx(COe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>P(k),children:[o.jsx(IOe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{j(!1),u.onOpenTerminal()},children:[o.jsx(NG,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{j(!1),u.onOpenBrowser()},children:[o.jsx(TG,{className:"icon"}),"查看浏览器"]})]})]}):null]}),o.jsx("button",{type:"button",className:"comp-icon sandbox-composer-control",title:"Codex 权限","aria-label":"Codex 权限",disabled:u.settingsBusy||r,onClick:u.onOpenPermissions,children:o.jsx(hC,{})}),o.jsx("button",{type:"button",className:`comp-icon sandbox-composer-control${u.workspaceLocked?" is-locked":""}`,title:u.workspaceLocked?"对话已开始,工作空间已锁定":"选择工作空间","aria-label":"Codex 工作空间",disabled:u.settingsBusy||r,onClick:u.onOpenWorkspace,children:o.jsx(gy,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(aE,{skillPrefix:"$",value:{skills:x.map(({name:V,description:Q})=>({name:V,description:Q}))},onRemoveSkill:V=>w(x.filter(Q=>Q.name!==V))}):null,o.jsx("textarea",{ref:S,className:"comp-input scroll",rows:1,value:t,disabled:i,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":D,onChange:V=>ne(V.target.value),onBlur:()=>window.setTimeout(()=>L(!0),0),onKeyDown:V=>{if(!AA(V.nativeEvent)){if(D){if((V.key==="ArrowDown"||V.key==="Tab"&&!V.shiftKey)&&I.length>0){V.preventDefault(),B(Q=>(Q+1)%I.length);return}if((V.key==="ArrowUp"||V.key==="Tab"&&V.shiftKey)&&I.length>0){V.preventDefault(),B(Q=>(Q-1+I.length)%I.length);return}if(V.key==="Enter"&&!V.shiftKey&&I[R]){V.preventDefault(),se(I[R]);return}if(V.key==="Escape"){V.preventDefault(),L(!0);return}}if(V.key==="Backspace"&&!t&&V.currentTarget.selectionStart===0&&x.length>0){V.preventDefault(),w(x.slice(0,-1));return}V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),O&&s(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!O,onClick:()=>s(t),"aria-label":"发送",children:r?o.jsx(sl,{className:"icon spin"}):o.jsx(kOe,{className:"icon"})})]}),o.jsx("input",{ref:_,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:Z}),o.jsx("input",{ref:T,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:Z}),o.jsx("input",{ref:k,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:Z})]})}function sMe({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:s,onSnapshot:i,onActivity:r,onError:a}){const l=g.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=g.useState(!1),[d,f]=g.useState([]),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState([]),[x,E]=g.useState(!1),[w,S]=g.useState(!1),[_,T]=g.useState([]),[k,A]=g.useState(!1),[j,R]=g.useState([]),[B,z]=g.useState(!1),[L,F]=g.useState("");g.useEffect(()=>{u(!1),f([]),p(!1),b(!1),y([]),E(!1),S(!1),T([]),A(!1),R([]),z(!1),F("")},[e==null?void 0:e.id]);const C=g.useCallback(async()=>{const P=l.current;if(!P)return[];p(!0);try{const Z=await un.listModels(P);return l.current===P&&(f(Z),b(!0)),Z}catch(Z){return l.current===P&&(b(!0),a(Z instanceof Error?Z.message:String(Z))),[]}finally{l.current===P&&p(!1)}},[a]),I=g.useCallback(async()=>{const P=l.current;if(!P)return[];E(!0);try{const Z=await un.listSkills(P);return l.current===P&&(y(Z),S(!0)),Z}catch(Z){return l.current===P&&(S(!0),a(Z instanceof Error?Z.message:String(Z))),[]}finally{l.current===P&&E(!1)}},[a]),D=g.useCallback(async()=>{const P=l.current;if(P){A(!0),z(!0),F("");try{const Z=await un.listThreads(P);l.current===P&&R(Z.threads)}catch(Z){l.current===P&&F(Z instanceof Error?Z.message:String(Z))}finally{l.current===P&&z(!1)}}},[]);function $(P){i(P),T([]),y([]),S(!1),A(!1)}async function O(P){const Z=l.current;if(!(!Z||c||t)){if(P===(e==null?void 0:e.threadId)){A(!1);return}u(!0),a("");try{const te=await un.resumeThread(Z,P);if(l.current!==Z)return;$(te),r("已恢复 Codex 对话",[{label:"Thread",value:te.threadId,code:!0}])}catch(te){l.current===Z&&a(te instanceof Error?te.message:String(te))}finally{l.current===Z&&u(!1)}}}async function ne(P){const Z=e,te=P.trim();if(!te.startsWith("/"))return!1;if(!Z||t||c)return!0;const V=WOe(te),Q=V&&AE.find(K=>K.name===V.name);if(!V||!Q)return a(`未知快捷命令:${te.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),T([]),Q.name==="model"&&!V.argument)return n("/model "),m||await C(),!0;if(Q.name==="skill"||Q.name==="skills")return n("$"),w||(await I()).length===0&&n(""),!0;if(Q.name==="resume"&&!V.argument)return n(""),await D(),!0;n(""),u(!0);try{if(Q.name==="model"){const K=await un.setModel(Z.id,V.argument);if(l.current!==Z.id)return!0;s({model:K}),r("已切换 Codex 模型",[{label:"模型",value:K,code:!0}])}else if(Q.name==="models"){const K=m?d:await C();if(l.current!==Z.id)return!0;r(K.length>0?"Codex 可用模型":"当前没有可用模型",JOe(K,Z.model))}else if(Q.name==="new"||Q.name==="clear"){const K=await un.newThread(Z.id);if(l.current!==Z.id)return!0;$(K),r("已新建 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(Q.name==="resume"){const K=await un.resumeThread(Z.id,V.argument);if(l.current!==Z.id)return!0;$(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(Q.name==="fork"){const K=await un.forkThread(Z.id);if(l.current!==Z.id)return!0;$(K),r("已分叉 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(Q.name==="compact"){if(await un.compactThread(Z.id),l.current!==Z.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:Z.threadId,code:!0}])}else if(Q.name==="archive"){const K=Z.threadId,ce=await un.archiveThread(Z.id,K);if(l.current!==Z.id)return!0;ce.snapshot&&$(ce.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:K,code:!0}])}else if(Q.name==="status"){const K=await un.getStatus(Z.id);if(l.current!==Z.id)return!0;s(K),r("Codex 当前状态",eMe(K))}else Q.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",ZOe())}catch(K){l.current===Z.id&&(n(te),a(K instanceof Error?K.message:String(K)))}finally{l.current===Z.id&&u(!1)}return!0}function se(){y([]),S(!1),T([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:C,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:I,selectedSkills:_,setSelectedSkills:T,invalidateSkills:se,threadsOpen:k,threads:j,threadsLoading:B,threadsError:L,openThreads:D,closeThreads:()=>{c||(A(!1),F(""))},resumeThread:O,executeSlash:ne}}const iMe={volcengine:"火山引擎 AgentKit 提供企业级 Agent 解决方案",byteplus:"BytePlus AgentKit 提供企业级 Agent 解决方案"},rMe={volcengine:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",byteplus:"https://docs.byteplus.com/en/docs/legal"};function aMe(e){return e.toLowerCase()==="github"?o.jsx(Hee,{className:"icon"}):o.jsx(qee,{className:"icon"})}function oMe({branding:e,cloudProvider:t,onUsername:n}){const[s,i]=g.useState(null),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(""),f=g.useRef(null);g.useEffect(()=>{let v=!0;return i(null),a(""),KB().then(y=>{v&&i(y)}).catch(y=>{v&&a(y instanceof Error?y.message:String(y))}),()=>{v=!1}},[l]);const h=s!==null&&s.length===0;g.useEffect(()=>{var v;h&&((v=f.current)==null||v.focus())},[h]);const p=bte.test(u),m=t==="byteplus"?m2:p2,b=()=>{p&&n(u)};return o.jsxs("div",{className:"login",children:[o.jsx("header",{className:"login-top",children:o.jsxs("span",{className:"login-brand",children:[o.jsx("img",{className:"login-brand-logo",src:e.logoUrl||m,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),o.jsx("main",{className:"login-main",children:o.jsxs("div",{className:"login-card",children:[o.jsx(Ba,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),r?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(v=>v+1),children:"重试"})]}):s===null?null:s.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:s.map(v=>o.jsxs("button",{className:"login-btn",onClick:()=>xte(v.loginUrl),children:[aMe(v.id),o.jsxs("span",{children:["使用 ",v.label," 登录"]})]},v.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:v=>{v.preventDefault(),b()},children:[o.jsx("input",{ref:f,className:"login-name-input",value:u,onChange:v=>d(v.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!p,"aria-label":"进入",children:o.jsx(Kp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:u&&!p?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:iMe[t]}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:rMe[t],target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function lMe({open:e,checking:t,error:n,onLogin:s}){const i=g.useRef(null);return g.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=i.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?wi.createPortal(o.jsx("div",{className:"auth-expired-backdrop",children:o.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[o.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:o.jsx(Gk,{})}),o.jsxs("div",{className:"auth-expired-copy",children:[o.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),o.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&o.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),o.jsx("footer",{className:"auth-expired-actions",children:o.jsx("button",{ref:i,type:"button",onClick:s,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}const cMe=[{value:"slow",label:"执行速度慢"},{value:"crash",label:"运行崩溃"},{value:"incorrect",label:"结果不准确"},{value:"tool_error",label:"工具调用失败"},{value:"other",label:"其他问题"}];function uMe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function dMe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function fMe({onClose:e,onSubmit:t}){const n=g.useId(),s=g.useId(),i=g.useRef(null),r=g.useRef(null),a=g.useRef(!1),l=g.useRef(e),[c,u]=g.useState(()=>new Set),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(""),[v,y]=g.useState(!1);a.current=h,l.current=e,g.useEffect(()=>{var k;const S=document.body.style.overflow,_=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(k=r.current)==null||k.focus();const T=A=>{var z;if(A.key==="Escape"&&!a.current){A.preventDefault(),l.current();return}if(A.key!=="Tab")return;const j=Array.from(((z=i.current)==null?void 0:z.querySelectorAll("button:not(:disabled), textarea:not(:disabled)"))??[]);if(j.length===0)return;const R=j[0],B=j[j.length-1];A.shiftKey&&document.activeElement===R?(A.preventDefault(),B.focus()):!A.shiftKey&&document.activeElement===B&&(A.preventDefault(),R.focus())};return window.addEventListener("keydown",T),()=>{document.body.style.overflow=S,window.removeEventListener("keydown",T),_!=null&&_.isConnected&&_.focus()}},[]);const x=S=>{u(_=>{const T=new Set(_);return T.has(S)?T.delete(S):T.add(S),T})},E=async()=>{if(!(h||v)){p(!0),b("");try{await t({issues:[...c],description:d.trim()}),y(!0)}catch(S){b(S instanceof Error?S.message:String(S))}finally{p(!1)}}},w=c.size>0||d.trim().length>0;return wi.createPortal(o.jsx("div",{className:"issue-feedback-backdrop",onMouseDown:S=>{S.target===S.currentTarget&&!h&&e()},children:o.jsxs("section",{ref:i,className:"issue-feedback-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":v?`${s}-success`:s,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"issue-feedback-head",children:[o.jsx("h2",{id:n,children:"问题反馈"}),o.jsx("button",{type:"button",className:"issue-feedback-close",onClick:e,disabled:h,"aria-label":"关闭问题反馈",children:o.jsx(uMe,{})})]}),v?o.jsxs("div",{className:"issue-feedback-success",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"issue-feedback-success-mark","aria-hidden":"true",children:o.jsx(dMe,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:"上报成功,感谢您的反馈"}),o.jsx("p",{id:`${s}-success`,children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("div",{className:"issue-feedback-body",children:[o.jsx("p",{id:s,className:"issue-feedback-intro",children:"请选择遇到的问题,也可以补充具体表现。"}),o.jsx("p",{className:"issue-feedback-privacy",role:"alert",children:"您的对话数据将会上报到 AgentKit 团队,请注意隐私保护。"}),o.jsx("div",{className:"issue-feedback-chips","aria-label":"常见问题",children:cMe.map(S=>o.jsx("button",{type:"button",className:"issue-feedback-chip","aria-pressed":c.has(S.value),onClick:()=>x(S.value),disabled:h,children:S.label},S.value))}),o.jsxs("label",{className:"issue-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:r,value:d,onChange:S=>f(S.target.value),placeholder:"请描述问题发生时的表现(选填)",maxLength:4e3,rows:5,disabled:h})]}),m&&o.jsx("p",{className:"issue-feedback-error",role:"alert",children:m})]}),o.jsx("footer",{className:"issue-feedback-actions",children:v?o.jsx("button",{type:"button",className:"is-primary",onClick:e,children:"完成"}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:e,disabled:h,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:()=>void E(),disabled:!w||h,children:h?"正在上报…":"提交反馈"})]})})]})}),document.body)}const hMe=[{value:"conversation",label:"对话"},{value:"agents",label:"智能体"},{value:"applications",label:"自动化"},{value:"search",label:"搜索"},{value:"other",label:"其他"}],pMe=[{value:"page_slow",label:"页面加载慢"},{value:"feature_unavailable",label:"功能无法使用"},{value:"display_error",label:"页面显示异常"},{value:"no_response",label:"操作无响应"},{value:"other",label:"其他问题"}],mMe=["点击后没有反应","页面一直处于加载状态","部分内容显示不完整","操作后出现错误提示"];function gMe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function bMe({initialModule:e,onSubmit:t}){const n=g.useRef(null),[s,i]=g.useState(()=>new Set),[r,a]=g.useState(e),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(""),[p,m]=g.useState(!1),b=E=>{i(w=>{const S=new Set(w);return S.has(E)?S.delete(E):S.add(E),S})},v=E=>{var w;c(S=>S.trim()?S.includes(E)?S:`${S.trimEnd()} +${E}`:E),(w=n.current)==null||w.focus()},y=async E=>{if(E.preventDefault(),!(u||p)){d(!0),h("");try{await t({module:r,issues:[...s],description:l.trim()}),m(!0)}catch(w){h(w instanceof Error?w.message:String(w))}finally{d(!1)}}},x=s.size>0||l.trim().length>0;return o.jsxs("div",{className:"platform-feedback-page",children:[o.jsxs("header",{className:"platform-feedback-header",children:[o.jsx("h1",{children:"问题反馈"}),o.jsx("p",{children:"告诉我们您在使用 AgentKit Studio 时遇到的问题。"})]}),o.jsx("div",{className:"platform-feedback-scroll",children:p?o.jsxs("section",{className:"platform-feedback-success","aria-labelledby":"feedback-success-title","aria-live":"polite",role:"status",children:[o.jsx("span",{className:"platform-feedback-success-icon","aria-hidden":"true",children:o.jsx(gMe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"feedback-success-title",children:"上报成功,感谢您的反馈"}),o.jsx("p",{children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("form",{className:"platform-feedback-form",onSubmit:E=>void y(E),children:[o.jsxs("section",{className:"platform-feedback-section",children:[o.jsx("div",{className:"platform-feedback-section-heading",children:o.jsx("h2",{children:"所属模块"})}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"所属模块",children:hMe.map(E=>o.jsx("button",{type:"button","aria-pressed":r===E.value,onClick:()=>a(E.value),disabled:u,children:E.label},E.value))})]}),o.jsx("section",{className:"platform-feedback-section",children:o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"常见问题(可多选)"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题类型",children:pMe.map(E=>o.jsx("button",{type:"button","aria-pressed":s.has(E.value),onClick:()=>b(E.value),disabled:u,children:E.label},E.value))})]})}),o.jsxs("section",{className:"platform-feedback-section",children:[o.jsxs("label",{className:"platform-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:n,value:l,onChange:E=>c(E.target.value),placeholder:"请描述问题发生时的页面、操作和表现",maxLength:4e3,rows:6,disabled:u})]}),o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"快捷补充"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题描述推荐",children:mMe.map(E=>o.jsx("button",{type:"button",onClick:()=>v(E),disabled:u,children:E},E))})]})]}),o.jsx("p",{className:"platform-feedback-privacy",role:"alert",children:"您的数据将会上报到 AgentKit 团队,请注意隐私保护。"}),f&&o.jsx("p",{className:"platform-feedback-error",role:"alert",children:f}),o.jsx("div",{className:"platform-feedback-actions",children:o.jsx("button",{type:"submit",disabled:!x||u,children:u?"正在上报…":"提交反馈"})})]})})]})}function yMe({node:e,ctx:t}){const n=e.variant??"default";return o.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}Uu("Button",yMe);function xMe({node:e,ctx:t}){return o.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}Uu("Card",xMe);const EMe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},vMe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function kG(e){return EMe[e]??"flex-start"}function AG(e){return vMe[e]??"stretch"}function wMe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:kG(e.justify),alignItems:AG(e.align)},children:n.map(s=>t.render(s))})}Uu("Column",wMe);function _Me({node:e}){const t=e.axis==="vertical";return o.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}Uu("Divider",_Me);const SMe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function NMe({node:e}){const t=e.name??"";return o.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:SMe[t]??"•"})}Uu("Icon",NMe);function TMe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:kG(e.justify),alignItems:AG(e.align??"center")},children:n.map(s=>t.render(s))})}Uu("Row",TMe);const kMe=new Set(["h1","h2","h3","h4","h5"]);function AMe({node:e,ctx:t}){const n=e.variant??"body",s=t.resolveString(e.text),i=kMe.has(n)?n:"p";return o.jsx(i,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:s})}Uu("Text",AMe);function CMe(e){return e==="agents"?"agents":e==="applications"?"applications":e==="search"?"search":["conversation","new-chat","sandbox"].includes(e)?"conversation":"other"}async function m_(e){const[t,n,s]=await Promise.allSettled([yOe(),xOe(),u2(e)]);return{agentId:e,ready:!0,harnessEnabled:s.status==="fulfilled",builtinTools:s.status==="fulfilled"?s.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const Ta={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},IMe=600,jMe=1e3,RMe=5e3,OMe=500,MMe=new Set,LMe=[];function Na(){return{skills:[]}}function g_(e){return`${NE(e)}.active`}function lT(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function DMe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(lT(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function cT(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const s=cT(n,t);if(s)return s}}function CG(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...CG(n)));return t}function VD(){const e=typeof localStorage<"u"?localStorage.getItem(Ta.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function PMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.75",y:"3.75",width:"16.5",height:"16.5",rx:"3.25"}),o.jsx("path",{d:"M12 8.5v7M8.5 12h7"}),o.jsx("path",{d:"M6.75 6.75h1M16.25 17.25h1",opacity:"0.6"})]})}function BMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14.75",rx:"2.25"}),o.jsx("path",{d:"M3.5 9h17M9.25 12.25 7.1 14.4l2.15 2.15M14.75 12.25l2.15 2.15-2.15 2.15M12.8 11.85l-1.6 5.1"})]})}function UMe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M5.25 8.5h1.5M5.25 11.5h1.5"}),o.jsx("rect",{x:"14.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M17.25 15.5h1.5M17.25 12.5h1.5M8.75 12h6.5m-2.5-2.5 2.5 2.5-2.5 2.5"})]})}function FMe(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),o.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function uT(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function $Me(e){if(!e)return"";const t=[];return e.ts&&t.push(uT(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Hc(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function GD(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return Hc(e[n]);return""}const HMe="send_a2ui_json_to_client";function zMe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"||t.kind==="artifact"?t.files.length>0:t.kind==="tool"?!(t.name===HMe&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?BH(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function VMe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function GMe(e){return new Promise((t,n)=>{let s="";try{s=new URL(e,window.location.href).protocol}catch{}if(s!=="http:"&&s!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const i=window.open(e,"veadk_oauth","width=520,height=720");if(!i){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{i.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&l(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!r){if(i.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=i.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&l(d)}catch{}}},500)})}function KMe(e,t){const n=JSON.parse(JSON.stringify(e??{})),s=n.exchangedAuthCredential??n.exchanged_auth_credential??{},i=s.oauth2??{};return i.authResponseUri=t,i.auth_response_uri=t,s.oauth2=i,n.exchangedAuthCredential=s,n}function KD({text:e}){const[t,n]=g.useState(!1);return o.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?o.jsx(za,{className:"icon"}):o.jsx(bx,{className:"icon"})})}const qD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],YD=()=>qD[Math.floor(Math.random()*qD.length)];function b_(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function WD(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function XD(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}const qMe={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},YMe={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},WMe={user:"由我审批",auto_review:"自动审查"};function XMe(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function QMe(e){var n,s,i;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(s=e.grantRoot)!=null&&s.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(i=e.cwd)!=null&&i.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function QD(e){return e.flatMap(t=>t.apps.map(n=>po(t.id,n)))}function ZMe(e,t){var n;return((n=e.find(s=>s.runtimeId&&s.apps.some(i=>po(s.id,i)===t)))==null?void 0:n.runtimeId)??""}function JMe(e,t){for(const n of e){const s=n.apps.find(i=>po(n.id,i)===t);if(s&&n.runtimeId)return{runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:s}}return null}function eLe(){const[e,t]=g.useState([]),[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(""),c=g.useRef(null),[u,d]=g.useState(!1),[f,h]=g.useState([]),[p,m]=g.useState(null),[b,v]=g.useState([]),[y,x]=g.useState(!1),[E,w]=g.useState(!1),[S,_]=g.useState(""),[T,k]=g.useState(!1),[A,j]=g.useState(!1),[R,B]=g.useState(null),[z,L]=g.useState(null),[F,C]=g.useState(!1),[I,D]=g.useState(""),[$,O]=g.useState(null),[ne,se]=g.useState(!1),[P,Z]=g.useState(""),[te,V]=g.useState(!1),[Q,K]=g.useState(!1),[ce,he]=g.useState("confirm"),[ge,ue]=g.useState(""),[ve,Me]=g.useState("codex"),[Se,ae]=g.useState(!1),[me,we]=g.useState(0),[et,De]=g.useState(null),[Ue,Ye]=g.useState(null),Ae=g.useRef(null),ze=g.useRef(null),Be=g.useRef((p==null?void 0:p.id)??""),X=g.useRef(""),oe=g.useRef(0),J=g.useRef(new Set);Be.current=(p==null?void 0:p.id)??"",g.useEffect(()=>()=>{for(const M of J.current)URL.revokeObjectURL(M);J.current.clear()},[]);function xe(M){const U=URL.createObjectURL(M);return J.current.add(U),U}function Oe(M){!M||!J.current.delete(M)||URL.revokeObjectURL(M)}function lt(){for(const M of J.current)URL.revokeObjectURL(M);J.current.clear()}const[Mt,ut]=g.useState({}),bn=a?Mt[a]??[]:f,wt=p?b:bn,_t=(M,U)=>ut(W=>({...W,[M]:typeof U=="function"?U(W[M]??[]):U}));function yn(M,U,W=[],re=""){if(Be.current!==M)return;const ye=crypto.randomUUID(),Te={role:"system",blocks:[],activity:{id:ye,title:U,...W.length>0?{details:W}:{}},meta:{localId:ye,ts:Date.now()/1e3}};v(He=>{if(!re)return[...He,Te];const nt=He.findIndex(Xe=>{var ct;return((ct=Xe.meta)==null?void 0:ct.localId)===re});return nt<0?[...He,Te]:[...He.slice(0,nt),Te,...He.slice(nt)]})}const[Ft,Bt]=g.useState(""),[at,ft]=g.useState("agent"),[$e,St]=g.useState(null),[be,We]=g.useState({}),Ge=g.useRef(new Map),ht=!n||be.ready===!0&&be.agentId===n,[Gn,dn]=g.useState(null),[zt,rn]=g.useState(!1),Sn=g.useRef(0),[Vt,ot]=g.useState([]),[Nn,mn]=g.useState(Na),[Ct,ms]=g.useState(null),[Rs,gs]=g.useState(0),[Mn,zs]=g.useState(!1),[is,Tn]=g.useState(null),[rs,bs]=g.useState(!1),[_i,kn]=g.useState([]),[Vs,Ss]=g.useState(!1),Fn=g.useRef(new Set),[$n,Gs]=g.useState(()=>new Set),[Os,An]=g.useState(()=>new Set),[xn,fn]=g.useState(()=>new Set),Jt=g.useRef(new Map),an=g.useRef(new Map),on=g.useRef(void 0),ys=g.useRef(()=>{}),de=(M,U)=>Gs(W=>{const re=new Set(W);return U?re.add(M):re.delete(M),re}),Ce=M=>{const U=an.current.get(M);U!==void 0&&window.clearTimeout(U),an.current.delete(M),An(W=>new Set(W).add(M))},Pe=M=>{const U=an.current.get(M);U!==void 0&&window.clearTimeout(U);const W=window.setTimeout(()=>{an.current.delete(M),An(re=>{const ye=new Set(re);return ye.delete(M),ye})},2400);an.current.set(M,W)},it=(M,U)=>{fn(W=>{if(W.has(M)===U)return W;const re=new Set(W);return re.delete(M),re})},Ze=g.useRef(""),[xt,Ie]=g.useState(""),[Kn,as]=g.useState(""),[Ks,ai]=g.useState(()=>new Set),[qn,en]=g.useState(null),[Lt,Ms]=g.useState(null),[os,Gi]=g.useState(!1),[Ya,_c]=g.useState(),[rr,zu]=g.useState(YD),[qs,ie]=g.useState(null),[Qt,Ln]=g.useState(!1),[Ns,tn]=g.useState(!1),[Ts,Gr]=g.useState(""),Kr=g.useRef(!1),[ls,_r]=g.useState(null),[q,_e]=g.useState(""),[Ve,st]=g.useState(),[bt,Nt]=g.useState(null),ln=(bt==null?void 0:bt.capabilities.runtimeScope)??"mine",[oi,Ys]=g.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[xs,Li]=g.useState("cloud"),[mi,ya]=g.useState(Rm),[yt,Dn]=g.useState("volcengine"),[Ki,vo]=g.useState(""),[Qg,Zg]=g.useState(!1),[wo,li]=g.useState(!1),[CE,Jg]=g.useState(!1),[e0,Wa]=g.useState({}),[IE,t0]=g.useState({}),[n0,_o]=g.useState({}),s0=$n.has(a),So=Os.has(a),No=s0||u,gl=!!a&&rs,Xa=p?y:No,i0=Xa||!p&&So,Yn=sMe({session:p,conversationBusy:y,onInputChange:Bt,onSessionPatch:M=>{const U=Be.current;m(W=>(W==null?void 0:W.id)===U?{...W,...M}:W)},onSnapshot:M=>{const U=Be.current;lt(),v(tMe(M)),m(W=>(W==null?void 0:W.id)===U?{...W,threadId:M.threadId,cwd:M.cwd??W.cwd,model:M.model??W.model,workspaceLocked:M.workspaceLocked,permissions:M.permissions,busy:!1}:W)},onActivity:(M,U=[])=>{const W=Be.current;W&&yn(W,M,U)},onError:Ie}),jE=e0[a]??"",RE=IE[a]??MMe,OE=n0[a]??LMe,qi=Ct==null?void 0:Ct.graph,r0=[Ct==null?void 0:Ct.name,qi==null?void 0:qi.name,qi==null?void 0:qi.id].filter(M=>!!M),Vu=Nn.targetAgent&&qi?cT(qi,Nn.targetAgent.name):qi,a0=(Vu==null?void 0:Vu.skills)??(Nn.targetAgent?[]:(Ct==null?void 0:Ct.skills)??[]),o0=qi?CG(qi):[];function Nh(M){b_(M);for(const U of M)U.status==="uploading"?Fn.current.add(U.id):U.uri&&Qb(n,U.uri).catch(W=>Ie(String(W)))}function Gu(){Sn.current+=1;const M=Gn;dn(null),rn(!1),M&&!M.id.startsWith("pending-")&&sRe(M.id).catch(U=>{Ie(U instanceof Error?U.message:String(U))})}async function Ku(M){try{await PS(n,q,M),await DS(n,q,M),r(U=>U.filter(W=>W.id!==M)),ut(U=>{const{[M]:W,...re}=U;return re})}catch(U){Ie(String(U))}}function ME(M){const U=Vt.find(ye=>ye.id===M);if(!U)return;const W=Vt.filter(ye=>ye.id!==M);b_([U]),U.status==="uploading"&&Fn.current.add(M),ot(W),W.length===0&&!Ft.trim()&&!!a&&wt.length===0?(Ze.current="",l(""),Ku(a)):U.uri&&Qb(n,U.uri).catch(ye=>Ie(String(ye)))}const l0=(M,U)=>{var Te,He,nt,Xe,ct;const W=U.author&&U.author!=="user"?U.author:void 0;W&&(Wa(Je=>({...Je,[M]:W})),t0(Je=>({...Je,[M]:new Set(Je[M]??[]).add(W)})),_o(Je=>{var Ke;return(Ke=Je[M])!=null&&Ke.length?Je:{...Je,[M]:[W]}}));const re=((Te=U.actions)==null?void 0:Te.transferToAgent)??((He=U.actions)==null?void 0:He.transfer_to_agent);re&&_o(Je=>{const Ke=Je[M]??[];return Ke[Ke.length-1]===re?Je:{...Je,[M]:[...Ke,re]}}),(((nt=U.actions)==null?void 0:nt.endOfAgent)??((Xe=U.actions)==null?void 0:Xe.end_of_agent)??((ct=U.actions)==null?void 0:ct.escalate))&&_o(Je=>{const Ke=Je[M]??[];return Ke.length<=1?Je:{...Je,[M]:Ke.slice(0,-1)}})},[To,Ut]=g.useState(VD),[c0,u0]=g.useState([]),[LE,Th]=g.useState({}),kh=g.useCallback(M=>{u0(U=>{const W=U.findIndex(ye=>ye.id===M.id);if(W===-1)return[M,...U];const re=[...U];return re[W]={...re[W],...M},re})},[]),[DE,d0]=g.useState(!0),[qu,ci]=g.useState(!1),[Ah,ks]=g.useState(!1),[Ch,H]=g.useState(!1),[le,fe]=g.useState(null),[ke,tt]=g.useState("custom"),[Et,cs]=g.useState([]),Sr=g.useRef([]),Yt=g.useRef(null),Yi=g.useRef(null),[pC,f0]=g.useState([]),[Ws,qr]=g.useState(""),Nr=g.useRef(null),[PE,Si]=g.useState(!1),[Yu,En]=g.useState(!1),[mC,BE]=g.useState(""),[IG,jG]=g.useState("good"),[RG,h0]=g.useState("basic"),[OG,MG]=g.useState("good"),[Ih,p0]=g.useState(""),[LG,DG]=g.useState(null),[bl,Es]=g.useState(!1),[Sc,Yr]=g.useState(null),UE=g.useRef(null),[Qa,jh]=g.useState(()=>{const M=ja();return gh(M),M}),[PG,gC]=g.useState(!1),[BG,bC]=g.useState(""),[yC,m0]=g.useState(null),[UG,xC]=g.useState({}),[FG,EC]=g.useState(()=>new Set),[Wu,xa]=g.useState(null),[g0,b0]=g.useState(ki(yt)),[vC,Wi]=g.useState(""),[wC,Di]=g.useState(""),[vn,ar]=g.useState(null),[$G,FE]=g.useState(!1),y0=g.useRef(!1),Xu=g.useRef(!1),Za=g.useCallback(M=>{if(!q)return!1;try{ID(localStorage,q,M)}catch(U){return as(U instanceof Error?U.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return Sr.current=M,cs(M),as(""),!0},[q]),Ja=g.useCallback(M=>{var U;M&&((U=Yt.current)==null?void 0:U.id)!==M||(Yt.current=null,Yi.current!==null&&(window.clearTimeout(Yi.current),Yi.current=null))},[]),Qu=g.useCallback(()=>{const M=Yt.current;M&&(Ja(),Za([M,...Sr.current.filter(U=>U.id!==M.id)]))},[Ja,Za]),HG=g.useCallback((M,U,W)=>{!M||!q||(Yt.current&&Yt.current.id!==M&&Qu(),Yt.current={id:M,draft:U,updatedAt:Date.now(),deploymentTarget:W},Yi.current!==null&&window.clearTimeout(Yi.current),Yi.current=window.setTimeout(Qu,IMe))},[Qu,q]),$E=g.useCallback(M=>{!M||!q||(Ja(M),Za(Sr.current.filter(U=>U.id!==M)))},[Ja,Za,q]),_C=g.useCallback(M=>{if(!q||M.length===0)return;const U=new Set(M.map(W=>W.id));Yt.current&&U.has(Yt.current.id)&&Ja(),Za(Sr.current.filter(W=>!U.has(W.id))),Th(W=>Object.fromEntries(Object.entries(W).filter(([re])=>!U.has(re)))),U.has(Ws)&&(qr(""),fe(null),xa(null),Nr.current=null,localStorage.removeItem(g_(q)))},[Ja,Za,Ws,q]),SC=g.useCallback(M=>{if(!M||!q)return;Ja(M);const U=Nr.current,W=Sr.current.filter(re=>re.id!==M);Za((U==null?void 0:U.id)===M?[U,...W]:W)},[Ja,Za,q]);g.useEffect(()=>(window.addEventListener("pagehide",Qu),()=>{window.removeEventListener("pagehide",Qu)}),[Qu]),g.useEffect(()=>{if(!q){Ja(),Sr.current=[],cs([]),f0([]),qr(""),as(""),Nr.current=null;return}let M=[],U="";try{M=qje(localStorage,q),localStorage.getItem(NE(q))!==null&&ID(localStorage,q,M),U=localStorage.getItem(g_(q))||"",as("")}catch(re){as(re instanceof Error?re.message:"无法读取本机草稿,请稍后重试。")}Sr.current=M,cs(M),f0(DMe(q));const W=M.find(re=>re.id===U);Nr.current=W??null,To==="custom"&&W&&(qr(W.id),fe(W.draft),xa(W.deploymentTarget??null))},[Ja,q]),g.useEffect(()=>{if(!q)return;const M=g_(q);try{To==="custom"&&Ws?localStorage.setItem(M,Ws):localStorage.removeItem(M)}catch{as("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[To,Ws,q]);const zG=g.useCallback(M=>{if(!q)return;const U=[...new Set(M.filter(Boolean))];f0(U),localStorage.setItem(lT(q),JSON.stringify(U))},[q]),VG=g.useCallback(async M=>{const U=M.filter(Xe=>!!Xe.runtimeId&&Xe.canDelete===!0);if(U.length===0)return;const W=ZMe(Qa,n),re=new Set(U.map(Xe=>Xe.runtimeId));EC(Xe=>{const ct=new Set(Xe);for(const Je of re)ct.add(Je);return ct}),pb(re);const ye=new Set,Te=new Set,He=new Set,nt=[];for(const Xe of U)try{if(!Xe.region)throw new Error("Runtime 缺少地域信息,无法删除");await D8(Xe.runtimeId,Xe.region),O1(Xe.runtimeId),ye.add(Xe.runtimeId),Te.add(Xe.id)}catch(ct){const Je=ct instanceof Error?ct.message:String(ct);He.add(Xe.runtimeId),nt.push(`${Xe.label}: ${Je}`)}if(ye.size>0&&(pb(ye),jh(ja()),m0(ct=>{if(!ct)return ct;const Je=new Set(ct);for(const Ke of ye)Je.delete(Ke);return Je}),xC(ct=>Object.fromEntries(Object.entries(ct).filter(([Je])=>!ye.has(Je)))),f0(ct=>{const Je=ct.filter(Ke=>!Te.has(Ke));return q&&localStorage.setItem(lT(q),JSON.stringify(Je)),Je}),Za(Sr.current.filter(ct=>{var Je;return!((Je=ct.deploymentTarget)!=null&&Je.runtimeId)||!ye.has(ct.deploymentTarget.runtimeId)})),(W?ye.has(W):U.some(ct=>ct.id===n))&&(uK(),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),Wi(""),Di(""),Es(!0),Ie("")),vn!=null&&vn.runtime&&ye.has(vn.runtime.runtimeId)&&(Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),Wi(""),Di(""),Es(!0),Ie(""))),He.size>0&&EC(Xe=>{const ct=new Set(Xe);for(const Je of He)ct.delete(Je);return ct}),nt.length>0){const Xe=nt.slice(0,3).join(";"),ct=nt.length>3?`;另有 ${nt.length-3} 个失败`:"";throw new Error(`${nt.length} 个 Agent 删除失败:${Xe}${ct}`)}},[vn,n,Za,Qa,q]),HE=g.useCallback(async()=>{gC(!0),bC("");try{const M=[];let U="";do{const W=await Tx({scope:ln,region:"all",pageSize:100,nextToken:U});M.push(...W.runtimes),U=W.nextToken}while(U&&M.length<2e3);m0(new Set(M.map(W=>W.runtimeId))),xC(Object.fromEntries(M.map(W=>[W.runtimeId,{canDelete:W.canDelete}])))}catch(M){bC(M instanceof Error?M.message:String(M))}finally{gC(!1)}},[ln]);function x0(M){console.log("create agent draft:",M),Ut(null),xl()}function zE(M,U){console.log("Agent added, navigating to:",M,U),jh(ja()),m0(null),pb(),$E(Ws),qr(""),Nr.current=null,xa(null),Wi(""),Di(M),h0("basic"),Ut(null),En(!0),s(M)}const VE=g.useCallback(M=>{Ut(null),H(!1),Es(!1),ar(null),En(!0),Di(""),h0("basic"),Wi(M.id),Ie("")},[]),NC=g.useCallback(M=>{Ws&&Th(U=>({...U,[Ws]:M.id})),VE(M)},[Ws,VE]),TC=g.useCallback(async M=>{if(!M.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const U=(Wu==null?void 0:Wu.region)??g0,W=await dy(M.runtimeId,M.agentName,M.region??U,M.version);jh(ja()),gs(ye=>ye+1);const re=await m_(W);Ge.current.set(W,re),We(re),m0(ye=>{const Te=new Set(ye??[]);return Te.add(M.runtimeId),Te}),pb(),xa(null),$E(Ws),Th(ye=>{if(!Ws||!ye[Ws])return ye;const Te={...ye};return delete Te[Ws],Te}),qr(""),Nr.current=null,Di(W),h0("basic"),Ut(null),En(!0),s(W)},[Ws,g0,$E,Wu]),Rh=g.useRef(null),GE=g.useRef(new Map),Nc=g.useRef(!0),yl=g.useRef(!1),Tc=g.useRef(null),kC=g.useRef({key:"",turnCount:0}),KE=(p==null?void 0:p.id)??a;g.useLayoutEffect(()=>{const M=Rh.current,U=kC.current,W=U.key!==KE,re=!W&&wt.length>U.turnCount;if(kC.current={key:KE,turnCount:wt.length},!M||wt.length===0||!W&&!re)return;Nc.current=!0,yl.current=!1,Tc.current!==null&&(window.clearTimeout(Tc.current),Tc.current=null);const ye=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(W||ye){M.scrollTop=M.scrollHeight;return}yl.current=!0,M.scrollTo({top:M.scrollHeight,behavior:"smooth"}),Tc.current=window.setTimeout(()=>{yl.current=!1,Tc.current=null},450)},[KE,wt.length]),g.useLayoutEffect(()=>{const M=Rh.current;!M||!Nc.current||yl.current||(M.scrollTop=M.scrollHeight)},[Xa,wt]),g.useEffect(()=>{if(!Ih||Yu||wt.length===0)return;const M=GE.current.get(Ih);if(!M)return;Nc.current=!1,M.scrollIntoView({behavior:"smooth",block:"center"});const U=window.setTimeout(()=>{p0("")},2600);return()=>window.clearTimeout(U)},[Ih,Yu,wt]),g.useEffect(()=>()=>{Tc.current!==null&&window.clearTimeout(Tc.current)},[]);const GG=g.useCallback(()=>{const M=Rh.current;!M||yl.current||(Nc.current=M.scrollHeight-M.scrollTop-M.clientHeight<32)},[]),KG=g.useCallback(M=>{M.deltaY<0&&(yl.current=!1,Nc.current=!1)},[]),qG=g.useCallback(()=>{yl.current=!1,Nc.current=!1},[]),YG=g.useCallback(()=>{const M=Rh.current;!M||!Nc.current||yl.current||(M.scrollTop=M.scrollHeight)},[]),qE=g.useCallback(()=>{_r(null),OS().then(M=>{_e(M.userId),st(M.info),li(!!M.local),ie(M.status),M.status==="authenticated"&&(y0.current=!0,Xu.current=!0,localStorage.removeItem(Ta.app),s(""),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),Es(!1))}).catch(M=>{_r(M instanceof Error?M.message:String(M))})},[]);g.useEffect(()=>{qE()},[qE]),g.useEffect(()=>{const M=()=>{Gr(""),Ln(!0)};return window.addEventListener(MS,M),kte()&&M(),()=>window.removeEventListener(MS,M)},[]);const WG=g.useCallback(async()=>{if(Kr.current)return;Kr.current=!0;const M=Ete();if(!M){Kr.current=!1,Gr("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}tn(!0),Gr("");try{for(;;){await new Promise(U=>window.setTimeout(U,1e3));try{const U=await OS();if(U.status==="authenticated"){_e(U.userId),st(U.info),li(!!U.local),ie(U.status),Ln(!1),Ate(),M.close();return}}catch{}if(M.closed){Gr("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{Kr.current=!1,tn(!1)}},[]);g.useEffect(()=>{wo&&q&&zR(q)},[wo,q]),g.useEffect(()=>{if(qs!=="authenticated"||!q||!n){We({});return}const M=Ge.current.get(n);if(M){We(M);return}let U=!1;return We({}),m_(n).then(W=>{U||(Ge.current.set(n,W),We(W))}),()=>{U=!0}},[n,qs,q]),g.useEffect(()=>{if(qs!=="authenticated"||!q){Nt(null);return}let M=!1;return Nt(null),j8().then(U=>{M||Nt(U)}).catch(U=>{console.warn("[app] /web/access failed; using ordinary-user access:",U),M||Nt(I8)}),()=>{M=!0}},[qs,q]),g.useEffect(()=>{C8().then(M=>{bTe(M.telemetry),xTe({agentsSource:M.agentsSource}),Ys(M.features),Li(M.agentsSource),Dn(M.provider),ya(M.branding),vo(M.version),Zg(!0)})},[]),g.useEffect(()=>{qs!=="authenticated"||!Ve||!bt||yTe({userId:bt.telemetry.userId,role:bt.role,local:wo})},[bt,qs,wo,Ve]),g.useEffect(()=>{b0(M=>{const U=ki(yt);return!M||yt==="byteplus"&&M.startsWith("cn-")||yt==="volcengine"&&M.startsWith("ap-")?U:M})},[yt]),g.useEffect(()=>{bt&&(bt.capabilities.createAgents||(Ut(null),fe(null),ks(!1),H(!1),u0([])),bt.capabilities.manageAgents||En(!1))},[bt]),g.useEffect(()=>{qs!=="authenticated"||xs!=="cloud"||!Qg||!Yu||vn||HE()},[vn,xs,qs,Yu,HE,Qg]),g.useEffect(()=>{document.title=mi.title;let M=document.querySelector('link[rel~="icon"]');M||(M=document.createElement("link"),M.rel="icon",document.head.appendChild(M)),M.removeAttribute("type"),M.href=mi.logoUrl||(yt==="byteplus"?m2:p2)},[yt,mi]),g.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(M=>M.ok?M.json():null).then(M=>{M&&d0(!!M.credentials)}).catch(M=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",M)})},[]);function XG(M){zR(M),y0.current=!0,Xu.current=!0,localStorage.removeItem(Ta.app),Nt(null),Ut(null),fe(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),xl(),s(""),Es(!1),_e(M),st({name:M}),li(!0),ie("authenticated")}function QG(){Nt(null),wo?(yte(),_e(""),st(void 0),ie("unauthenticated")):wte()}g.useEffect(()=>{if(qs==="authenticated"){if(xs==="cloud"){const M=QD(Qa);s(U=>U&&M.includes(U)?U:(U&&(Xu.current=!0,localStorage.removeItem(Ta.app)),""));return}t8().then(M=>{t(M);const U=QD(Qa);s(W=>W&&(M.includes(W)||U.includes(W))?W:(W&&(Xu.current=!0,localStorage.removeItem(Ta.app)),""))}).catch(M=>Ie(String(M)))}},[qs,xs,Qa]),g.useEffect(()=>{n?(Xu.current=!1,localStorage.setItem(Ta.app,n)):localStorage.removeItem(Ta.app)},[n]),g.useEffect(()=>{let M=!1;if(Tn(null),kn([]),bl||vn||!n||!q||!a){bs(!1);return}return bs(!0),US(n,q,a).then(U=>{M||(Tn(U),u2(n).then(W=>{M||kn(W)}).catch(()=>{M||kn([])}))}).catch(()=>{M||Tn(null)}).finally(()=>{M||bs(!1)}),()=>{M=!0}},[vn,n,bl,q,a]),g.useEffect(()=>{let M=!1;if(ms(null),mn(Na()),qs!=="authenticated"||bl||vn||!n){zs(!1);return}return zs(!0),d2(n).then(U=>{M||ms(U)}).catch(()=>{M||ms(null)}).finally(()=>{M||zs(!1)}),()=>{M=!0}},[vn,n,Rs,qs,bl]),g.useEffect(()=>{bt&&localStorage.setItem(Ta.view,bt.capabilities.createAgents?To??"chat":"chat")},[bt,To]),g.useEffect(()=>{localStorage.setItem(Ta.session,a),Ze.current=a},[a]),g.useEffect(()=>{const M=JMe(Qa,n);if(!M||!q){ys.current=()=>{},fn(Je=>Je.size===0?Je:new Set);return}const{runtimeId:U,region:W,appName:re}=M;let ye=!1,Te=0;function He(){on.current!==void 0&&(window.clearTimeout(on.current),on.current=void 0)}function nt(Je){He(),on.current=window.setTimeout(()=>void Xe(),Je)}async function Xe(){const Je=++Te;try{const Ke=await l8({runtimeId:U,region:W,appName:re,userId:q});if(ye||Je!==Te)return;const nn=new Set(Ke.items.filter(rt=>rt.state==="running").map(rt=>rt.sessionId));if(fn(rt=>rt.size===nn.size&&[...nn].every(Xs=>rt.has(Xs))?rt:nn),nn.size>0){nt(jMe);return}const cn=Ke.items.filter(rt=>rt.state==="pending").map(rt=>Date.parse(rt.dueAt)).filter(Number.isFinite);cn.length>0&&nt(Math.max(OMe,Math.min(...cn)-Date.now()))}catch{!ye&&Je===Te&&nt(RMe)}}const ct=()=>{He(),Xe()};return ys.current=ct,ct(),()=>{ye=!0,Te+=1,He(),ys.current===ct&&(ys.current=()=>{})}},[n,Qa,q]),g.useEffect(()=>()=>Jt.current.forEach(M=>M.abort()),[]),g.useEffect(()=>()=>an.current.forEach(M=>{window.clearTimeout(M)}),[]),g.useEffect(()=>()=>{var M,U;(M=Ae.current)==null||M.abort(),(U=ze.current)==null||U.abort()},[]),g.useEffect(()=>{if(bl||vn||p||!n||!q)return;let M=!1;return(async()=>{const U=await E0(n);if(!M){if(!y0.current){y0.current=!0;const W=localStorage.getItem(Ta.session)||"";if(VD()===null&&W&&U.some(re=>re.id===W)){Oh(W);return}}xl()}})(),()=>{M=!0}},[vn,n,bl,p,q]),g.useEffect(()=>{const M=UE.current;M&&M.app===n&&(UE.current=null,Oh(M.sid))},[n]);function ZG(M,U){Si(!1),M===n?Oh(U):(UE.current={app:M,sid:U},s(M))}async function E0(M){try{const U=await o2(M,q),W=await Promise.allSettled(U.map(Te=>{var He;return(He=Te.events)!=null&&He.length?Promise.resolve(Te):o1(M,q,Te.id)})),re=W.find(Te=>Te.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(Te.reason)));if((re==null?void 0:re.status)==="rejected")throw re.reason;const ye=W.flatMap(Te=>Te.status==="fulfilled"?[Te.value]:[]);return r(ye),ye}catch(U){return Ie(String(U)),[]}}function AC(M="codex",U=!1){p||(Ie(""),ue(""),he("confirm"),Me(M),ae(U),K(!0))}function JG(){var M;(M=Ae.current)==null||M.abort(),Ae.current=null,K(!1),he("confirm"),ue(""),!p&&at==="temporary"&&!Se&&ft("agent")}async function eK(M){var W;(W=Ae.current)==null||W.abort();const U=new AbortController;Ae.current=U,he("loading"),ue("");try{const re=ve==="codex"?await un.startSession({displayName:M,signal:U.signal}):await un.startAgentSession(ve,{displayName:M,signal:U.signal});if(Ae.current!==U)return;if(ETe({kind:ve,source:Se?"my_agents":"new_chat",sessionId:re.id}),Se){we(Te=>Te+1),K(!1),he("confirm"),Es(!0);return}if(ve!=="codex")return;const ye=await un.connectSession(re.id,{signal:U.signal});if(Ae.current!==U)return;Ze.current="",l(""),h([]),Bt(""),mn(Na()),ft("temporary"),Gu(),rn(!1),Nh(Vt),ot([]),lt(),v([]),m(ye),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),Es(!1),De(null),Ye(null),K(!1),he("confirm")}catch(re){if((re==null?void 0:re.name)==="AbortError"||Ae.current!==U)return;vTe({kind:ve,source:Se?"my_agents":"new_chat",error:re}),ue(re instanceof Error?re.message:String(re)),he("error")}finally{Ae.current===U&&(Ae.current=null)}}async function YE(M,U="my_agents"){Ie("");const W=Date.now();try{if(M.toolName==="codex"){const ye=await un.connectSession(M.id);mb({kind:M.toolName,source:U,durationMs:Date.now()-W,sandboxStatus:ye.status}),Ze.current="",l(""),h([]),Bt(""),mn(Na()),lt(),v([]),m(ye),De(null),Ye(null),Es(!1),En(!1);return}const re=await un.openAgentSession(M.toolName,M.id);mb({kind:M.toolName,source:U,durationMs:Date.now()-W,sandboxStatus:re.session.status}),Ye(re),De(null),Es(!1),En(!1)}catch(re){throw Vw({kind:M.toolName,source:U,durationMs:Date.now()-W,error:re}),Ie(re instanceof Error?re.message:String(re)),re}}function tK(M){De(M),Ye(null),Es(!1),En(!1),Ie("")}async function nK(M){(p==null?void 0:p.id)===M.id&&ko(),M.toolName==="codex"?await un.deleteSession(M.id):await un.deleteAgentSession(M.toolName,M.id),De(null),Ye(null),we(U=>U+1),Es(!0)}function ko(){var U;(U=ze.current)==null||U.abort(),ze.current=null,Be.current="",X.current="",x(!1),lt(),v([]),ot([]),Bt(""),Ie(""),ft("agent"),w(!1),_(""),k(!1),j(!1),B(null),L(null),C(!1),D(""),O(null),se(!1),Z(""),V(!1),oe.current+=1;const M=p;m(null),M&&un.closeSession(M.id).catch(W=>Ie(String(W)))}async function WE(M){const U=p;if(U){B(M),L(null),D(""),C(!0);try{const W=M==="terminal"?await un.launchTerminal(U.id):await un.launchBrowser(U.id);L(W)}catch(W){D(W instanceof Error?W.message:String(W))}finally{C(!1)}}}async function sK(M){const U=p;if(!(!U||E)){w(!0),_("");try{const W=await un.updatePermissions(U.id,M);m(re=>(re==null?void 0:re.id)===U.id?{...re,permissions:W}:re),yn(U.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:qMe[W.sandboxMode]},{label:"审批策略",value:YMe[W.approvalPolicy]},{label:"审批方式",value:WMe[W.approvalsReviewer]},{label:"网络访问",value:W.networkAccess?"允许":"关闭"}]),Be.current===U.id&&k(!1)}catch(W){_(W instanceof Error?W.message:String(W))}finally{w(!1)}}}const iK=g.useCallback(async M=>{const U=p==null?void 0:p.id;if(!U)throw new Error("当前没有已连接的 Sandbox。");return un.listDirectories(U,M)},[p==null?void 0:p.id]);async function rK(M){const U=p;if(!(!U||U.workspaceLocked||E)){w(!0),_("");try{const W=await un.updateWorkspace(U.id,M);m(re=>(re==null?void 0:re.id)===U.id?{...re,cwd:W}:re),Yn.invalidateSkills(),yn(U.id,"已更新工作空间",[{label:"工作目录",value:W,code:!0}]),Be.current===U.id&&j(!1)}catch(W){_(W instanceof Error?W.message:String(W))}finally{w(!1)}}}async function aK(M){const U=p,W=$;if(!(!U||!W||ne)){se(!0),Z("");try{await un.resolveApproval(U.id,W.id,M),yn(U.id,XMe(W,M),QMe(W),X.current),O(re=>(re==null?void 0:re.id)===W.id?null:re)}catch(re){Z(re instanceof Error?re.message:String(re))}finally{se(!1)}}}async function oK(M){const U=p;if(!U||te)return;const W=++oe.current;Ie(""),V(!0);const re=Array.from(M).map(ye=>{const Te={id:WD(),mimeType:XD(ye),name:ye.name,sizeBytes:ye.size,status:"uploading",previewUrl:xe(ye)};return{file:ye,attachment:Te}});ot(ye=>[...ye,...re.map(({attachment:Te})=>Te)]);try{const Te=(await Promise.all(re.map(async({file:He,attachment:nt})=>{try{const Xe=await un.uploadFile(U.id,He);return oe.current!==W?null:(ot(ct=>ct.map(Je=>Je.id===nt.id?{...Je,id:Xe.id,uri:Xe.path,name:Xe.name,mimeType:Xe.mimeType,sizeBytes:Xe.sizeBytes,status:"ready"}:Je)),Xe)}catch(Xe){if(oe.current!==W)return null;const ct=Xe instanceof Error?Xe.message:String(Xe);return ot(Je=>Je.map(Ke=>Ke.id===nt.id?{...Ke,status:"error",error:ct}:Ke)),Ie(ct),null}}))).filter(He=>He!==null);oe.current===W&&Te.length>0&&yn(U.id,Te.length===1?"已上传文件到 Sandbox":`已上传 ${Te.length} 个文件到 Sandbox`,Te.map((He,nt)=>({label:Te.length===1?"文件":`文件 ${nt+1}`,value:He.path,code:!0})))}finally{if(oe.current===W)V(!1);else for(const{attachment:ye}of re)Oe(ye.previewUrl)}}function lK(M){const U=Vt.find(W=>W.id===M);U&&(Oe(U.previewUrl),ot(W=>W.filter(re=>re.id!==M)))}async function CC(M,U=[],W=[]){var Xs;const re=p,ye=U.filter(qe=>qe.status==="ready"&&qe.uri);if(!re||y||!M.trim()&&ye.length===0)return;Ie(""),O(null),Z("");const Te=Date.now(),He=new AbortController;(Xs=ze.current)==null||Xs.abort(),ze.current=He;const nt=[];W.length>0&&nt.push({kind:"invocation",value:{skills:W.map(({name:qe,description:Tt})=>({name:qe,description:Tt}))}}),ye.length>0&&nt.push({kind:"attachment",files:ye.map(qe=>({id:qe.id,mimeType:qe.mimeType,name:qe.name,sizeBytes:qe.sizeBytes,previewUrl:qe.previewUrl}))}),M.trim()&&nt.push({kind:"text",text:M});const Xe=ye.map(qe=>qe.uri).filter(qe=>!!qe),Je=[W.map(qe=>`$${qe.name}`).join(" "),M.trim()].filter(Boolean).join(" "),Ke=Xe.length>0?[Je,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...Xe.map(qe=>`- ${qe}`)].filter(Boolean).join(` -`):Ze,tn=crypto.randomUUID(),ln=crypto.randomUUID(),rt=[{role:"user",blocks:nt,meta:{localId:tn,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:ln}}];W.current=ln,v(qe=>[...qe,...rt]),x(!0),m(qe=>(qe==null?void 0:qe.id)===re.id?{...qe,busy:!0,workspaceLocked:!0}:qe);try{const qe=await cn.sendMessage({sessionId:re.id,text:Ke,skillIds:Y.map(Nt=>Nt.id)},{signal:ze.signal,onApproval:Nt=>{Ve.current===ze&&(Q(""),O(Nt))},onApprovalResolved:Nt=>{Ve.current===ze&&O(mt=>(mt==null?void 0:mt.id)===Nt?null:mt)},onBlocks:Nt=>{Ve.current===ze&&v(mt=>{const Tt=mt.slice(),Jn=Tt.findIndex(kt=>{var Xs;return((Xs=kt.meta)==null?void 0:Xs.localId)===ln}),Cs=Tt[Jn];return(Cs==null?void 0:Cs.role)==="assistant"&&(Tt[Jn]={...Cs,blocks:Nt}),Tt})},onUsage:Nt=>{Ve.current===ze&&v(mt=>{const Tt=mt.slice(),Jn=Tt.findIndex(kt=>{var Xs;return((Xs=kt.meta)==null?void 0:Xs.localId)===ln}),Cs=Tt[Jn];return(Cs==null?void 0:Cs.role)==="assistant"&&(Tt[Jn]={...Cs,meta:{...Cs.meta,sandboxUsage:Nt.usage}}),Tt})}});if(Ve.current!==ze)return;P3({kind:re.toolName,source:"composer",sessionState:"existing",durationMs:Date.now()-ke}),v(Nt=>{const mt=Nt.slice(),Tt=mt.findIndex(Cs=>{var kt;return((kt=Cs.meta)==null?void 0:kt.localId)===ln}),Jn=mt[Tt];return(Jn==null?void 0:Jn.role)==="assistant"&&(mt[Tt]={...Jn,blocks:qe.blocks,meta:{...Jn.meta,ts:Date.now()/1e3,...qe.usage?{sandboxUsage:qe.usage.usage}:{}}}),mt})}catch(qe){if((qe==null?void 0:qe.name)==="AbortError"||Ve.current!==ze)return;rp({kind:re.toolName,source:"composer",sessionState:"existing",durationMs:Date.now()-ke,phase:"sandbox_send",error:qe}),v(Nt=>Nt.filter(mt=>{var Tt,Jn;return((Tt=mt.meta)==null?void 0:Tt.localId)!==tn&&((Jn=mt.meta)==null?void 0:Jn.localId)!==ln})),Pt(M),ot(U),Zn.setSelectedSkills(Y),je(`内置智能体发送失败:${qe instanceof Error?qe.message:String(qe)}`);try{const Nt=await cn.getSettings(re.id);m(mt=>(mt==null?void 0:mt.id)===re.id?{...mt,...Nt}:mt)}catch{}}finally{Ve.current===ze&&(Ve.current=null,W.current===ln&&(W.current=""),x(!1),O(null),m(qe=>(qe==null?void 0:qe.id)===re.id?{...qe,busy:!1}:qe))}}async function cK(M){if(await Zn.executeSlash(M)||!p||y||Zn.commandBusy)return;const U=zt,Y=Zn.selectedSkills;Pt(""),ot([]),Zn.setSelectedSkills([]),await CC(M.trim(),U,Y)}function yl(){To(),je(""),Hu(YD()),ft("agent"),_t(null),Vu(),sn(!1);const M=a&&xn.length===0&&zt.length>0?a:"";et.current="",l(""),Kn(null),Cn([]),d(!1),h([]),mn(Sa()),Nh(zt),ot([]),M&&Gu(M)}function uK(){var M;Wu.current=!0,localStorage.removeItem(Na.app),a&&((M=dn.current.get(a))==null||M.abort()),c.current=null,yl(),s(""),We({}),Os(null)}function dK(){Dn(null),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),yl()}async function fK(M){var U;try{(U=dn.current.get(M))==null||U.abort(),it(M,!1),await PS(n,ge,M),await DS(n,ge,M);const Y=rn.current.get(M);Y!==void 0&&window.clearTimeout(Y),rn.current.delete(M),ys(re=>{if(!re.has(M))return re;const xe=new Set(re);return xe.delete(M),xe}),ut(re=>{const{[M]:xe,...ke}=re;return ke}),M===a&&yl(),await E0(n)}catch(Y){je(String(Y))}}async function Oh(M){if(p&&To(),M!==a&&(et.current=M,je(""),d(!1),h([]),ft("agent"),_t(null),Vu(),mn(Sa()),Kn(null),Cn([]),l(M),Ot[M]===void 0)){Jg(!0);try{const U=await o1(n,ge,M);wt(M,fne(U.events??[],U.state))}catch(U){je(String(U))}finally{Jg(!1)}}}async function hK(M){if(!M.sessionId||!M.messageId){je("这条案例缺少会话定位信息,无法跳转。");return}_i(!1),Bt(null),As(!1),H(!1),oi(!1),_n(!1),BE(n),jG(M.kind),p0(M.messageId),await Oh(M.sessionId)}function pK(){const M=mC||n;_i(!1),Bt(null),As(!1),H(!1),oi(!1),Ki(""),Mi(M),h0("evaluations"),MG(IG),_n(!0),BE(""),p0("")}function mK(M){const U=new Map,Y=new Map;for(const re of M){if(!re.sessionId||!re.messageId)continue;const xe=U.get(re.sessionId)??new Set;if(xe.add(re.messageId),U.set(re.sessionId,xe),re.runtimeId&&re.userId){const ke=[re.runtimeId,n,re.userId,re.sessionId].join(":"),ze=Y.get(ke)??{runtimeId:re.runtimeId,appName:n,userId:re.userId,sessionId:re.sessionId,eventIds:new Set};ze.eventIds.add(re.messageId),Y.set(ke,ze)}}if(U.size!==0){ut(re=>{const xe={...re};for(const[ke,ze]of U){const nt=xe[ke];nt&&(xe[ke]=nt.map(Xe=>{var ct;return(ct=Xe.meta)!=null&&ct.eventId&&ze.has(Xe.meta.eventId)?{...Xe,meta:{...Xe.meta,feedback:void 0}}:Xe}))}return xe}),r(re=>re.map(xe=>{const ke=U.get(xe.id);if(!ke||!xe.state)return xe;const ze={...xe.state};for(const nt of ke)delete ze[`veadk_feedback:${nt}`];return{...xe,state:ze}})),ri(re=>{const xe=new Set(re);for(const ke of U.values())for(const ze of ke)xe.delete(ze);return xe});for(const re of Y.values())QB({runtimeId:re.runtimeId,appName:re.appName,userId:re.userId,sessionId:re.sessionId,eventIds:[...re.eventIds]});DG(re=>re&&(M.some(xe=>xe.id===re.id||xe.messageId===re.messageId)?null:re))}}async function IC(M=!0){if(a)return a;c.current||(c.current=a1(n,ge));const U=c.current;try{const Y=await U;M&&l(Y);const re=Date.now()/1e3,xe={id:Y,lastUpdateTime:re,events:[]};return r(ke=>[xe,...ke.filter(ze=>ze.id!==Y)]),Y}finally{c.current===U&&(c.current=null)}}async function gK(M){if(!n||!ge||!a||!ls)return!1;cs(!0),je("");try{const U=await FS(n,ge,a,M,ls.revision);return Kn(U),!0}catch(U){return je(String(U)),!1}finally{cs(!1)}}async function bK(M){if(!(!n||!ge||!a||!ls)){cs(!0),je("");try{const U=await v8(n,ge,a,M,ls.revision);Kn(U)}catch(U){je(String(U))}finally{cs(!1)}}}async function yK(M){je("");let U;try{U=await IC()}catch(re){je(String(re));return}const Y=Array.from(M).map(re=>({file:re,attachment:{id:WD(),mimeType:XD(re),name:re.name,sizeBytes:re.size,status:"uploading"}}));ot(re=>[...re,...Y.map(xe=>xe.attachment)]),await Promise.all(Y.map(async({file:re,attachment:xe})=>{try{const ke=await b8(n,ge,U,re);if(qn.current.delete(xe.id)){ke.uri&&await Qb(n,ke.uri);return}ot(ze=>ze.map(nt=>nt.id===xe.id?ke:nt))}catch(ke){if(qn.current.delete(xe.id))return;const ze=ke instanceof Error?ke.message:String(ke);ot(nt=>nt.map(Xe=>Xe.id===xe.id?{...Xe,status:"error",error:ze}:Xe)),je(ze)}}))}async function jC(M,U=[],Y=Sa(),re="composer"){if(!M.trim()&&U.length===0||So||ml||!n||!ge)return;je("");const xe=Date.now(),ke=!a,ze=ke?"new":"existing",nt=!!qi,Xe=[];(Y.skills.length>0||Y.targetAgent)&&Xe.push({kind:"invocation",value:Y}),U.length&&Xe.push({kind:"attachment",files:U.map(rt=>({id:rt.id,mimeType:rt.mimeType,data:rt.data,uri:rt.uri,name:rt.name,sizeBytes:rt.sizeBytes}))}),M.trim()&&Xe.push({kind:"text",text:M});const ct=[{role:"user",blocks:Xe,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];ke&&(h(ct),d(!0));const Ze=He;let Ke;try{Ke=await IC(!ke)}catch(rt){ke&&(h([]),d(!1),Pt(M),mn(Y)),nt&&rp({kind:"runtime",source:re,sessionState:ze,durationMs:Date.now()-xe,phase:"create_session",error:rt}),je(String(rt));return}let tn=Zv(ls);if(Ze)try{let rt=await US(n,ge,Ke);const Ws=Bke[Ze].filter(qe=>{var Nt;return(Nt=ye.builtinTools)==null?void 0:Nt.includes(qe)});for(const qe of[...YH[Ze],...Ws])rt.tools.some(Nt=>Nt.name===qe)||(rt=await FS(n,ge,Ke,{kind:"tool",name:qe},rt.revision));Kn(rt),tn=Zv(rt)}catch(rt){ke&&(h([]),d(!1),Pt(M),mn(Y)),nt&&rp({kind:"runtime",source:re,sessionState:ze,durationMs:Date.now()-xe,phase:"mount_task_capabilities",error:rt}),je(`任务能力挂载失败:${String(rt)}`);return}wt(Ke,rt=>ke?ct:[...rt,...ct]),ke&&(et.current=Ke,l(Ke),h([]),d(!1));const ln=new AbortController;dn.current.set(Ke,ln),de(Ke,!0),Ie(Ke),et.current=Ke,Ya(rt=>({...rt,[Ke]:""})),t0(rt=>({...rt,[Ke]:new Set})),wo(rt=>({...rt,[Ke]:[]}));try{let rt=Oa(),Ws="",qe=0,Nt=Date.now()/1e3,mt="",Tt="",Jn=!1,Cs=null;for await(const kt of jm({appName:n,userId:ge,sessionId:Ke,text:M,attachments:U,invocation:Y,signal:ln.signal,sessionCapabilities:tn})){if(ln.signal.aborted)break;const Xs=kt.error??kt.errorMessage??kt.error_message;if(typeof Xs=="string"&&Xs){Jn=!0,Cs=Xs,et.current===Ke&&je(Xs);break}l0(Ke,kt);const xa=kt.author&&kt.author!=="user"?kt.author:"";xa&&xa!==Ws&&(Ws=xa,rt=Oa()),rt=Tf(rt,kt);const ar=kt.usageMetadata??kt.usage_metadata;ar!=null&&ar.totalTokenCount&&(qe=ar.totalTokenCount),kt.timestamp&&(Nt=kt.timestamp),kt.id&&(mt=kt.id);const Ao=kt.invocationId??kt.invocation_id;Ao&&(Tt=Ao);const Bs=rt.blocks,Dh={author:Ws||void 0,tokens:qe||void 0,ts:Nt,eventId:mt||void 0,invocationId:Tt||void 0};wt(Ke,w0=>{var Ph;const Co=w0.slice(),Io=Co[Co.length-1];return(Io==null?void 0:Io.role)==="assistant"&&(!((Ph=Io.meta)!=null&&Ph.author)||Io.meta.author===Ws)?Co[Co.length-1]={...Io,blocks:Bs,meta:Dh}:Co.push({role:"assistant",blocks:Bs,meta:Dh}),Co})}E0(n),!ln.signal.aborted&&nt&&(Jn?rp({kind:"runtime",source:re,sessionState:ze,durationMs:Date.now()-xe,phase:"run_sse",error:Cs??"run_sse failed"}):P3({kind:"runtime",source:re,sessionState:ze,durationMs:Date.now()-xe})),!ln.signal.aborted&&!Jn&&mt&&xs.current()}catch(rt){(rt==null?void 0:rt.name)!=="AbortError"&&!ln.signal.aborted&&et.current===Ke&&(nt&&rp({kind:"runtime",source:re,sessionState:ze,durationMs:Date.now()-xe,phase:"run_sse",error:rt}),je(String(rt)))}finally{dn.current.get(Ke)===ln&&dn.current.delete(Ke),de(Ke,!1),Be(Ke),Ya(rt=>({...rt,[Ke]:""})),wo(rt=>({...rt,[Ke]:[]}))}}function xK(M,U){var xe,ke;const Y=((xe=M==null?void 0:M.event)==null?void 0:xe.name)??U.id,re=((ke=M==null?void 0:M.event)==null?void 0:ke.context)??{};jC(`[ui-action] ${Y}: ${JSON.stringify(re)}`,[],Sa(),"a2ui_action")}async function EK(M){var Xe,ct,Ze;if(!M.authUri)throw new Error("事件中没有授权地址。");if(!n||!ge||!a)throw new Error("会话尚未就绪。");const U=a,Y=await VMe(M.authUri),re=GMe(M.authConfig,Y),xe=Ke=>Ke.map(tn=>tn.kind==="auth"&&!tn.done?{...tn,done:!0}:tn);wt(U,Ke=>{const tn=Ke.slice(),ln=tn[tn.length-1];return(ln==null?void 0:ln.role)==="assistant"&&(tn[tn.length-1]={...ln,blocks:xe(ln.blocks)}),tn});const ke=xt[xt.length-1],ze=xe(ke&&ke.role==="assistant"?ke.blocks:[]),nt=new AbortController;dn.current.set(U,nt),de(U,!0),Ie(U);try{let Ke=Oa(),tn=((Xe=ke==null?void 0:ke.meta)==null?void 0:Xe.author)??"",ln=ze,rt=0,Ws=Date.now()/1e3,qe=((ct=ke==null?void 0:ke.meta)==null?void 0:ct.eventId)??"",Nt=((Ze=ke==null?void 0:ke.meta)==null?void 0:Ze.invocationId)??"",mt=!1;for await(const Tt of jm({appName:n,userId:ge,sessionId:a,text:"",functionResponses:[{id:M.callId,name:"adk_request_credential",response:re}],signal:nt.signal,sessionCapabilities:Zv(ls)})){if(nt.signal.aborted)break;const Jn=Tt.error??Tt.errorMessage??Tt.error_message;if(typeof Jn=="string"&&Jn){mt=!0,et.current===U&&je(Jn);break}l0(U,Tt);const Cs=Tt.author&&Tt.author!=="user"?Tt.author:"";Cs&&Cs!==tn&&(tn=Cs,ln=[],Ke=Oa()),Ke=Tf(Ke,Tt);const kt=Tt.usageMetadata??Tt.usage_metadata;kt!=null&&kt.totalTokenCount&&(rt=kt.totalTokenCount),Tt.timestamp&&(Ws=Tt.timestamp),Tt.id&&(qe=Tt.id);const Xs=Tt.invocationId??Tt.invocation_id;Xs&&(Nt=Xs);const xa=[...ln,...Ke.blocks];wt(U,ar=>{var w0,Co,Io,Ph,$C;const Ao=ar.slice(),Bs=Ao[Ao.length-1],Dh={author:tn||((w0=Bs==null?void 0:Bs.meta)==null?void 0:w0.author),tokens:rt||((Co=Bs==null?void 0:Bs.meta)==null?void 0:Co.tokens),ts:Ws,eventId:qe||((Io=Bs==null?void 0:Bs.meta)==null?void 0:Io.eventId),invocationId:Nt||((Ph=Bs==null?void 0:Bs.meta)==null?void 0:Ph.invocationId)};return(Bs==null?void 0:Bs.role)==="assistant"&&(!(($C=Bs.meta)!=null&&$C.author)||Bs.meta.author===tn)?Ao[Ao.length-1]={...Bs,blocks:xa,meta:Dh}:Ao.push({role:"assistant",blocks:xa,meta:Dh}),Ao})}E0(n),!nt.signal.aborted&&!mt&&qe&&xs.current()}catch(Ke){(Ke==null?void 0:Ke.name)!=="AbortError"&&!nt.signal.aborted&&et.current===U&&je(String(Ke))}finally{dn.current.get(U)===nt&&dn.current.delete(U),de(U,!1),Be(U),Ya(Ke=>({...Ke,[U]:""})),wo(Ke=>({...Ke,[U]:[]}))}}if(ne)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:ne}),o.jsx("button",{type:"button",onClick:qE,children:"重试"})]});if(qs===null)return o.jsx("div",{className:"boot"});if(qs==="unauthenticated")return o.jsx(aMe,{branding:Qn,cloudProvider:Dt,onUsername:XG});if(!St)return o.jsx("div",{className:"boot"});const Yr=St.capabilities.createAgents,RC=St.capabilities.manageAgents,xl=Yr?No:null,OC=Yr&&Ch,MC=Yr&&Ah,LC=qu&&!!(Sn||vC||wC),DC=lH(e,Xa),Mh=DC.filter(M=>M.runtimeId&&(yC===null||yC.has(M.runtimeId))).map(M=>{var U;return{...M,canDelete:M.runtimeId?((U=UG[M.runtimeId])==null?void 0:U.canDelete)===!0:!1}}),vK=(()=>{if(Mh.length===0)return Mh;const M=new Map(pC.map((U,Y)=>[U,Y]));return[...Mh].sort((U,Y)=>{const re=M.get(U.id),xe=M.get(Y.id);return re!=null&&xe!=null?re-xe:re!=null?-1:xe!=null?1:Mh.indexOf(U)-Mh.indexOf(Y)})})(),PC=M=>{var U;return((U=DC.find(Y=>Y.id===M))==null?void 0:U.label)??M},In=Xa.find(M=>M.runtimeId&&M.apps.some(U=>ho(M.id,U)===n)),qi=In&&In.runtimeId&&In.region?{runtimeId:In.runtimeId,name:In.name,region:In.region}:void 0,Lh=(qi==null?void 0:qi.runtimeId)??"",ko=In?In.apps.find(M=>ho(In.id,M)===n)??(At==null?void 0:At.appName)??In.apps[0]??In.name:"",wK=async M=>{var ke,ze,nt;const U=Xn,Y=a;if(!U||!Y)throw new Error("当前会话不可用,请关闭后重试。");const re=((ke=U.turn.meta)==null?void 0:ke.invocationId)??"",xe=Lh?[]:await l1(n,Y).catch(()=>[]);await BS({source:"agent_exec",module:"conversation",issues:M.issues,problem:"",description:M.description,page:"conversation",appName:ko||n,runtimeId:Lh,region:(qi==null?void 0:qi.region)??"cn-beijing",sessionId:Y,eventId:((ze=U.turn.meta)==null?void 0:ze.eventId)??((nt=U.turn.meta)==null?void 0:nt.localId)??"",invocationId:re,input:U.input,output:$c(U.turn),toolCalls:WR(U.turn),trace:nne(xe,re)})},_K=async M=>{const U=p?"":a,Y=p||U?xt:[],re=U&&n&&!Lh?await l1(n,U).catch(()=>[]):[];await BS({source:"platform",module:M.module,issues:M.issues,problem:"",description:M.description,page:vt??"unknown",appName:ko||n,runtimeId:Lh,region:(qi==null?void 0:qi.region)??"cn-beijing",sessionId:U,eventId:"",invocationId:"",input:Y.filter(xe=>xe.role==="user").map($c).filter(Boolean).join(` +`):Je,nn=crypto.randomUUID(),cn=crypto.randomUUID(),rt=[{role:"user",blocks:nt,meta:{localId:nn,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:cn}}];X.current=cn,v(qe=>[...qe,...rt]),x(!0),m(qe=>(qe==null?void 0:qe.id)===re.id?{...qe,busy:!0,workspaceLocked:!0}:qe);try{const qe=await un.sendMessage({sessionId:re.id,text:Ke,skillIds:W.map(Tt=>Tt.id)},{signal:He.signal,onApproval:Tt=>{ze.current===He&&(Z(""),O(Tt))},onApprovalResolved:Tt=>{ze.current===He&&O(mt=>(mt==null?void 0:mt.id)===Tt?null:mt)},onBlocks:Tt=>{ze.current===He&&v(mt=>{const kt=mt.slice(),Wn=kt.findIndex(At=>{var Qs;return((Qs=At.meta)==null?void 0:Qs.localId)===cn}),As=kt[Wn];return(As==null?void 0:As.role)==="assistant"&&(kt[Wn]={...As,blocks:Tt}),kt})},onUsage:Tt=>{ze.current===He&&v(mt=>{const kt=mt.slice(),Wn=kt.findIndex(At=>{var Qs;return((Qs=At.meta)==null?void 0:Qs.localId)===cn}),As=kt[Wn];return(As==null?void 0:As.role)==="assistant"&&(kt[Wn]={...As,meta:{...As.meta,sandboxUsage:Tt.usage}}),kt})}});if(ze.current!==He)return;P3({kind:re.toolName,source:"composer",sessionState:"existing",durationMs:Date.now()-Te}),v(Tt=>{const mt=Tt.slice(),kt=mt.findIndex(As=>{var At;return((At=As.meta)==null?void 0:At.localId)===cn}),Wn=mt[kt];return(Wn==null?void 0:Wn.role)==="assistant"&&(mt[kt]={...Wn,blocks:qe.blocks,meta:{...Wn.meta,ts:Date.now()/1e3,...qe.usage?{sandboxUsage:qe.usage.usage}:{}}}),mt})}catch(qe){if((qe==null?void 0:qe.name)==="AbortError"||ze.current!==He)return;rp({kind:re.toolName,source:"composer",sessionState:"existing",durationMs:Date.now()-Te,phase:"sandbox_send",error:qe}),v(Tt=>Tt.filter(mt=>{var kt,Wn;return((kt=mt.meta)==null?void 0:kt.localId)!==nn&&((Wn=mt.meta)==null?void 0:Wn.localId)!==cn})),Bt(M),ot(U),Yn.setSelectedSkills(W),Ie(`内置智能体发送失败:${qe instanceof Error?qe.message:String(qe)}`);try{const Tt=await un.getSettings(re.id);m(mt=>(mt==null?void 0:mt.id)===re.id?{...mt,...Tt}:mt)}catch{}}finally{ze.current===He&&(ze.current=null,X.current===cn&&(X.current=""),x(!1),O(null),m(qe=>(qe==null?void 0:qe.id)===re.id?{...qe,busy:!1}:qe))}}async function cK(M){if(await Yn.executeSlash(M)||!p||y||Yn.commandBusy)return;const U=Vt,W=Yn.selectedSkills;Bt(""),ot([]),Yn.setSelectedSkills([]),await CC(M.trim(),U,W)}function xl(){ko(),Ie(""),zu(YD()),ft("agent"),St(null),Gu(),rn(!1);const M=a&&bn.length===0&&Vt.length>0?a:"";Ze.current="",l(""),Tn(null),kn([]),d(!1),h([]),mn(Na()),Nh(Vt),ot([]),M&&Ku(M)}function uK(){var M;Xu.current=!0,localStorage.removeItem(Ta.app),a&&((M=Jt.current.get(a))==null||M.abort()),c.current=null,xl(),s(""),We({}),ms(null)}function dK(){Ms(null),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),xl()}async function fK(M){var U;try{(U=Jt.current.get(M))==null||U.abort(),it(M,!1),await PS(n,q,M),await DS(n,q,M);const W=an.current.get(M);W!==void 0&&window.clearTimeout(W),an.current.delete(M),An(re=>{if(!re.has(M))return re;const ye=new Set(re);return ye.delete(M),ye}),ut(re=>{const{[M]:ye,...Te}=re;return Te}),M===a&&xl(),await E0(n)}catch(W){Ie(String(W))}}async function Oh(M){if(p&&ko(),M!==a&&(Ze.current=M,Ie(""),d(!1),h([]),ft("agent"),St(null),Gu(),mn(Na()),Tn(null),kn([]),l(M),Mt[M]===void 0)){Jg(!0);try{const U=await o1(n,q,M);_t(M,fne(U.events??[],U.state))}catch(U){Ie(String(U))}finally{Jg(!1)}}}async function hK(M){if(!M.sessionId||!M.messageId){Ie("这条案例缺少会话定位信息,无法跳转。");return}Si(!1),Ut(null),ks(!1),H(!1),ci(!1),En(!1),BE(n),jG(M.kind),p0(M.messageId),await Oh(M.sessionId)}function pK(){const M=mC||n;Si(!1),Ut(null),ks(!1),H(!1),ci(!1),Wi(""),Di(M),h0("evaluations"),MG(IG),En(!0),BE(""),p0("")}function mK(M){const U=new Map,W=new Map;for(const re of M){if(!re.sessionId||!re.messageId)continue;const ye=U.get(re.sessionId)??new Set;if(ye.add(re.messageId),U.set(re.sessionId,ye),re.runtimeId&&re.userId){const Te=[re.runtimeId,n,re.userId,re.sessionId].join(":"),He=W.get(Te)??{runtimeId:re.runtimeId,appName:n,userId:re.userId,sessionId:re.sessionId,eventIds:new Set};He.eventIds.add(re.messageId),W.set(Te,He)}}if(U.size!==0){ut(re=>{const ye={...re};for(const[Te,He]of U){const nt=ye[Te];nt&&(ye[Te]=nt.map(Xe=>{var ct;return(ct=Xe.meta)!=null&&ct.eventId&&He.has(Xe.meta.eventId)?{...Xe,meta:{...Xe.meta,feedback:void 0}}:Xe}))}return ye}),r(re=>re.map(ye=>{const Te=U.get(ye.id);if(!Te||!ye.state)return ye;const He={...ye.state};for(const nt of Te)delete He[`veadk_feedback:${nt}`];return{...ye,state:He}})),ai(re=>{const ye=new Set(re);for(const Te of U.values())for(const He of Te)ye.delete(He);return ye});for(const re of W.values())QB({runtimeId:re.runtimeId,appName:re.appName,userId:re.userId,sessionId:re.sessionId,eventIds:[...re.eventIds]});DG(re=>re&&(M.some(ye=>ye.id===re.id||ye.messageId===re.messageId)?null:re))}}async function IC(M=!0){if(a)return a;c.current||(c.current=a1(n,q));const U=c.current;try{const W=await U;M&&l(W);const re=Date.now()/1e3,ye={id:W,lastUpdateTime:re,events:[]};return r(Te=>[ye,...Te.filter(He=>He.id!==W)]),W}finally{c.current===U&&(c.current=null)}}async function gK(M){if(!n||!q||!a||!is)return!1;Ss(!0),Ie("");try{const U=await FS(n,q,a,M,is.revision);return Tn(U),!0}catch(U){return Ie(String(U)),!1}finally{Ss(!1)}}async function bK(M){if(!(!n||!q||!a||!is)){Ss(!0),Ie("");try{const U=await v8(n,q,a,M,is.revision);Tn(U)}catch(U){Ie(String(U))}finally{Ss(!1)}}}async function yK(M){Ie("");let U;try{U=await IC()}catch(re){Ie(String(re));return}const W=Array.from(M).map(re=>({file:re,attachment:{id:WD(),mimeType:XD(re),name:re.name,sizeBytes:re.size,status:"uploading"}}));ot(re=>[...re,...W.map(ye=>ye.attachment)]),await Promise.all(W.map(async({file:re,attachment:ye})=>{try{const Te=await b8(n,q,U,re);if(Fn.current.delete(ye.id)){Te.uri&&await Qb(n,Te.uri);return}ot(He=>He.map(nt=>nt.id===ye.id?Te:nt))}catch(Te){if(Fn.current.delete(ye.id))return;const He=Te instanceof Error?Te.message:String(Te);ot(nt=>nt.map(Xe=>Xe.id===ye.id?{...Xe,status:"error",error:He}:Xe)),Ie(He)}}))}async function jC(M,U=[],W=Na(),re="composer"){if(!M.trim()&&U.length===0||No||gl||!n||!q)return;Ie("");const ye=Date.now(),Te=!a,He=Te?"new":"existing",nt=!!Xi,Xe=[];(W.skills.length>0||W.targetAgent)&&Xe.push({kind:"invocation",value:W}),U.length&&Xe.push({kind:"attachment",files:U.map(rt=>({id:rt.id,mimeType:rt.mimeType,data:rt.data,uri:rt.uri,name:rt.name,sizeBytes:rt.sizeBytes}))}),M.trim()&&Xe.push({kind:"text",text:M});const ct=[{role:"user",blocks:Xe,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];Te&&(h(ct),d(!0));const Je=$e;let Ke;try{Ke=await IC(!Te)}catch(rt){Te&&(h([]),d(!1),Bt(M),mn(W)),nt&&rp({kind:"runtime",source:re,sessionState:He,durationMs:Date.now()-ye,phase:"create_session",error:rt}),Ie(String(rt));return}let nn=Zv(is);if(Je)try{let rt=await US(n,q,Ke);const Xs=Fke[Je].filter(qe=>{var Tt;return(Tt=be.builtinTools)==null?void 0:Tt.includes(qe)});for(const qe of[...YH[Je],...Xs])rt.tools.some(Tt=>Tt.name===qe)||(rt=await FS(n,q,Ke,{kind:"tool",name:qe},rt.revision));Tn(rt),nn=Zv(rt)}catch(rt){Te&&(h([]),d(!1),Bt(M),mn(W)),nt&&rp({kind:"runtime",source:re,sessionState:He,durationMs:Date.now()-ye,phase:"mount_task_capabilities",error:rt}),Ie(`任务能力挂载失败:${String(rt)}`);return}_t(Ke,rt=>Te?ct:[...rt,...ct]),Te&&(Ze.current=Ke,l(Ke),h([]),d(!1));const cn=new AbortController;Jt.current.set(Ke,cn),de(Ke,!0),Ce(Ke),Ze.current=Ke,Wa(rt=>({...rt,[Ke]:""})),t0(rt=>({...rt,[Ke]:new Set})),_o(rt=>({...rt,[Ke]:[]}));try{let rt=Ma(),Xs="",qe=0,Tt=Date.now()/1e3,mt="",kt="",Wn=!1,As=null;for await(const At of jm({appName:n,userId:q,sessionId:Ke,text:M,attachments:U,invocation:W,signal:cn.signal,sessionCapabilities:nn})){if(cn.signal.aborted)break;const Qs=At.error??At.errorMessage??At.error_message;if(typeof Qs=="string"&&Qs){Wn=!0,As=Qs,Ze.current===Ke&&Ie(Qs);break}l0(Ke,At);const Ea=At.author&&At.author!=="user"?At.author:"";Ea&&Ea!==Xs&&(Xs=Ea,rt=Ma()),rt=kf(rt,At);const or=At.usageMetadata??At.usage_metadata;or!=null&&or.totalTokenCount&&(qe=or.totalTokenCount),At.timestamp&&(Tt=At.timestamp),At.id&&(mt=At.id);const Co=At.invocationId??At.invocation_id;Co&&(kt=Co);const Ls=rt.blocks,Dh={author:Xs||void 0,tokens:qe||void 0,ts:Tt,eventId:mt||void 0,invocationId:kt||void 0};_t(Ke,w0=>{var Ph;const Io=w0.slice(),jo=Io[Io.length-1];return(jo==null?void 0:jo.role)==="assistant"&&(!((Ph=jo.meta)!=null&&Ph.author)||jo.meta.author===Xs)?Io[Io.length-1]={...jo,blocks:Ls,meta:Dh}:Io.push({role:"assistant",blocks:Ls,meta:Dh}),Io})}E0(n),!cn.signal.aborted&&nt&&(Wn?rp({kind:"runtime",source:re,sessionState:He,durationMs:Date.now()-ye,phase:"run_sse",error:As??"run_sse failed"}):P3({kind:"runtime",source:re,sessionState:He,durationMs:Date.now()-ye})),!cn.signal.aborted&&!Wn&&mt&&ys.current()}catch(rt){(rt==null?void 0:rt.name)!=="AbortError"&&!cn.signal.aborted&&Ze.current===Ke&&(nt&&rp({kind:"runtime",source:re,sessionState:He,durationMs:Date.now()-ye,phase:"run_sse",error:rt}),Ie(String(rt)))}finally{Jt.current.get(Ke)===cn&&Jt.current.delete(Ke),de(Ke,!1),Pe(Ke),Wa(rt=>({...rt,[Ke]:""})),_o(rt=>({...rt,[Ke]:[]}))}}function xK(M,U){var ye,Te;const W=((ye=M==null?void 0:M.event)==null?void 0:ye.name)??U.id,re=((Te=M==null?void 0:M.event)==null?void 0:Te.context)??{};jC(`[ui-action] ${W}: ${JSON.stringify(re)}`,[],Na(),"a2ui_action")}async function EK(M){var Xe,ct,Je;if(!M.authUri)throw new Error("事件中没有授权地址。");if(!n||!q||!a)throw new Error("会话尚未就绪。");const U=a,W=await GMe(M.authUri),re=KMe(M.authConfig,W),ye=Ke=>Ke.map(nn=>nn.kind==="auth"&&!nn.done?{...nn,done:!0}:nn);_t(U,Ke=>{const nn=Ke.slice(),cn=nn[nn.length-1];return(cn==null?void 0:cn.role)==="assistant"&&(nn[nn.length-1]={...cn,blocks:ye(cn.blocks)}),nn});const Te=wt[wt.length-1],He=ye(Te&&Te.role==="assistant"?Te.blocks:[]),nt=new AbortController;Jt.current.set(U,nt),de(U,!0),Ce(U);try{let Ke=Ma(),nn=((Xe=Te==null?void 0:Te.meta)==null?void 0:Xe.author)??"",cn=He,rt=0,Xs=Date.now()/1e3,qe=((ct=Te==null?void 0:Te.meta)==null?void 0:ct.eventId)??"",Tt=((Je=Te==null?void 0:Te.meta)==null?void 0:Je.invocationId)??"",mt=!1;for await(const kt of jm({appName:n,userId:q,sessionId:a,text:"",functionResponses:[{id:M.callId,name:"adk_request_credential",response:re}],signal:nt.signal,sessionCapabilities:Zv(is)})){if(nt.signal.aborted)break;const Wn=kt.error??kt.errorMessage??kt.error_message;if(typeof Wn=="string"&&Wn){mt=!0,Ze.current===U&&Ie(Wn);break}l0(U,kt);const As=kt.author&&kt.author!=="user"?kt.author:"";As&&As!==nn&&(nn=As,cn=[],Ke=Ma()),Ke=kf(Ke,kt);const At=kt.usageMetadata??kt.usage_metadata;At!=null&&At.totalTokenCount&&(rt=At.totalTokenCount),kt.timestamp&&(Xs=kt.timestamp),kt.id&&(qe=kt.id);const Qs=kt.invocationId??kt.invocation_id;Qs&&(Tt=Qs);const Ea=[...cn,...Ke.blocks];_t(U,or=>{var w0,Io,jo,Ph,$C;const Co=or.slice(),Ls=Co[Co.length-1],Dh={author:nn||((w0=Ls==null?void 0:Ls.meta)==null?void 0:w0.author),tokens:rt||((Io=Ls==null?void 0:Ls.meta)==null?void 0:Io.tokens),ts:Xs,eventId:qe||((jo=Ls==null?void 0:Ls.meta)==null?void 0:jo.eventId),invocationId:Tt||((Ph=Ls==null?void 0:Ls.meta)==null?void 0:Ph.invocationId)};return(Ls==null?void 0:Ls.role)==="assistant"&&(!(($C=Ls.meta)!=null&&$C.author)||Ls.meta.author===nn)?Co[Co.length-1]={...Ls,blocks:Ea,meta:Dh}:Co.push({role:"assistant",blocks:Ea,meta:Dh}),Co})}E0(n),!nt.signal.aborted&&!mt&&qe&&ys.current()}catch(Ke){(Ke==null?void 0:Ke.name)!=="AbortError"&&!nt.signal.aborted&&Ze.current===U&&Ie(String(Ke))}finally{Jt.current.get(U)===nt&&Jt.current.delete(U),de(U,!1),Pe(U),Wa(Ke=>({...Ke,[U]:""})),_o(Ke=>({...Ke,[U]:[]}))}}if(ls)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:ls}),o.jsx("button",{type:"button",onClick:qE,children:"重试"})]});if(qs===null)return o.jsx("div",{className:"boot"});if(qs==="unauthenticated")return o.jsx(oMe,{branding:mi,cloudProvider:yt,onUsername:XG});if(!bt)return o.jsx("div",{className:"boot"});const Wr=bt.capabilities.createAgents,RC=bt.capabilities.manageAgents,El=Wr?To:null,OC=Wr&&Ch,MC=Wr&&Ah,LC=Yu&&!!(vn||vC||wC),DC=lH(e,Qa),Mh=DC.filter(M=>M.runtimeId&&(yC===null||yC.has(M.runtimeId))).map(M=>{var U;return{...M,canDelete:M.runtimeId?((U=UG[M.runtimeId])==null?void 0:U.canDelete)===!0:!1}}),vK=(()=>{if(Mh.length===0)return Mh;const M=new Map(pC.map((U,W)=>[U,W]));return[...Mh].sort((U,W)=>{const re=M.get(U.id),ye=M.get(W.id);return re!=null&&ye!=null?re-ye:re!=null?-1:ye!=null?1:Mh.indexOf(U)-Mh.indexOf(W)})})(),PC=M=>{var U;return((U=DC.find(W=>W.id===M))==null?void 0:U.label)??M},Cn=Qa.find(M=>M.runtimeId&&M.apps.some(U=>po(M.id,U)===n)),Xi=Cn&&Cn.runtimeId&&Cn.region?{runtimeId:Cn.runtimeId,name:Cn.name,region:Cn.region}:void 0,Lh=(Xi==null?void 0:Xi.runtimeId)??"",Ao=Cn?Cn.apps.find(M=>po(Cn.id,M)===n)??(Ct==null?void 0:Ct.appName)??Cn.apps[0]??Cn.name:"",wK=async M=>{var Te,He,nt;const U=qn,W=a;if(!U||!W)throw new Error("当前会话不可用,请关闭后重试。");const re=((Te=U.turn.meta)==null?void 0:Te.invocationId)??"",ye=Lh?[]:await l1(n,W).catch(()=>[]);await BS({source:"agent_exec",module:"conversation",issues:M.issues,problem:"",description:M.description,page:"conversation",appName:Ao||n,runtimeId:Lh,region:(Xi==null?void 0:Xi.region)??"cn-beijing",sessionId:W,eventId:((He=U.turn.meta)==null?void 0:He.eventId)??((nt=U.turn.meta)==null?void 0:nt.localId)??"",invocationId:re,input:U.input,output:Hc(U.turn),toolCalls:WR(U.turn),trace:nne(ye,re)})},_K=async M=>{const U=p?"":a,W=p||U?wt:[],re=U&&n&&!Lh?await l1(n,U).catch(()=>[]):[];await BS({source:"platform",module:M.module,issues:M.issues,problem:"",description:M.description,page:Lt??"unknown",appName:Ao||n,runtimeId:Lh,region:(Xi==null?void 0:Xi.region)??"cn-beijing",sessionId:U,eventId:"",invocationId:"",input:W.filter(ye=>ye.role==="user").map(Hc).filter(Boolean).join(` -`),output:Y.filter(xe=>xe.role==="assistant").map($c).filter(Boolean).join(` +`),output:W.filter(ye=>ye.role==="assistant").map(Hc).filter(Boolean).join(` -`),toolCalls:Y.flatMap(WR),trace:re})},BC=async(M,U,Y="")=>{var Xe,ct,Ze,Ke,tn,ln,rt,Ws;const re=(Xe=M.meta)==null?void 0:Xe.eventId,xe=a;if(!re||!xe||!qi||Dt==="byteplus")return;const ke=$c(M),ze=(ct=M.meta)==null?void 0:ct.feedback,nt={...ze,rating:U,syncStatus:"syncing",updatedAt:Date.now()/1e3};wt(xe,qe=>qe.map(Nt=>{var mt;return((mt=Nt.meta)==null?void 0:mt.eventId)===re?{...Nt,meta:{...Nt.meta,feedback:nt}}:Nt})),ri(qe=>new Set(qe).add(re)),In!=null&&In.runtimeId&&ko&&Xb({runtimeId:In.runtimeId,region:In.region??Ti(Dt),appName:ko,userId:ge,sessionId:xe,messageId:re,invocationId:(Ze=M.meta)==null?void 0:Ze.invocationId,rating:U,input:Y,output:ke,createdAt:(Ke=M.meta)!=null&&Ke.ts?new Date(M.meta.ts*1e3).toISOString():void 0});try{const qe=await o8({appName:n,userId:ge,sessionId:xe,eventId:re,rating:U});wt(xe,Nt=>Nt.map(mt=>{var Tt;return((Tt=mt.meta)==null?void 0:Tt.eventId)===re?{...mt,meta:{...mt.meta,feedback:qe}}:mt})),r(Nt=>Nt.map(mt=>mt.id===xe?{...mt,state:{...mt.state??{},[`veadk_feedback:${re}`]:qe}}:mt)),In!=null&&In.runtimeId&&ko&&(Xb({runtimeId:In.runtimeId,region:In.region??Ti(Dt),appName:ko,userId:ge,sessionId:xe,messageId:re,invocationId:(tn=M.meta)==null?void 0:tn.invocationId,rating:qe.rating,input:Y,output:ke,createdAt:(ln=M.meta)!=null&&ln.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),d8({runtimeId:In.runtimeId,region:In.region??Ti(Dt),appName:ko,pageSize:100}))}catch(qe){wt(xe,Nt=>Nt.map(mt=>{var Tt;return((Tt=mt.meta)==null?void 0:Tt.eventId)===re?{...mt,meta:{...mt.meta,feedback:ze}}:mt})),In!=null&&In.runtimeId&&ko&&Xb({runtimeId:In.runtimeId,region:In.region??Ti(Dt),appName:ko,userId:ge,sessionId:xe,messageId:re,invocationId:(rt=M.meta)==null?void 0:rt.invocationId,rating:(ze==null?void 0:ze.rating)??null,input:Y,output:ke,createdAt:(Ws=M.meta)!=null&&Ws.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),et.current===xe&&je(qe instanceof Error?qe.message:String(qe))}finally{ri(qe=>{const Nt=new Set(qe);return Nt.delete(re),Nt})}},v0=async M=>{jh(Ia());let U=Ge.current.get(M);U||(U=await m_(M),Ge.current.set(M,U)),We(U),bs(Y=>Y+1),s(M),rr(null),Ki(""),Mi(""),Es(!1),_n(!1),Bt(null),oi(!1),As(!1),H(!1),_i(!1),yl()},SK=async M=>{await v0(M)},NK=M=>{if(!Yr){je("当前账号没有添加 Agent 的权限。");return}Es(!1),_n(!1),b0(M),fe(null),Bt(null),H(!0),je("")},TK=async(M,U)=>{if(!M.runtime)throw new Error("缺少 Runtime 信息,无法连接智能体。");const Y=Date.now();try{const re=await dy(M.runtime.runtimeId,M.name,M.runtime.region,M.runtime.currentVersion);return mb({kind:"runtime",source:U,durationMs:Date.now()-Y,runtimeRegion:M.runtime.region,runtimeIsMine:M.isMine}),re}catch(re){throw Vw({kind:"runtime",source:U,durationMs:Date.now()-Y,error:re}),re}},UC=async(M,U={})=>{if(M.runtime)try{const Y=await TK(M,U.source??"my_agents");await v0(Y)}catch(Y){const re=Y instanceof Error?Y.message:String(Y);if(je(re),U.rethrow)throw new Error(re)}},kK=M=>{M.runtime&&(rr(M),Ki(""),Mi(""),Es(!1),_n(!0),je(""))},AK=M=>{if(!Yr){je("当前账号没有创建智能体的权限。");return}AC(M,!0)},XE=()=>{Dn(null),p&&To(),et.current="",l(""),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Ki(""),Mi(""),Es(!0),qr(null),je("")},CK=()=>{Dn(null),p&&To(),et.current="",l(""),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr("catalog"),je("")},IK=async M=>{if(BE(""),p0(""),M.runtimeId&&M.id.startsWith("detail:")){const U=Date.now();try{const Y=await dy(M.runtimeId,M.label,M.region??Ti(Dt),M.currentVersion);mb({kind:"runtime",source:"agent_workspace",durationMs:Date.now()-U,runtimeRegion:M.region}),await v0(Y)}catch(Y){Vw({kind:"runtime",source:"agent_workspace",durationMs:Date.now()-U,error:Y}),je(Y instanceof Error?Y.message:String(Y))}return}await v0(M.id)},QE=Sn!=null&&Sn.runtime?Xa.find(M=>{var U;return M.runtimeId===((U=Sn.runtime)==null?void 0:U.runtimeId)}):void 0,El=Sn!=null&&Sn.runtime?{id:`detail:${Sn.runtime.runtimeId}`,label:Sn.name,app:Sn.appName??Sn.name,remote:!0,runtimeApp:QE==null?void 0:QE.apps[0],runtimeId:Sn.runtime.runtimeId,region:Sn.runtime.region,currentVersion:Sn.runtime.currentVersion,canDelete:Sn.runtime.canDelete}:null,FC=vt!==null?"feedback":_c?"applications":PE?"search":gl||qu||Je||Fe?"agents":a||No||Ku||Ah||Ch?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Mne,{branding:Qn,cloudProvider:Dt,access:St,features:Ds,sessions:i,currentSessionId:a,activePage:FC,streamingSids:Yn,evaluatingSids:gn,onNewChat:dK,onSearch:()=>{Dn(null),p&&To(),Bt(null),oi(!1),As(!1),H(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),_i(!0),je("")},onQuickCreate:()=>{if(!Yr){je("当前账号没有添加 Agent 的权限。");return}p&&To(),et.current="",l(""),oi(!1),As(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),Bt(null),fe(null),b0(Ti(Dt)),H(!0),je("")},onSkillCenter:()=>{p&&To(),Bt(null),As(!1),H(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),oi(!0),je("")},onAddAgent:()=>{if(!Yr){je("当前账号没有添加 Agent 的权限。");return}p&&To(),et.current="",Bt(null),oi(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),l(""),H(!1),As(!0),je("")},onMyAgents:XE,onApplications:CK,onIssueFeedback:()=>{vt===null&&(Dn(FC??(p?"sandbox":a?"conversation":"workspace")),je(""))},onPickSession:M=>{Dn(null),Bt(null),oi(!1),As(!1),H(!1),_i(!1),_n(!1),rr(null),Pe(null),Ye(null),Es(!1),qr(null),je(""),Oh(M)},onDeleteSession:fK,userInfo:on,version:Eo,onLogout:QG}),(()=>{const M=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(vOe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:yl}),p?o.jsx(tMe,{appName:n,value:Ut,onChange:Pt,onSubmit:U=>void cK(U),disabled:!1,busy:y||Zn.commandBusy,attachments:zt,onAddFiles:oK,onRemoveAttachment:lK,actions:{onOpenTerminal:()=>void WE("terminal"),onOpenBrowser:()=>void WE("browser"),onOpenPermissions:()=>{_(""),k(!0)},onOpenWorkspace:()=>{_(""),j(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:ee||y},models:Zn.models,modelsLoading:Zn.modelsLoading,modelsLoaded:Zn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Zn.loadModels(),skills:Zn.skills,skillsLoading:Zn.skillsLoading,skillsLoaded:Zn.skillsLoaded,selectedSkills:Zn.selectedSkills,onRequestSkills:()=>void Zn.loadSkills(),onSelectedSkillsChange:Zn.setSelectedSkills}):o.jsx(Uke,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?PC(n):"Agent",value:Ut,onChange:Pt,onSubmit:()=>{if(!p&&at==="skill-create"){const xe=Ut.trim();if(!xe||Ht)return;const ke={id:`pending-${Date.now()}`,prompt:xe,status:"provisioning",candidates:CA.map((nt,Xe)=>({id:`pending-${Xe}`,model:nt,modelLabel:nt,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};sn(!0);const ze=++kn.current;je(""),un(ke),Pt(""),eRe(xe,nt=>{kn.current===ze&&un(nt)}).then(nt=>{kn.current===ze&&un(nt)}).catch(nt=>{kn.current===ze&&(un(null),Pt(xe),je(nt instanceof Error?nt.message:String(nt)))}).finally(()=>{kn.current===ze&&sn(!1)});return}const U=Ut;if(Pt(""),p){CC(U);return}const Y=zt,re=An;ot([]),mn(Sa()),jC(U,Y,re),b_(Y)},disabled:p?!1:!ge||at==="temporary"||at==="agent"&&!n,busy:p?y:at==="skill-create"?Ht:So,showMeta:xt.length>0&&!p,attachments:p?[]:zt,skills:p?[]:a0,agents:p?[]:o0,invocation:p?Sa():An,capabilitiesLoading:!p&&vn,allowAttachments:!p,onInvocationChange:mn,onAddFiles:yK,onRemoveAttachment:ME,newChatMode:p?"agent":at,newChatTask:p?null:He,newChatLayout:!p&&xt.length===0&&Vn===null,showAgentPicker:!p&&xt.length===0&&Vn===null&&at==="agent",agentPickerDisabled:!ge||So,selectedRuntimeId:qi==null?void 0:qi.runtimeId,runtimeScope:St.capabilities.runtimeScope,onSelectRuntime:async U=>{var Y;await UC({id:U.runtimeId,name:U.name,description:((Y=U.description)==null?void 0:Y.trim())||"暂无描述",createdAt:U.createdAt??"",specificationLabel:"地域",specification:Nf(U.region,Dt),isMine:U.isMine,runtime:{runtimeId:U.runtimeId,region:U.region,currentVersion:U.currentVersion,canDelete:U.canDelete}},{rethrow:!0,source:"new_chat_picker"})},onSelectSandboxSession:U=>YE(U,"new_chat_picker"),showModeSelector:!1,temporaryEnabled:ht&&ye.temporaryEnabled,skillCreateEnabled:ht&&ye.skillCreateEnabled,harnessEnabled:ht&&ye.harnessEnabled,builtinTools:ht?ye.builtinTools:[],onModeChange:U=>{if(!(U==="temporary"&&!ye.temporaryEnabled||U==="skill-create"&&!ye.skillCreateEnabled)){if(U==="temporary"){_t(null),ft(U),AC();return}if(ft(U),U!=="agent"&&_t(null),je(""),U==="skill-create"){mn(Sa());const Y=a&&xn.length===0&&zt.length>0?a:"";Nh(zt),ot([]),Y&&(et.current="",l(""),Gu(Y))}}},onTaskChange:_t})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Et&&o.jsx("div",{className:"error",role:"alert",children:Et}),Ln&&o.jsx("div",{className:"error",role:"alert",children:Ln}),CE&&o.jsxs("div",{className:"session-loading",children:[o.jsx(yn,{className:"icon spin"})," 加载会话…"]}),mC&&!LC&&!OC&&!MC&&!PE&&!Ku&&xl===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:pK,children:[o.jsx(Vk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),vt!==null?o.jsx(gMe,{initialModule:AMe(vt),onSubmit:_K}):_c==="coding-agents"?o.jsx(WTe,{onBack:()=>qr("catalog")}):_c==="feishu"?o.jsx(jTe,{onBack:()=>qr("catalog")}):_c&&_c!=="catalog"?o.jsx(eTe,{automation:_c,onBack:()=>qr("catalog")}):_c==="catalog"?o.jsx(WNe,{onOpen:qr}):Fe?o.jsx(qOe,{workspace:Fe,onBack:XE}):Je?o.jsx(HOe,{session:Je,onBack:XE,onOpen:()=>YE(Je,"sandbox_detail"),onDelete:()=>nK(Je)}):gl?o.jsx(_Ne,{cloudProvider:Dt,canCreate:Yr,runtimeScope:St.capabilities.runtimeScope,onCreateAgent:NK,onUseAgent:U=>UC(U,{source:"my_agents"}),onViewAgentDetails:kK,onCreateSandboxAgent:AK,onUseSandboxAgent:U=>YE(U,"my_agents"),onViewSandboxAgentDetails:tK,sandboxRefreshKey:me,connectedRuntimeId:Lh,hiddenRuntimeIds:FG,drafts:bt,deploymentTasks:c0,draftDeploymentTaskIds:LE,onViewDeploymentTask:VE,onEditDraft:U=>{Es(!1),fe(U.draft),tt("custom"),Kr(U.id),Sr.current=U,ya(U.deploymentTarget??null),Ki(""),Mi(""),Bt("custom"),je("")},onDeleteDraft:U=>_C([U])}):LC?o.jsx(fSe,{agents:El?[El]:vK,drafts:bt,agentOrder:pC,selectedAgentId:n,agentInfo:At,agentInfoAgentId:n,loadingAgentInfo:vn,canCreate:Yr,canUpdate:Yr||RC,loadingAgents:PG,agentsError:BG,deploymentTasks:c0,focusedDeploymentTaskId:vC,focusedAgentId:(El==null?void 0:El.id)??wC,focusedAgentSection:RG,focusedCaseKind:OG,feedbackCasePreview:LG,detailOnly:!0,onRetryAgents:()=>void HE(),onAgentOrderChange:zG,onDeleteAgents:VG,onDeleteDrafts:_C,onSelectAgent:SK,onTalkAgent:IK,onOpenFeedbackCase:U=>void hK(U),onFeedbackCasesDeleted:mK,onCreateAgent:()=>{if(!Yr){je("当前账号没有添加 Agent 的权限。");return}_n(!1),H(!0),Bt(null),fe(null),ya(null),b0(Ti(Dt)),Kr(""),Sr.current=null,Ki(""),Mi(""),je("")},onUpdateAgent:(U,Y)=>{var ze,nt;if(!RC&&!Yr){je("当前账号没有管理 Agent 的权限。");return}if(!Y.canUpdate){je(Y.reason||"当前 Runtime 不支持原地更新。");return}if(!Y.runtime.runtimeId){je("仅支持更新已部署的云端智能体。");return}if(!Y.runtime.region){je("Runtime 缺少地域信息,无法更新。");return}if(!((ze=Y.agent)!=null&&ze.appName)){je("Runtime 缺少智能体名称,无法更新。");return}const re=Object.fromEntries(Y.runtime.envs.map(({key:Xe,value:ct})=>[Xe,ct])),xe={...U,deployment:{...U.deployment??{feishuEnabled:!1},network:Y.runtime.network,envValues:{...re,...((nt=U.deployment)==null?void 0:nt.envValues)??{}}}};_n(!1),fe(xe),tt("custom");const ke=`runtime-${Y.runtime.runtimeId}`;Kr(ke),Sr.current=bt.find(Xe=>Xe.id===ke)??null,Ki(""),Mi(""),ya({runtimeId:Y.runtime.runtimeId,name:Y.runtime.name||Y.agent.name||U.name,region:Y.runtime.region,appName:Y.agent.appName,currentVersion:Y.runtime.currentVersion}),Bt("custom"),je("")},onEditDraft:U=>{_n(!1),fe(U.draft),tt("custom"),Kr(U.id),Sr.current=U,ya(U.deploymentTarget??null),Ki(""),Mi(""),Bt("custom"),je("")}},(El==null?void 0:El.id)??"workspace"):OC?o.jsx(WH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:DMe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{H(!1),fe(null),Bt("menu")}},{key:"package",icon:PMe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{H(!1),fe(null),Bt("package")}},{key:"migration",icon:BMe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):PE?o.jsx(Nne,{userId:ge,appId:n,agentInfo:At,capabilitiesLoading:vn,agentLabel:PC,onOpenSession:ZG}):MC?o.jsx(z_e,{onAdded:U=>{jh(Ia()),As(!1),s(U)},onCancel:()=>As(!1)}):Ku?o.jsx(F_e,{cloudProvider:Dt}):xl!==null&&!DE?o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[o.jsxs("div",{style:{fontSize:18,fontWeight:600},children:["需要配置",Dt==="byteplus"?"BytePlus":"火山引擎"," AK/SK"]}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要",Dt==="byteplus"?" BytePlus ":" Volcengine ","凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:Dt==="byteplus"?"BYTEPLUS_ACCESS_KEY":"VOLCENGINE_ACCESS_KEY"})," ","与"," ",o.jsx("code",{children:Dt==="byteplus"?"BYTEPLUS_SECRET_KEY":"VOLCENGINE_SECRET_KEY"})," ","后重试。"]})]}):xl==="menu"?o.jsx(lAe,{onSelect:U=>{fe(null),ya(null),Ki(""),Mi(""),U==="custom"&&tt("custom"),Kr(U==="custom"?`draft-${Date.now().toString(36)}`:""),Sr.current=null,Bt(U)},onImport:U=>{fe(U),tt("yaml_import"),ya(null),Ki(""),Mi(""),Kr(`draft-${Date.now().toString(36)}`),Sr.current=null,Bt("custom")}}):xl==="intelligent"?o.jsx(UAe,{userId:ge,cloudProvider:Dt,onBack:()=>Bt("menu"),onCreate:x0,onAgentAdded:zE,onDeploymentTaskChange:kh}):xl==="custom"?o.jsx(Tje,{cloudProvider:Dt,initialDraft:le??void 0,onBack:()=>Bt("menu"),onCreate:x0,onAgentAdded:zE,features:Ds,onDeploymentTaskChange:kh,createMode:Ae,deploymentTarget:Yu??void 0,initialDeployRegion:g0,onDraftChange:(U,Y)=>{Ys&&(Y?HG(Ys,U,Yu??void 0):SC(Ys))},onDiscard:Ys?()=>{SC(Ys),Kr(""),Sr.current=null,fe(null),ya(null),Ki(""),Mi(n),Bt(null),H(!1),_n(!0),je("")}:void 0,onDeploymentStarted:NC,onDeploymentComplete:TC},Ys||"custom"):xl==="template"?o.jsx(Cje,{cloudProvider:Dt,onBack:()=>Bt("menu"),onCreate:x0}):xl==="workflow"?o.jsx(Pje,{cloudProvider:Dt,onBack:()=>Bt("menu"),onCreate:x0}):xl==="package"?o.jsx(Hje,{cloudProvider:Dt,onBack:()=>{Bt(null),H(!0)},onAgentAdded:zE,onDeploymentTaskChange:kh,onDeploymentStarted:NC,onDeploymentComplete:TC,initialDeployRegion:g0}):xt.length===0&&Vn?o.jsx(mRe,{initialJob:Vn}):xt.length===0&&!ht?o.jsxs("div",{className:"session-loading",children:[o.jsx(yn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):xt.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(mOe,{canUpdate:St.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":at==="skill-create"?"想创建一个什么 Skill?":nr})]}),M]}),o.jsx(sOe,{})]},`welcome-${ye.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${i0?" is-streaming":""}`,ref:Rh,onScroll:GG,onWheel:KG,onTouchMove:qG,children:xt.map((U,Y)=>{var Ws,qe,Nt,mt,Tt,Jn,Cs;const re=Y===xt.length-1;if(U.role==="system")return U.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(wOe,{activity:U.activity,time:uT((Ws=U.meta)==null?void 0:Ws.ts)})},U.activity.id):null;if(U.role==="user"){const kt=U.blocks.map(ar=>ar.kind==="text"?ar.text:"").join(""),Xs=U.blocks.flatMap(ar=>ar.kind==="attachment"?ar.files:[]),xa=U.blocks.find(ar=>ar.kind==="invocation");return o.jsxs(is.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(xa==null?void 0:xa.kind)==="invocation"&&o.jsx(aE,{value:xa.value}),Xs.length>0&&o.jsx(oE,{appName:n,items:Xs}),kt&&o.jsx("div",{className:"bubble",children:o.jsx(ph,{text:kt})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((qe=U.meta)==null?void 0:qe.ts)&&o.jsx("span",{className:"meta-text",children:uT(U.meta.ts)}),o.jsx(KD,{text:kt})]})]},Y)}const xe=((Nt=U.meta)==null?void 0:Nt.author)??"",ke=xe&&Vi?cT(Vi,xe):void 0,ze=!!(xe&&r0.length>0&&!r0.includes(xe)),nt=(ke==null?void 0:ke.name)||xe,Xe=(ke==null?void 0:ke.description)||(ze?"正在执行主 Agent 移交的任务。":"");if(U.blocks.length>0&&U.blocks.every(kt=>kt.kind==="agent-transfer"))return null;const ct=U.blocks.length===0,Ze=((Tt=(mt=U.meta)==null?void 0:mt.feedback)==null?void 0:Tt.rating)??null,Ke=((Jn=U.meta)==null?void 0:Jn.eventId)??"",tn=pi.has(Ke),ln=!!(qi&&Ke&&$c(U)),rt=ln?GD(xt,Y):"";return o.jsxs(is.div,{ref:kt=>{Ke&&(kt?GE.current.set(Ke,kt):GE.current.delete(Ke))},className:["turn turn--assistant",ze?"turn--subagent":"",Ih&&Ih===Ke?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[ze&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(jee,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:nt})]}),o.jsx("p",{className:"subagent-run-description",title:Xe,children:Xe})]}),ct?re&&Wa?o.jsx(qH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(kA,{appName:n,blocks:U.blocks,streaming:re&&(Wa||_o),onStreamFrame:re?YG:void 0,onAction:xK,onAuth:EK,onArtifactDownload:(kt,Xs)=>p8(n,ge,a,kt,Xs),onArtifactPreview:(kt,Xs)=>g8(n,ge,a,kt,Xs)}),!(re&&Wa)&&!HMe(U)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(re&&Wa)&&!zMe(U)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Cs=U.meta)!=null&&Cs.sandboxUsage)?o.jsx(SOe,{usage:U.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[ln&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Ze==="good","aria-busy":tn,title:Ze==="good"?"取消点赞":"赞",disabled:tn,onClick:()=>void BC(U,Ze==="good"?null:"good",rt),children:o.jsx(kne,{className:"icon",filled:Ze==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Ze==="bad","aria-busy":tn,title:Ze==="bad"?"取消点踩":"踩",disabled:tn,onClick:()=>void BC(U,Ze==="bad"?null:"bad",rt),children:o.jsx(Ane,{className:"icon",filled:Ze==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>Jt({turn:U,input:GD(xt,Y)}),children:o.jsx(q8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var kt;wc((kt=U.meta)!=null&&kt.ts?U.meta.ts*1e3:Date.now()),qa(!0)},children:o.jsx(UMe,{})})]}),o.jsx(KD,{text:$c(U)})]}),U.meta&&o.jsx("span",{className:"meta-text",children:FMe(U.meta)})]})]})]},Y)})}),!p&&o.jsx(rhe,{appName:n,info:At,loading:vn,activeAgent:jE,seenAgents:RE,execPath:OE,capabilities:ls,capabilityLoading:Ss,capabilityMutating:Ks,builtinTools:hi,onAddCapability:gK,onRemoveCapability:U=>void bK(U)}),o.jsx("div",{className:"conversation-composer-slot",children:M})]})]})})})(),Xn&&a&&o.jsx(dMe,{onClose:()=>Jt(null),onSubmit:wK}),mi&&a&&o.jsx(nG,{appName:n,sessionId:a,endTimeMs:ba,onClose:()=>qa(!1)}),o.jsx(EOe,{open:X,state:ce,agentKind:we,error:be,onCancel:JG,onConfirm:M=>void eK(M)}),p?o.jsxs(o.Fragment,{children:[o.jsx(OOe,{open:R!==null,kind:R??"terminal",launch:z,loading:F,error:I,onReload:()=>{R&&WE(R)},onClose:()=>{B(null),L(null),C(!1),D("")}}),o.jsx(BOe,{open:T,value:p.permissions,busy:E||y,error:S,onSave:M=>void sK(M),onClose:()=>{E||(k(!1),_(""))}}),o.jsx(UOe,{open:A,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:S,browse:iK,onSave:M=>void rK(M),onClose:()=>{E||(j(!1),_(""))}}),o.jsx(MOe,{open:Zn.threadsOpen,threads:Zn.threads,currentThreadId:p.threadId,loading:Zn.threadsLoading,error:Zn.threadsError,onSelect:M=>void Zn.resumeThread(M),onClose:Zn.closeThreads}),o.jsx(FOe,{approval:$,busy:te,error:P,onDecision:M=>void aK(M)})]}):null,o.jsx(oMe,{open:Qt,checking:Ts,error:ks,onLogin:()=>void WG()}),$G&&o.jsx("div",{className:"confirm-scrim",onClick:()=>FE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:M=>M.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>FE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{fe(null),Bt("menu"),FE(!1)},children:"确定返回"})]})]})})]})}const ZD="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(ZD)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(ZD,String(t))}catch{}window.location.reload()}});(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||IW.createRoot(document.getElementById("root")).render(o.jsx(Lt.StrictMode,{children:o.jsx($W,{reducedMotion:"user",children:o.jsx(Eee,{maskOpacity:.9,children:o.jsx(JMe,{})})})}));export{XA as $,uye as A,dye as B,SF as C,o as D,pt as E,Fn as F,Kt as G,sLe as H,DV as I,kbe as J,wi as K,g as L,Wx as M,Ur as N,iLe as O,xV as P,Zp as Q,Lt as R,wu as S,pIe as T,SV as U,$i as V,br as W,Uu as X,xE as Y,_V as Z,Su as _,pa as a,hF as a0,LV as b,xIe as c,xL as d,Pf as e,er as f,rLe as g,oV as h,vc as i,vE as j,Vf as k,HAe as l,fLe as m,q2 as n,fge as o,XAe as p,qm as q,nn as r,Cbe as s,Dbe as t,pge as u,Gf as v,Dye as w,bbe as x,ybe as y,Vye as z}; +`),toolCalls:W.flatMap(WR),trace:re})},BC=async(M,U,W="")=>{var Xe,ct,Je,Ke,nn,cn,rt,Xs;const re=(Xe=M.meta)==null?void 0:Xe.eventId,ye=a;if(!re||!ye||!Xi||yt==="byteplus")return;const Te=Hc(M),He=(ct=M.meta)==null?void 0:ct.feedback,nt={...He,rating:U,syncStatus:"syncing",updatedAt:Date.now()/1e3};_t(ye,qe=>qe.map(Tt=>{var mt;return((mt=Tt.meta)==null?void 0:mt.eventId)===re?{...Tt,meta:{...Tt.meta,feedback:nt}}:Tt})),ai(qe=>new Set(qe).add(re)),Cn!=null&&Cn.runtimeId&&Ao&&Xb({runtimeId:Cn.runtimeId,region:Cn.region??ki(yt),appName:Ao,userId:q,sessionId:ye,messageId:re,invocationId:(Je=M.meta)==null?void 0:Je.invocationId,rating:U,input:W,output:Te,createdAt:(Ke=M.meta)!=null&&Ke.ts?new Date(M.meta.ts*1e3).toISOString():void 0});try{const qe=await o8({appName:n,userId:q,sessionId:ye,eventId:re,rating:U});_t(ye,Tt=>Tt.map(mt=>{var kt;return((kt=mt.meta)==null?void 0:kt.eventId)===re?{...mt,meta:{...mt.meta,feedback:qe}}:mt})),r(Tt=>Tt.map(mt=>mt.id===ye?{...mt,state:{...mt.state??{},[`veadk_feedback:${re}`]:qe}}:mt)),Cn!=null&&Cn.runtimeId&&Ao&&(Xb({runtimeId:Cn.runtimeId,region:Cn.region??ki(yt),appName:Ao,userId:q,sessionId:ye,messageId:re,invocationId:(nn=M.meta)==null?void 0:nn.invocationId,rating:qe.rating,input:W,output:Te,createdAt:(cn=M.meta)!=null&&cn.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),d8({runtimeId:Cn.runtimeId,region:Cn.region??ki(yt),appName:Ao,pageSize:100}))}catch(qe){_t(ye,Tt=>Tt.map(mt=>{var kt;return((kt=mt.meta)==null?void 0:kt.eventId)===re?{...mt,meta:{...mt.meta,feedback:He}}:mt})),Cn!=null&&Cn.runtimeId&&Ao&&Xb({runtimeId:Cn.runtimeId,region:Cn.region??ki(yt),appName:Ao,userId:q,sessionId:ye,messageId:re,invocationId:(rt=M.meta)==null?void 0:rt.invocationId,rating:(He==null?void 0:He.rating)??null,input:W,output:Te,createdAt:(Xs=M.meta)!=null&&Xs.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),Ze.current===ye&&Ie(qe instanceof Error?qe.message:String(qe))}finally{ai(qe=>{const Tt=new Set(qe);return Tt.delete(re),Tt})}},v0=async M=>{jh(ja());let U=Ge.current.get(M);U||(U=await m_(M),Ge.current.set(M,U)),We(U),gs(W=>W+1),s(M),ar(null),Wi(""),Di(""),Es(!1),En(!1),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),xl()},SK=async M=>{await v0(M)},NK=M=>{if(!Wr){Ie("当前账号没有添加 Agent 的权限。");return}Es(!1),En(!1),b0(M),fe(null),Ut(null),H(!0),Ie("")},TK=async(M,U)=>{if(!M.runtime)throw new Error("缺少 Runtime 信息,无法连接智能体。");const W=Date.now();try{const re=await dy(M.runtime.runtimeId,M.name,M.runtime.region,M.runtime.currentVersion);return mb({kind:"runtime",source:U,durationMs:Date.now()-W,runtimeRegion:M.runtime.region,runtimeIsMine:M.isMine}),re}catch(re){throw Vw({kind:"runtime",source:U,durationMs:Date.now()-W,error:re}),re}},UC=async(M,U={})=>{if(M.runtime)try{const W=await TK(M,U.source??"my_agents");await v0(W)}catch(W){const re=W instanceof Error?W.message:String(W);if(Ie(re),U.rethrow)throw new Error(re)}},kK=M=>{M.runtime&&(ar(M),Wi(""),Di(""),Es(!1),En(!0),Ie(""))},AK=M=>{if(!Wr){Ie("当前账号没有创建智能体的权限。");return}AC(M,!0)},XE=()=>{Ms(null),p&&ko(),Ze.current="",l(""),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Wi(""),Di(""),Es(!0),Yr(null),Ie("")},CK=()=>{Ms(null),p&&ko(),Ze.current="",l(""),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr("catalog"),Ie("")},IK=async M=>{if(BE(""),p0(""),M.runtimeId&&M.id.startsWith("detail:")){const U=Date.now();try{const W=await dy(M.runtimeId,M.label,M.region??ki(yt),M.currentVersion);mb({kind:"runtime",source:"agent_workspace",durationMs:Date.now()-U,runtimeRegion:M.region}),await v0(W)}catch(W){Vw({kind:"runtime",source:"agent_workspace",durationMs:Date.now()-U,error:W}),Ie(W instanceof Error?W.message:String(W))}return}await v0(M.id)},QE=vn!=null&&vn.runtime?Qa.find(M=>{var U;return M.runtimeId===((U=vn.runtime)==null?void 0:U.runtimeId)}):void 0,vl=vn!=null&&vn.runtime?{id:`detail:${vn.runtime.runtimeId}`,label:vn.name,app:vn.appName??vn.name,remote:!0,runtimeApp:QE==null?void 0:QE.apps[0],runtimeId:vn.runtime.runtimeId,region:vn.runtime.region,currentVersion:vn.runtime.currentVersion,canDelete:vn.runtime.canDelete}:null,FC=Lt!==null?"feedback":Sc?"applications":PE?"search":bl||Yu||et||Ue?"agents":a||To||qu||Ah||Ch?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Mne,{branding:mi,cloudProvider:yt,access:bt,features:oi,sessions:i,currentSessionId:a,activePage:FC,streamingSids:$n,evaluatingSids:xn,onNewChat:dK,onSearch:()=>{Ms(null),p&&ko(),Ut(null),ci(!1),ks(!1),H(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),Si(!0),Ie("")},onQuickCreate:()=>{if(!Wr){Ie("当前账号没有添加 Agent 的权限。");return}p&&ko(),Ze.current="",l(""),ci(!1),ks(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),Ut(null),fe(null),b0(ki(yt)),H(!0),Ie("")},onSkillCenter:()=>{p&&ko(),Ut(null),ks(!1),H(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),ci(!0),Ie("")},onAddAgent:()=>{if(!Wr){Ie("当前账号没有添加 Agent 的权限。");return}p&&ko(),Ze.current="",Ut(null),ci(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),l(""),H(!1),ks(!0),Ie("")},onMyAgents:XE,onApplications:CK,onIssueFeedback:()=>{Lt===null&&(Ms(FC??(p?"sandbox":a?"conversation":"workspace")),Ie(""))},onPickSession:M=>{Ms(null),Ut(null),ci(!1),ks(!1),H(!1),Si(!1),En(!1),ar(null),De(null),Ye(null),Es(!1),Yr(null),Ie(""),Oh(M)},onDeleteSession:fK,userInfo:Ve,version:Ki,onLogout:QG}),(()=>{const M=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(wOe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:xl}),p?o.jsx(nMe,{appName:n,value:Ft,onChange:Bt,onSubmit:U=>void cK(U),disabled:!1,busy:y||Yn.commandBusy,attachments:Vt,onAddFiles:oK,onRemoveAttachment:lK,actions:{onOpenTerminal:()=>void WE("terminal"),onOpenBrowser:()=>void WE("browser"),onOpenPermissions:()=>{_(""),k(!0)},onOpenWorkspace:()=>{_(""),j(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:te||y},models:Yn.models,modelsLoading:Yn.modelsLoading,modelsLoaded:Yn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Yn.loadModels(),skills:Yn.skills,skillsLoading:Yn.skillsLoading,skillsLoaded:Yn.skillsLoaded,selectedSkills:Yn.selectedSkills,onRequestSkills:()=>void Yn.loadSkills(),onSelectedSkillsChange:Yn.setSelectedSkills}):o.jsx($ke,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?PC(n):"Agent",value:Ft,onChange:Bt,onSubmit:()=>{if(!p&&at==="skill-create"){const ye=Ft.trim();if(!ye||zt)return;const Te={id:`pending-${Date.now()}`,prompt:ye,status:"provisioning",candidates:CA.map((nt,Xe)=>({id:`pending-${Xe}`,model:nt,modelLabel:nt,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};rn(!0);const He=++Sn.current;Ie(""),dn(Te),Bt(""),tRe(ye,nt=>{Sn.current===He&&dn(nt)}).then(nt=>{Sn.current===He&&dn(nt)}).catch(nt=>{Sn.current===He&&(dn(null),Bt(ye),Ie(nt instanceof Error?nt.message:String(nt)))}).finally(()=>{Sn.current===He&&rn(!1)});return}const U=Ft;if(Bt(""),p){CC(U);return}const W=Vt,re=Nn;ot([]),mn(Na()),jC(U,W,re),b_(W)},disabled:p?!1:!q||at==="temporary"||at==="agent"&&!n,busy:p?y:at==="skill-create"?zt:No,showMeta:wt.length>0&&!p,attachments:p?[]:Vt,skills:p?[]:a0,agents:p?[]:o0,invocation:p?Na():Nn,capabilitiesLoading:!p&&Mn,allowAttachments:!p,onInvocationChange:mn,onAddFiles:yK,onRemoveAttachment:ME,newChatMode:p?"agent":at,newChatTask:p?null:$e,newChatLayout:!p&&wt.length===0&&Gn===null,showAgentPicker:!p&&wt.length===0&&Gn===null&&at==="agent",agentPickerDisabled:!q||No,selectedRuntimeId:Xi==null?void 0:Xi.runtimeId,runtimeScope:bt.capabilities.runtimeScope,onSelectRuntime:async U=>{var W;await UC({id:U.runtimeId,name:U.name,description:((W=U.description)==null?void 0:W.trim())||"暂无描述",createdAt:U.createdAt??"",specificationLabel:"地域",specification:Tf(U.region,yt),isMine:U.isMine,runtime:{runtimeId:U.runtimeId,region:U.region,currentVersion:U.currentVersion,canDelete:U.canDelete}},{rethrow:!0,source:"new_chat_picker"})},onSelectSandboxSession:U=>YE(U,"new_chat_picker"),showModeSelector:!1,temporaryEnabled:ht&&be.temporaryEnabled,skillCreateEnabled:ht&&be.skillCreateEnabled,harnessEnabled:ht&&be.harnessEnabled,builtinTools:ht?be.builtinTools:[],onModeChange:U=>{if(!(U==="temporary"&&!be.temporaryEnabled||U==="skill-create"&&!be.skillCreateEnabled)){if(U==="temporary"){St(null),ft(U),AC();return}if(ft(U),U!=="agent"&&St(null),Ie(""),U==="skill-create"){mn(Na());const W=a&&bn.length===0&&Vt.length>0?a:"";Nh(Vt),ot([]),W&&(Ze.current="",l(""),Ku(W))}}},onTaskChange:St})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[xt&&o.jsx("div",{className:"error",role:"alert",children:xt}),Kn&&o.jsx("div",{className:"error",role:"alert",children:Kn}),CE&&o.jsxs("div",{className:"session-loading",children:[o.jsx(gn,{className:"icon spin"})," 加载会话…"]}),mC&&!LC&&!OC&&!MC&&!PE&&!qu&&El===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:pK,children:[o.jsx(Vk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),Lt!==null?o.jsx(bMe,{initialModule:CMe(Lt),onSubmit:_K}):Sc==="coding-agents"?o.jsx(QTe,{onBack:()=>Yr("catalog")}):Sc==="feishu"?o.jsx(OTe,{onBack:()=>Yr("catalog")}):Sc&&Sc!=="catalog"?o.jsx(nTe,{automation:Sc,onBack:()=>Yr("catalog")}):Sc==="catalog"?o.jsx(QNe,{onOpen:Yr}):Ue?o.jsx(YOe,{workspace:Ue,onBack:XE}):et?o.jsx(zOe,{session:et,onBack:XE,onOpen:()=>YE(et,"sandbox_detail"),onDelete:()=>nK(et)}):bl?o.jsx(NNe,{cloudProvider:yt,canCreate:Wr,runtimeScope:bt.capabilities.runtimeScope,onCreateAgent:NK,onUseAgent:U=>UC(U,{source:"my_agents"}),onViewAgentDetails:kK,onCreateSandboxAgent:AK,onUseSandboxAgent:U=>YE(U,"my_agents"),onViewSandboxAgentDetails:tK,sandboxRefreshKey:me,connectedRuntimeId:Lh,hiddenRuntimeIds:FG,drafts:Et,deploymentTasks:c0,draftDeploymentTaskIds:LE,onViewDeploymentTask:VE,onEditDraft:U=>{Es(!1),fe(U.draft),tt("custom"),qr(U.id),Nr.current=U,xa(U.deploymentTarget??null),Wi(""),Di(""),Ut("custom"),Ie("")},onDeleteDraft:U=>_C([U])}):LC?o.jsx(pSe,{agents:vl?[vl]:vK,drafts:Et,agentOrder:pC,selectedAgentId:n,agentInfo:Ct,agentInfoAgentId:n,loadingAgentInfo:Mn,canCreate:Wr,canUpdate:Wr||RC,loadingAgents:PG,agentsError:BG,deploymentTasks:c0,focusedDeploymentTaskId:vC,focusedAgentId:(vl==null?void 0:vl.id)??wC,focusedAgentSection:RG,focusedCaseKind:OG,feedbackCasePreview:LG,detailOnly:!0,onRetryAgents:()=>void HE(),onAgentOrderChange:zG,onDeleteAgents:VG,onDeleteDrafts:_C,onSelectAgent:SK,onTalkAgent:IK,onOpenFeedbackCase:U=>void hK(U),onFeedbackCasesDeleted:mK,onCreateAgent:()=>{if(!Wr){Ie("当前账号没有添加 Agent 的权限。");return}En(!1),H(!0),Ut(null),fe(null),xa(null),b0(ki(yt)),qr(""),Nr.current=null,Wi(""),Di(""),Ie("")},onUpdateAgent:(U,W)=>{var He,nt;if(!RC&&!Wr){Ie("当前账号没有管理 Agent 的权限。");return}if(!W.canUpdate){Ie(W.reason||"当前 Runtime 不支持原地更新。");return}if(!W.runtime.runtimeId){Ie("仅支持更新已部署的云端智能体。");return}if(!W.runtime.region){Ie("Runtime 缺少地域信息,无法更新。");return}if(!((He=W.agent)!=null&&He.appName)){Ie("Runtime 缺少智能体名称,无法更新。");return}const re=Object.fromEntries(W.runtime.envs.map(({key:Xe,value:ct})=>[Xe,ct])),ye={...U,deployment:{...U.deployment??{feishuEnabled:!1},network:W.runtime.network,envValues:{...re,...((nt=U.deployment)==null?void 0:nt.envValues)??{}}}};En(!1),fe(ye),tt("custom");const Te=`runtime-${W.runtime.runtimeId}`;qr(Te),Nr.current=Et.find(Xe=>Xe.id===Te)??null,Wi(""),Di(""),xa({runtimeId:W.runtime.runtimeId,name:W.runtime.name||W.agent.name||U.name,region:W.runtime.region,appName:W.agent.appName,currentVersion:W.runtime.currentVersion}),Ut("custom"),Ie("")},onEditDraft:U=>{En(!1),fe(U.draft),tt("custom"),qr(U.id),Nr.current=U,xa(U.deploymentTarget??null),Wi(""),Di(""),Ut("custom"),Ie("")}},(vl==null?void 0:vl.id)??"workspace"):OC?o.jsx(WH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:PMe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{H(!1),fe(null),Ut("menu")}},{key:"package",icon:BMe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{H(!1),fe(null),Ut("package")}},{key:"migration",icon:UMe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):PE?o.jsx(Nne,{userId:q,appId:n,agentInfo:Ct,capabilitiesLoading:Mn,agentLabel:PC,onOpenSession:ZG}):MC?o.jsx(G_e,{onAdded:U=>{jh(ja()),ks(!1),s(U)},onCancel:()=>ks(!1)}):qu?o.jsx(H_e,{cloudProvider:yt}):El!==null&&!DE?o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[o.jsxs("div",{style:{fontSize:18,fontWeight:600},children:["需要配置",yt==="byteplus"?"BytePlus":"火山引擎"," AK/SK"]}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要",yt==="byteplus"?" BytePlus ":" Volcengine ","凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:yt==="byteplus"?"BYTEPLUS_ACCESS_KEY":"VOLCENGINE_ACCESS_KEY"})," ","与"," ",o.jsx("code",{children:yt==="byteplus"?"BYTEPLUS_SECRET_KEY":"VOLCENGINE_SECRET_KEY"})," ","后重试。"]})]}):El==="menu"?o.jsx(cAe,{onSelect:U=>{fe(null),xa(null),Wi(""),Di(""),U==="custom"&&tt("custom"),qr(U==="custom"?`draft-${Date.now().toString(36)}`:""),Nr.current=null,Ut(U)},onImport:U=>{fe(U),tt("yaml_import"),xa(null),Wi(""),Di(""),qr(`draft-${Date.now().toString(36)}`),Nr.current=null,Ut("custom")}}):El==="intelligent"?o.jsx(FAe,{userId:q,cloudProvider:yt,onBack:()=>Ut("menu"),onCreate:x0,onAgentAdded:zE,onDeploymentTaskChange:kh}):El==="custom"?o.jsx(kje,{cloudProvider:yt,initialDraft:le??void 0,onBack:()=>Ut("menu"),onCreate:x0,onAgentAdded:zE,features:oi,onDeploymentTaskChange:kh,createMode:ke,deploymentTarget:Wu??void 0,initialDeployRegion:g0,onDraftChange:(U,W)=>{Ws&&(W?HG(Ws,U,Wu??void 0):SC(Ws))},onDiscard:Ws?()=>{SC(Ws),qr(""),Nr.current=null,fe(null),xa(null),Wi(""),Di(n),Ut(null),H(!1),En(!0),Ie("")}:void 0,onDeploymentStarted:NC,onDeploymentComplete:TC},Ws||"custom"):El==="template"?o.jsx(Ije,{cloudProvider:yt,onBack:()=>Ut("menu"),onCreate:x0}):El==="workflow"?o.jsx(Bje,{cloudProvider:yt,onBack:()=>Ut("menu"),onCreate:x0}):El==="package"?o.jsx(zje,{cloudProvider:yt,onBack:()=>{Ut(null),H(!0)},onAgentAdded:zE,onDeploymentTaskChange:kh,onDeploymentStarted:NC,onDeploymentComplete:TC,initialDeployRegion:g0}):wt.length===0&&Gn?o.jsx(gRe,{initialJob:Gn}):wt.length===0&&!ht?o.jsxs("div",{className:"session-loading",children:[o.jsx(gn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):wt.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(gOe,{canUpdate:bt.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":at==="skill-create"?"想创建一个什么 Skill?":rr})]}),M]}),o.jsx(iOe,{})]},`welcome-${be.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${i0?" is-streaming":""}`,ref:Rh,onScroll:GG,onWheel:KG,onTouchMove:qG,children:wt.map((U,W)=>{var Xs,qe,Tt,mt,kt,Wn,As;const re=W===wt.length-1;if(U.role==="system")return U.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(_Oe,{activity:U.activity,time:uT((Xs=U.meta)==null?void 0:Xs.ts)})},U.activity.id):null;if(U.role==="user"){const At=U.blocks.map(or=>or.kind==="text"?or.text:"").join(""),Qs=U.blocks.flatMap(or=>or.kind==="attachment"?or.files:[]),Ea=U.blocks.find(or=>or.kind==="invocation");return o.jsxs(es.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Ea==null?void 0:Ea.kind)==="invocation"&&o.jsx(aE,{value:Ea.value}),Qs.length>0&&o.jsx(oE,{appName:n,items:Qs}),At&&o.jsx("div",{className:"bubble",children:o.jsx(mh,{text:At})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((qe=U.meta)==null?void 0:qe.ts)&&o.jsx("span",{className:"meta-text",children:uT(U.meta.ts)}),o.jsx(KD,{text:At})]})]},W)}const ye=((Tt=U.meta)==null?void 0:Tt.author)??"",Te=ye&&qi?cT(qi,ye):void 0,He=!!(ye&&r0.length>0&&!r0.includes(ye)),nt=(Te==null?void 0:Te.name)||ye,Xe=(Te==null?void 0:Te.description)||(He?"正在执行主 Agent 移交的任务。":"");if(U.blocks.length>0&&U.blocks.every(At=>At.kind==="agent-transfer"))return null;const ct=U.blocks.length===0,Je=((kt=(mt=U.meta)==null?void 0:mt.feedback)==null?void 0:kt.rating)??null,Ke=((Wn=U.meta)==null?void 0:Wn.eventId)??"",nn=Ks.has(Ke),cn=!!(Xi&&Ke&&Hc(U)),rt=cn?GD(wt,W):"";return o.jsxs(es.div,{ref:At=>{Ke&&(At?GE.current.set(Ke,At):GE.current.delete(Ke))},className:["turn turn--assistant",He?"turn--subagent":"",Ih&&Ih===Ke?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[He&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(jee,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:nt})]}),o.jsx("p",{className:"subagent-run-description",title:Xe,children:Xe})]}),ct?re&&Xa?o.jsx(qH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(kA,{appName:n,blocks:U.blocks,streaming:re&&(Xa||So),onStreamFrame:re?YG:void 0,onAction:xK,onAuth:EK,onArtifactDownload:(At,Qs)=>p8(n,q,a,At,Qs),onArtifactPreview:(At,Qs)=>g8(n,q,a,At,Qs)}),!(re&&Xa)&&!zMe(U)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(re&&Xa)&&!VMe(U)&&o.jsxs("div",{className:"turn-meta",children:[p&&((As=U.meta)!=null&&As.sandboxUsage)?o.jsx(NOe,{usage:U.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[cn&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Je==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Je==="good","aria-busy":nn,title:Je==="good"?"取消点赞":"赞",disabled:nn,onClick:()=>void BC(U,Je==="good"?null:"good",rt),children:o.jsx(kne,{className:"icon",filled:Je==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Je==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Je==="bad","aria-busy":nn,title:Je==="bad"?"取消点踩":"踩",disabled:nn,onClick:()=>void BC(U,Je==="bad"?null:"bad",rt),children:o.jsx(Ane,{className:"icon",filled:Je==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>en({turn:U,input:GD(wt,W)}),children:o.jsx(q8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var At;_c((At=U.meta)!=null&&At.ts?U.meta.ts*1e3:Date.now()),Gi(!0)},children:o.jsx(FMe,{})})]}),o.jsx(KD,{text:Hc(U)})]}),U.meta&&o.jsx("span",{className:"meta-text",children:$Me(U.meta)})]})]})]},W)})}),!p&&o.jsx(ohe,{appName:n,info:Ct,loading:Mn,activeAgent:jE,seenAgents:RE,execPath:OE,capabilities:is,capabilityLoading:rs,capabilityMutating:Vs,builtinTools:_i,onAddCapability:gK,onRemoveCapability:U=>void bK(U)}),o.jsx("div",{className:"conversation-composer-slot",children:M})]})]})})})(),qn&&a&&o.jsx(fMe,{onClose:()=>en(null),onSubmit:wK}),os&&a&&o.jsx(nG,{appName:n,sessionId:a,endTimeMs:Ya,onClose:()=>Gi(!1)}),o.jsx(vOe,{open:Q,state:ce,agentKind:ve,error:ge,onCancel:JG,onConfirm:M=>void eK(M)}),p?o.jsxs(o.Fragment,{children:[o.jsx(MOe,{open:R!==null,kind:R??"terminal",launch:z,loading:F,error:I,onReload:()=>{R&&WE(R)},onClose:()=>{B(null),L(null),C(!1),D("")}}),o.jsx(UOe,{open:T,value:p.permissions,busy:E||y,error:S,onSave:M=>void sK(M),onClose:()=>{E||(k(!1),_(""))}}),o.jsx(FOe,{open:A,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:S,browse:iK,onSave:M=>void rK(M),onClose:()=>{E||(j(!1),_(""))}}),o.jsx(LOe,{open:Yn.threadsOpen,threads:Yn.threads,currentThreadId:p.threadId,loading:Yn.threadsLoading,error:Yn.threadsError,onSelect:M=>void Yn.resumeThread(M),onClose:Yn.closeThreads}),o.jsx($Oe,{approval:$,busy:ne,error:P,onDecision:M=>void aK(M)})]}):null,o.jsx(lMe,{open:Qt,checking:Ns,error:Ts,onLogin:()=>void WG()}),$G&&o.jsx("div",{className:"confirm-scrim",onClick:()=>FE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:M=>M.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>FE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{fe(null),Ut("menu"),FE(!1)},children:"确定返回"})]})]})})]})}const ZD="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(ZD)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(ZD,String(t))}catch{}window.location.reload()}});(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||IW.createRoot(document.getElementById("root")).render(o.jsx(Pt.StrictMode,{children:o.jsx($W,{reducedMotion:"user",children:o.jsx(Eee,{maskOpacity:.9,children:o.jsx(eLe,{})})})}));export{XA as $,fye as A,hye as B,SF as C,o as D,pt as E,Un as F,qt as G,iLe as H,DV as I,Cbe as J,wi as K,g as L,Wx as M,Fr as N,rLe as O,xV as P,Zp as Q,Pt as R,_u as S,mIe as T,SV as U,zi as V,yr as W,Fu as X,xE as Y,_V as Z,Nu as _,ma as a,hF as a0,LV as b,EIe as c,xL as d,Bf as e,sr as f,aLe as g,oV as h,wc as i,vE as j,Gf as k,zAe as l,hLe as m,q2 as n,pge as o,QAe as p,qm as q,sn as r,jbe as s,Bbe as t,gge as u,Kf as v,Bye as w,xbe as x,Ebe as y,Kye as z}; diff --git a/veadk/webui/assets/index-BVfXmA_H.css b/veadk/webui/assets/index-Gl3bdwkz.css similarity index 72% rename from veadk/webui/assets/index-BVfXmA_H.css rename to veadk/webui/assets/index-Gl3bdwkz.css index 4d8dd106..f6f48a36 100644 --- a/veadk/webui/assets/index-BVfXmA_H.css +++ b/veadk/webui/assets/index-Gl3bdwkz.css @@ -1,4 +1,4 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, -apple-system, system-ui, "Segoe UI", "Noto Sans", "Helvetica", "Arial", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;--font-mono:ui-monospace, "SFMono-Regular", "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;--spacing:.25rem;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:1024px;--breakpoint-xl:1280px;--breakpoint-2xl:1536px;--container-sm:24rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--breakpoint-xs:380px;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-2xs:.125rem;--radius-xs:.25rem;--radius-sm:.375rem;--radius-md:.5rem;--radius-lg:.625rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.25rem;--radius-4xl:1.5rem;--radius-full:9999px;--text-sm:var(--font-text-sm-size);--text-sm--line-height:var(--font-text-sm-line-height);--text-sm--font-weight:var(--font-text-sm-weight);--text-sm--letter-spacing:var(--font-text-sm-tracking);--tracking-wide:var(--font-tracking-wide);--tracking-normal:var(--font-tracking-normal);--tracking-tight:var(--font-tracking-tight);--shadow-hairline:var(--shadow-hairline)}:root,:where([data-theme]){--gray-500:#5d5d5d;--alpha-0:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-0:color-mix(in oklab, var(--alpha-base) 0%, transparent)}}:root,:where([data-theme]){--alpha-02:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-02:color-mix(in oklab, var(--alpha-base) 2%, transparent)}}:root,:where([data-theme]){--alpha-04:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-04:color-mix(in oklab, var(--alpha-base) 4%, transparent)}}:root,:where([data-theme]){--alpha-05:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-05:color-mix(in oklab, var(--alpha-base) 5%, transparent)}}:root,:where([data-theme]){--alpha-06:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-06:color-mix(in oklab, var(--alpha-base) 6%, transparent)}}:root,:where([data-theme]){--alpha-08:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-08:color-mix(in oklab, var(--alpha-base) 8%, transparent)}}:root,:where([data-theme]){--alpha-10:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-10:color-mix(in oklab, var(--alpha-base) 10%, transparent)}}:root,:where([data-theme]){--alpha-12:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-12:color-mix(in oklab, var(--alpha-base) 12%, transparent)}}:root,:where([data-theme]){--alpha-15:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-15:color-mix(in oklab, var(--alpha-base) 15%, transparent)}}:root,:where([data-theme]){--alpha-16:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-16:color-mix(in oklab, var(--alpha-base) 16%, transparent)}}:root,:where([data-theme]){--alpha-20:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-20:color-mix(in oklab, var(--alpha-base) 20%, transparent)}}:root,:where([data-theme]){--alpha-25:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-25:color-mix(in oklab, var(--alpha-base) 25%, transparent)}}:root,:where([data-theme]){--alpha-30:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-30:color-mix(in oklab, var(--alpha-base) 30%, transparent)}}:root,:where([data-theme]){--alpha-35:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-35:color-mix(in oklab, var(--alpha-base) 35%, transparent)}}:root,:where([data-theme]){--alpha-40:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-40:color-mix(in oklab, var(--alpha-base) 40%, transparent)}}:root,:where([data-theme]){--alpha-50:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-50:color-mix(in oklab, var(--alpha-base) 50%, transparent)}}:root,:where([data-theme]){--alpha-60:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-60:color-mix(in oklab, var(--alpha-base) 60%, transparent)}}:root,:where([data-theme]){--alpha-70:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-70:color-mix(in oklab, var(--alpha-base) 70%, transparent)}}:root,:where([data-theme]){--white:#fff;--black:#000;--green-25:#edfaf2;--green-50:#d9f4e4;--green-75:#b8ebcc;--green-100:#8cdfad;--green-200:#66d492;--green-300:#40c977;--green-400:#04b84c;--green-500:#00a240;--green-600:#008635;--green-700:#00692a;--green-800:#004f1f;--green-900:#003716;--green-950:#011c0b;--green-1000:#001207;--green-a25:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a25:color-mix(in oklab, var(--green-400) 8%, transparent)}}:root,:where([data-theme]){--green-a50:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a50:color-mix(in oklab, var(--green-400) 15%, transparent)}}:root,:where([data-theme]){--green-a75:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a75:color-mix(in oklab, var(--green-400) 29%, transparent)}}:root,:where([data-theme]){--green-a100:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a100:color-mix(in oklab, var(--green-400) 45%, transparent)}}:root,:where([data-theme]){--green-a200:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a200:color-mix(in oklab, var(--green-400) 60%, transparent)}}:root,:where([data-theme]){--green-a300:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a300:color-mix(in oklab, var(--green-400) 75%, transparent)}}:root,:where([data-theme]){--red-25:#fff0f0;--red-50:#ffd9d9;--red-75:#ffc6c5;--red-100:#ffa4a2;--red-200:#ff8583;--red-300:#ff6764;--red-400:#fa423e;--red-500:#e02e2a;--red-600:#ba2623;--red-700:#911e1b;--red-800:#6e1615;--red-900:#4d100e;--red-950:#280b0a;--red-1000:#1f0909;--red-a25:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a25:color-mix(in oklab, var(--red-400) 8%, transparent)}}:root,:where([data-theme]){--red-a50:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a50:color-mix(in oklab, var(--red-400) 16%, transparent)}}:root,:where([data-theme]){--red-a75:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a75:color-mix(in oklab, var(--red-400) 30%, transparent)}}:root,:where([data-theme]){--red-a100:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a100:color-mix(in oklab, var(--red-400) 48%, transparent)}}:root,:where([data-theme]){--red-a200:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a200:color-mix(in oklab, var(--red-400) 64%, transparent)}}:root,:where([data-theme]){--red-a300:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a300:color-mix(in oklab, var(--red-400) 79%, transparent)}}:root,:where([data-theme]){--pink-25:#fff4f9;--pink-50:#ffe8f3;--pink-75:#ffd4e8;--pink-100:#ffbada;--pink-200:#ffa3ce;--pink-300:#ff8cc1;--pink-400:#ff66ad;--pink-500:#e04c91;--pink-600:#ba437a;--pink-700:#963c67;--pink-800:#6e2c4a;--pink-900:#4d1f34;--pink-950:#29101c;--pink-1000:#1a0a11;--pink-a25:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a25:color-mix(in oklab, var(--pink-400) 8%, transparent)}}:root,:where([data-theme]){--pink-a50:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a50:color-mix(in oklab, var(--pink-400) 16%, transparent)}}:root,:where([data-theme]){--pink-a75:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a75:color-mix(in oklab, var(--pink-400) 28%, transparent)}}:root,:where([data-theme]){--pink-a100:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a100:color-mix(in oklab, var(--pink-400) 45%, transparent)}}:root,:where([data-theme]){--pink-a200:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a200:color-mix(in oklab, var(--pink-400) 60%, transparent)}}:root,:where([data-theme]){--pink-a300:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a300:color-mix(in oklab, var(--pink-400) 76%, transparent)}}:root,:where([data-theme]){--orange-25:#fff5f0;--orange-50:#ffe7d9;--orange-75:#ffcfb4;--orange-100:#ffb790;--orange-200:#ff9e6c;--orange-300:#ff8549;--orange-400:#fb6a22;--orange-500:#e25507;--orange-600:#b9480d;--orange-700:#923b0f;--orange-800:#6d2e0f;--orange-900:#4a2206;--orange-950:#281105;--orange-1000:#211107;--orange-a25:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a25:color-mix(in oklab, var(--orange-400) 7%, transparent)}}:root,:where([data-theme]){--orange-a50:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a50:color-mix(in oklab, var(--orange-400) 16%, transparent)}}:root,:where([data-theme]){--orange-a75:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a75:color-mix(in oklab, var(--orange-400) 33%, transparent)}}:root,:where([data-theme]){--orange-a100:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a100:color-mix(in oklab, var(--orange-400) 48%, transparent)}}:root,:where([data-theme]){--orange-a200:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a200:color-mix(in oklab, var(--orange-400) 65%, transparent)}}:root,:where([data-theme]){--orange-a300:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a300:color-mix(in oklab, var(--orange-400) 81%, transparent)}}:root,:where([data-theme]){--yellow-25:#fffbed;--yellow-50:#fff6d9;--yellow-75:#ffeeb8;--yellow-100:#ffe48c;--yellow-200:#ffdb66;--yellow-300:#ffd240;--yellow-400:#ffc300;--yellow-500:#e0ac00;--yellow-600:#ba8e00;--yellow-700:#916f00;--yellow-800:#6e5400;--yellow-900:#4d3b00;--yellow-950:#261d00;--yellow-1000:#1a1400;--yellow-a25:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a25:color-mix(in oklab, var(--yellow-400) 8%, transparent)}}:root,:where([data-theme]){--yellow-a50:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a50:color-mix(in oklab, var(--yellow-400) 15%, transparent)}}:root,:where([data-theme]){--yellow-a75:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a75:color-mix(in oklab, var(--yellow-400) 27%, transparent)}}:root,:where([data-theme]){--yellow-a100:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a100:color-mix(in oklab, var(--yellow-400) 45%, transparent)}}:root,:where([data-theme]){--yellow-a200:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a200:color-mix(in oklab, var(--yellow-400) 59%, transparent)}}:root,:where([data-theme]){--yellow-a300:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a300:color-mix(in oklab, var(--yellow-400) 74%, transparent)}}:root,:where([data-theme]){--purple-25:#f9f5fe;--purple-50:#efe5fe;--purple-75:#e0cefd;--purple-100:#ceb0fb;--purple-200:#be95fa;--purple-300:#ad7bf9;--purple-400:#924ff7;--purple-500:#8046d9;--purple-600:#6b3ab4;--purple-700:#532d8d;--purple-800:#3f226a;--purple-900:#2c184a;--purple-950:#160c25;--purple-1000:#100a19;--purple-a25:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a25:color-mix(in oklab, var(--purple-400) 6%, transparent)}}:root,:where([data-theme]){--purple-a50:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a50:color-mix(in oklab, var(--purple-400) 15%, transparent)}}:root,:where([data-theme]){--purple-a75:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a75:color-mix(in oklab, var(--purple-400) 28%, transparent)}}:root,:where([data-theme]){--purple-a100:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a100:color-mix(in oklab, var(--purple-400) 45%, transparent)}}:root,:where([data-theme]){--purple-a200:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a200:color-mix(in oklab, var(--purple-400) 60%, transparent)}}:root,:where([data-theme]){--purple-a300:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a300:color-mix(in oklab, var(--purple-400) 75%, transparent)}}:root,:where([data-theme]){--blue-25:#f5faff;--blue-50:#e5f3ff;--blue-75:#cce6ff;--blue-100:#99ceff;--blue-200:#66b5ff;--blue-300:#339cff;--blue-400:#0285ff;--blue-500:#0169cc;--blue-600:#004f99;--blue-700:#003f7a;--blue-800:#013566;--blue-900:#00284d;--blue-950:#000e1a;--blue-1000:#000d19;--blue-a25:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a25:color-mix(in oklab, var(--blue-400) 4%, transparent)}}:root,:where([data-theme]){--blue-a50:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a50:color-mix(in oklab, var(--blue-400) 13%, transparent)}}:root,:where([data-theme]){--blue-a75:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a75:color-mix(in oklab, var(--blue-400) 25%, transparent)}}:root,:where([data-theme]){--blue-a100:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a100:color-mix(in oklab, var(--blue-400) 40%, transparent)}}:root,:where([data-theme]){--blue-a200:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a200:color-mix(in oklab, var(--blue-400) 60%, transparent)}}:root,:where([data-theme]){--blue-a300:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a300:color-mix(in oklab, var(--blue-400) 80%, transparent)}}:root,:where([data-theme]){--hairline:1px}:where(:root),:where([data-theme=light]){--gray-0:#fff;--gray-25:#fcfcfc;--gray-50:#f9f9f9;--gray-75:#f3f3f3;--gray-100:#ededed;--gray-150:#dfdfdf;--gray-200:#cdcdcd;--gray-250:#b9b9b9;--gray-300:#afafaf;--gray-350:#9f9f9f;--gray-400:#8f8f8f;--gray-450:#767676;--gray-550:#4f4f4f;--gray-600:#414141;--gray-650:#393939;--gray-700:#303030;--gray-750:#282828;--gray-800:#212121;--gray-850:#1c1c1c;--gray-900:#181818;--gray-925:#161616;--gray-950:#131313;--gray-975:#101010;--gray-1000:#0d0d0d;--alpha-base:#0d0d0d}:where([data-theme=dark]){--gray-0:#0d0d0d;--gray-25:#101010;--gray-50:#131313;--gray-75:#161616;--gray-100:#181818;--gray-150:#1c1c1c;--gray-200:#212121;--gray-250:#282828;--gray-300:#303030;--gray-350:#393939;--gray-400:#414141;--gray-450:#4f4f4f;--gray-550:#767676;--gray-600:#8f8f8f;--gray-650:#9f9f9f;--gray-700:#afafaf;--gray-750:#b9b9b9;--gray-800:#cdcdcd;--gray-850:#dcdcdc;--gray-900:#ededed;--gray-925:#f3f3f3;--gray-950:#f3f3f3;--gray-975:#f9f9f9;--gray-1000:#fff;--alpha-base:#fff}@media (min-resolution:150dpi),(min-resolution:1.5x){:root,:where([data-theme]){--hairline:.5px}}:root,:where([data-theme]){--shadow-color:0 0 0;--elevation-100-geo:0 1px 2px -1px;--elevation-200-geo:0 2px 4px -1px;--elevation-300-geo:0 4px 8px -2px;--elevation-400-geo:0 8px 16px -4px}:where(:root),:where([data-theme=light]){--shadow-alpha-100:.08;--shadow-alpha-200:.08;--shadow-alpha-300:.1;--shadow-alpha-400:.12;--shadow-hairline-width:1px;--shadow-hairline-color:#00000014}@media (min-resolution:150dpi),(min-resolution:1.5x){:where(:root),:where([data-theme=light]){--shadow-hairline-width:.5px;--shadow-hairline-color:#0000001a}}:where([data-theme=dark]){--shadow-alpha-100:.2;--shadow-alpha-200:.2;--shadow-alpha-300:.36;--shadow-alpha-400:.3;--shadow-hairline-width:1px;--shadow-hairline-color:#ffffff1a}@media (min-resolution:150dpi),(min-resolution:1.5x){:where([data-theme=dark]){--shadow-hairline-width:.5px;--shadow-hairline-color:#ffffff1f}}:where([data-theme=dark]) [data-surface=elevated]{--shadow-hairline:0 0 #0000}:root,:where([data-theme]){--color-text:var(--gray-1000);--color-text-inverse:var(--gray-0);--color-text-primary:var(--color-text);--color-text-primary-soft:var(--color-text);--color-background-primary-soft-alt:var(--alpha-02);--color-border-primary-soft-alt:var(--alpha-06);--color-text-primary-soft-alt:var(--color-text);--color-text-primary-surface:var(--color-text);--color-text-primary-solid:var(--color-text-inverse);--color-text-primary-outline:var(--color-text);--color-text-primary-outline-hover:var(--color-text);--color-text-primary-ghost:var(--color-text);--color-text-primary-ghost-hover:var(--color-text);--color-ring-primary:var(--color-ring);--color-ring-primary-soft:var(--color-ring-primary);--color-ring-primary-solid:var(--color-ring-primary);--color-ring-primary-outline:var(--color-ring-primary);--color-ring-primary-ghost:var(--color-ring-primary);--color-text-secondary-soft:var(--color-text);--color-background-secondary-soft-alt:var(--alpha-02);--color-border-secondary-soft-alt:var(--alpha-06);--color-text-secondary-soft-alt:var(--color-text);--color-text-secondary-solid:var(--white);--color-text-secondary-outline:var(--color-text-secondary);--color-text-secondary-outline-hover:var(--color-text);--color-text-secondary-ghost:var(--color-text-secondary);--color-text-secondary-ghost-hover:var(--color-text);--color-ring-secondary:var(--color-ring);--color-ring-secondary-soft:var(--color-ring-secondary);--color-ring-secondary-solid:var(--color-ring-secondary);--color-ring-secondary-outline:var(--color-ring-secondary);--color-ring-secondary-ghost:var(--color-ring-secondary);--color-background-info-soft:var(--blue-50);--color-background-info-soft-hover:var(--blue-75);--color-background-info-soft-active:var(--blue-75);--color-background-info-soft-alpha:var(--blue-a50);--color-background-info-soft-alpha-hover:var(--blue-a75);--color-background-info-soft-alpha-active:var(--blue-a75);--color-background-info-solid:var(--blue-400);--color-background-info-solid-hover:var(--blue-500);--color-background-info-solid-active:var(--blue-500);--color-text-info-solid:var(--white);--color-background-info-outline-hover:var(--blue-a25);--color-background-info-outline-active:var(--blue-a25);--color-border-info-outline:var(--blue-500);--color-border-info-outline-hover:var(--blue-500);--color-text-info-outline:var(--blue-500);--color-text-info-outline-hover:var(--blue-500);--color-background-info-ghost-hover:var(--blue-a50);--color-background-info-ghost-active:var(--blue-a50);--color-ring-info:var(--color-ring);--color-ring-info-soft:var(--color-ring-info);--color-ring-info-solid:var(--color-ring-info);--color-ring-info-outline:var(--color-ring-info);--color-ring-info-ghost:var(--color-ring-info);--color-background-warning-soft:var(--orange-50);--color-background-warning-soft-hover:var(--orange-75);--color-background-warning-soft-active:var(--orange-75);--color-background-warning-soft-alpha:var(--orange-a50);--color-background-warning-soft-alpha-hover:var(--orange-a75);--color-background-warning-soft-alpha-active:var(--orange-a75);--color-background-warning-solid:var(--orange-500);--color-background-warning-solid-hover:var(--orange-600);--color-background-warning-solid-active:var(--orange-600);--color-text-warning-solid:var(--white);--color-background-warning-outline-hover:var(--orange-a25);--color-background-warning-outline-active:var(--orange-a25);--color-border-warning-outline:var(--orange-500);--color-border-warning-outline-hover:var(--orange-500);--color-text-warning-outline:var(--orange-500);--color-text-warning-outline-hover:var(--orange-500);--color-background-warning-ghost-hover:var(--orange-a50);--color-background-warning-ghost-active:var(--orange-a50);--color-text-warning-ghost:var(--orange-500);--color-text-warning-ghost-hover:var(--orange-500);--color-ring-warning:var(--color-ring);--color-ring-warning-soft:var(--color-ring-warning);--color-ring-warning-solid:var(--color-ring-warning);--color-ring-warning-outline:var(--color-ring-warning);--color-ring-warning-ghost:var(--color-ring-warning);--color-text-caution-hover:var(--yellow-800);--color-background-caution-soft:var(--yellow-50);--color-background-caution-soft-hover:var(--yellow-75);--color-background-caution-soft-active:var(--yellow-75);--color-background-caution-soft-alpha:var(--yellow-a50);--color-background-caution-soft-alpha-hover:var(--yellow-a75);--color-background-caution-soft-alpha-active:var(--yellow-a75);--color-background-caution-solid:var(--yellow-600);--color-background-caution-solid-hover:var(--yellow-700);--color-background-caution-solid-active:var(--yellow-700);--color-text-caution-solid:var(--white);--color-background-caution-outline-hover:var(--yellow-a25);--color-background-caution-outline-active:var(--yellow-a25);--color-border-caution-outline:var(--yellow-700);--color-border-caution-outline-hover:var(--yellow-700);--color-text-caution-outline:var(--yellow-700);--color-text-caution-outline-hover:var(--yellow-700);--color-background-caution-ghost-hover:var(--yellow-a50);--color-background-caution-ghost-active:var(--yellow-a50);--color-text-caution-ghost:var(--yellow-700);--color-text-caution-ghost-hover:var(--yellow-700);--color-ring-caution:var(--color-ring);--color-ring-caution-soft:var(--color-ring-caution);--color-ring-caution-solid:var(--color-ring-caution);--color-ring-caution-outline:var(--color-ring-caution);--color-ring-caution-ghost:var(--color-ring-caution);--color-background-danger-soft:var(--red-50);--color-background-danger-soft-hover:var(--red-75);--color-background-danger-soft-active:var(--red-75);--color-background-danger-soft-alpha:var(--red-a50);--color-background-danger-soft-alpha-hover:var(--red-a75);--color-background-danger-soft-alpha-active:var(--red-a75);--color-background-danger-solid:var(--red-500);--color-background-danger-solid-hover:var(--red-600);--color-background-danger-solid-active:var(--red-600);--color-text-danger-solid:var(--white);--color-background-danger-outline-hover:var(--red-a25);--color-background-danger-outline-active:var(--red-a25);--color-border-danger-outline:var(--red-500);--color-border-danger-outline-hover:var(--red-500);--color-text-danger-outline:var(--red-500);--color-text-danger-outline-hover:var(--red-500);--color-background-danger-ghost-hover:var(--red-a50);--color-background-danger-ghost-active:var(--red-a50);--color-text-danger-ghost:var(--red-500);--color-text-danger-ghost-hover:var(--red-500);--color-ring-danger:var(--red-200);--color-ring-danger-soft:var(--color-ring-danger);--color-ring-danger-solid:var(--color-ring-danger);--color-ring-danger-outline:var(--color-ring-danger);--color-ring-danger-ghost:var(--color-ring-danger);--color-background-success-soft:var(--green-50);--color-background-success-soft-hover:var(--green-75);--color-background-success-soft-active:var(--green-75);--color-background-success-soft-alpha:var(--green-a50);--color-background-success-soft-alpha-hover:var(--green-a75);--color-background-success-soft-alpha-active:var(--green-a75);--color-text-success-solid:var(--white);--color-background-success-outline-hover:var(--green-a25);--color-background-success-outline-active:var(--green-a25);--color-text-success-outline:var(--green-500);--color-text-success-outline-hover:var(--green-500);--color-background-success-ghost-hover:var(--green-a50);--color-background-success-ghost-active:var(--green-a50);--color-text-success-ghost:var(--green-500);--color-text-success-ghost-hover:var(--green-500);--color-ring-success:var(--color-ring);--color-ring-success-soft:var(--color-ring-info);--color-ring-success-solid:var(--color-ring-info);--color-ring-success-outline:var(--color-ring-info);--color-ring-success-ghost:var(--color-ring-info);--color-background-discovery-soft:var(--purple-50);--color-background-discovery-soft-hover:var(--purple-75);--color-background-discovery-soft-active:var(--purple-75);--color-background-discovery-soft-alpha:var(--purple-a50);--color-background-discovery-soft-alpha-hover:var(--purple-a75);--color-background-discovery-soft-alpha-active:var(--purple-a75);--color-background-discovery-solid:var(--purple-400);--color-background-discovery-solid-hover:var(--purple-500);--color-background-discovery-solid-active:var(--purple-500);--color-text-discovery-solid:var(--white);--color-background-discovery-outline-hover:var(--purple-a25);--color-background-discovery-outline-active:var(--purple-a25);--color-border-discovery-outline:var(--purple-500);--color-border-discovery-outline-hover:var(--purple-500);--color-background-discovery-ghost-hover:var(--purple-a50);--color-background-discovery-ghost-active:var(--purple-a50);--color-text-discovery-ghost:var(--purple-500);--color-text-discovery-ghost-hover:var(--purple-500);--color-ring-discovery:var(--color-ring);--color-ring-discovery-soft:var(--color-ring);--color-ring-discovery-solid:var(--color-ring);--color-ring-discovery-outline:var(--color-ring);--color-ring-discovery-ghost:var(--color-ring);--color-background-disabled:var(--alpha-05);--color-border-disabled:var(--alpha-06);--font-tracking-wide:0em;--font-tracking-normal:0em;--font-tracking-tight:0em;--font-heading-5xl-size:4.5rem;--font-heading-5xl-line-height:4.5rem;--font-heading-5xl-weight:var(--font-weight-semibold);--font-heading-5xl-tracking:var(--tracking-tight);--font-heading-4xl-size:3.75rem;--font-heading-4xl-line-height:3.75rem;--font-heading-4xl-weight:var(--font-weight-semibold);--font-heading-4xl-tracking:var(--tracking-tight);--font-heading-3xl-size:3rem;--font-heading-3xl-line-height:3rem;--font-heading-3xl-weight:var(--font-weight-semibold);--font-heading-3xl-tracking:var(--tracking-tight);--font-heading-2xl-size:2.25rem;--font-heading-2xl-line-height:2.625rem;--font-heading-2xl-weight:var(--font-weight-semibold);--font-heading-2xl-tracking:var(--tracking-tight);--font-heading-xl-size:2rem;--font-heading-xl-line-height:2.375rem;--font-heading-xl-weight:var(--font-weight-semibold);--font-heading-xl-tracking:var(--tracking-tight);--font-heading-lg-size:1.5rem;--font-heading-lg-line-height:1.75rem;--font-heading-lg-weight:var(--font-weight-semibold);--font-heading-lg-tracking:var(--tracking-normal);--font-heading-md-size:1.25rem;--font-heading-md-line-height:1.625rem;--font-heading-md-weight:var(--font-weight-semibold);--font-heading-md-tracking:var(--tracking-normal);--font-heading-sm-size:1.125rem;--font-heading-sm-line-height:1.625rem;--font-heading-sm-weight:var(--font-weight-semibold);--font-heading-sm-tracking:var(--tracking-normal);--font-heading-xs-size:1rem;--font-heading-xs-line-height:1.5rem;--font-heading-xs-weight:var(--font-weight-semibold);--font-heading-xs-tracking:var(--tracking-normal);--font-text-lg-size:1.125rem;--font-text-lg-line-height:1.8125rem;--font-text-lg-weight:var(--font-weight-normal);--font-text-lg-tracking:var(--tracking-normal);--font-text-md-size:1rem;--font-text-md-line-height:1.5rem;--font-text-md-weight:var(--font-weight-normal);--font-text-md-tracking:var(--tracking-normal);--font-text-sm-size:.875rem;--font-text-sm-line-height:1.25rem;--font-text-sm-weight:var(--font-weight-normal);--font-text-sm-tracking:var(--tracking-normal);--font-text-xs-size:.75rem;--font-text-xs-line-height:1.125rem;--font-text-xs-weight:var(--font-weight-normal);--font-text-xs-tracking:var(--tracking-wide);--font-text-2xs-size:.625rem;--font-text-2xs-line-height:.875rem;--font-text-2xs-weight:var(--font-weight-normal);--font-text-2xs-tracking:var(--tracking-wide);--font-text-3xs-size:.5rem;--font-text-3xs-line-height:.75rem;--font-text-3xs-weight:var(--font-weight-normal);--font-text-3xs-tracking:var(--tracking-wide);--control-size-3xs:1.375rem;--control-size-2xs:1.5rem;--control-size-xs:1.625rem;--control-size-sm:1.75rem;--control-size-md:2rem;--control-size-lg:2.25rem;--control-size-xl:2.5rem;--control-size-2xl:2.75rem;--control-size-3xl:3rem;--control-gutter-2xs:.375rem;--control-gutter-xs:.5rem;--control-gutter-sm:.625rem;--control-gutter-md:.75rem;--control-gutter-lg:.875rem;--control-gutter-xl:1rem;--control-gutter-pill-scaling:1.33;--control-radius-sm:var(--radius-sm);--control-radius-md:var(--radius-md);--control-radius-lg:var(--radius-lg);--control-radius-xl:var(--radius-xl);--control-font-size-sm:var(--font-text-xs-size);--control-font-size-md:var(--font-text-sm-size);--control-font-size-lg:var(--font-text-md-size);--control-icon-size-xs:.875rem;--control-icon-size-sm:1rem;--control-icon-size-md:1.125rem;--control-icon-size-lg:1.25rem;--control-icon-size-xl:1.375rem;--control-icon-size-2xl:1.5rem;--cubic-enter:cubic-bezier(.19, 1, .22, 1);--cubic-exit:cubic-bezier(.8, 0, .4, 1);--cubic-exit-snappy:cubic-bezier(.65, 0, .4, 1);--cubic-move:cubic-bezier(.65, 0, .35, 1);--transition-duration-basic:.15s;--transition-ease-basic:ease;--scrollbar-color:var(--alpha-30);--shadow-hairline:0 0 0 var(--shadow-hairline-width) var(--shadow-hairline-color);--shadow-100:var(--elevation-100-geo) rgb(var(--shadow-color) / var(--shadow-alpha-100));--shadow-100-strong:var(--elevation-100-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-100) * 1.25));--shadow-100-stronger:var(--elevation-100-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-100) * 1.6));--shadow-200:var(--elevation-200-geo) rgb(var(--shadow-color) / var(--shadow-alpha-200));--shadow-200-strong:var(--elevation-200-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-200) * 1.25));--shadow-200-stronger:var(--elevation-200-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-200) * 1.6));--shadow-300:var(--elevation-300-geo) rgb(var(--shadow-color) / var(--shadow-alpha-300));--shadow-300-strong:var(--elevation-300-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-300) * 1.25));--shadow-300-stronger:var(--elevation-300-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-300) * 1.6));--shadow-400:var(--elevation-400-geo) rgb(var(--shadow-color) / var(--shadow-alpha-400));--shadow-400-strong:var(--elevation-400-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-400) * 1.25));--shadow-400-stronger:var(--elevation-400-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-400) * 1.6))}:where(:root),:where([data-theme=light]){--color-text-secondary:var(--gray-500);--color-text-tertiary:var(--gray-400);--color-ring:var(--blue-500);--color-background-primary-soft:var(--gray-100);--color-background-primary-soft-hover:var(--gray-150);--color-background-primary-soft-active:var(--gray-200);--color-background-primary-soft-alpha:var(--alpha-08);--color-background-primary-soft-alpha-hover:var(--alpha-12);--color-background-primary-soft-alpha-active:var(--alpha-16);--color-background-primary-surface:var(--alpha-05);--color-border-primary-surface:var(--alpha-05);--color-background-primary-solid:var(--gray-900);--color-background-primary-solid-hover:var(--gray-700);--color-background-primary-solid-active:var(--gray-600);--color-background-primary-outline-hover:var(--alpha-02);--color-background-primary-outline-active:var(--alpha-04);--color-border-primary-outline:var(--alpha-16);--color-border-primary-outline-hover:var(--alpha-20);--color-background-primary-ghost-hover:var(--alpha-08);--color-background-primary-ghost-active:var(--alpha-12);--color-background-secondary-soft:var(--gray-100);--color-background-secondary-soft-hover:var(--gray-150);--color-background-secondary-soft-active:var(--gray-200);--color-background-secondary-soft-alpha:var(--alpha-08);--color-background-secondary-soft-alpha-hover:var(--alpha-12);--color-background-secondary-soft-alpha-active:var(--alpha-16);--color-background-secondary-solid:var(--gray-500);--color-background-secondary-solid-hover:var(--gray-600);--color-background-secondary-solid-active:var(--gray-700);--color-background-secondary-outline-hover:var(--alpha-02);--color-background-secondary-outline-active:var(--alpha-04);--color-border-secondary-outline:var(--alpha-16);--color-border-secondary-outline-hover:var(--alpha-20);--color-background-secondary-ghost-hover:var(--alpha-08);--color-background-secondary-ghost-active:var(--alpha-12);--color-text-info:var(--blue-500);--color-text-info-soft:var(--blue-600);--color-background-info-surface:var(--blue-a25);--color-border-info-surface:var(--blue-a25);--color-text-info-surface:var(--blue-600);--color-text-info-ghost:var(--blue-500);--color-text-info-ghost-hover:var(--blue-500);--color-text-warning:var(--orange-700);--color-text-warning-soft:var(--orange-700);--color-background-warning-surface:var(--orange-a25);--color-border-warning-surface:var(--orange-a25);--color-text-warning-surface:var(--orange-700);--color-text-caution:var(--yellow-700);--color-text-caution-soft:var(--yellow-800);--color-background-caution-surface:var(--yellow-a25);--color-border-caution-surface:var(--yellow-a25);--color-text-caution-surface:var(--yellow-800);--color-text-danger:var(--red-700);--color-text-danger-soft:var(--red-600);--color-background-danger-surface:var(--red-a25);--color-border-danger-surface:var(--red-a25);--color-text-danger-surface:var(--red-600);--color-text-success:var(--green-700);--color-text-success-soft:var(--green-600);--color-background-success-surface:var(--green-a25);--color-border-success-surface:var(--green-a25);--color-text-success-surface:var(--green-600);--color-background-success-solid:var(--green-500);--color-background-success-solid-hover:var(--green-500);--color-background-success-solid-active:var(--green-500);--color-border-success-outline:var(--green-500);--color-border-success-outline-hover:var(--green-500);--color-text-discovery:var(--purple-700);--color-text-discovery-soft:var(--purple-600);--color-background-discovery-surface:var(--purple-a25);--color-border-discovery-surface:var(--purple-a25);--color-text-discovery-surface:var(--purple-600);--color-text-discovery-outline:var(--purple-500);--color-text-discovery-outline-hover:var(--purple-500);--color-text-disabled:var(--gray-400);--color-border-subtle:var(--alpha-05);--color-border:var(--alpha-10);--color-border-strong:var(--alpha-15);--shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--color-surface:var(--gray-0);--color-surface-secondary:var(--gray-50);--color-surface-tertiary:var(--gray-75);--color-surface-elevated:var(--gray-0);--color-surface-elevated-secondary:var(--gray-50)}:where([data-theme=dark]){--color-text-secondary:var(--gray-700);--color-text-tertiary:var(--gray-600);--color-ring:var(--blue-400);--color-background-primary-soft:var(--gray-300);--color-background-primary-soft-hover:var(--gray-350);--color-background-primary-soft-active:var(--gray-400);--color-background-primary-soft-alpha:var(--alpha-12);--color-background-primary-soft-alpha-hover:var(--alpha-16);--color-background-primary-soft-alpha-active:var(--alpha-20);--color-background-primary-surface:var(--alpha-08);--color-border-primary-surface:var(--alpha-08);--color-background-primary-solid:var(--gray-950);--color-background-primary-solid-hover:var(--gray-900);--color-background-primary-solid-active:var(--gray-850);--color-background-primary-outline-hover:var(--alpha-04);--color-background-primary-outline-active:var(--alpha-06);--color-border-primary-outline:var(--alpha-25);--color-border-primary-outline-hover:var(--alpha-30);--color-background-primary-ghost-hover:var(--alpha-12);--color-background-primary-ghost-active:var(--alpha-16);--color-background-secondary-soft:var(--gray-300);--color-background-secondary-soft-hover:var(--gray-350);--color-background-secondary-soft-active:var(--gray-400);--color-background-secondary-soft-alpha:var(--alpha-12);--color-background-secondary-soft-alpha-hover:var(--alpha-16);--color-background-secondary-soft-alpha-active:var(--alpha-20);--color-background-secondary-solid:var(--gray-400);--color-background-secondary-solid-hover:var(--gray-450);--color-background-secondary-solid-active:var(--gray-500);--color-background-secondary-outline-hover:var(--alpha-04);--color-background-secondary-outline-active:var(--alpha-06);--color-border-secondary-outline:var(--alpha-25);--color-border-secondary-outline-hover:var(--alpha-30);--color-background-secondary-ghost-hover:var(--alpha-12);--color-background-secondary-ghost-active:var(--alpha-16);--color-text-info:var(--blue-200);--color-text-info-soft:var(--blue-300);--color-background-info-surface:var(--blue-a50);--color-border-info-surface:var(--blue-a50);--color-text-info-surface:var(--blue-300);--color-text-info-ghost:var(--blue-200);--color-text-info-ghost-hover:var(--blue-200);--color-text-warning:var(--orange-500);--color-text-warning-soft:var(--orange-400);--color-background-warning-surface:var(--orange-a50);--color-border-warning-surface:var(--orange-a50);--color-text-warning-surface:var(--orange-400);--color-text-caution:var(--yellow-500);--color-text-caution-soft:var(--yellow-400);--color-background-caution-surface:var(--yellow-a50);--color-border-caution-surface:var(--yellow-a50);--color-text-caution-surface:var(--yellow-400);--color-text-danger:var(--red-500);--color-text-danger-soft:var(--red-400);--color-background-danger-surface:var(--red-a50);--color-border-danger-surface:var(--red-a50);--color-text-danger-surface:var(--red-400);--color-text-success:var(--green-400);--color-text-success-soft:var(--green-400);--color-background-success-surface:var(--green-a50);--color-border-success-surface:var(--green-a50);--color-text-success-surface:var(--green-400);--color-background-success-solid:var(--green-600);--color-background-success-solid-hover:var(--green-600);--color-background-success-solid-active:var(--green-600);--color-border-success-outline:var(--green-600);--color-border-success-outline-hover:var(--green-600);--color-text-discovery:var(--purple-500);--color-text-discovery-soft:var(--purple-200);--color-background-discovery-surface:var(--purple-a50);--color-border-discovery-surface:var(--purple-a50);--color-text-discovery-surface:var(--purple-200);--color-text-discovery-outline:var(--purple-400);--color-text-discovery-outline-hover:var(--purple-400);--color-text-disabled:var(--gray-500);--color-border-subtle:var(--alpha-06);--color-border:var(--alpha-12);--color-border-strong:var(--alpha-20);--shadow:0 10px 15px -3px #0003, 0 4px 6px -4px #0003;--color-surface:var(--gray-200);--color-surface-secondary:var(--gray-100);--color-surface-tertiary:var(--gray-50);--color-surface-elevated:var(--gray-300);--color-surface-elevated-secondary:var(--gray-400)}:root,:where([data-theme]){--alert-border-radius:var(--radius-xl);--alert-gap:calc(var(--spacing) * 3);--alert-gutter:calc(var(--spacing) * 4);--alert-font-size:var(--font-text-sm-size);--alert-line-height:var(--font-text-sm-line-height);--alert-title-font-weight:var(--font-weight-semibold);--avatar-radius:var(--radius-full);--avatar-size:28px;--avatar-font-size-scaling:.5;--avatar-overflow-font-size-scaling-one:.45;--avatar-overflow-font-size-scaling-two:.37;--avatar-overflow-font-size-scaling-three:.3;--avatar-group-cutout-width:3px;--avatar-group-cutout-color:var(--color-surface);--avatar-group-spacing:-8px;--badge-gutter-sm:calc(var(--control-gutter-2xs) - 1px);--badge-gutter-md:var(--control-gutter-2xs);--badge-gutter-lg:var(--control-gutter-xs);--badge-size-sm:calc(var(--control-size-3xs) - 2px);--badge-size-md:var(--control-size-3xs);--badge-size-lg:var(--control-size-2xs);--badge-radius-sm:var(--radius-xs);--badge-radius-md:var(--radius-xs);--badge-radius-lg:var(--radius-sm);--badge-font-size-sm:var(--font-text-xs-size);--badge-font-size-md:var(--font-text-sm-size);--badge-font-size-lg:var(--font-text-sm-size);--badge-tracking-sm:var(--tracking-wide);--badge-tracking-md:var(--tracking-normal);--badge-tracking-lg:var(--tracking-normal);--badge-font-weight-sm:var(--font-weight-semibold);--badge-font-weight-md:var(--font-weight-semibold);--badge-font-weight-lg:var(--font-weight-semibold);--badge-icon-font-size-sm:var(--font-text-xs-size);--badge-icon-font-size-md:var(--font-text-md-size);--badge-icon-font-size-lg:var(--font-text-md-size);--badge-indicator-size-sm:var(--font-text-xs-size);--badge-indicator-size-md:var(--font-text-xs-size);--badge-indicator-size-lg:var(--font-text-sm-size);--button-gap-sm:3px;--button-gap-md:4px;--button-gap-lg:6px;--button-font-weight:var(--font-weight-medium);--input-gap-xs:4px;--input-gap-sm:6px;--input-gap-md:8px;--input-gap-lg:10px;--input-text-color:var(--color-text);--input-placeholder-text-color:var(--color-text-tertiary);--input-outline-border-color:var(--color-border-primary-outline);--input-outline-border-color-focus:var(--alpha-50);--input-soft-background-color:var(--color-background-primary-soft-alpha);--input-soft-border-color-focus:var(--alpha-20);--link-font-weight:inherit;--link-gap:calc(var(--spacing) * .5);--link-radius:var(--radius-sm);--link-underline-decoration-offset:.1em;--chat-max-width:800px;--chat-gutter:calc(var(--spacing) * 5);--chat-background-color:var(--color-surface);--thread-gutter:calc(var(--spacing) * 4);--composer-gutter:calc(var(--spacing) * 3);--composer-compact-gutter:calc(var(--spacing) * 2);--composer-radius:var(--radius-4xl);--composer-background-color:var(--color-surface-elevated);--smoothing-background-color:var(--color-surface);--user-message-text-color:var(--color-text);--source-list-gutter:var(--thread-gutter);--codeblock-background-color:var(--gray-25);--codeblock-syntax-4:var(--pink-500);--dialog-min-width:250px;--dialog-max-width:450px;--dialog-container-inner-padding:calc(var(--spacing) * 5);--dialog-backdrop-fade-background:var(--color-surface-elevated)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--dialog-backdrop-fade-background:color-mix(in oklab, var(--color-surface-elevated) 60%, transparent)}}:root,:where([data-theme]){--menu-gutter:calc(var(--spacing) * 1.5);--menu-radius:var(--radius-xl);--menu-font-size:var(--font-text-sm-size);--menu-line-height:var(--font-text-sm-line-height);--menu-item-padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);--menu-item-gap:calc(var(--spacing) * 1.5);--menu-separator-gutter:var(--menu-gutter) calc(-1 * var(--menu-gutter));--menu-separator-background-color:var(--color-border);--menu-radio-indicator-size:var(--font-text-lg-size);--menu-radio-indicator-hole-size:var(--font-text-3xs-size);--menu-checkbox-indicator-size:var(--font-text-lg-size);--modal-container-inner-padding:calc(var(--spacing) * 5);--popover-radius:var(--radius-xl);--radio-group-col-gap:calc(var(--spacing) * 2.5);--radio-group-row-gap:calc(var(--spacing) * 5);--radio-group-item-gap:calc(var(--spacing) * 1.5);--radio-group-item-font-size:var(--font-text-sm-size);--radio-group-item-line-height:var(--font-text-sm-line-height);--radio-group-indicator-size:var(--font-text-md-size);--radio-group-indicator-border-color:var(--color-border-primary-outline);--radio-group-indicator-border-color-hover:var(--alpha-25);--radio-group-indicator-background-color:var(--color-background-primary-solid);--radio-group-indicator-hole-size:.375rem;--radio-group-indicator-hole-background-color:var(--color-text-primary-solid);--segmented-control-gap:2px;--segmented-control-gutter:2px;--segmented-control-font-weight:var(--font-weight-semibold);--segmented-control-thumb-shadow:0 1px 4px -1px #0003;--segmented-control-option-highlight-gutter:1px;--select-control-font-weight:var(--font-weight-medium);--switch-track-width:32px;--switch-track-height:19px;--switch-thumb-offset:3px;--switch-thumb-size:calc(var(--switch-track-height) - 2 * var(--switch-thumb-offset));--switch-thumb-shadow:0 1px 2px #0003;--switch-label-gap:calc(var(--spacing) * 2)}:where(:root),:where([data-theme=light]){--avatar-image-border-color:var(--alpha-04);--input-outline-border-color-hover:var(--alpha-25);--input-border-color-invalid:var(--red-500);--link-primary-text-color:var(--blue-500);--link-primary-text-color-hover:var(--blue-800);--user-message-background-color:var(--alpha-05);--codeblock-syntax-1:#c0660d;--codeblock-syntax-2:var(--blue-500);--codeblock-syntax-3:var(--green-600);--codeblock-syntax-5:var(--purple-500);--dialog-backdrop-dim-background:#0000004d;--menu-item-background-color:var(--alpha-08);--modal-backdrop-background:#0000004d;--segmented-control-background:var(--gray-100);--segmented-control-thumb-background:var(--gray-0);--segmented-control-option-highlight-background-color:var(--gray-200);--slider-track-color:var(--gray-150);--slider-range-color:var(--gray-450);--switch-track-color:var(--gray-150);--switch-track-color-hover:var(--gray-200);--switch-track-color-checked:var(--gray-900);--switch-track-color-checked-disabled:var(--gray-300);--switch-track-color-disabled:var(--gray-100);--switch-thumb-color:var(--gray-0);--switch-thumb-color-disabled:var(--gray-0)}:where([data-theme=dark]){--avatar-image-border-color:var(--alpha-15);--input-outline-border-color-hover:var(--alpha-30);--input-border-color-invalid:var(--red-600);--link-primary-text-color:var(--blue-300);--link-primary-text-color-hover:var(--blue-400);--user-message-background-color:var(--alpha-08);--codeblock-syntax-1:var(--yellow-100);--codeblock-syntax-2:var(--blue-200);--codeblock-syntax-3:var(--green-300);--codeblock-syntax-5:var(--purple-300);--dialog-backdrop-dim-background:#00000080;--menu-item-background-color:var(--alpha-10);--modal-backdrop-background:#00000080;--segmented-control-background:var(--gray-0);--segmented-control-thumb-background:var(--gray-300);--segmented-control-option-highlight-background-color:var(--gray-300);--slider-track-color:var(--gray-400);--slider-range-color:var(--gray-600);--switch-track-color:var(--gray-400);--switch-track-color-hover:var(--gray-450);--switch-track-color-checked:var(--blue-400);--switch-track-color-checked-disabled:var(--blue-700);--switch-track-color-disabled:var(--gray-300);--switch-thumb-color:var(--gray-1000);--switch-thumb-color-disabled:var(--gray-800)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}html,:host{font-synthesis-weight:none}textarea{resize:none}img,svg{flex-grow:0;flex-shrink:0}input,textarea,select,optgroup{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;filter:none;outline-offset:0;outline-width:2px}a,button,input,label,select,textarea,:where([aria-role=button]){touch-action:manipulation}button{text-transform:none;vertical-align:middle}button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}pre{white-space:pre-wrap}table{border-spacing:0}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}html,:host{color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;letter-spacing:var(--tracking-normal)}[data-theme=light]{color-scheme:light}[data-theme=dark]{color-scheme:dark}*{scrollbar-color:var(--scrollbar-color) transparent;scrollbar-width:thin}[data-exiting]{pointer-events:none}::placeholder{color:var(--color-text-tertiary)}b,strong{font-weight:var(--font-weight-semibold)}@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_AMS-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Caligraphic-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Caligraphic-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Fraktur-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Fraktur-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-BoldItalic.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Math-BoldItalic.woff2)format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Math-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Script-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size1-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size2-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size3-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size4-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Typewriter-Regular.woff2)format("woff2")}.katex{text-indent:0;text-rendering:auto;font:1.21em/1.2 KaTeX_Main,Times New Roman,serif}.katex *{border-color:currentColor;-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.16.0"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{white-space:nowrap;width:min-content;position:relative}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;table-layout:fixed;display:inline-table}.katex .vlist-r{display:table-row}.katex .vlist{vertical-align:bottom;display:table-cell;position:relative}.katex .vlist>span{height:0;display:block;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{width:0;overflow:hidden}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{vertical-align:bottom;width:2px;min-width:2px;font-size:1px;display:table-cell}.katex .vbox{flex-direction:column;align-items:baseline;display:inline-flex}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{flex-direction:row;display:inline-flex}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline{border-bottom-style:dashed;width:100%;display:inline-block}.katex .sqrt>.root{margin-left:.277778em;margin-right:-.555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.833333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.714286em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.857143em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14286em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71429em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96286em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55429em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.416667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.583333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.833333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.347222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.416667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.486111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.694444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.833333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44028em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.289352em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.347222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.405093em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.520833em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.578704em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.694444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.833333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.289296em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.385728em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.433944em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.578592em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.694311em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.833173em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.200965em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.241158em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.281351em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.321543em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.361736em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.401929em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.482315em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.694534em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.833601em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{width:.12em;display:inline-block}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{min-width:1px;display:inline-block}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{width:100%;height:inherit;fill:currentColor;fill-opacity:1;fill-rule:nonzero;stroke:currentColor;stroke-dasharray:none;stroke-dashoffset:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-width:1px;display:block;position:absolute}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;max-width:none;min-height:0;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{width:50.2%;position:absolute;left:0;overflow:hidden}.katex .halfarrow-right{width:50.2%;position:absolute;right:0;overflow:hidden}.katex .brace-left{width:25.1%;position:absolute;left:0;overflow:hidden}.katex .brace-center{width:50%;position:absolute;left:25%;overflow:hidden}.katex .brace-right{width:25.1%;position:absolute;right:0;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{text-align:left;display:inline-block;position:absolute;right:calc(50% + .3em)}.katex .cd-label-right{text-align:right;display:inline-block;position:absolute;left:calc(50% + .3em)}.katex-display{text-align:center;margin:1em 0;display:block}.katex-display>.katex{text-align:center;white-space:nowrap;display:block}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.bottom-0{bottom:0}.left-0{left:0}.container{width:100%}@media (min-width:380px){.container{max-width:380px}}@media (min-width:576px){.container{max-width:576px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.mx-px{margin-inline:1px}.mt-1{margin-top:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.h-0{height:0}.h-\[var\(--button-icon-size\)\]{height:var(--button-icon-size)}.w-\[var\(--button-icon-size\)\]{width:var(--button-icon-size)}.w-full{width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-\[120px\]{min-width:120px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-default{border-color:var(--color-border)}.border-subtle{border-color:var(--color-border-subtle)}.bg-surface{background-color:var(--color-surface)}.fill-secondary{fill:var(--color-text-secondary)}.p-4{padding:calc(var(--spacing) * 4)}.pt-4{padding-top:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-right{text-align:right}.heading-lg{font-size:var(--font-heading-lg-size);font-weight:var(--font-heading-lg-weight);letter-spacing:var(--font-heading-lg-tracking);line-height:var(--font-heading-lg-line-height)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));letter-spacing:var(--tw-tracking,var(--text-sm--letter-spacing));font-weight:var(--tw-font-weight,var(--text-sm--font-weight))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-ellipsis{text-overflow:ellipsis}.text-secondary{color:var(--color-text-secondary)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.shadow-lg{--tw-shadow:var(--shadow-300);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (min-width:576px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}:root{--background:0 0% 100%;--foreground:240 10% 3.9%;--card:0 0% 100%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--accent:240 4.8% 95.9%;--destructive:0 72% 51%;--border:240 5.9% 90%;--ring:240 5.9% 10%;--radius:.5rem;--canvas:240 5% 97.3%;--panel:0 0% 100%;--feature-link:208 100% 47.45%;color-scheme:light;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif}*{box-sizing:border-box}html,body,#root{overscroll-behavior:none;height:100%;margin:0;overflow:hidden}#root{position:fixed;top:0;right:0;bottom:0;left:0}body{background:hsl(var(--canvas));color:hsl(var(--foreground));-webkit-font-smoothing:antialiased}.icon{flex-shrink:0;width:16px;height:16px}.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}*{scrollbar-width:thin;scrollbar-color:hsl(var(--foreground) / .18) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--foreground) / .18);background-clip:content-box;border:2px solid #0000;border-radius:999px}::-webkit-scrollbar-thumb:hover{background:hsl(var(--foreground) / .32);background-clip:content-box}::-webkit-scrollbar-corner{background:0 0}.layout{height:100dvh;min-height:0;display:flex;overflow:hidden}.main-shell{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sidebar{background:0 0;flex-direction:column;flex-shrink:0;width:236px;height:100%;min-height:0;transition:width .22s cubic-bezier(.22,1,.36,1);display:flex;position:relative}.sidebar.is-collapsed{width:56px}@media (max-width:860px){.sidebar{width:204px}}.sidebar-top{flex-direction:column;gap:2px;padding:0 10px 8px;display:flex}.sidebar-brand-row{align-items:center;gap:6px;height:54px;min-height:54px;padding:0 0 0 10px;display:flex}.sidebar:not(.is-collapsed) .sidebar-top{padding-right:0}.sidebar:not(.is-collapsed) .sidebar-brand-row{padding-right:10px}.brand{min-width:0;color:inherit;cursor:pointer;letter-spacing:-.01em;text-align:left;background:0 0;border:0;flex:1;align-items:center;gap:9px;padding:0;font-family:inherit;font-size:15px;font-weight:600;display:flex}.brand-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.brand-logo,.brand-title,.brand{cursor:pointer}.login-brand-logo,.login-brand,.login-title{cursor:text}.sidebar-collapse-toggle{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;flex:0 0 28px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.sidebar-collapse-toggle:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.sidebar-collapse-toggle .icon{width:17px;height:17px}.sidebar.is-collapsed .sidebar-brand-row{justify-content:center;padding-inline:0}.sidebar.is-collapsed .brand{display:none}.brand-logo,.login-brand-logo{object-fit:contain;flex:0 0 20px;width:20px;min-width:20px;max-width:20px;height:20px;min-height:20px;max-height:20px;display:block}.new-chat{height:36px;min-height:36px;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:10px;padding:8px 10px;font-size:14px;transition:background .12s;display:flex}.new-chat .icon{width:18px;height:18px}.new-chat:hover,.new-chat.is-active{background:hsl(var(--foreground) / .05)}.sidebar-beta-badge{color:#976507;background:#fac70f29;border:1px solid #ce8b0d47;border-radius:999px;flex:none;padding:1px 5px;font-size:9.5px;font-weight:600;line-height:1.3}.new-chat--conversation>.icon{transform-origin:50%}.new-chat--conversation:hover>.icon{animation:.65s cubic-bezier(.22,1,.36,1) both sidebar-plus-return}.sidebar-agent-face{overflow:visible}.sidebar-agent-face__eye{transform-box:fill-box;transform-origin:50%;animation:1s ease-in-out infinite sidebar-agent-blink}@keyframes sidebar-plus-return{0%{transform:rotate(0)}48%{transform:rotate(48deg)}to{transform:rotate(0)}}@keyframes sidebar-agent-blink{0%,42%,58%,to{transform:scaleY(1)}50%{transform:scaleY(.08)}}@media (prefers-reduced-motion:reduce){.new-chat--conversation:hover>.icon,.sidebar-agent-face__eye{animation:none}}.studio-update-action{color:#fff;min-width:104px;min-height:40px;box-shadow:none;-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);cursor:pointer;font:inherit;background:#111;border:0;border-radius:999px;justify-content:center;align-items:center;gap:7px;padding:0 17px;font-size:12.5px;font-weight:650;transition:background-color .24s cubic-bezier(.22,1,.36,1),color .18s,box-shadow .24s,-webkit-backdrop-filter .24s,backdrop-filter .24s;display:inline-flex}.studio-update-action:not(:disabled):hover{color:#fff;background:#29292b;border:0;box-shadow:0 7px 18px #00000029}.studio-update-action:focus-visible{outline:2px solid hsl(var(--ring) / .55);outline-offset:2px}.studio-update-action:disabled{cursor:default;opacity:.42}.sidebar.is-collapsed .new-chat{white-space:nowrap;align-self:center;gap:0;width:36px;height:36px;min-height:36px;padding:9px;overflow:hidden}.sidebar.is-collapsed .sidebar-nav-label,.sidebar.is-collapsed .sidebar-beta-badge,.sidebar.is-collapsed .sidebar-history{display:none}.agentsel{--agentsel-available-width: calc(100vw - 250px) ;z-index:32;width:min(320px,var(--agentsel-available-width));background:0 0;border:0;flex-flow:wrap;align-content:stretch;align-items:stretch;gap:8px;margin-left:6px;animation:.16s ease-out agentsel-in;display:flex;position:absolute;top:8px;left:100%;overflow:visible;container-type:inline-size}.agentsel.has-detail{width:min(688px,var(--agentsel-available-width))}.agentsel--navbar{z-index:44;width:min(clamp(264px,26vw,288px),100vw - 48px);height:min(640px,100dvh - 74px);margin-left:0;position:absolute;top:calc(100% + 7px);left:0}.agentsel--navbar .agentsel-main{flex-basis:auto;width:100%}.sidebar.is-collapsed .agentsel{--agentsel-available-width: calc(100vw - 70px) }.agentsel-main{border:1px solid hsl(var(--border));background:hsl(var(--background));width:320px;min-width:min(240px,100%);height:100%;min-height:0;max-height:100%;box-shadow:0 12px 40px hsl(var(--foreground) / .14);border-radius:12px;flex-direction:column;flex:320px;display:flex;overflow:hidden}.agentsel-detail{border:1px solid hsl(var(--border));background:hsl(var(--background));width:360px;min-width:min(280px,100%);height:100%;min-height:0;max-height:100%;box-shadow:0 12px 40px hsl(var(--foreground) / .14);border-radius:12px;flex-direction:column;flex:360px;display:flex;overflow:hidden}.agentsel-preview{animation:.16s cubic-bezier(.22,1,.36,1) agentsel-preview-in}@container (max-width:527px){.agentsel.has-detail>.agentsel-main,.agentsel.has-detail>.agentsel-detail{height:calc(50% - 4px);max-height:calc(50% - 4px)}}.agentsel-preview-head{padding:7px 14px}.agentsel-detail-tabs{border:1px solid hsl(var(--border) / .58);background:hsl(var(--secondary) / .58);border-radius:9px;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;height:36px;padding:3px;display:grid;position:relative;overflow:hidden}.agentsel-detail-tabs-slider{z-index:0;border:1px solid hsl(var(--border) / .72);background:hsl(var(--background));border-radius:6px;width:calc(50% - 3px);transition:transform .24s cubic-bezier(.22,1,.36,1);position:absolute;top:3px;bottom:3px;left:3px;transform:translate(0)}.agentsel-detail-tabs.is-runtime .agentsel-detail-tabs-slider{transform:translate(100%)}.agentsel-detail-tabs button{z-index:1;min-width:0;color:hsl(var(--muted-foreground));font:inherit;text-align:center;cursor:pointer;background:0 0;border:0;border-radius:6px;font-size:12px;font-weight:550;transition:color .16s;position:relative}.agentsel-detail-tabs button:hover,.agentsel-detail-tabs button[aria-selected=true]{color:hsl(var(--foreground))}.agentsel-detail-tabs button:focus-visible{outline:2px solid hsl(var(--ring) / .24);outline-offset:-2px}.agentsel-tab-panel{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.agentsel-tab-panel[hidden]{display:none}.agentsel-detail-body{overscroll-behavior-y:contain;scrollbar-gutter:stable;flex:1;min-width:0;min-height:0;padding:12px 14px;overflow:hidden auto}.agentsel-panel-state{min-height:120px;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:7px;font-size:12.5px;display:flex}.agentsel-panel-state .icon{width:15px;height:15px}.agentsel-panel-empty{text-align:center;color:hsl(var(--muted-foreground));overflow-wrap:anywhere;flex-direction:column;gap:6px;padding:24px 8px;font-size:12.5px;display:flex}.agentsel-panel-empty small{color:hsl(var(--muted-foreground) / .75);-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:11px;line-height:1.45;display:-webkit-box;overflow:hidden}.agentsel-identity,.agentsel-runtime-identity{align-items:flex-start;gap:10px;min-width:0;display:flex}.agentsel-identity{padding-bottom:12px}.agentsel-identity-icon,.agentsel-runtime-identity>.icon{width:18px;height:18px;color:hsl(var(--muted-foreground));flex-shrink:0;margin-top:1px}.agentsel-identity-copy,.agentsel-runtime-identity>div{flex-direction:column;flex:1;gap:3px;min-width:0;display:flex}.agentsel-identity-copy strong,.agentsel-runtime-identity strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;font-weight:650;overflow:hidden}.agentsel-identity-copy span,.agentsel-runtime-identity span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.agentsel-runtime-identity{border-bottom:1px solid hsl(var(--border));margin-bottom:14px;padding-bottom:12px}.agentsel-info-section{border-top:1px solid hsl(var(--border));min-width:0;padding:11px 0}.agentsel-info-section h3{color:hsl(var(--muted-foreground));align-items:center;gap:6px;margin:0 0 8px;font-size:11.5px;font-weight:600;display:flex}.agentsel-info-section h3 .icon{width:13px;height:13px}.agentsel-description{white-space:pre-wrap;overflow-wrap:anywhere;max-height:104px;color:hsl(var(--foreground));margin:0;font-size:12.5px;line-height:1.65;overflow-y:auto}.agentsel-chips{flex-wrap:wrap;gap:5px;min-width:0;display:flex}.agentsel-chip{border:1px solid hsl(var(--border));background:hsl(var(--canvas) / .7);max-width:100%;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;border-radius:5px;padding:3px 7px;font-size:11.5px;line-height:1.35;display:block;overflow:hidden}.agentsel-info-list{flex-direction:column;gap:6px;min-width:0;display:flex}.agentsel-info-list-item{background:hsl(var(--canvas) / .72);border-radius:6px;flex-direction:column;gap:2px;min-width:0;padding:7px 8px;display:flex}.agentsel-info-list-item>strong,.agentsel-component-head>strong{text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:600;overflow:hidden}.agentsel-info-list-item>span{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:11px;line-height:1.45;display:-webkit-box;overflow:hidden}.agentsel-component-head{align-items:center;gap:8px;min-width:0;display:flex}.agentsel-component-head>strong{flex:1;min-width:0}.agentsel-component-head>span{background:hsl(var(--foreground) / .06);color:hsl(var(--muted-foreground));border-radius:4px;flex-shrink:0;padding:1px 5px;font-size:10px}.agentsel-kv{flex-direction:column;gap:8px;margin:0;display:flex}.agentsel-kv-row{grid-template-columns:52px 1fr;gap:8px;font-size:12.5px;display:grid}.agentsel-kv-row dt{color:hsl(var(--muted-foreground))}.agentsel-kv-row dd{min-width:0;color:hsl(var(--foreground));overflow-wrap:anywhere;margin:0}.agentsel-envs{margin-top:14px}.agentsel-envs-head{color:hsl(var(--muted-foreground));margin-bottom:6px;font-size:12px;font-weight:600}.agentsel-env{flex-direction:column;gap:1px;margin-bottom:6px;display:flex}.agentsel-env-k{overflow-wrap:anywhere;color:hsl(var(--muted-foreground));font-family:inherit;font-size:11px}.agentsel-env-v{overflow-wrap:anywhere;color:hsl(var(--foreground));font-family:inherit;font-size:11.5px}.agentsel-head-actions{align-items:center;gap:2px;display:flex}.agentsel-pager{flex:0 0 36px;justify-content:center;align-items:center;gap:14px;padding:6px 10px 0;display:flex}.agentsel-pager button{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;padding:2px;display:flex}.agentsel-pager button:hover:not(:disabled){color:hsl(var(--foreground))}.agentsel-pager button:disabled{opacity:.3;cursor:default}.agentsel-pager button .icon{width:18px;height:18px}.agentsel-pager-label{color:hsl(var(--muted-foreground));text-align:center;min-width:40px;font-size:13px}@keyframes agentsel-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes agentsel-preview-in{0%{opacity:0;transform:translate(-6px)}to{opacity:1;transform:translate(0)}}.agentsel-head{box-sizing:border-box;border-bottom:1px solid hsl(var(--border));flex-shrink:0;justify-content:space-between;align-items:center;height:52px;padding:0 14px;display:flex}.agentsel-title{text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:8px;min-width:0;font-size:14px;font-weight:600;display:flex;overflow:hidden}.agentsel-title .icon{width:17px;height:17px}.agentsel-refresh{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;border-radius:6px;padding:4px;display:flex}.agentsel-refresh:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.agentsel-refresh .icon{width:16px;height:16px}.agentsel-body{overscroll-behavior-y:contain;scrollbar-gutter:stable;flex:1;min-height:0;padding:10px;overflow-y:auto}.agentsel-body--cloud{scrollbar-gutter:auto;flex-direction:column;display:flex;overflow:hidden}.agentsel-tools{flex-direction:column;gap:8px;margin-bottom:10px;display:flex}.agentsel-search{border:1px solid hsl(var(--border));border-radius:8px;align-items:center;gap:8px;padding:7px 10px;display:flex}.agentsel-search .icon{width:15px;height:15px;color:hsl(var(--muted-foreground))}.agentsel-search input{font:inherit;color:hsl(var(--foreground));background:0 0;border:none;outline:none;flex:1;font-size:13px}.agentsel-mine{color:hsl(var(--muted-foreground));cursor:pointer;align-items:center;gap:7px;font-size:12.5px;display:flex}.agentsel-list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.agentsel-listwrap{min-height:220px;position:relative}.agentsel-body--cloud .agentsel-listwrap{overscroll-behavior-y:contain;scrollbar-gutter:auto;flex:1;min-height:0;overflow-y:auto}.agentsel-loading{color:hsl(var(--muted-foreground));background:hsl(var(--background) / .72);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);border-radius:8px;justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex;position:absolute;top:0;right:0;bottom:0;left:0}.agentsel-loading .icon{width:16px;height:16px}.agentsel-item{width:100%;min-height:46px;color:hsl(var(--foreground));font:inherit;text-align:left;background:0 0;border:none;border-radius:8px;align-items:center;gap:9px;padding:4px 0;font-size:13.5px;display:flex}.agentsel-main button.agentsel-item{cursor:pointer;min-height:0;padding:9px 10px}.agentsel-item:hover{background:hsl(var(--foreground) / .05);box-shadow:none;transform:none}.agentsel-runtime-item:hover{background:0 0}.agentsel-item.active{background:hsl(var(--foreground) / .08);font-weight:600}.agentsel-item.is-previewed{background:hsl(var(--foreground) / .055)}.agentsel-runtime-item.active,.agentsel-runtime-item.is-previewed{background:0 0}.agentsel-item .icon{width:16px;height:16px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-item-main{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.agentsel-item-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;font-weight:550;overflow:hidden}.agentsel-item-meta{align-items:center;gap:4px;min-width:0;display:flex}.agentsel-item-actions{flex-shrink:0;align-items:center;gap:1px;display:flex}.agentsel-connect,.agentsel-info{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px}.agentsel-connect{min-width:38px;height:28px;padding:0 5px;font-size:11.5px;font-weight:550}.agentsel-info{place-items:center;width:28px;height:28px;padding:0;display:grid}.agentsel-connect:hover:not(:disabled),.agentsel-info:hover{background:hsl(var(--foreground) / .07);color:hsl(var(--foreground));box-shadow:none}.agentsel-info.active{color:hsl(var(--foreground));box-shadow:none;background:0 0}.agentsel-connect:disabled{opacity:.55;cursor:default}.agentsel-info .icon{width:15px;height:15px}.agentsel-rt{flex-direction:column;display:flex}.agentsel-rt-row{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;text-align:left;background:0 0;border:none;border-radius:8px;align-items:center;gap:7px;padding:9px 8px;font-size:13.5px;display:flex}.agentsel-rt-row:hover{background:hsl(var(--foreground) / .05)}.agentsel-rt-row .icon{width:15px;height:15px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-rt-name{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.runtime-owner-badge{color:#0b68cb;background:#007bff1f;border-radius:999px;flex-shrink:0;padding:1px 6px;font-size:10px;font-weight:600}.agentsel-status{border-radius:999px;flex-shrink:0;padding:1px 6px;font-size:10px}.agentsel-status.is-ok{color:#238b49;background:#21c45d24}.agentsel-status.is-warn{color:#b86614;background:#f59f0a29}.agentsel-status.is-bad{color:#ca2b2b;background:#dc282824}.agentsel-status.is-muted{background:hsl(var(--muted));color:hsl(var(--muted-foreground))}.agentsel-apps{flex-direction:column;gap:2px;padding:2px 0 6px 20px;display:flex}.agentsel-app{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;text-align:left;background:0 0;border:none;border-radius:7px;align-items:center;gap:8px;padding:7px 10px;font-size:13px;display:flex}.agentsel-app:hover{background:hsl(var(--foreground) / .05)}.agentsel-app.active{background:hsl(var(--foreground) / .08);font-weight:600}.agentsel-app .icon{width:14px;height:14px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-apps-note{color:hsl(var(--muted-foreground));align-items:center;gap:7px;padding:7px 10px;font-size:12.5px;display:flex}.agentsel-apps-note .icon{width:14px;height:14px}.agentsel-apps-note--muted{font-style:italic}.agentsel-empty{text-align:center;color:hsl(var(--muted-foreground));padding:24px 10px;font-size:13px}.agentsel-error{overflow-wrap:anywhere;color:#bd2828;white-space:pre-wrap;background:#dc282814;border-radius:8px;min-width:0;max-width:100%;margin:4px 0 10px;padding:8px 10px;font-size:12.5px;overflow:hidden}.agentsel-more{border:1px dashed hsl(var(--border));width:100%;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border-radius:8px;margin-top:8px;padding:9px;font-size:13px}.agentsel-more:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}@media (max-width:860px){.agentsel{--agentsel-available-width: calc(100vw - 218px) }}.sidebar-history{flex-direction:column;flex:1;min-height:0;display:flex}.history-head{color:hsl(var(--foreground));justify-content:space-between;align-items:center;padding:8px 10px 6px 20px;font-size:13px;font-weight:600;display:flex}.history-refresh{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;padding:2px;display:flex}.history-refresh:hover{color:hsl(var(--foreground))}.history-new-chat{width:24px;height:24px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;margin:-4px 0;padding:0;transition:color .12s;display:inline-flex}.history-new-chat .icon{width:15px;height:15px}.history-new-chat:hover{color:hsl(var(--foreground));background:0 0}.history-list{flex-direction:column;flex:1;gap:2px;padding:4px 10px 12px;display:flex;overflow-y:auto}.history-empty{color:hsl(var(--muted-foreground));text-align:center;padding:16px 8px;font-size:13px}.history-item{border-radius:8px;align-items:center;transition:background .12s;display:flex;position:relative}.history-item:hover{background:hsl(var(--foreground) / .05)}.history-item.active{background:hsl(var(--foreground) / .08)}.history-item-btn{text-align:left;min-width:0;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;flex:1;align-items:center;gap:7px;padding:9px 10px;font-size:14px;display:flex}.history-title{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.history-streaming{background:#22c55e;border-radius:50%;flex-shrink:0;width:7px;height:7px;margin-right:4px;animation:1.4s ease-in-out infinite history-pulse;box-shadow:0 0 #22c55e80}@keyframes history-pulse{0%,to{box-shadow:0 0 #22c55e80}50%{box-shadow:0 0 0 4px #22c55e00}}.history-evaluating-status{color:#956718;flex-shrink:0;align-items:center;gap:5px;font-size:10.5px;font-weight:600;line-height:1;display:inline-flex}.history-evaluating{background:#f59f0a;border-radius:50%;flex-shrink:0;width:7px;height:7px;animation:1.4s ease-in-out infinite history-evaluation-pulse;box-shadow:0 0 #f59f0a6b}@keyframes history-evaluation-pulse{0%,to{box-shadow:0 0 #f59f0a6b}50%{box-shadow:0 0 0 4px #f59f0a00}}@media (prefers-reduced-motion:reduce){.history-streaming,.history-evaluating{box-shadow:none;animation:none}}.history-more{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;opacity:0;background:0 0;border:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;margin-right:4px;transition:opacity .12s,background .12s;display:flex}.history-item:hover .history-more{opacity:1}.history-more:hover{background:hsl(var(--border));color:hsl(var(--foreground))}.menu-scrim{z-index:30;position:fixed;top:0;right:0;bottom:0;left:0}.history-menu{z-index:31;background:hsl(var(--background));border:1px solid hsl(var(--border));min-width:120px;box-shadow:0 6px 20px hsl(var(--foreground) / .12);border-radius:8px;margin-top:2px;padding:4px;position:absolute;top:100%;right:4px}.menu-item{width:100%;font:inherit;cursor:pointer;color:hsl(var(--foreground));background:0 0;border:none;border-radius:6px;align-items:center;gap:8px;padding:7px 10px;font-size:13px;display:flex}.menu-item:hover{background:hsl(var(--accent))}.menu-item--danger{color:hsl(var(--destructive))}.menu-item .icon{width:15px;height:15px}.main{background:hsl(var(--panel));border:1px solid hsl(var(--border));border-radius:12px;flex-direction:column;flex:1;min-width:0;min-height:0;margin:10px;display:flex;position:relative;overflow:hidden}.error{z-index:3;border-radius:var(--radius);background:hsl(var(--destructive) / .1);width:calc(100% - 32px);max-width:768px;color:hsl(var(--destructive));overflow-wrap:anywhere;margin:10px auto 0;padding:10px 12px;font-size:13px;position:relative}.case-return-bar{flex:none;justify-content:center;padding:12px 16px 0;display:flex}.case-return-bar button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-height:32px;color:hsl(var(--foreground));cursor:pointer;font:inherit;box-shadow:0 1px 2px hsl(var(--foreground) / .05);border-radius:999px;align-items:center;gap:7px;padding:0 11px;font-size:12px;font-weight:620;display:inline-flex}.case-return-bar button:hover{background:hsl(var(--secondary) / .55)}.case-return-bar svg{width:14px;height:14px}.transcript{flex:1;padding:28px 16px 8px;overflow-y:auto}.transcript.is-streaming{overflow-anchor:none}.welcome{flex-direction:column;flex:1;justify-content:center;align-items:center;gap:32px;padding:0 16px clamp(88px,16vh,136px);display:flex;position:relative}.welcome-primary{flex-direction:column;align-items:center;gap:32px;width:100%;display:flex;position:relative}.welcome-heading{z-index:10;flex-direction:column;align-items:center;gap:72px;display:flex;position:relative}.welcome-feature-pill{background:hsl(var(--muted));height:36px;color:hsl(var(--muted-foreground));white-space:nowrap;border-radius:999px;align-items:center;gap:12px;padding:0 16px;font-size:13px;font-weight:500;line-height:1;display:inline-flex;position:relative}.welcome-feature-divider{background:hsl(var(--border));width:1px;height:16px}.welcome-feature-link{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:hsl(var(--feature-link));font:inherit;line-height:inherit;cursor:pointer;background:0 0;border:0;padding:0}.welcome-feature-link:focus-visible{outline:2px solid hsl(var(--feature-link) / .35);outline-offset:3px;border-radius:3px}.welcome-feature-pill:has(.studio-update-trigger--feature)>.welcome-feature-link:not(.studio-update-trigger--feature),.welcome-feature-pill:has(.studio-update-trigger--feature)>.welcome-feature-popover{display:none}.welcome-feature-popover{z-index:40;border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(340px,100vw - 32px);box-shadow:0 14px 36px hsl(var(--foreground) / .12);color:hsl(var(--foreground));text-align:left;white-space:normal;opacity:0;pointer-events:none;border-radius:14px;padding:16px;transition:opacity .16s,transform .16s;position:absolute;top:50%;left:calc(100% + 12px);transform:translate(-4px,-50%)}.welcome-feature-pill:hover .welcome-feature-popover,.welcome-feature-pill:focus-within .welcome-feature-popover{opacity:1;pointer-events:auto;transform:translateY(-50%)}.welcome-feature-popover>strong{margin-bottom:12px;font-size:13px;font-weight:600;display:block}.welcome-feature-popover ul{gap:12px;margin:0;padding:0;list-style:none;display:grid}.welcome-feature-popover li{gap:3px;display:grid}.welcome-feature-popover li span{color:hsl(var(--foreground));font-size:13px;font-weight:500;line-height:1.4}.welcome-feature-popover p{color:hsl(var(--muted-foreground));margin:0;font-size:12px;line-height:1.55}@media (max-width:900px){.welcome-feature-popover{top:calc(100% + 10px);left:50%;transform:translate(-50%,-4px)}.welcome-feature-pill:hover .welcome-feature-popover,.welcome-feature-pill:focus-within .welcome-feature-popover{transform:translate(-50%)}}.welcome-title,.composer-placeholder-reveal{animation:.9s cubic-bezier(.22,1,.36,1) both welcome-text-reveal}@keyframes welcome-text-reveal{0%{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0)}}@media (prefers-reduced-motion:reduce){.welcome-title,.composer-placeholder-reveal{opacity:1;clip-path:none;animation:none}.welcome-feature-popover{transition:none}}.welcome-title{letter-spacing:-.02em;margin:0;font-size:26px;font-weight:600}.welcome .composer{padding:0}.turn{flex-direction:column;gap:8px;max-width:768px;margin:0 auto 22px;display:flex}.turn:last-child{margin-bottom:0}.turn--user{align-items:flex-end}.turn--assistant{align-items:flex-start}.turn--assistant.is-feedback-target{border-radius:12px;animation:2.4s ease-out feedback-target-pulse}@keyframes feedback-target-pulse{0%{background:hsl(var(--foreground) / .07);box-shadow:0 0 0 8px hsl(var(--foreground) / .05)}to{box-shadow:0 0 hsl(var(--foreground) / 0);background:0 0}}.transcript.is-streaming>.turn--assistant:last-child{min-height:max(0px,100% - 180px)}.turn--subagent{isolation:isolate;width:100%;max-width:768px;box-shadow:none;background:0 0;border:0;border-radius:14px;gap:10px;margin-top:42px;margin-bottom:22px;padding:30px 16px 14px;position:relative}.turn--subagent:before{z-index:-1;border-radius:inherit;-webkit-backdrop-filter:blur(18px)saturate(115%);content:"";pointer-events:none;background:radial-gradient(circle at 12% 8%,#e3ebf28c,#0000 38%),radial-gradient(circle at 88% 78%,#e3e6ed6b,#0000 42%),linear-gradient(120deg,#ffffff8f,#f2f4f742);border:1px solid #dadfe7d1;position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.turn--subagent:has(>.turn-meta){padding-bottom:0}.turn--subagent:has(>.turn-meta):before{bottom:44px}.transcript.is-streaming>.turn--subagent:last-child{min-height:0}.subagent-run-label{background:hsl(var(--background));max-width:calc(100% - 28px);min-height:36px;box-shadow:none;border:1px solid #d5dae2;border-radius:10px;align-items:center;gap:8px;padding:4px 9px 4px 4px;display:inline-flex;position:absolute;top:0;left:14px;transform:translateY(-50%)}.subagent-run-handoff{color:#606b7b;white-space:nowrap;background:#eff2f5;border-radius:7px;flex:none;align-items:center;gap:5px;height:26px;padding:0 8px 0 6px;font-size:12px;font-weight:400;display:inline-flex}.subagent-run-handoff svg{flex:0 0 15px;width:15px;height:15px}.subagent-run-title{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:14.5px;font-weight:400;overflow:hidden}.subagent-run-description{color:#636c79;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;padding:0 2px 4px;font-size:13.5px;line-height:1.6;display:-webkit-box;overflow:hidden}.turn--subagent .turn-meta{margin:20px -16px 0;position:static}@media (max-width:700px){.turn--subagent{width:100%;padding:30px 10px 12px}.turn--subagent:has(>.turn-meta){padding-bottom:0}.turn--subagent .turn-meta{margin-left:-10px;margin-right:-10px}.subagent-run-label{max-width:calc(100% - 20px);left:10px}}.bubble{font-size:14.5px;line-height:1.65}.turn--user .bubble{background:hsl(var(--secondary));border-radius:18px;max-width:85%;padding:10px 16px}.turn--assistant .bubble{max-width:100%}.md{font-size:14.5px;line-height:1.65}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:0 0 .7em}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{letter-spacing:-.01em;margin:1.1em 0 .5em;font-weight:650;line-height:1.3}.md h1{font-size:1.4em}.md h2{font-size:1.25em}.md h3{font-size:1.1em}.md h4,.md h5,.md h6{font-size:1em}.md ul{list-style:outside}.md ol{list-style:decimal}.md ul ul{list-style-type:circle}.md ul ul ul{list-style-type:square}.md ol ol{list-style-type:lower-alpha}.md ol ol ol{list-style-type:lower-roman}.md li,.md li>ul,.md li>ol{margin:.15em 0}.md a{color:hsl(var(--primary));text-underline-offset:2px;text-decoration:underline}.md a:hover{opacity:.8}.md blockquote{border-left:3px solid hsl(var(--border));color:hsl(var(--muted-foreground));margin:0 0 .7em;padding:.1em .9em}.md strong{font-weight:650}.md code{background:hsl(var(--muted));border-radius:5px;padding:.12em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.875em}.md pre{background:hsl(var(--muted));border-radius:8px;margin:0 0 .7em;padding:12px 14px;line-height:1.55;overflow-x:auto}.md pre code{background:0 0;border-radius:0;padding:0;font-size:12.5px}.md table{border-collapse:collapse;width:100%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));border-radius:12px;margin:0 0 .7em;font-size:.95em;overflow:hidden}.md table thead th,.md table th{background:hsl(var(--muted));border:1px solid hsl(var(--border));text-align:left;padding:12px 16px;font-size:.98em;font-weight:650}.md table tbody td,.md table td{border:1px solid hsl(var(--border));text-align:left;vertical-align:top;padding:12px 16px;line-height:1.65}.md table tbody tr:nth-child(2n){background:hsl(var(--muted) / .25)}.md table tbody tr:hover{background:hsl(var(--accent))}.md table caption{caption-side:top;text-align:left;color:hsl(var(--muted-foreground));padding:0 0 8px;font-size:.9em;font-weight:600}.md table colgroup,.md table col{display:table-column}.md table thead,.md table tbody,.md table tfoot{display:table-row-group}.md table tr{display:table-row}.md strong,.md b{font-weight:650}.md em,.md i{font-style:italic}.md del,.md s{text-decoration:line-through}.md ins,.md u{text-decoration:underline}.md mark{background:#fff3c2b3;border-radius:4px;padding:.1em .3em}.md sub{vertical-align:sub;font-size:.8em}.md sup{vertical-align:super;font-size:.8em}.md code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.md pre{overflow-x:auto}@media (max-width:640px){.md table{font-size:.85em}.md table thead th,.md table th,.md table tbody td,.md table td{padding:8px 10px}}.md p{line-height:1.7}.md br{content:"";margin:.4em 0;display:block}.md hr{border:none;border-top:1px solid hsl(var(--border));margin:1.5em 0}.md blockquote{border-left:3px solid hsl(var(--primary) / .4);background:hsl(var(--muted) / .3);border-radius:0 8px 8px 0;margin:.8em 0;padding:.6em 1em}.md ul,.md ol{margin:.6em 0;padding-left:1.6em}.md li{margin:.3em 0;line-height:1.6}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{margin-top:1.2em;margin-bottom:.5em;line-height:1.3}.md h1{font-size:1.6em;font-weight:700}.md h2{font-size:1.4em;font-weight:650}.md h3{font-size:1.2em;font-weight:600}.md h4{font-size:1.1em;font-weight:600}.md h5,.md h6{font-size:1em;font-weight:600}.md .image-preview-trigger{background:hsl(var(--muted));width:fit-content;max-width:40%;box-shadow:0 0 0 1px hsl(var(--border));cursor:zoom-in;border:0;border-radius:10px;margin:0 0 .7em;padding:0;line-height:0;display:block;position:relative;overflow:hidden}.md .image-preview-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:3px}.md .image-preview-trigger img{border-radius:inherit;width:auto;max-width:100%;height:auto;transition:filter .18s,transform .18s;display:block}.md .image-preview-trigger:hover img{filter:brightness(.92);transform:scale(1.01)}.image-preview-hint{color:#fff;opacity:0;background:#131316ad;border:1px solid #fff3;border-radius:8px;place-items:center;width:28px;height:28px;transition:opacity .16s,transform .16s;display:grid;position:absolute;bottom:8px;right:8px;transform:translateY(3px)}.image-preview-hint svg{width:14px;height:14px}.image-preview-trigger:hover .image-preview-hint,.image-preview-trigger:focus-visible .image-preview-hint{opacity:1;transform:translateY(0)}.md .video-container{gap:6px;margin:0 0 .7em;display:grid}.md .video-caption{color:hsl(var(--muted-foreground));font-size:.9em}.md .video-link-text{color:inherit;text-decoration:none;transition:color .15s}.md .video-link-text:hover{color:hsl(var(--foreground));text-decoration:underline}.md .video-preview-trigger{background:hsl(var(--muted));width:fit-content;max-width:80%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));cursor:pointer;border:0;border-radius:12px;padding:0;line-height:0;transition:box-shadow .18s,transform .18s;display:block;position:relative;overflow:hidden}.md .video-preview-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:3px}.md .video-preview-trigger:hover{box-shadow:0 4px 16px hsl(var(--foreground) / .15),0 0 0 1px hsl(var(--border));transform:translateY(-1px)}.md .video-preview-trigger .video-thumbnail{border-radius:inherit;width:auto;max-width:100%;height:auto;transition:filter .18s,transform .18s;display:block}.md .video-preview-trigger:hover .video-thumbnail{filter:brightness(.9);transform:scale(1.01)}.video-preview-hint{color:#fff;opacity:0;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#131316b3;border:1px solid #fff3;border-radius:10px;place-items:center;width:32px;height:32px;transition:opacity .16s,transform .16s;display:grid;position:absolute;bottom:10px;right:10px;transform:translateY(4px)}.video-preview-hint svg{width:16px;height:16px}.video-preview-trigger:hover .video-preview-hint,.video-preview-trigger:focus-visible .video-preview-hint{opacity:1;transform:translateY(0)}.md .video-inline{max-width:100%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));border-radius:12px;margin:0 0 .7em}.video-viewer-backdrop{z-index:90;-webkit-backdrop-filter:blur(16px)saturate(.85);backdrop-filter:blur(16px)saturate(.85);background:#131316c7;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.video-viewer{border:1px solid hsl(var(--foreground) / .15);background:hsl(var(--background));border-radius:18px;flex-direction:column;width:min(1080px,94vw);max-height:min(880px,90vh);display:flex;overflow:hidden;box-shadow:0 32px 100px #07070885}.video-viewer-header{background:hsl(var(--muted) / .3);border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;min-height:56px;padding:10px 16px;display:flex}.video-viewer-title{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;max-width:70%;font-weight:500;overflow:hidden}.video-viewer-nav{gap:6px;display:flex}.video-viewer-download,.video-viewer-close{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:9px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.video-viewer-download:hover,.video-viewer-close:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.video-viewer-download svg,.video-viewer-close svg{width:17px;height:17px}.video-viewer-body{background:#161618;flex:1;place-items:center;min-height:0;padding:20px;display:grid;overflow:hidden}.video-viewer-body .video-fullscreen{background:#000;border-radius:12px;max-width:100%;max-height:calc(90vh - 96px);box-shadow:0 4px 20px #0006}@media (max-width:640px){.md .video-preview-trigger{max-width:100%}.video-viewer-backdrop{padding:0}.video-viewer{border:none;border-radius:0;width:100vw;max-height:100vh}.video-viewer-body .video-fullscreen{border-radius:0;max-height:calc(100vh - 96px)}}.turn--user .md code,.turn--user .md pre{background:hsl(var(--background) / .55)}.block-thinking,.block-tool{width:100%}.think-head,.tool-head{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;display:inline-flex}.think-head{gap:8px;min-height:32px;padding:3px 7px 3px 3px}.think-icon{flex:0 0 20px;place-items:center;width:20px;height:26px;display:grid}.think-icon>svg{width:18px;height:18px}.spark{color:hsl(var(--muted-foreground))}.spark.pulse{animation:1.4s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.5}}.chev{opacity:.58;flex:0 0 13px;width:13px;height:13px;transition:transform .18s}.chev.open{transform:rotate(90deg)}.think-label{font-size:14.5px;font-weight:400;line-height:1.35}.think-label--done{color:hsl(var(--muted-foreground))}.tool-head{color:hsl(var(--muted-foreground));transition:color .12s}.tool-head:hover{color:hsl(var(--foreground))}.tool-head--generic{gap:8px;min-height:32px;padding:3px 7px 3px 3px}.tool-name{color:inherit;font-size:14.5px;font-weight:400;line-height:1.35}.tool-icon{flex:0 0 20px;place-items:center;width:20px;height:26px;display:grid}.tool-icon>svg{width:18px;height:18px}.tool-icon--generic{color:hsl(var(--muted-foreground))}.tool-chevron{opacity:.58;flex:0 0 13px;width:13px;height:13px;transition:transform .18s}.tool-chevron.is-open{transform:rotate(90deg)}.tool-detail{flex-direction:column;gap:8px;margin:6px 0 4px;padding-left:3px;display:flex}.tool-section-label{text-transform:uppercase;letter-spacing:.04em;color:hsl(var(--muted-foreground));margin-bottom:4px;font-size:11px}.tool-result{max-height:240px;overflow:auto}.think-collapse{grid-template-rows:0fr;transition:grid-template-rows .28s;display:grid}.think-collapse.open{grid-template-rows:1fr}.think-collapse-inner{overflow:hidden}.think-body{color:hsl(var(--muted-foreground));white-space:pre-wrap;border-left:0;max-height:220px;margin:0;padding:0;font-size:14px;line-height:1.7;overflow-y:auto}.tool-args{background:hsl(var(--muted));white-space:pre-wrap;border-radius:6px;margin:0;padding:8px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.5;overflow-x:auto}.turn-meta{color:hsl(var(--muted-foreground));opacity:0;align-items:center;gap:10px;margin-top:2px;font-size:12px;transition:opacity .15s;display:flex}.turn-empty{color:hsl(var(--muted-foreground));margin-top:2px;font-size:13px;font-style:italic}.auth-card{border:1px solid hsl(var(--border));background:hsl(var(--card));border-radius:12px;width:100%;max-width:640px;margin:2px 0;padding:18px 20px}.auth-card-head{align-items:center;gap:8px;margin-bottom:6px;display:flex}.auth-card-icon{color:#f59f0a;width:18px;height:18px}.auth-card-icon--done{color:#1eae53}.auth-card-collapsed{border:1px solid hsl(var(--border));background:hsl(var(--card));color:hsl(var(--muted-foreground));border-radius:9px;align-items:center;gap:7px;margin:2px 0;padding:6px 12px;font-size:13px;font-weight:500;display:inline-flex}.auth-card-code{background:hsl(var(--muted));color:hsl(var(--foreground));word-break:break-all;border-radius:5px;padding:1px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.auth-card-title{font-size:14px;font-weight:600}.auth-card-desc{color:hsl(var(--muted-foreground));margin:0 0 14px;font-size:13px;line-height:1.6}.auth-card-btn{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font:inherit;cursor:pointer;border:none;border-radius:9px;align-items:center;gap:7px;padding:8px 16px;font-size:13px;font-weight:600;transition:opacity .12s;display:inline-flex}.auth-card-btn:hover:not(:disabled){opacity:.88}.auth-card-btn:disabled{opacity:.55;cursor:default}.auth-card-btn .cw-i{width:15px;height:15px}.auth-card-done{color:#1eae53;align-items:center;gap:6px;font-size:13px;font-weight:500;display:inline-flex}.auth-card-done .cw-i{width:16px;height:16px}.auth-card-err{color:hsl(var(--destructive));margin-top:8px;font-size:12px}.artifact-list{gap:8px;width:min(100%,440px);margin:6px 0;display:grid}.artifact-card{width:100%;color:hsl(var(--foreground));text-align:left;background:#f5f9ff;border:1px solid #d1e1fa;border-radius:12px;align-items:center;gap:12px;padding:12px 14px;display:flex}.artifact-card__icon{color:#2371e7;background:#d8e7fd;border-radius:10px;flex:none;justify-content:center;align-items:center;width:36px;height:36px;display:inline-flex}.artifact-card__icon svg{width:18px;height:18px}.artifact-card__copy{flex:auto;gap:3px;min-width:0;display:grid}.artifact-card__name{text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;overflow:hidden}.artifact-card__hint{color:hsl(var(--muted-foreground));font-size:12px}.artifact-card__actions{flex:none;gap:6px;margin-left:auto;display:flex}.artifact-card__action{background:hsl(var(--background));color:#315b9b;white-space:nowrap;cursor:pointer;border:1px solid #becde4;border-radius:8px;flex:none;align-items:center;gap:5px;min-height:30px;padding:0 10px;font-size:12px;font-weight:600;display:inline-flex}.artifact-card__action:hover:not(:disabled){background:#ebf3ff}.artifact-card__action:disabled{cursor:default;opacity:.55}.artifact-card__action svg{width:14px;height:14px}.artifact-card__action--primary{color:#fff;background:#2c77e8;border-color:#3e81e5}.artifact-card__action--primary:hover:not(:disabled){background:#1867dc}.artifact-card__error{color:hsl(var(--destructive));font-size:12px}.artifact-preview{z-index:1200;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.artifact-preview__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:default;background:#0b182b94;border:0;position:absolute;top:0;right:0;bottom:0;left:0}.artifact-preview__panel{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:16px;grid-template-rows:auto minmax(0,1fr);width:min(1120px,92vw);max-height:90vh;display:grid;position:relative;overflow:hidden;box-shadow:0 26px 80px #0b182b4d}.artifact-preview__header{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;gap:16px;min-height:52px;padding:0 16px 0 20px;font-size:14px;font-weight:600;display:flex}.artifact-preview__header button{width:32px;height:32px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:center;align-items:center;display:inline-flex}.artifact-preview__header button:hover{background:hsl(var(--muted))}.artifact-preview__header svg{width:17px;height:17px}.artifact-preview__canvas{background:#eceff3;min-height:0;padding:18px;overflow:auto}.artifact-preview__canvas img{border-radius:8px;width:100%;height:auto;display:block;box-shadow:0 6px 24px #0b182b29}.turn-actions{align-items:center;gap:2px;display:inline-flex}.turn-actions--right{opacity:0;align-self:flex-end;margin-top:2px;transition:opacity .15s}.turn--assistant:hover .turn-meta,.turn--user:hover .turn-actions--right{opacity:1}.icon-btn{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;transition:background .12s,color .12s;display:inline-flex}.icon-btn:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.icon-btn:disabled{opacity:.35;cursor:default}.icon-btn:disabled:hover{color:hsl(var(--muted-foreground));background:0 0}.icon-btn .icon{width:15px;height:15px}.feedback-btn:hover,.feedback-btn--good,.feedback-btn--bad,.feedback-btn--good:hover,.feedback-btn--bad:hover{color:hsl(var(--foreground));background:0 0}.feedback-btn[aria-busy=true]{opacity:1}.feedback-btn--good[aria-busy=true]:hover,.feedback-btn--bad[aria-busy=true]:hover{color:hsl(var(--foreground))}.feedback-btn .icon{width:18px;height:18px}.meta-text{white-space:nowrap;color:hsl(var(--muted-foreground));font-size:12px}.turn-actions--right{gap:6px}.drawer-scrim{background:hsl(var(--foreground) / .2);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:40;animation:.2s fade;position:fixed;top:0;right:0;bottom:0;left:0}@keyframes fade{0%{opacity:0}to{opacity:1}}.drawer{background:hsl(var(--background));border-left:1px solid hsl(var(--border));width:min(560px,92vw);box-shadow:-12px 0 40px hsl(var(--foreground) / .14);z-index:41;flex-direction:column;animation:.24s cubic-bezier(.22,1,.36,1) slidein;display:flex;position:fixed;top:0;bottom:0;right:0}@keyframes slidein{0%{transform:translate(100%)}to{transform:translate(0)}}.drawer-head{border-bottom:1px solid hsl(var(--border));background:hsl(var(--canvas));justify-content:space-between;align-items:center;padding:15px 18px;display:flex}.drawer-title{letter-spacing:-.01em;font-size:15px;font-weight:650}.drawer-sub{color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;margin-top:3px;font-size:12px}.drawer-close{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;border-radius:6px;padding:6px;display:flex}.drawer-close:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.drawer-body{flex:1;padding:16px 18px;overflow:auto}.drawer-loading,.drawer-empty{color:hsl(var(--muted-foreground));align-items:center;gap:8px;font-size:14px;display:flex}.drawer-loading{flex:1;justify-content:center;padding:24px}.drawer-empty{padding:20px 0}.drawer--trace{width:min(1080px,96vw)}.trace-split{flex:1;min-height:0;display:flex}.trace-tree{border-right:1px solid hsl(var(--border));flex:1.25;min-width:0;padding:8px 6px;overflow:auto}.trace-row{cursor:pointer;width:100%;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;gap:10px;padding:5px 8px;transition:background .1s;display:flex}.trace-row:hover{background:hsl(var(--foreground) / .04)}.trace-row.active{background:hsl(var(--primary) / .07);box-shadow:inset 2px 0 hsl(var(--primary) / .55)}.trace-label{flex:1;align-items:center;gap:6px;min-width:0;display:flex}.trace-caret{width:16px;height:16px;color:hsl(var(--muted-foreground));flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.trace-caret.hidden{visibility:hidden}.trace-caret .chev{width:13px;height:13px;transition:transform .18s}.trace-caret.open .chev{transform:rotate(90deg)}.trace-dot{border-radius:50%;flex-shrink:0;width:8px;height:8px}.trace-name{white-space:nowrap;text-overflow:ellipsis;font-size:13px;overflow:hidden}.trace-dur{text-align:right;width:66px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;flex-shrink:0;font-size:11px}.trace-track{background:hsl(var(--foreground) / .05);border-radius:5px;flex:0 0 34%;height:16px;position:relative}.trace-bar{opacity:.9;border-radius:4px;min-width:3px;height:8px;position:absolute;top:4px}.trace-detail{flex:1;min-width:0;padding:18px 20px;overflow:auto}.td-title{letter-spacing:-.01em;word-break:break-all;font-size:15px;font-weight:600}.td-dur{color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;align-items:center;gap:7px;margin-top:4px;font-size:12px;display:flex}.td-dot{border-radius:50%;width:8px;height:8px}.td-section{letter-spacing:.01em;color:hsl(var(--foreground));margin:22px 0 9px;font-size:12px;font-weight:650}.td-props{flex-direction:column;display:flex}.td-prop{border-bottom:1px solid hsl(var(--border));gap:16px;padding:7px 0;font-size:13px;display:flex}.td-key{color:hsl(var(--muted-foreground));flex-shrink:0;min-width:140px}.td-val{text-align:right;word-break:break-word;font-variant-numeric:tabular-nums;flex:1;min-width:0}.td-pre{background:hsl(var(--canvas));border:1px solid hsl(var(--border));white-space:pre-wrap;word-break:break-word;border-radius:8px;max-height:320px;margin:0;padding:11px 13px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.55;overflow:auto}.composer{width:100%;max-width:768px;margin:0 auto;padding:6px 16px 18px}.conversation-composer-slot{padding:6px 16px 18px}.conversation-composer-slot>.composer-slot>.composer{padding:0}.composer--new-chat{position:relative}.composer-box{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:26px;align-items:flex-end;gap:6px;padding:6px 6px 6px 8px;display:flex;position:relative}.composer--new-chat .composer-box{border-color:hsl(var(--border) / .55);border-radius:16px;min-height:136px;padding:10px;display:block;box-shadow:0 8px 32px #00000007,0 24px 72px 8px #00000005}.composer-input-stack{flex-direction:column;flex:1;min-width:0;display:flex;position:relative}.composer-input-stack .comp-input{width:100%}.composer--new-chat .composer-input-stack{min-height:114px}.composer--new-chat .comp-input{min-height:76px;padding:4px 10px}.composer--new-chat .comp-input::placeholder{color:#0000}.composer-placeholder-reveal{z-index:1;width:max-content;max-width:calc(100% - 20px);color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;pointer-events:none;font-size:15px;line-height:1.5;position:absolute;top:4px;left:10px;overflow:hidden}.composer--new-chat .composer-menu-wrap{height:36px;position:absolute;bottom:10px;left:10px}.composer--new-chat .new-chat-mode{align-items:center;min-height:36px;display:flex;position:absolute;bottom:10px;left:52px}.composer--new-chat.composer--has-task .new-chat-mode{left:138px}.composer--new-chat.composer--task-image .new-chat-mode,.composer--new-chat.composer--task-video .new-chat-mode{left:176px}.composer--new-chat.composer--skill-mode .new-chat-mode{left:10px}.new-chat-task-chip{z-index:2;color:#7a5bae;width:78px;height:36px;font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;gap:7px;padding:0 10px;font-size:15px;line-height:1;transition:background .15s,transform .15s;display:inline-flex;position:absolute;bottom:10px;left:52px}.new-chat-task-chip--image,.new-chat-task-chip--video{width:116px}.new-chat-task-chip--skill{width:86px;left:10px}.new-chat-task-chip>span:last-child{white-space:nowrap;flex:none}.new-chat-task-chip:hover,.new-chat-task-chip:focus-visible{background:#f4f1f8;outline:none}.new-chat-task-chip:active{transform:scale(.97)}.new-chat-task-chip:disabled{cursor:default;opacity:.5}.new-chat-task-chip__icon{border-radius:50%;flex:0 0 20px;place-items:center;width:20px;height:20px;display:grid;position:relative}.new-chat-task-chip__task-icon,.new-chat-task-chip__remove-icon{width:18px;height:18px;transition:opacity .12s,transform .15s;position:absolute}.new-chat-task-chip__remove-icon{color:#fff;opacity:0;box-sizing:content-box;background:#896bbd;border-radius:50%;width:12px;height:12px;padding:3px;transform:scale(.72)}.new-chat-task-chip:hover .new-chat-task-chip__task-icon,.new-chat-task-chip:focus-visible .new-chat-task-chip__task-icon{opacity:0;transform:scale(.72)}.new-chat-task-chip:hover .new-chat-task-chip__remove-icon,.new-chat-task-chip:focus-visible .new-chat-task-chip__remove-icon{opacity:1;transform:scale(1)}.composer--new-chat .comp-send{position:absolute;bottom:10px;right:10px}.composer--new-chat .comp-send .icon{width:20px;height:20px}.task-shortcuts{z-index:1;flex-wrap:wrap;justify-content:center;gap:10px;width:100%;display:flex;position:absolute;top:calc(100% + 18px);left:0}.task-shortcut{border:1px solid hsl(var(--border) / .72);background:hsl(var(--background));min-width:92px;height:40px;color:hsl(var(--muted-foreground));font:inherit;white-space:nowrap;cursor:pointer;opacity:0;border-radius:999px;flex:none;justify-content:center;align-items:center;gap:8px;padding:0 18px;font-size:13px;line-height:1;transition:border-color .14s,background .14s,color .14s,transform .14s;animation:.32s cubic-bezier(.22,1,.36,1) forwards task-shortcut-enter;display:inline-flex;transform:translateY(6px)}.task-shortcut>span{white-space:nowrap}.task-shortcut:nth-child(2){animation-delay:45ms}.task-shortcut:nth-child(3){animation-delay:90ms}.task-shortcut:nth-child(4){animation-delay:.135s}.task-shortcut:hover{color:#7454ab;background:#f6f5fa;border-color:#8970b257;transform:translateY(-1px)}.task-shortcut:focus-visible{outline-offset:2px;outline:2px solid #8970b257}.task-shortcut:disabled{cursor:not-allowed;opacity:.5}.task-shortcut>svg{stroke:currentColor;flex:none;width:18px;height:18px}.prompt-suggestions{z-index:1;gap:3px;width:100%;display:grid;position:absolute;top:calc(100% + 18px);left:0}.prompt-suggestion{width:100%;min-height:46px;color:hsl(var(--muted-foreground));font:inherit;text-align:left;cursor:pointer;opacity:0;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:8px 14px;font-size:15px;line-height:1.5;transition:background .14s,color .14s,transform .14s;animation:.44s cubic-bezier(.22,1,.36,1) forwards prompt-suggestion-enter;display:flex;transform:translateY(10px)}.prompt-suggestion:nth-child(2){animation-delay:65ms}.prompt-suggestion:nth-child(3){animation-delay:.13s}.prompt-suggestion:nth-child(4){animation-delay:.195s}.prompt-suggestion:hover{background:hsl(var(--foreground) / .025);color:hsl(var(--foreground))}.prompt-suggestion:focus-visible{outline:2px solid hsl(var(--primary) / .42);outline-offset:-2px}.prompt-suggestion:disabled{cursor:not-allowed;opacity:.5}.prompt-suggestion>svg{stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.35px;transform-origin:50%;flex:none;width:18px;height:18px;transition:transform .22s cubic-bezier(.22,1,.36,1)}.prompt-suggestion>span{white-space:nowrap;text-overflow:ellipsis;min-width:0;max-height:1.5em;transition:max-height .22s cubic-bezier(.22,1,.36,1);display:block;overflow:hidden}.prompt-suggestion:hover>span,.prompt-suggestion:focus-visible>span{white-space:normal;text-overflow:clip;max-height:4.5em}.prompt-suggestion:first-child:hover>svg{transform:rotate(-8deg)scale(1.06)}.prompt-suggestion:nth-child(2):hover>svg{transform:rotate(6deg)scale(1.07)}.prompt-suggestion:nth-child(3):hover>svg{transform:rotate(-5deg)scale(1.06)}.prompt-suggestion:nth-child(4):hover>svg{transform:rotate(5deg)scale(1.06)}@keyframes prompt-suggestion-enter{to{opacity:1;transform:translateY(0)}}@keyframes task-shortcut-enter{to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.task-shortcut,.prompt-suggestion,.new-chat-task-chip,.new-chat-task-chip__task-icon,.new-chat-task-chip__remove-icon{opacity:1;transition:none;animation:none;transform:none}.prompt-suggestion>svg,.prompt-suggestion>span{transition:none}.prompt-suggestion:hover>svg{transform:none}}.composer-meta{min-width:0;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:8px;padding:7px 12px 0;font-size:11px;line-height:1.4;display:flex}.composer-session-line{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex}.composer-session-id{text-overflow:ellipsis;max-width:300px;font-family:inherit;overflow:hidden}.composer-session-copy{width:18px;height:18px;color:inherit;cursor:pointer;opacity:.72;background:0 0;border:0;border-radius:4px;flex:0 0 18px;place-items:center;padding:0;transition:background .12s,color .12s,opacity .12s;display:inline-grid}.composer-session-copy:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground));opacity:1}.composer-session-copy svg{width:11px;height:11px}.composer-meta-separator{opacity:.55}.comp-input{resize:none;color:hsl(var(--foreground));font:inherit;background:0 0;border:none;outline:none;flex:1;max-height:200px;padding:8px 4px;font-size:15px;line-height:1.5;overflow-y:auto}.comp-input::placeholder{color:hsl(var(--muted-foreground))}.comp-icon{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:background .12s,color .12s;display:flex}.comp-icon:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.comp-send{background:hsl(var(--primary));width:36px;height:36px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,transform .1s;display:flex}.comp-send:hover:not(:disabled){opacity:.85}.comp-send:active:not(:disabled){transform:scale(.94)}.comp-send:disabled{opacity:.3;cursor:default}.invocation-chips{flex-wrap:wrap;gap:6px;min-width:0;display:flex}.composer>.invocation-chips{padding:0 8px 8px}.turn--user>.invocation-chips{justify-content:flex-end;margin-bottom:6px}.invocation-chip{border:1px solid hsl(var(--border));background:hsl(var(--background));max-width:260px;min-height:28px;color:hsl(var(--foreground));box-shadow:0 1px 2px hsl(var(--foreground) / .025);border-radius:8px;align-items:center;gap:5px;padding:4px 8px;font-size:12px;font-weight:560;line-height:1.2;display:inline-flex}.invocation-chip--skill{color:#267848}.invocation-chip--agent{color:#2762b0}.invocation-chip>svg{flex:none;width:13px;height:13px}.invocation-chip>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.invocation-chip button{color:currentColor;cursor:pointer;opacity:.55;background:0 0;border:none;border-radius:5px;justify-content:center;align-items:center;width:17px;height:17px;margin:-1px -3px -1px 1px;padding:0;display:inline-flex}.invocation-chip button:hover{background:hsl(var(--accent));opacity:1}.invocation-chip button svg{width:11px;height:11px}.composer-command-menu{z-index:34;border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(500px,100vw - 48px);box-shadow:0 2px 7px hsl(var(--foreground) / .08),0 22px 60px -24px hsl(var(--foreground) / .28);transform-origin:0 100%;border-radius:14px;animation:.13s ease-out command-menu-in;position:absolute;bottom:calc(100% + 10px);left:0;overflow:hidden}@keyframes command-menu-in{0%{opacity:0;transform:translateY(5px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.composer-command-head{border-bottom:1px solid hsl(var(--border));height:38px;color:hsl(var(--muted-foreground));letter-spacing:.02em;align-items:center;gap:7px;padding:0 10px 0 12px;font-size:11px;font-weight:650;display:flex}.composer-command-head>svg{width:13px;height:13px}.composer-command-head>span{flex:1}.composer-command-menu kbd{border:1px solid hsl(var(--border));background:hsl(var(--canvas));min-width:22px;color:hsl(var(--muted-foreground));text-align:center;border-radius:5px;padding:2px 5px;font:10px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace}.composer-command-list{max-height:min(330px,42vh);padding:5px;display:grid;overflow-y:auto}.composer-command-item{width:100%;min-height:52px;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:9px;grid-template-columns:34px minmax(0,1fr) auto;align-items:center;gap:9px;padding:6px 8px;display:grid}.composer-command-item.is-active{background:hsl(var(--accent))}.composer-command-icon{border-radius:9px;justify-content:center;align-items:center;width:34px;height:34px;display:inline-flex}.composer-command-icon--skill{color:#218349;background:#e7f8ee}.composer-command-icon--agent{color:#2664b5;background:#e9f1fc}.composer-command-icon svg{width:16px;height:16px}.composer-command-copy{gap:3px;min-width:0;display:grid}.composer-command-copy strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:620;line-height:1.2;overflow:hidden}.composer-command-copy>span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11px;line-height:1.3;overflow:hidden}.composer-command-empty{min-height:68px;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:7px;padding:14px;font-size:12px;display:flex}.composer-command-empty svg{width:14px;height:14px}.composer-menu-wrap{flex-shrink:0;position:relative}.composer-menu{z-index:31;background:hsl(var(--background));border:1px solid hsl(var(--border));min-width:168px;box-shadow:0 6px 20px hsl(var(--foreground) / .12);border-radius:12px;margin-bottom:6px;padding:4px;position:absolute;bottom:100%;left:0}.media-grid{flex-wrap:wrap;gap:8px;max-width:min(620px,100%);display:flex}.turn--user .media-grid{justify-content:flex-end}.composer>.media-grid{justify-content:flex-start;padding:0 8px 9px}.media-card{border:1px solid hsl(var(--border));background:hsl(var(--background));width:272px;min-width:0;box-shadow:0 1px 2px hsl(var(--foreground) / .025);border-radius:14px;transition:border-color .16s,box-shadow .16s,transform .16s;position:relative;overflow:visible}.media-card:hover{border-color:hsl(var(--foreground) / .2);box-shadow:0 8px 28px -20px hsl(var(--foreground) / .28);transform:translateY(-1px)}.media-card--image{width:176px}.media-grid--compact .media-card{width:224px}.media-grid--compact .media-card--image{width:92px}.media-card-main{border-radius:inherit;width:100%;min-width:0;height:68px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:11px;padding:10px 12px;display:flex}.media-card-main:disabled{cursor:default}.media-card--image .media-card-main{height:132px;padding:4px;display:block}.media-grid--compact .media-card-main{height:58px;padding:8px 10px}.media-grid--compact .media-card--image .media-card-main{height:72px;padding:3px}.media-card-image{object-fit:cover;background:hsl(var(--muted));border-radius:10px;width:100%;height:100%;display:block}.media-card--image .media-card-copy,.media-card--image .media-card-open{display:none}.media-card-icon{width:40px;height:44px;color:hsl(var(--muted-foreground));background:hsl(var(--muted));border-radius:9px;flex:none;justify-content:center;align-items:center;display:inline-flex}.media-card--pdf .media-card-icon{color:#db2a24;background:#fdeded}.media-card--video .media-card-icon{color:#226cd3;background:#edf3fd}.media-card--markdown .media-card-icon{color:#259353;background:#ebfaf1}.media-card-icon svg{width:21px;height:21px}.media-card-video-container{background:#131316;place-items:center;width:100%;height:100%;display:grid;position:relative;overflow:hidden}.media-card-video{object-fit:cover;opacity:.85;width:100%;height:100%}.media-card-video-play{color:#fff;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#0000008c;border-radius:50%;place-items:center;width:48px;height:48px;transition:transform .18s,background .18s;display:grid;position:absolute;transform:scale(1)}.media-card-video-play svg{width:20px;height:20px;margin-left:3px}.media-card-main:hover .media-card-video-play{background:#000000b3;transform:scale(1.08)}.media-card-copy{flex:1;gap:5px;min-width:0;display:grid}.media-card-name{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:560;line-height:1.2;overflow:hidden}.media-card-meta{min-width:0;color:hsl(var(--muted-foreground));align-items:center;gap:5px;font-size:11px;line-height:1.2;display:flex}.media-card-type{letter-spacing:.06em;font-size:9px;font-weight:700}.media-card-open{width:14px;height:14px;color:hsl(var(--muted-foreground));opacity:0;flex:none;transition:opacity .15s}.media-card:hover .media-card-open{opacity:1}.media-card-spinner{width:12px;height:12px;animation:.85s linear infinite spin}.media-card--error{border-color:hsl(var(--destructive) / .42)}.media-card--error .media-card-meta{color:hsl(var(--destructive))}.media-card-remove{z-index:2;border:1px solid hsl(var(--border));background:hsl(var(--background));width:21px;height:21px;color:hsl(var(--muted-foreground));box-shadow:0 2px 8px hsl(var(--foreground) / .12);cursor:pointer;border-radius:999px;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:-7px;right:-7px}.media-card-remove:hover{color:hsl(var(--foreground))}.media-card-remove svg{width:12px;height:12px}.media-viewer-backdrop{z-index:90;-webkit-backdrop-filter:blur(12px)saturate(.8);backdrop-filter:blur(12px)saturate(.8);background:#131316b8;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.media-viewer{border:1px solid hsl(var(--foreground) / .13);background:hsl(var(--background));border-radius:18px;flex-direction:column;width:min(1080px,94vw);height:min(820px,90vh);display:flex;overflow:hidden;box-shadow:0 32px 100px #07070875}.media-viewer-header{border-bottom:1px solid hsl(var(--border));background:hsl(var(--background) / .94);justify-content:space-between;align-items:center;gap:18px;min-height:58px;padding:9px 12px 9px 18px;display:flex}.media-viewer-header>div{gap:2px;min-width:0;display:grid}.media-viewer-header strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:620;overflow:hidden}.media-viewer-header span{color:hsl(var(--muted-foreground));font-size:11px}.media-viewer-header nav{gap:4px;display:flex}.media-viewer-header a,.media-viewer-header button{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:9px;justify-content:center;align-items:center;padding:0;display:inline-flex}.media-viewer-header a:hover,.media-viewer-header button:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.media-viewer-header svg{width:17px;height:17px}.media-viewer-body{background:hsl(var(--canvas));flex:1;min-height:0;overflow:auto}.media-viewer-body--image,.media-viewer-body--video{background:#161618;place-items:center;padding:24px;display:grid}.media-viewer-body--image img,.media-viewer-body--video video{object-fit:contain;border-radius:8px;max-width:100%;max-height:100%}.media-viewer-video-wrapper{place-items:center;width:100%;display:grid}.media-viewer-video{background:#000;border-radius:12px;max-width:100%;max-height:calc(90vh - 140px);box-shadow:0 4px 20px #0006}.media-viewer-body--pdf iframe{background:#fff;border:none;width:100%;height:100%;display:block}.media-document{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(820px,100% - 48px);box-shadow:0 12px 38px -30px hsl(var(--foreground) / .3);border-radius:12px;margin:24px auto;padding:34px 40px}.media-document--plain{white-space:pre-wrap;word-break:break-word;min-height:calc(100% - 48px);font:13px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace}.media-viewer-loading{height:100%;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.media-viewer-loading svg{width:17px;height:17px;animation:.85s linear infinite spin}@media (max-width:640px){.composer-command-menu{width:auto;right:0}.media-card{width:min(272px,82vw)}.media-viewer-backdrop{padding:0}.media-viewer{border:none;border-radius:0;width:100vw;height:100vh}.media-document{width:calc(100% - 24px);margin:12px auto;padding:22px 18px}.md .image-preview-trigger{max-width:100%}}.a2ui-surface{width:100%;max-width:360px;font-size:14px}.a2ui-card{background:hsl(var(--card));border:1px solid hsl(var(--border));box-shadow:0 1px 2px hsl(var(--foreground) / .04),0 8px 24px -16px hsl(var(--foreground) / .18);border-radius:8px;padding:18px}.a2ui-column,.a2ui-row{gap:10px}.a2ui-text{color:hsl(var(--foreground));margin:0;line-height:1.5}.a2ui-text--h1{letter-spacing:0;font-size:19px;font-weight:650}.a2ui-text--h2{letter-spacing:0;font-size:16px;font-weight:650}.a2ui-text--h3{font-size:14px;font-weight:600}.a2ui-text--h4{color:hsl(var(--muted-foreground));text-transform:uppercase;letter-spacing:0;font-size:12px;font-weight:600}.a2ui-text--caption{color:hsl(var(--muted-foreground));font-size:12px}.a2ui-text--body{font-size:14px}.a2ui-icon{color:hsl(var(--muted-foreground));justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.a2ui-divider--h{background:hsl(var(--border));width:100%;height:1px;margin:4px 0}.a2ui-divider--v{background:hsl(var(--border));align-self:stretch;width:1px}.a2ui-button{background:hsl(var(--secondary));color:hsl(var(--secondary-foreground));cursor:pointer;font:inherit;border:1px solid #0000;border-radius:10px;padding:8px 14px;font-size:13px;font-weight:500;transition:background .15s,opacity .15s}.a2ui-button:hover{background:hsl(var(--accent))}.a2ui-button--primary{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.a2ui-button--primary:hover{background:hsl(var(--primary));opacity:.88}.a2ui-button--borderless{color:hsl(var(--foreground));background:0 0}.a2ui-button--borderless:hover{background:hsl(var(--accent))}.a2ui-surface[data-a2ui-surface^=flight-]{max-width:520px}.a2ui-surface[data-a2ui-surface^=flight-] .a2ui-card{background:linear-gradient(180deg,#f6fbfe,hsl(var(--card)) 42%),hsl(var(--card));box-shadow:0 1px 2px hsl(var(--foreground) / .05),0 18px 48px -28px #283d5359;border-color:#d7e0ea;padding:0;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-content]{gap:16px;padding:18px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-top]{gap:12px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-brand]{min-width:0}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-brand-icon]{color:#004fa3;background:#006fe61a;border-radius:999px;width:28px;height:28px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-title]{color:#41454e;white-space:nowrap;text-overflow:ellipsis;font-size:13px;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-chip]{background:#e3f8ed;border:1px solid #bbe7d2;border-radius:999px;flex-shrink:0;gap:6px;padding:5px 9px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-chip] .a2ui-icon,.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-text]{color:#126e41}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-hero]{background:hsl(var(--background) / .88);border:1px solid #dde6ee;border-radius:8px;gap:16px;padding:18px;position:relative}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination]{flex:1 1 0;gap:2px;min-width:0}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-code],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-code]{color:#191d24;font-size:34px;font-weight:760;line-height:1}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-label],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-label]{color:#717784;font-size:11px;font-weight:700}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-city],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-city]{color:#545964;font-size:13px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-mark]{flex:none;gap:3px;padding:0 4px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-icon]{color:#0054ad;background:#006fe61f;border-radius:999px;width:34px;height:34px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-duration],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-aircraft]{white-space:nowrap;font-size:11px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-times],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-details]{gap:10px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-time],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-time],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding]{background:#f3f4f6;border:1px solid #e5e7eb;border-radius:8px;flex:1 1 0;gap:2px;min-width:0;padding:11px 12px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-value]{font-size:14px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-airport],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-airport]{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding-value]{font-size:20px;line-height:1.15}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-footer]{gap:10px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-divider]{background:#d9e0e8;margin:0}@media (max-width:520px){.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-content]{padding:14px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-hero],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-times],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-details]{flex-wrap:wrap}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-mark]{order:3;width:100%}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding]{min-width:120px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-code],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-code]{font-size:34px}}.a2ui-fallback{background:hsl(var(--muted));border:1px solid hsl(var(--border));color:hsl(var(--muted-foreground));border-radius:10px;padding:8px 10px;font-size:12px}.a2ui-fallback pre{margin:6px 0 0;overflow-x:auto}.boot{background:hsl(var(--background));height:100vh}.boot-error{color:hsl(var(--foreground));flex-direction:column;justify-content:center;align-items:center;gap:12px;font-size:14px;display:flex}.boot-error p{margin:0}.boot-error button,.login-provider-error button{border:1px solid hsl(var(--border));background:hsl(var(--card));color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:7px 18px;font-size:13px}.boot-error button:hover,.login-provider-error button:hover{background:hsl(var(--accent))}.navbar{background:0 0;flex:0 0 54px;justify-content:space-between;align-items:center;gap:16px;min-height:54px;padding:0 10px;display:flex}.navbar-left,.navbar-right,.navbar-default,.navbar-portal-slot,.navbar-portal-actions{align-items:center;display:flex}.navbar-left{flex:1;min-width:0;container-type:inline-size}.navbar-default{min-width:0}.navbar-title-group{align-items:center;gap:6px;min-width:0;display:flex}.loading-gap-spinner{box-sizing:border-box;border:1.5px solid #111;border-right-color:#0000;border-radius:50%;flex:0 0 16px;width:16px;height:16px;animation:.7s linear infinite loading-gap-spin;display:inline-block}@keyframes loading-gap-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.loading-gap-spinner{animation-duration:1.4s}}.agent-info-trigger{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:7px;flex:0 0 30px;justify-content:center;align-items:center;padding:0;transition:background .15s,color .15s;display:inline-flex}.agent-info-trigger:hover,.agent-info-trigger[aria-expanded=true]{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.agent-info-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:1px}.agent-info-trigger svg{width:17px;height:17px}.navbar-right{flex:none;gap:10px;min-width:0}.navbar-portal-slot,.navbar-portal-actions{min-width:0}.navbar-portal-slot:empty,.navbar-portal-actions:empty,.navbar-left:has(.navbar-portal-slot:not(:empty))>.navbar-default{display:none}.global-deploy-center{z-index:38;position:relative}.global-deploy-task{border:1px solid hsl(var(--border));background:hsl(var(--background) / .82);max-width:300px;min-height:32px;color:hsl(var(--muted-foreground));font:inherit;white-space:nowrap;cursor:pointer;border-radius:7px;outline:none;align-items:center;gap:7px;padding:0 10px;font-size:12px;transition:border-color .12s,background-color .12s;display:flex}.global-deploy-task:hover{background:hsl(var(--background))}.global-deploy-task:focus-visible{border-color:hsl(var(--ring) / .32);box-shadow:0 0 0 2px hsl(var(--ring) / .07)}.global-deploy-task.is-idle{color:hsl(var(--muted-foreground))}.global-deploy-task.is-running{color:#1863b4;border-color:#0c77e93d}.global-deploy-task.is-success{color:#277c46;border-color:#279b5138}.global-deploy-task.is-error{border-color:hsl(var(--destructive) / .24);color:hsl(var(--destructive))}.global-deploy-task.is-cancelled{color:hsl(var(--muted-foreground))}.global-deploy-task-icon{flex:none;width:14px;height:14px}.global-deploy-task-detail{text-overflow:ellipsis;overflow:hidden}.global-deploy-task-chevron{flex:none;width:13px;height:13px;transition:transform .14s}.global-deploy-task-chevron.is-open{transform:rotate(180deg)}.global-deploy-task-scrim{z-index:1;background:0 0;border:0;padding:0;position:fixed;top:0;right:0;bottom:0;left:0}.global-deploy-popover{z-index:2;border:1px solid hsl(var(--border));background:hsl(var(--background));width:390px;max-width:calc(100vw - 32px);box-shadow:0 14px 36px hsl(var(--foreground) / .14);border-radius:10px;position:absolute;top:40px;right:0;overflow:hidden}.global-deploy-popover-head{border-bottom:1px solid hsl(var(--border));height:44px;color:hsl(var(--foreground));justify-content:space-between;align-items:center;padding:0 14px;font-size:13px;font-weight:650;display:flex}.global-deploy-popover-head span:last-child{background:hsl(var(--secondary));min-width:20px;color:hsl(var(--muted-foreground));text-align:center;border-radius:999px;padding:1px 6px;font-size:11px}.global-deploy-list{max-height:min(520px,100vh - 82px);padding:8px;overflow-y:auto}.global-deploy-empty{color:hsl(var(--muted-foreground));text-align:center;padding:34px 16px;font-size:12.5px}.global-deploy-item{border:1px solid hsl(var(--border) / .8);background:hsl(var(--canvas) / .42);border-radius:8px;padding:12px}.global-deploy-item+.global-deploy-item{margin-top:7px}.global-deploy-item-head{justify-content:space-between;align-items:center;gap:12px;display:flex}.global-deploy-runtime-name{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650;overflow:hidden}.global-deploy-status{color:hsl(var(--muted-foreground));flex:none;font-size:11.5px}.global-deploy-item.is-running .global-deploy-status{color:#1863b4}.global-deploy-item.is-success .global-deploy-status{color:#277c46}.global-deploy-item.is-error .global-deploy-status{color:hsl(var(--destructive))}.global-deploy-item.is-cancelled .global-deploy-status{color:hsl(var(--muted-foreground))}.global-deploy-meta{grid-template-columns:1fr 1fr;gap:9px 14px;margin:11px 0 0;display:grid}.global-deploy-meta>div{min-width:0}.global-deploy-meta dt{color:hsl(var(--muted-foreground));margin-bottom:3px;font-size:10.5px}.global-deploy-meta dd{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:11.5px;overflow:hidden}.global-deploy-message{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;margin:10px 0 0;font-size:11.5px;line-height:1.45;overflow:hidden}.global-deploy-error{color:hsl(var(--muted-foreground));margin-top:10px;font-size:11.5px}.deploy-error-message-text{-webkit-line-clamp:3;overflow-wrap:anywhere;white-space:pre-wrap;-webkit-box-orient:vertical;margin:0;line-height:1.5;display:-webkit-box;overflow:hidden}.deploy-error-message.is-expanded .deploy-error-message-text{-webkit-line-clamp:unset;max-height:280px;display:block;overflow:auto}.deploy-error-message-actions{justify-content:flex-end;gap:2px;margin-top:6px;display:flex}.deploy-error-message-actions button{width:26px;height:26px;color:inherit;cursor:pointer;opacity:.72;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;padding:0;display:inline-flex}.deploy-error-message-actions button:hover{background:hsl(var(--foreground) / .07);opacity:1}.deploy-error-message-actions button:disabled{cursor:default;opacity:.5}.deploy-error-message-actions .deploy-error-retry{width:auto;font:inherit;gap:5px;margin-right:auto;padding:0 8px;font-size:11.5px;font-weight:600}.deploy-error-message-actions svg{width:14px;height:14px}.global-deploy-progress{background:hsl(var(--foreground) / .08);border-radius:999px;height:3px;margin-top:10px;overflow:hidden}.global-deploy-progress span{border-radius:inherit;background:#2581e4;height:100%;transition:width .18s;display:block}.global-deploy-item-actions{justify-content:flex-end;margin-top:9px;display:flex}.global-deploy-item-actions button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-height:27px;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;border-radius:5px;padding:0 9px;font-size:11.5px}.global-deploy-item-actions button:hover:not(:disabled){border-color:hsl(var(--destructive) / .3);background:hsl(var(--destructive) / .05);color:hsl(var(--destructive))}.global-deploy-item-actions button:disabled{opacity:.55;cursor:default}.navbar-title{letter-spacing:-.01em;color:hsl(var(--foreground));padding:5px 8px;font-size:16px;font-weight:650}.agent-dd{min-width:0;max-width:33.333cqw;position:relative}.agent-dd-trigger{color:hsl(var(--foreground));font:inherit;letter-spacing:-.01em;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:5px;max-width:100%;padding:5px 8px;font-size:16px;font-weight:650;transition:background .12s;display:inline-flex}.agent-dd-trigger:hover{background:hsl(var(--foreground) / .05)}.agent-dd-current{white-space:nowrap;text-overflow:ellipsis;min-width:0;max-width:100%;overflow:hidden}.agent-dd-chev{opacity:.6;width:16px;height:16px;transition:transform .2s}.agent-dd-chev.open{transform:rotate(180deg)}.agent-switch{letter-spacing:-.01em;align-items:center;gap:6px;min-width:0;max-width:33.333cqw;padding:5px 8px;font-size:16px;font-weight:650;display:inline-flex}.agent-switch-action{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:7px;flex:0 0 28px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.agent-switch-action:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.agent-switch-action:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:1px}.agent-switch-action svg{width:16px;height:16px}@keyframes ddpop{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.account{position:relative}.account-avatar{isolation:isolate;background:radial-gradient(circle at var(--avatar-x,32%) var(--avatar-y,30%),hsl(var(--avatar-hue-a,202) 100% 92%) 0 12%,hsl(var(--avatar-hue-a,202) 95% 75% / .76) 34%,transparent 62%),radial-gradient(ellipse at 82% 78%,hsl(var(--avatar-hue-c,185) 86% 49% / .88) 0 18%,transparent 58%),linear-gradient(142deg,hsl(var(--avatar-hue-b,222) 94% 83%),hsl(var(--avatar-hue-b,222) 95% 54%) 52%,hsl(var(--avatar-hue-c,185) 74% 62%));color:#152747e0;cursor:pointer;text-shadow:0 1px 2px #ffffff9e;width:32px;height:32px;box-shadow:none;background-position:20% 12%,80% 80%,50%;background-size:180% 180%,160% 160%,100% 100%;border:none;border-radius:9px;flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;transition:filter .16s,transform .16s;animation:9s ease-in-out infinite alternate avatar-smoke-drift;display:flex;position:relative;overflow:hidden}.account-avatar:hover{filter:saturate(1.12)brightness(1.03);transform:scale(1.035)}.account-avatar.has-image{text-shadow:none;animation:none}.account-avatar-image{z-index:1;border-radius:inherit;object-fit:cover;width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0}@keyframes avatar-smoke-drift{0%{background-position:18% 12%,82% 84%,50%}50%{background-position:58% 42%,54% 62%,50%}to{background-position:82% 70%,26% 24%,50%}}.account-avatar--lg{cursor:default;border-radius:11px;width:40px;height:40px;font-size:16px}.account-pop{z-index:31;background:hsl(var(--panel));border:1px solid hsl(var(--border));min-width:220px;box-shadow:0 8px 28px hsl(var(--foreground) / .14);border-radius:14px;padding:12px;animation:.12s ddpop;position:absolute;top:calc(100% + 8px);right:0}.account-head{align-items:center;gap:10px;display:flex}.account-id{flex:1;min-width:0}.account-name-row{align-items:center;gap:6px;min-width:0;display:flex}.account-name{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.account-sub{color:hsl(var(--muted-foreground));white-space:nowrap;text-overflow:ellipsis;font-size:12px;overflow:hidden}.account-action{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:10px;align-items:center;gap:8px;margin-top:10px;padding:9px 10px;font-size:13px;transition:background .12s;display:flex}.account-action+.account-action{margin-top:2px}.account-action:hover{background:hsl(var(--foreground) / .05)}.account-action .icon{width:16px;height:16px;color:hsl(var(--muted-foreground))}.system-info-dialog{width:360px;padding:0;overflow:hidden}.system-info-head{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;margin:0 20px;padding:20px 0 16px;display:flex}.system-info-head h2{margin:0;font-size:17px;font-weight:650}.system-info-meta{margin:0;padding:18px 20px 20px}.system-info-meta div{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.system-info-meta dt{color:hsl(var(--muted-foreground));font-size:13px}.system-info-meta dd{overflow-wrap:anywhere;font-variant-numeric:tabular-nums;max-width:100%;margin:0;font-family:inherit;font-size:13px;font-weight:400}.sidebar-footer{flex-shrink:0;margin-top:auto}.sidebar-feedback{width:calc(100% - 20px);height:36px;color:hsl(var(--foreground));cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:32px minmax(0,1fr);align-items:center;column-gap:9px;margin:0 10px;padding:0 10px 0 8px;font-size:14px;transition:background .12s;display:grid}.sidebar-feedback:hover{background:#fffae6}.sidebar-feedback>.icon{justify-self:center}.sidebar-feedback:focus-visible{box-shadow:inset 0 0 0 2px hsl(var(--ring) / .3);outline:none}.sidebar-user{flex-shrink:0;padding:8px 10px 12px;position:relative}.sidebar-user-btn{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:10px;align-items:center;gap:9px;padding:7px 8px;transition:background .12s;display:flex}.sidebar-user-btn:hover{background:hsl(var(--foreground) / .05)}.sidebar-user-identity{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.sidebar-user-primary{align-items:center;gap:6px;min-width:0;display:flex}.sidebar-user-name{text-align:left;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden}.sidebar-user-email{text-align:left;min-width:0;color:hsl(var(--muted-foreground));white-space:nowrap;text-overflow:ellipsis;font-size:11px;line-height:1.25;overflow:hidden}.studio-role-badge{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex-shrink:0;padding:2px 5px;font-size:10px;font-weight:600;line-height:1.2}.studio-role-badge--admin{color:#7027b4;background:#8f37e11c;border-color:#7d2cc93d}.studio-role-badge--developer{color:#976507;background:#fac70f2e;border-color:#ce9b0d4d}.studio-role-badge--user{color:#1b7e43;background:#25b15f1f;border-color:#2994543d}.sidebar.is-collapsed .sidebar-user-btn{justify-content:center;gap:0;width:36px;height:36px;padding:2px;overflow:hidden}.sidebar.is-collapsed .sidebar-feedback{grid-template-columns:1fr;justify-content:center;column-gap:0;width:36px;margin-inline:10px;padding:9px;overflow:hidden}.sidebar.is-collapsed .sidebar-user-identity{display:none}.sidebar.is-collapsed .sidebar-user-pop{width:220px;left:8px;right:auto}@media (prefers-reduced-motion:reduce){.sidebar{transition:none}}.sidebar-user-pop{position:absolute;inset:auto 10px calc(100% - 4px)}.skillcenter{flex-direction:column;flex:1;min-width:0;min-height:0;padding:0;display:flex}.skillcenter-regions{border:1px solid hsl(var(--border));background:hsl(var(--canvas) / .62);padding:2px;display:grid}.skillcenter-regions button{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0}.skillcenter-regions button.active{background:hsl(var(--background));color:hsl(var(--foreground));box-shadow:0 1px 2px hsl(var(--foreground) / .07)}.skillcenter-regions button:focus-visible,.skillcenter-pager button:focus-visible,.skill-detail-close:focus-visible{outline:2px solid hsl(var(--ring) / .28);outline-offset:1px}.skillcenter-space-item:focus-visible,.skillcenter-skill-item:focus-visible{background:hsl(var(--muted) / .62);border-color:#0000;outline:none}.skillcenter-regions{border-radius:7px;grid-template-columns:repeat(2,58px)}.skillcenter-regions button{border-radius:5px;height:27px;font-size:11.5px}.skillcenter-browser{flex:1;grid-template-columns:minmax(270px,.9fr) minmax(360px,1.35fr);gap:0;min-width:0;min-height:0;display:grid}.skillcenter-panel{flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.skillcenter-panel+.skillcenter-panel{border-left:1px solid hsl(var(--border))}.skillcenter-panel-head{border-bottom:1px solid hsl(var(--border));flex:0 0 48px;justify-content:space-between;align-items:center;gap:12px;height:48px;padding:0 14px;display:flex}.skillcenter-panel-head>div{align-items:center;gap:8px;min-width:0;display:flex}.skillcenter-panel-head .icon{width:17px;height:17px;color:hsl(var(--muted-foreground))}.skillcenter-panel-head h2{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:13.5px;font-weight:620;overflow:hidden}.skillcenter-panel-head>span{color:hsl(var(--muted-foreground));flex-shrink:0;font-size:11.5px}.skillcenter-count-badge{background:hsl(var(--muted));min-width:25px;height:21px;color:hsl(var(--muted-foreground));border-radius:999px;justify-content:center;align-items:center;padding:0 7px;font-size:11px;font-weight:600;line-height:1;display:inline-flex}.skillcenter-listwrap{overscroll-behavior:contain;flex:1;min-height:0;position:relative;overflow-y:auto}.skillcenter-list{flex-direction:column;gap:6px;padding:8px;display:flex}.skillcenter-space-item,.skillcenter-skill-item{width:100%;min-width:0;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:8px;align-items:flex-start;gap:10px;padding:10px;transition:background-color .12s,border-color .12s;display:flex}.skillcenter-space-item:hover,.skillcenter-skill-item:hover,.skillcenter-space-item.active{background:hsl(var(--muted) / .62);border-color:#0000}.skillcenter-symbol{border:1px solid hsl(var(--border));background:hsl(var(--background));width:30px;height:30px;color:hsl(var(--foreground) / .78);border-radius:7px;flex:0 0 30px;place-items:center;display:grid}.skillcenter-symbol .icon{width:18px;height:18px}.skillcenter-symbol--skill{color:#2764b4;background:#f2f7fd;border-color:#ccdbf0}.skillcenter-item-body{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.skillcenter-item-title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.skillcenter-item-description{min-width:0;color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:17px;display:-webkit-box;overflow:hidden}.skillcenter-item-meta{flex-wrap:wrap;align-items:center;gap:5px 8px;min-width:0;margin-top:2px;display:flex}.skillcenter-status{background:hsl(var(--muted));color:hsl(var(--muted-foreground));border-radius:999px;flex-shrink:0;padding:2px 6px;font-size:10.5px;line-height:16px}.skillcenter-status.is-positive{color:#1d7742;background:#e7f8ee}.skillcenter-status.is-progress{color:#8d5911;background:#fdf5e3}.skillcenter-status.is-danger{color:hsl(var(--destructive));background:hsl(var(--destructive) / .09)}.skillcenter-meta-text{min-width:0;max-width:170px;color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;line-height:16px;overflow:hidden}.skillcenter-pager{border-top:1px solid hsl(var(--border));height:44px;color:hsl(var(--muted-foreground));flex:0 0 44px;justify-content:space-between;align-items:center;gap:12px;padding:0 12px;font-size:11.5px;display:flex}.skillcenter-pager-actions{align-items:center;gap:7px;display:flex}.skillcenter-pager-actions>span{text-align:center;min-width:38px}.skillcenter-pager button,.skill-detail-close{color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.skillcenter-pager button{width:26px;height:26px;padding:0}.skillcenter-pager button:hover:not(:disabled),.skill-detail-close:hover{color:hsl(var(--foreground));background:hsl(var(--accent))}.skillcenter-pager button:disabled{opacity:.35;cursor:default}.skillcenter-pager button .icon{width:17px;height:17px}.skillcenter-empty,.skillcenter-loading,.skillcenter-error{min-height:130px;color:hsl(var(--muted-foreground));text-align:center;overflow-wrap:anywhere;justify-content:center;align-items:center;gap:8px;padding:24px;font-size:12.5px;line-height:1.55;display:flex}.skillcenter-error{color:hsl(var(--destructive))}.skillcenter-loading--overlay{z-index:2;background:hsl(var(--background) / .82);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);min-height:0;position:absolute;top:0;right:0;bottom:0;left:0}.skillcenter-loading-mark{border:1.5px solid hsl(var(--foreground) / .16);border-top-color:hsl(var(--foreground) / .62);border-radius:50%;flex-shrink:0;width:14px;height:14px;animation:.8s linear infinite spin}.skill-detail-backdrop{z-index:80;background:hsl(var(--foreground) / .25);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);place-items:center;padding:16px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.skill-detail-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(760px,100%);height:min(760px,100%);min-height:0;box-shadow:0 18px 48px hsl(var(--foreground) / .16);border-radius:12px;flex-direction:column;display:flex;overflow:hidden}.skill-detail-head{border-bottom:1px solid hsl(var(--border));flex-shrink:0;justify-content:space-between;align-items:flex-start;gap:16px;padding:16px 18px 14px;display:flex}.skill-detail-heading{align-items:flex-start;gap:11px;min-width:0;display:flex}.skill-detail-heading>div{min-width:0}.skill-detail-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:1px 0 4px;font-size:16px;font-weight:650;line-height:22px;overflow:hidden}.skill-detail-heading p{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:12px;line-height:17px;display:-webkit-box;overflow:hidden}.skill-detail-close{flex:0 0 30px;width:30px;height:30px;padding:0}.skill-detail-meta{border-bottom:1px solid hsl(var(--border));background:hsl(var(--canvas) / .45);flex-shrink:0;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 18px;margin:0;padding:14px 18px;display:grid}.skill-detail-meta>div{min-width:0}.skill-detail-meta dt{color:hsl(var(--muted-foreground));margin-bottom:3px;font-size:10.5px}.skill-detail-meta dd{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:12px;line-height:17px;overflow:hidden}.skill-detail-content{flex-direction:column;flex:1;min-height:0;display:flex}.skill-detail-content-title{border-bottom:1px solid hsl(var(--border));flex:0 0 40px;align-items:center;height:40px;padding:0 18px;font-size:12px;font-weight:600;display:flex}.skill-detail-content>.skillcenter-loading,.skill-detail-content>.skillcenter-error,.skill-detail-content>.skillcenter-empty{flex:1;min-height:0}.skill-detail-markdown{overflow-wrap:anywhere;flex:1;min-height:0;padding:18px 22px 28px;overflow-y:auto}@media (max-width:760px){.skillcenter-browser{grid-template-rows:repeat(2,minmax(0,1fr));grid-template-columns:minmax(0,1fr)}.skillcenter-panel+.skillcenter-panel{border-top:1px solid hsl(var(--border));border-left:0}.skill-detail-meta{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (max-width:560px){.skillcenter-regions{grid-template-columns:repeat(2,46px)}.skillcenter-browser{gap:8px}.skillcenter-item-meta{gap:4px 6px}.skillcenter-meta-text{max-width:132px}.skill-detail-backdrop{padding:8px}.skill-detail-dialog{border-radius:10px}.skill-detail-meta{grid-template-columns:minmax(0,1fr);gap:8px;max-height:180px;overflow-y:auto}}.addagent{flex:1;justify-content:center;align-items:flex-start;min-height:0;padding:8vh 16px 16px;display:flex;overflow-y:auto}.addagent-card{width:100%;max-width:480px}.addagent-title{letter-spacing:-.01em;margin:0 0 6px;font-size:20px;font-weight:650}.addagent-sub{color:hsl(var(--muted-foreground));margin:0 0 22px;font-size:13px;line-height:1.6}.addagent-field{margin-bottom:14px;display:block}.addagent-label{color:hsl(var(--muted-foreground));margin-bottom:6px;font-size:12.5px;font-weight:500;display:block}.addagent-input{border:1px solid hsl(var(--border));width:100%;font:inherit;background:hsl(var(--background));color:hsl(var(--foreground));border-radius:10px;padding:10px 12px;font-size:14px}.addagent-input:focus{border-color:hsl(var(--ring) / .4);outline:none}.addagent-error{background:hsl(var(--destructive) / .1);color:hsl(var(--destructive));border-radius:10px;margin:4px 0 14px;padding:9px 12px;font-size:12.5px;line-height:1.5}.addagent-actions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}.addagent-btn{font:inherit;cursor:pointer;border:1px solid #0000;border-radius:10px;align-items:center;gap:7px;padding:9px 16px;font-size:14px;font-weight:500;transition:background .12s,opacity .12s;display:inline-flex}.addagent-btn--ghost{border-color:hsl(var(--border));color:hsl(var(--foreground));background:0 0}.addagent-btn--ghost:hover{background:hsl(var(--foreground) / .05)}.addagent-btn--primary{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.addagent-btn--primary:hover:not(:disabled){opacity:.88}.addagent-btn:disabled{opacity:.4;cursor:default}.addagent-btn .icon{width:15px;height:15px}.search{flex-direction:column;flex:1;width:100%;max-width:720px;min-height:0;margin:0 auto;padding:28px 16px 16px;display:flex}.search-box{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:12px;align-items:center;gap:0;padding:5px 6px;transition:border-color .16s,box-shadow .16s;display:flex;position:relative}.search-box:focus-within{border-color:hsl(var(--foreground) / .3);box-shadow:0 0 0 3px hsl(var(--foreground) / .035)}.search-source-picker-wrap{flex:none;position:relative}.search-source-picker{max-width:176px;height:34px;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;gap:5px;padding:0 8px;display:inline-flex}.search-source-picker:hover,.search-source-picker[aria-expanded=true]{background:hsl(var(--foreground) / .045)}.search-source-picker>span{flex:none;font-size:13px;font-weight:550}.search-source-picker>small{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-weight:400;overflow:hidden}.search-source-chevron{width:12px;height:12px;color:hsl(var(--muted-foreground));flex:none;transition:transform .15s}.search-source-chevron.open{transform:rotate(180deg)}.search-source-menu{z-index:30;border:1px solid hsl(var(--border));background:hsl(var(--panel));width:224px;box-shadow:0 12px 28px hsl(var(--foreground) / .1);border-radius:9px;flex-direction:column;padding:5px;display:flex;position:absolute;top:calc(100% + 9px);left:-6px}.search-source-menu>button{min-width:0;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 9px;display:flex}.search-source-menu>button:hover:not(:disabled),.search-source-menu>button[aria-selected=true]{background:hsl(var(--foreground) / .055)}.search-source-menu>button:disabled{color:hsl(var(--muted-foreground));cursor:default}.search-source-menu>button>span{font-size:12.5px;font-weight:550}.search-source-menu>button>small{max-width:100%;color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;overflow:hidden}.search-box-divider{background:hsl(var(--border));width:1px;height:18px;margin:0 11px 0 5px}.search-input{color:hsl(var(--foreground));font:inherit;background:0 0;border:none;outline:none;flex:1;font-size:15px}.search-input::placeholder{color:hsl(var(--muted-foreground))}.search-input:disabled{cursor:default}.search-go{background:hsl(var(--primary));width:34px;height:34px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,transform .1s;display:flex}.search-go:hover:not(:disabled){opacity:.85}.search-go:active:not(:disabled){transform:scale(.94)}.search-go:disabled{opacity:.3;cursor:default}.search-go .icon{width:17px;height:17px}.search-results{flex-direction:column;flex:1;gap:4px;min-height:0;margin-top:12px;display:flex;overflow-y:auto}.search-empty{text-align:center;color:hsl(var(--muted-foreground));padding:40px 8px;font-size:13px}.search-result{text-align:left;width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:12px;align-items:flex-start;gap:12px;padding:12px 14px;transition:background .12s;display:flex}.search-result:hover{background:hsl(var(--foreground) / .05)}.search-result-static{cursor:default;border:1px solid #0000}.search-result-static:hover{border-color:hsl(var(--border));background:hsl(var(--foreground) / .025)}a.search-result{color:inherit;text-decoration:none}.search-result-ext{vertical-align:-1px;opacity:.6;width:12px;height:12px;margin-left:4px}.search-result-icon{width:16px;height:16px;color:hsl(var(--muted-foreground));stroke:currentColor;stroke-width:1.65px;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;margin-top:2px}.search-result-body{flex:1;min-width:0}.search-result-head{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.search-result-title{white-space:nowrap;text-overflow:ellipsis;font-size:14px;font-weight:600;overflow:hidden}.search-result-meta{color:hsl(var(--muted-foreground));flex-shrink:0;font-size:11.5px}.search-result-snippet{color:hsl(var(--muted-foreground));-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:3px;font-size:12.5px;line-height:1.5;display:-webkit-box;overflow:hidden}.search-result-snippet-expanded{-webkit-line-clamp:4;white-space:pre-wrap;overflow-wrap:anywhere}.login{border:1px solid hsl(var(--border));background:hsl(var(--panel));color:hsl(var(--foreground));border-radius:14px;flex-direction:column;display:flex;position:fixed;top:10px;right:10px;bottom:10px;left:10px;overflow:hidden}.login-top{padding:18px 24px}.login-brand{letter-spacing:-.01em;align-items:center;gap:9px;font-size:15px;font-weight:600;display:inline-flex}.login-main{flex:1;justify-content:center;align-items:center;padding:0 24px;display:flex}.login-card{width:100%;max-width:420px}.login-title{letter-spacing:-.02em;margin:0 0 14px;font-size:28px;font-weight:700;line-height:1.2}.login-sub{color:hsl(var(--muted-foreground));margin:0 0 28px;font-size:15px}.login-btn{border:1px solid hsl(var(--border));background:hsl(var(--background));width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:14px;justify-content:center;align-items:center;gap:8px;padding:14px 18px;font-size:15px;font-weight:500;transition:background .15s,border-color .15s,transform .1s;display:flex}.login-btn:hover{background:hsl(var(--accent));border-color:hsl(var(--ring) / .3)}.login-btn:active{transform:scale(.99)}.login-btn .icon{width:18px;height:18px}.login-powered{color:hsl(var(--muted-foreground));margin:18px 0 0;font-size:12px}.login-legal{color:hsl(var(--muted-foreground));margin:6px 0 0;font-size:12px}.login-legal a{color:inherit;text-decoration:underline;-webkit-text-decoration-color:hsl(var(--muted-foreground) / .45);text-decoration-color:hsl(var(--muted-foreground) / .45);text-underline-offset:2px;font-weight:600}.login-legal a:hover{color:hsl(var(--foreground))}.login-footer{text-align:center;color:hsl(var(--muted-foreground));padding:18px 24px;font-size:12px}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.001ms!important;animation-duration:.001ms!important;animation-iteration-count:1!important}}.login-providers{flex-direction:column;gap:10px;display:flex}.login-provider-error{color:hsl(var(--destructive));flex-direction:column;align-items:flex-start;gap:12px;font-size:13px;display:flex}.login-provider-error p{margin:0}.login-name{align-items:center;gap:8px;display:flex}.login-name-input{border:1px solid hsl(var(--border));font:inherit;background:hsl(var(--background));color:hsl(var(--foreground));border-radius:14px;flex:1;padding:13px 16px;font-size:15px}.login-name-input:focus{border-color:hsl(var(--ring) / .4);outline:none}.login-name-go{background:hsl(var(--primary));width:36px;height:36px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex}.login-name-go .icon{width:18px;height:18px}.login-name-go:disabled{opacity:.35;cursor:default}.login-hint{min-height:16px;color:hsl(var(--destructive));margin:8px 0 0;font-size:12px;line-height:16px}.session-loading{z-index:5;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .6);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);justify-content:center;align-items:center;gap:8px;font-size:14px;display:flex;position:absolute;top:0;right:0;bottom:0;left:0}.main{position:relative}.topo{background:hsl(var(--background));border:1px solid hsl(var(--border));width:288px;min-height:0;box-shadow:0 8px 24px hsl(var(--foreground) / .035);z-index:2;border-radius:18px;flex-direction:column;padding:16px;display:flex;position:absolute;top:28px;bottom:18px;right:18px;overflow:hidden}.topo.is-loading{place-items:center;min-height:88px;display:grid;bottom:auto}.topo.is-drawer{width:auto;min-height:0;max-height:none;box-shadow:none;background:0 0;border:0;border-radius:0;padding:22px;position:static;overflow:visible}.topo.is-loading.is-drawer{min-height:112px}.topo-loading-label{font-size:12px;line-height:1.5}.topo-agent-card{border:0;border-bottom:1px solid hsl(var(--border) / .72);background:0 0;border-radius:0;flex:none;min-width:0;padding:0 0 16px}.topo-agent-heading{flex-direction:column;gap:4px;min-width:0;display:flex}.topo-agent-heading h2{color:hsl(var(--foreground));letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:650;line-height:1.4;overflow:hidden}.topo-agent-heading>span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;line-height:1.4;overflow:hidden}.topo-description{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:12px 0 0;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.topo-module-stack{flex:1;grid-template-rows:minmax(124px,.95fr) minmax(142px,1.15fr) minmax(160px,.9fr);gap:0;min-width:0;min-height:0;display:grid}.topo-module-card{background:0 0;border:0;border-radius:0;flex-direction:column;min-width:0;min-height:0;padding:14px 0;display:flex}.topo-module-card+.topo-module-card{border-top:1px solid hsl(var(--border) / .72)}.topo-module-title{min-height:20px;color:hsl(var(--muted-foreground));align-items:center;gap:6px;width:100%;margin-bottom:0;font-size:13px;font-weight:600;line-height:1;display:inline-flex;position:static}.topo-module-label{text-overflow:ellipsis;white-space:nowrap;align-items:center;height:20px;display:inline-flex;overflow:hidden}.topo-section-count{background:hsl(var(--muted) / .72);min-width:18px;height:18px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;padding:0 5px;font-size:11px;font-weight:650;line-height:1;display:inline-flex}.topo-remove-capability:disabled,.topo-capability-add-slot:disabled{cursor:not-allowed;opacity:.45}.topo-module-scroll{box-sizing:border-box;overscroll-behavior:contain;scrollbar-color:hsl(var(--border)) transparent;scrollbar-width:thin;flex:1;min-height:24px;padding-top:9px;overflow-y:auto}.topo-module-scroll::-webkit-scrollbar{width:4px}.topo-module-scroll::-webkit-scrollbar-track{background:0 0}.topo-module-scroll::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:999px}.topo-module-scroll:focus-visible{outline:2px solid hsl(var(--ring) / .45);outline-offset:3px;border-radius:5px}.topo-tools-scroll{max-height:104px}.topo-skills-scroll{max-height:152px}.topo-tool-list{flex-direction:column;min-width:0;display:flex}.topo-tool{min-width:0;color:hsl(var(--foreground));align-items:center;gap:6px;padding:7px 2px 7px 14px;font-size:12.5px;line-height:1.4;display:flex;position:relative}.topo-tool:before{content:"";border:1px solid hsl(var(--muted-foreground) / .7);border-radius:2px;width:5px;height:5px;position:absolute;top:13px;left:2px}.topo-tool:first-child{padding-top:0}.topo-tool:first-child:before{top:6px}.topo-tool:last-child{padding-bottom:1px}.topo-tool+.topo-tool{border-top:1px solid hsl(var(--border) / .72)}.topo-capability-title,.topo-skill-title{align-items:center;gap:6px;min-width:0;display:flex}.topo-capability-title{flex:1}.topo-capability-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;overflow:hidden}.topo-capability-copy{flex-direction:column;gap:1px;min-width:0;display:flex}.topo-capability-copy code{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:9.5px;font-weight:450;line-height:1.25;overflow:hidden}.topo-capability-add-slot{border:1px dashed hsl(var(--border));background:hsl(var(--muted) / .18);width:100%;min-height:34px;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;border-radius:9px;justify-content:center;align-items:center;gap:6px;margin:0;padding:5px 10px;font-size:11.5px;transition:border-color .15s,background .15s,color .15s;display:flex}.topo-capability-add-dock{background:hsl(var(--background));flex:none;padding-top:6px}.topo-capability-add-slot>span:first-child{font-size:15px;line-height:1}.topo-capability-add-slot:hover:not(:disabled){border-color:hsl(var(--primary) / .55);background:hsl(var(--primary) / .055);color:hsl(var(--primary))}.topo-capability-add-slot:focus-visible{outline:2px solid hsl(var(--ring) / .38);outline-offset:2px}.topo-custom-badge{background:hsl(var(--primary) / .1);height:17px;color:hsl(var(--primary));border-radius:5px;flex-shrink:0;align-items:center;padding:0 5px;font-size:9.5px;font-weight:650;line-height:1;display:inline-flex}.topo-remove-capability{width:20px;height:20px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;margin-left:auto;padding:0;font-size:15px;line-height:1;display:inline-flex}.topo-remove-capability:hover:not(:disabled){background:hsl(var(--destructive) / .1);color:hsl(var(--destructive))}.topo-skill-list{flex-direction:column;min-width:0;display:flex}.topo-skill{flex-direction:column;gap:2px;min-width:0;padding:8px 0;display:flex}.topo-skill:first-child{padding-top:0}.topo-skill:last-child{padding-bottom:1px}.topo-skill+.topo-skill{border-top:1px solid hsl(var(--border) / .72)}.topo-skill-name{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px;font-weight:500;line-height:1.45;overflow:hidden}.topo-skill-title{width:100%}.topo-skill-description{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:1.45;display:-webkit-box;overflow:hidden}.topo-empty{color:hsl(var(--muted-foreground));font-size:11.5px;line-height:1.5}.topo-topology{min-height:0}.topo-canvas-heading{justify-content:space-between;align-items:center;gap:12px;margin-bottom:9px;display:flex}.topo-canvas-expand,.topo-canvas-dialog-header button{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:center;align-items:center;padding:0;display:inline-flex}.topo-canvas-expand:hover,.topo-canvas-dialog-header button:hover{background:hsl(var(--muted));color:hsl(var(--foreground))}.topo-canvas-expand:focus-visible,.topo-canvas-dialog-header button:focus-visible{outline:2px solid hsl(var(--ring) / .5);outline-offset:2px}.topo-canvas-expand svg,.topo-canvas-dialog-header button svg{width:16px;height:16px}.topo-canvas-preview{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:12px;flex:1;min-height:120px;position:relative;overflow:hidden}.topo-canvas-preview .abc-root,.topo-canvas-dialog-body .abc-root{border:0;flex:auto;width:100%;min-width:0;height:100%}.topo-canvas-preview .abc-minimap{display:none}.topo-canvas-dialog{z-index:1200;background:hsl(var(--background));flex-direction:column;min-width:0;min-height:0;display:flex;position:fixed;top:0;right:0;bottom:0;left:0}.topo-canvas-dialog-header{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;gap:24px;min-height:64px;padding:0 24px;display:flex}.topo-canvas-dialog-header>div{align-items:baseline;gap:10px;min-width:0;display:flex}.topo-canvas-dialog-header strong{font-size:15px;font-weight:600}.topo-canvas-dialog-header span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.topo-canvas-dialog-body{flex:1;min-width:0;min-height:0;padding:16px;display:flex}.topo-canvas-dialog-body .abc-canvas{border:1px solid hsl(var(--border));border-radius:16px;overflow:hidden}@media (max-width:640px){.topo-canvas-dialog-header{padding:0 16px}.topo-canvas-dialog-body{padding:8px}}.topo-canvas-heading .topo-section-count{flex-shrink:0}@media (min-width:1280px){.agent-info-trigger{display:none}.topo:not(.is-drawer) .topo-module-scroll{max-height:none}.main:has(>.topo)>.transcript{padding-right:322px}.main:has(>.topo)>.conversation-composer-slot{padding-left:16px;padding-right:322px}.conversation-composer-slot>.composer-slot>.composer{margin-left:auto;margin-right:auto}}@media (max-width:1279px){.topo{display:none}.topo.is-drawer{display:block}.topo.is-drawer .topo-module-stack{flex-direction:column;display:flex}}@media (prefers-reduced-motion:reduce){.topo-node{transition:none}.topo-node.is-active,.topo-remote{animation:none}}.session-capability-dialog-layer{z-index:110;place-items:center;padding:24px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.session-capability-dialog-scrim{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1013187a;border:0;width:100%;height:100%;padding:0;position:absolute;top:0;right:0;bottom:0;left:0}.session-capability-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:16px;flex-direction:column;width:min(560px,100vw - 32px);max-height:min(720px,100vh - 48px);animation:.18s cubic-bezier(.22,1,.36,1) session-capability-dialog-in;display:flex;position:relative;overflow:hidden;box-shadow:0 24px 80px #0d121c40,0 2px 8px #0d121c1f}.session-capability-dialog.is-wide{width:min(980px,100vw - 48px);height:min(720px,100dvh - 48px)}@keyframes session-capability-dialog-in{0%{opacity:0;transform:translateY(8px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.session-capability-dialog-head{border-bottom:1px solid hsl(var(--border));grid-template-columns:38px minmax(0,1fr) 32px;align-items:center;gap:12px;min-height:76px;padding:16px 18px;display:grid}.session-capability-dialog-head.is-iconless{grid-template-columns:minmax(0,1fr) 32px}.session-capability-dialog-mark{background:hsl(var(--primary) / .09);width:38px;height:38px;color:hsl(var(--primary));border-radius:11px;place-items:center;display:grid}.session-capability-dialog-mark svg{width:20px;height:20px}.session-capability-dialog-head h2{color:hsl(var(--foreground));letter-spacing:-.01em;margin:0;font-size:15px;font-weight:680}.session-capability-dialog-head p{color:hsl(var(--muted-foreground));margin:4px 0 0;font-size:11.5px;line-height:1.45}.session-capability-dialog-close{width:32px;height:32px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.session-capability-dialog-close:hover{background:hsl(var(--muted) / .7);color:hsl(var(--foreground))}.session-capability-dialog-close svg{width:18px;height:18px}.session-capability-search{border:1px solid hsl(var(--border));background:hsl(var(--background));min-width:0;height:40px;color:hsl(var(--muted-foreground));border-radius:6px;flex:0 0 40px;align-items:center;gap:8px;padding:0 12px;display:flex}.session-capability-search:focus-within{border-color:hsl(var(--ring) / .65);box-shadow:0 0 0 3px hsl(var(--ring) / .1)}.session-capability-search svg{flex:none;width:16px;height:16px}.session-capability-search input{width:100%;min-width:0;height:100%;color:hsl(var(--foreground));font:inherit;background:0 0;border:0;outline:0;padding:0;font-size:12px}.session-capability-search input::placeholder{color:hsl(var(--muted-foreground) / .8)}.session-tool-dialog-body{flex-direction:column;gap:12px;min-height:0;padding:16px;display:flex}.session-tool-picker{overscroll-behavior:contain;flex-direction:column;gap:7px;min-height:120px;display:flex;overflow-y:auto}.session-tool-option,.session-skill-option{border:1px solid hsl(var(--border) / .85);background:hsl(var(--background));border-radius:10px;align-items:center;gap:10px;min-width:0;display:flex}.session-tool-option{min-height:72px;padding:10px 11px}.session-tool-option:hover,.session-skill-option:hover{border-color:hsl(var(--foreground) / .2);background:hsl(var(--muted) / .22)}.session-tool-option-icon{background:hsl(var(--muted) / .75);width:32px;height:32px;color:hsl(var(--foreground) / .78);border-radius:9px;flex:0 0 32px;place-items:center;display:grid}.session-tool-option-icon svg{width:17px;height:17px}.session-tool-option-copy,.session-skill-option-copy{flex-direction:column;flex:1;min-width:0;display:flex}.session-tool-option-copy{gap:2px}.session-tool-option-copy strong,.session-skill-option-copy strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:620;overflow:hidden}.session-skill-option-copy strong{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.session-tool-option-copy code{color:hsl(var(--muted-foreground));font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10px}.session-tool-option-copy>span,.session-skill-option-copy>span{color:hsl(var(--muted-foreground));-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:11px;line-height:1.35;display:-webkit-box;overflow:hidden}.session-tool-option>button,.session-skill-option>button{background:hsl(var(--foreground));min-width:58px;height:30px;color:hsl(var(--background));font:inherit;cursor:pointer;border:0;border-radius:8px;flex:none;justify-content:center;align-items:center;gap:4px;padding:0 10px;font-size:11px;font-weight:600;display:inline-flex}.session-tool-option>button:disabled,.session-skill-option>button:disabled{opacity:.42;cursor:default}.session-skill-option>button svg{width:13px;height:13px}.session-skill-dialog-body{flex-direction:column;flex:1;min-height:0;display:flex}.session-skill-source-tabs{border-bottom:1px solid hsl(var(--border));align-items:stretch;gap:24px;min-height:48px;padding:0 18px;display:flex}.session-skill-source-tabs button{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:7px;padding:0 2px;font-size:12.5px;font-weight:600;display:inline-flex;position:relative}.session-skill-source-tabs button:after{content:"";background:0 0;border-radius:2px 2px 0 0;height:2px;position:absolute;bottom:-1px;left:0;right:0}.session-skill-source-tabs button:hover,.session-skill-source-tabs button.is-active{color:hsl(var(--foreground))}.session-skill-source-tabs button.is-active:after{background:hsl(var(--foreground))}.session-skill-source-tabs button>span{background:hsl(var(--muted));height:18px;color:hsl(var(--muted-foreground));border-radius:5px;align-items:center;padding:0 6px;font-size:9.5px;font-weight:600;display:inline-flex}.session-public-skill-browser{flex-direction:column;flex:1;height:min(548px,100vh - 204px);min-height:0;display:flex}.session-public-skill-head{align-items:center;gap:12px;min-height:68px;padding:13px 16px;display:flex}.session-public-skill-head .session-capability-search{flex:1}.session-public-skill-head>span{color:hsl(var(--muted-foreground));flex:none;font-size:10.5px}.session-public-skill-list{overscroll-behavior:contain;flex:1;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:8px;min-height:0;padding:12px;display:grid;overflow-y:auto}.session-public-skill-list>.session-capability-empty,.session-public-skill-list>.session-capability-loading,.session-public-skill-list>.session-capability-error{grid-column:1/-1}.session-public-skill-option{min-height:106px;padding:11px}.session-public-skill-option .session-skill-option-copy small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.session-skill-browser{flex:1;grid-template-columns:minmax(260px,.8fr) minmax(360px,1.4fr);height:min(548px,100vh - 204px);min-height:0;display:grid}.session-skill-spaces,.session-skill-results{flex-direction:column;min-width:0;min-height:0;display:flex}.session-skill-spaces{border-right:1px solid hsl(var(--border));background:hsl(var(--muted) / .16)}.session-skill-pane-head{flex-direction:column;gap:10px;min-height:92px;padding:13px 14px;display:flex}.session-skill-pane-head>div{align-items:center;gap:7px;min-width:0;display:flex}.session-skill-pane-head strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:650;overflow:hidden}.session-skill-pane-head>div>span{background:hsl(var(--muted));min-width:19px;height:18px;color:hsl(var(--muted-foreground));border-radius:999px;justify-content:center;align-items:center;padding:0 5px;font-size:10px;display:inline-flex}.session-skill-pane-list{overscroll-behavior:contain;flex-direction:column;flex:1;gap:7px;min-height:0;padding:10px;display:flex;overflow-y:auto}.session-skill-space{width:100%;min-height:76px;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:10px;align-items:flex-start;gap:9px;padding:10px;display:flex}.session-skill-space:hover{background:hsl(var(--background) / .72)}.session-skill-space.is-active{border-color:hsl(var(--primary) / .28);background:hsl(var(--background));box-shadow:0 1px 3px hsl(var(--foreground) / .06)}.session-skill-space>span:last-child{flex-direction:column;flex:1;gap:3px;min-width:0;display:flex}.session-skill-space strong,.session-skill-space small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.session-skill-space strong{font-size:12px;font-weight:620}.session-skill-space small{color:hsl(var(--muted-foreground));font-size:10.5px}.session-skill-space em{color:hsl(var(--muted-foreground));font-size:10px;font-style:normal}.session-skill-option{min-height:82px;padding:11px}.session-skill-option-copy{gap:4px}.session-skill-option-copy small{color:hsl(var(--muted-foreground) / .84);font-size:9.5px}.session-capability-empty,.session-capability-loading,.session-capability-error{min-height:120px;color:hsl(var(--muted-foreground));text-align:center;justify-content:center;align-items:center;font-size:12px;display:flex}.session-capability-error{color:hsl(var(--destructive))}@media (max-width:720px){.session-capability-dialog-layer{padding:12px}.session-capability-dialog.is-wide{width:calc(100vw - 24px);height:calc(100dvh - 24px)}.session-skill-browser{grid-template-rows:minmax(180px,.75fr) minmax(260px,1.25fr);grid-template-columns:1fr;height:min(620px,100vh - 170px)}.session-public-skill-browser{height:min(620px,100vh - 170px)}.session-public-skill-list{grid-template-columns:1fr}.session-skill-spaces{border-right:0;border-bottom:1px solid hsl(var(--border))}}@media (prefers-reduced-motion:reduce){.session-capability-dialog{animation:none}}.drawer--agent-info{border-right:1px solid hsl(var(--border));width:min(400px,92vw);box-shadow:12px 0 40px hsl(var(--foreground) / .14);border-left:0;animation:.22s cubic-bezier(.22,1,.36,1) agent-info-slide-in;left:0;right:auto}.agent-info-drawer-body{overscroll-behavior:contain;flex:1;min-height:0;overflow-y:auto}@keyframes agent-info-slide-in{0%{transform:translate(-100%)}to{transform:translate(0)}}@media (prefers-reduced-motion:reduce){.drawer--agent-info,.agent-info-scrim{animation:none}}.quick-create{flex-direction:column;flex:1;justify-content:center;align-items:center;padding:0 24px 6vh;display:flex}.qc-head{text-align:center;margin-bottom:28px}.qc-title{letter-spacing:-.02em;margin:0;font-size:26px;font-weight:650}.qc-sub{color:hsl(var(--muted-foreground));margin:8px 0 0;font-size:14px}.qc-cards{grid-template-columns:repeat(4,220px);justify-content:center;gap:16px;display:grid}@media (max-width:1240px){.qc-cards{grid-template-columns:repeat(2,220px)}}@media (max-width:560px){.qc-cards{grid-template-columns:minmax(0,320px)}}.qc-card{text-align:left;border:1px solid hsl(var(--border));background:hsl(var(--card));cursor:pointer;font:inherit;border-radius:16px;flex-direction:column;align-items:flex-start;gap:6px;padding:20px;transition:border-color .15s,box-shadow .15s;display:flex;position:relative}.qc-card:hover{border-color:hsl(var(--ring) / .35);box-shadow:0 8px 24px -16px hsl(var(--foreground) / .25)}.qc-card-arrow{width:18px;height:18px;color:hsl(var(--muted-foreground));opacity:0;transition:opacity .15s,transform .15s;position:absolute;top:18px;right:18px;transform:translate(-4px)}.qc-card:hover .qc-card-arrow{opacity:1;transform:translate(0)}.qc-icon{background:hsl(var(--secondary));width:40px;height:40px;color:hsl(var(--foreground));border-radius:12px;justify-content:center;align-items:center;margin-bottom:6px;display:inline-flex}.qc-icon svg{width:20px;height:20px}.qc-card-title{font-size:15px;font-weight:600}.qc-card-desc{color:hsl(var(--muted-foreground));font-size:12px;line-height:1.5}.navbar-title{letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:min(60vw,640px);padding:0;font-size:15px;font-weight:600;overflow:hidden}.create-stub{color:hsl(var(--muted-foreground));flex-direction:column;flex:1;justify-content:center;align-items:center;gap:16px;display:flex}.create-back{font:inherit;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;align-self:flex-start;margin:12px;font-size:13px}.create-back:hover{color:hsl(var(--foreground))}.navbar-crumbs{align-items:center;gap:4px;min-width:0;display:flex}.navbar-crumbs>.crumb:first-child{padding-left:0}.crumb{letter-spacing:-.01em;white-space:nowrap;border-radius:6px;padding:2px 4px;font-size:15px;font-weight:600}.crumb-link{font:inherit;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;font-weight:500;transition:background .12s,color .12s}.crumb-link:hover{color:hsl(var(--foreground));background:hsl(var(--foreground) / .05)}.crumb-current{color:hsl(var(--foreground))}.crumb-sep{width:15px;height:15px;color:hsl(var(--muted-foreground));flex-shrink:0}.confirm-scrim{z-index:60;background:hsl(var(--foreground) / .25);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);justify-content:center;align-items:center;display:flex;position:fixed;top:0;right:0;bottom:0;left:0}.confirm-box{background:hsl(var(--background));border:1px solid hsl(var(--border));width:340px;max-width:calc(100vw - 32px);box-shadow:0 16px 48px -16px hsl(var(--foreground) / .3);border-radius:14px;padding:20px}.confirm-title{margin-bottom:6px;font-size:15px;font-weight:600}.confirm-text{color:hsl(var(--muted-foreground));margin-bottom:18px;font-size:13px;line-height:1.6}.confirm-actions{justify-content:flex-end;gap:8px;display:flex}.confirm-btn{border:1px solid hsl(var(--border));background:hsl(var(--background));color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:7px 14px;font-size:13px;transition:background .12s}.confirm-btn:hover{background:hsl(var(--foreground) / .05)}.confirm-btn--danger{background:hsl(var(--destructive));color:#fff;border-color:#0000}.confirm-btn--danger:hover{background:hsl(var(--destructive) / .9)}.studio-confirm-backdrop{z-index:1200;background:hsl(var(--foreground) / .22);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);place-items:center;padding:32px;animation:.14s ease-out studio-confirm-fade-in;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.studio-confirm-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(420px,100vw - 40px);height:auto;min-height:0;box-shadow:0 24px 64px hsl(var(--foreground) / .16);border-radius:12px;flex-direction:column;animation:.18s cubic-bezier(.2,.8,.2,1) studio-confirm-rise-in;display:flex;overflow:hidden}.studio-confirm-head{border-bottom:1px solid hsl(var(--border));flex:0 0 58px;justify-content:space-between;align-items:center;gap:20px;padding:0 16px 0 18px;display:flex}.studio-confirm-title-wrap{align-items:center;gap:10px;min-width:0;display:flex}.studio-confirm-title-icon{color:#ba6708;background:#f59f0a1f;border-radius:7px;flex:none;place-items:center;width:30px;height:30px;display:grid}.studio-confirm-title-icon svg,.studio-confirm-close svg{width:16px;height:16px}.studio-confirm-title-wrap h2{min-width:0;color:hsl(var(--foreground));margin:0;font-size:14px;font-weight:650;line-height:1.35}.studio-confirm-close{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;place-items:center;padding:0;transition:background .16s,color .16s;display:grid}.studio-confirm-close:hover:not(:disabled){background:hsl(var(--secondary));color:hsl(var(--foreground))}.studio-confirm-close:focus-visible,.studio-confirm-actions button:focus-visible{outline:2px solid hsl(var(--primary) / .34);outline-offset:2px}.studio-confirm-close:disabled{cursor:not-allowed;opacity:.48}.studio-confirm-body{padding:24px 20px}.studio-confirm-body p{color:hsl(var(--foreground));margin:0;font-size:14px;line-height:1.65}.studio-confirm-actions{border-top:1px solid hsl(var(--border));justify-content:flex-end;gap:8px;padding:12px 16px;display:flex}.studio-confirm-actions button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-width:76px;height:34px;color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:0 14px;font-size:12px;font-weight:600}.studio-confirm-actions button:hover:not(:disabled){background:hsl(var(--secondary))}.studio-confirm-actions button:disabled{cursor:not-allowed;opacity:.6}.studio-confirm-actions .studio-confirm-primary{border-color:hsl(var(--primary));background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.studio-confirm-actions .studio-confirm-primary:hover:not(:disabled){background:hsl(var(--primary) / .9)}.studio-confirm-dialog--warning .studio-confirm-title-icon{color:#ba6708;background:#f59f0a1f}.studio-confirm-dialog--danger .studio-confirm-title-icon{background:hsl(var(--destructive) / .1);color:hsl(var(--destructive))}.studio-confirm-dialog--danger .studio-confirm-actions .studio-confirm-primary{border-color:hsl(var(--destructive));background:hsl(var(--destructive));color:#fff}.studio-confirm-dialog--danger .studio-confirm-actions .studio-confirm-primary:hover:not(:disabled){background:hsl(var(--destructive) / .9)}@keyframes studio-confirm-fade-in{0%{opacity:0}to{opacity:1}}@keyframes studio-confirm-rise-in{0%{opacity:0;transform:translateY(6px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.studio-confirm-backdrop,.studio-confirm-dialog{animation:none}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}.abc-root{--cw-workbench-toolbar-height: 64px;--cw-workspace-ink: 222 24% 13%;--cw-workspace-accent: 162 44% 32%;--cw-workspace-accent-soft: 156 34% 92%;--cw-workspace-warm: 42 28% 96%;flex:0 1 52%;min-width:460px;min-height:0;display:flex;flex-direction:column;overflow:hidden;border-right:0;background:hsl(var(--background))}.abc-canvas{flex:1;min-height:0;background:hsl(var(--background))}.abc-canvas .react-flow__pane{cursor:grab}.abc-canvas .react-flow__pane:active{cursor:grabbing}.abc-node{--abc-type-tone: 220 9% 24%;--abc-type-soft: 220 10% 97%;--abc-type-border: 220 9% 78%;position:relative;width:220px;height:88px;display:grid;grid-template-columns:38px minmax(0,1fr);align-items:center;gap:9px;padding:12px 14px;border:.5px solid hsl(var(--abc-type-border) / .62);border-radius:13px;background:hsl(var(--panel));box-shadow:0 10px 30px hsl(var(--foreground) / .055);color:hsl(var(--foreground));transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.abc-node:hover{border-color:hsl(var(--abc-type-tone) / .36);box-shadow:0 13px 34px hsl(var(--foreground) / .08)}.abc-node.is-selected{border-color:hsl(var(--abc-type-tone) / .62);box-shadow:0 0 0 1px hsl(var(--abc-type-tone) / .06),0 14px 38px hsl(var(--foreground) / .09)}.abc-node.is-llm{grid-template-columns:minmax(0,1fr);background:hsl(var(--panel))}.abc-node.is-a2a{--abc-type-tone: 213 18% 38%;--abc-type-soft: 214 20% 94%;--abc-type-border: 213 15% 72%;background:linear-gradient(145deg,hsl(var(--abc-type-soft)),hsl(var(--panel)) 58%)}.abc-canvas .react-flow__node-group{padding:0;border:0;border-radius:18px;background:transparent}.abc-group{--abc-type-tone: 213 40% 40%;--abc-type-soft: 214 45% 96%;--abc-type-border: 213 32% 62%;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border:.5px solid hsl(var(--abc-type-border) / .5);border-radius:18px;background:linear-gradient(180deg,hsl(var(--abc-type-soft) / .88),transparent 88px),hsl(var(--panel) / .72);box-shadow:0 14px 42px hsl(var(--foreground) / .055);transition:border-color .15s ease,box-shadow .15s ease}.abc-group.is-selected{border-color:hsl(var(--abc-type-tone) / .62);box-shadow:0 0 0 1px hsl(var(--abc-type-tone) / .06),0 16px 46px hsl(var(--foreground) / .08)}.abc-group.is-parallel{--abc-type-tone: 40 43% 38%;--abc-type-soft: 43 52% 94%;--abc-type-border: 40 38% 58%;border-style:solid}.abc-group.is-sequential{--abc-type-tone: 213 40% 40%;--abc-type-soft: 214 45% 96%;--abc-type-border: 213 32% 62%}.abc-group.is-llm{--abc-type-tone: 220 9% 24%;--abc-type-soft: 220 10% 97%;--abc-type-border: 220 9% 66%}.abc-group.is-loop{--abc-type-tone: 151 34% 34%;--abc-type-soft: 148 32% 94%;--abc-type-border: 151 28% 55%}.abc-group-head{position:relative;height:64px;display:flex;align-items:center;justify-content:center;padding:9px 56px;border-bottom:1px solid hsl(var(--border) / .75)}.abc-group.is-compact-empty .abc-group-head{border-bottom:0}.abc-group-head>span:first-child{width:100%;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;text-align:center}.abc-group-head strong{color:hsl(var(--abc-type-tone));font-size:13px;letter-spacing:-.02em}.abc-group-head small{display:-webkit-box;overflow:hidden;color:hsl(var(--muted-foreground));font-size:9.5px;line-height:1.3;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}.abc-group-add{height:40px;display:flex;align-items:center;justify-content:center;gap:7px;border:1px dashed hsl(var(--abc-type-tone) / .42);border-radius:10px;background:hsl(var(--background) / .58);color:hsl(var(--muted-foreground));cursor:pointer;font:inherit;font-size:10px;font-weight:600;transition:border-color .15s ease,background-color .15s ease,color .15s ease}.abc-group-boundary-actions{position:absolute;top:64px;right:0;bottom:0;left:0;z-index:2;pointer-events:none}.abc-group-boundary-add{position:absolute;top:50%;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--abc-type-tone) / .32);border-radius:50%;background:hsl(var(--background) / .94);box-shadow:0 6px 18px hsl(var(--foreground) / .08);color:hsl(var(--abc-type-tone));cursor:pointer;opacity:.72;pointer-events:auto;transform:translateY(-50%);transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease,opacity .15s ease}.abc-group-boundary-add.is-start{left:18px}.abc-group-boundary-add.is-end{right:18px}.abc-root.is-vertical .abc-group-boundary-actions{top:64px;right:0;bottom:0;left:0}.abc-root.is-vertical .abc-group-boundary-add{left:50%;transform:translate(-50%)}.abc-root.is-vertical .abc-group-boundary-add.is-start{top:18px}.abc-root.is-vertical .abc-group-boundary-add.is-end{top:auto;right:auto;bottom:18px}.abc-group-boundary-add:hover{border-color:hsl(var(--abc-type-tone) / .64);background:hsl(var(--abc-type-soft) / .92);box-shadow:0 8px 22px hsl(var(--foreground) / .1);opacity:1}.abc-group-boundary-add:focus-visible{outline:2px solid hsl(var(--abc-type-tone) / .5);outline-offset:2px;opacity:1}.abc-group-boundary-add svg{width:14px;height:14px}.abc-group-add-empty,.abc-group-add-bottom{position:absolute;right:24px;bottom:24px;left:24px}.abc-group-add:hover{border-color:hsl(var(--abc-type-tone) / .72);background:hsl(var(--abc-type-soft) / .86);color:hsl(var(--abc-type-tone))}.abc-group-add:focus-visible{outline:2px solid hsl(var(--abc-type-tone) / .5);outline-offset:2px}.abc-group-add svg{width:14px;height:14px}.abc-node.is-contained-in-parallel .abc-handle{opacity:0}.abc-node-icon{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;border-radius:10px;background:hsl(var(--abc-type-soft));color:hsl(var(--abc-type-tone))}.abc-node-icon svg{width:17px;height:17px}.abc-node-copy{min-width:0;display:flex;flex-direction:column;gap:2px;padding-right:18px}.abc-node-delete{position:absolute;z-index:3;top:7px;right:7px;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--border));border-radius:7px;background:hsl(var(--panel) / .96);box-shadow:0 4px 12px hsl(var(--foreground) / .08);color:hsl(var(--muted-foreground));cursor:pointer;opacity:0;pointer-events:none;transform:translateY(-2px) scale(.92);transition:opacity .12s ease,transform .12s ease,border-color .12s ease,color .12s ease}.abc-node:hover>.abc-node-delete,.abc-node:focus-within>.abc-node-delete,.abc-group:hover>.abc-node-delete,.abc-group:focus-within>.abc-node-delete,.abc-node-delete:focus-visible{opacity:1;pointer-events:auto;transform:translateY(0) scale(1)}.abc-node-delete:hover{border-color:hsl(var(--destructive) / .32);color:hsl(var(--destructive))}.abc-node-delete:focus-visible{outline:2px solid hsl(var(--destructive) / .34);outline-offset:2px}.abc-node-delete svg{width:12px;height:12px}.abc-group>.abc-node-delete{top:19px;right:12px}.abc-group>.abc-node-delete+.abc-handle{z-index:4}.abc-loop-handle{left:50%!important;opacity:0;pointer-events:none}.abc-node-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;color:hsl(var(--abc-type-tone));font-size:9px;font-weight:700;letter-spacing:.04em}.abc-node-copy>strong{overflow:hidden;font-size:13px;letter-spacing:-.015em;text-overflow:ellipsis;white-space:nowrap}.abc-node-copy>small{display:-webkit-box;overflow:hidden;color:hsl(var(--muted-foreground));font-size:9.5px;line-height:1.35;-webkit-box-orient:vertical;-webkit-line-clamp:2}.abc-terminal{width:96px;height:34px;display:flex;align-items:center;justify-content:center;border:.5px solid hsl(var(--border) / .68);border-radius:999px;background:hsl(var(--secondary) / .68);box-shadow:none;color:hsl(var(--foreground) / .76);font-size:10.5px;font-weight:650;letter-spacing:.03em}.abc-handle{width:7px!important;height:7px!important;border:0!important;background:transparent!important;opacity:0!important;pointer-events:none}.abc-group.is-sequential>.abc-handle{background:#3d628f!important}.abc-group.is-parallel>.abc-handle{background:#8b6f37!important}.abc-group.is-loop>.abc-handle,.abc-node.is-contained-in-loop .abc-loop-handle{background:#397458!important}.abc-canvas .react-flow__edge-path{transition:stroke-width .12s ease}.abc-canvas .react-flow__edge:hover .react-flow__edge-path{stroke-width:2.2}.abc-edge-tools{position:absolute;z-index:1002;display:inline-flex;align-items:center;justify-content:center;gap:3px;padding:0;border-radius:999px;pointer-events:all}.abc-canvas .react-flow__edgelabel-renderer{z-index:1002}.abc-edge-hover-path{fill:none;stroke:transparent;stroke-width:22px;pointer-events:stroke}.abc-edge-label{position:absolute;bottom:calc(100% + 1px);left:50%;padding:2px 5px;border-radius:5px;background:hsl(var(--background) / .92);color:hsl(var(--muted-foreground));font-size:10px;font-weight:600;transform:translate(-50%);white-space:nowrap}.abc-edge-add{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--cw-workspace-accent) / .28);border-radius:50%;background:hsl(var(--background));box-shadow:0 4px 12px hsl(var(--foreground) / .1);color:hsl(var(--cw-workspace-accent));cursor:pointer;opacity:0;transform:scale(.82);transition:opacity .14s ease,transform .14s ease,border-color .14s ease}.abc-edge-tools.is-visible .abc-edge-add,.abc-edge-tools:hover .abc-edge-add,.abc-edge-add:focus-visible{border-color:hsl(var(--cw-workspace-accent) / .68);opacity:1;transform:scale(1)}.abc-edge-add:focus-visible{outline:2px solid hsl(var(--cw-workspace-accent) / .5);outline-offset:2px}.abc-edge-add svg{width:11px;height:11px}@media (hover: none){.abc-edge-add{opacity:.88;transform:scale(1)}.abc-node-delete{opacity:1;pointer-events:auto;transform:none}}@media (prefers-reduced-motion: reduce){.abc-node-delete,.abc-edge-add{transition:none}}.abc-canvas .react-flow__controls{overflow:hidden;border:1px solid hsl(var(--border));border-radius:9px;box-shadow:0 8px 24px hsl(var(--foreground) / .08)}.abc-canvas .react-flow__controls-button{border-bottom-color:hsl(var(--border));background:hsl(var(--panel));color:hsl(var(--foreground))}.abc-minimap{width:168px!important;height:104px!important;overflow:hidden;border:1px solid hsl(var(--border));border-radius:9px;background:hsl(var(--panel))!important;box-shadow:0 8px 24px hsl(var(--foreground) / .06)}.abc-minimap-node .abc-minimap-shell,.abc-minimap-node .abc-minimap-icon-mark,.abc-minimap-node .abc-minimap-group-divider{vector-effect:non-scaling-stroke}.abc-minimap-node-agent .abc-minimap-shell{fill:hsl(var(--panel));stroke:#585e6ab8;stroke-width:1.4px}.abc-minimap-node-agent.is-a2a .abc-minimap-shell{fill:#f0f5fa;stroke:#4788aec7}.abc-minimap-agent-icon{fill:#edeff3}.abc-minimap-node-agent.is-a2a .abc-minimap-agent-icon{fill:#dae9f1}.abc-minimap-icon-mark{fill:none;stroke:#4f5f72;stroke-width:1.25px}.abc-minimap-icon-eye{fill:#4f5f72}.abc-minimap-copy-line{fill:hsl(var(--muted-foreground) / .34)}.abc-minimap-copy-line.is-primary{fill:hsl(var(--foreground) / .7)}.abc-minimap-node-terminal .abc-minimap-shell{fill:hsl(var(--cw-workspace-ink));stroke:hsl(var(--panel));stroke-width:1.5px;vector-effect:non-scaling-stroke}.abc-minimap-terminal-dot{fill:hsl(var(--panel) / .82)}.abc-minimap-node-group .abc-minimap-shell{fill:hsl(var(--panel) / .32);stroke:#3d628fc7;stroke-width:1.5px}.abc-minimap-node-group.is-parallel .abc-minimap-shell{stroke:#8b6f37d1}.abc-minimap-node-group.is-sequential .abc-minimap-shell{stroke:#3d628fd1}.abc-minimap-node-group.is-llm .abc-minimap-shell{stroke:#585e6ac7}.abc-minimap-node-group.is-loop .abc-minimap-shell{stroke:#397458d6}.abc-minimap-group-divider{stroke:hsl(var(--border));stroke-width:1px}.abc-minimap-group-title{fill:hsl(var(--muted-foreground) / .42)}.abc-minimap-node.is-selected .abc-minimap-shell{stroke-width:2.5px}.abc-minimap-node-agent.is-selected .abc-minimap-shell{stroke:#2e3138}.abc-minimap-node-group.is-sequential.is-selected .abc-minimap-shell{stroke:#314e72}.abc-minimap-node-group.is-parallel.is-selected .abc-minimap-shell{stroke:#6d572c}.abc-minimap-node-group.is-loop.is-selected .abc-minimap-shell{stroke:#2d5c46}@media (max-width: 1080px){.abc-root{min-width:360px}}@media (max-width: 860px){.abc-root{flex:none;width:100%;min-width:0;height:480px;border-right:0;border-bottom:0}.abc-minimap{display:none}}@media (max-width: 520px){.abc-root{height:430px}}.text-shimmer.text-shimmer{color:transparent;background-size:200% auto;background-position:200% center;background-clip:text;-webkit-background-clip:text;animation:text-shimmer 4s linear infinite}@keyframes text-shimmer{to{background-position:-200% center}}@media (prefers-reduced-motion: reduce){.text-shimmer.text-shimmer{animation:none;background-position:50% center}}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, -apple-system, system-ui, "Segoe UI", "Noto Sans", "Helvetica", "Arial", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;--font-mono:ui-monospace, "SFMono-Regular", "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;--spacing:.25rem;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:1024px;--breakpoint-xl:1280px;--breakpoint-2xl:1536px;--container-sm:24rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--breakpoint-xs:380px;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-2xs:.125rem;--radius-xs:.25rem;--radius-sm:.375rem;--radius-md:.5rem;--radius-lg:.625rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.25rem;--radius-4xl:1.5rem;--radius-full:9999px;--text-sm:var(--font-text-sm-size);--text-sm--line-height:var(--font-text-sm-line-height);--text-sm--font-weight:var(--font-text-sm-weight);--text-sm--letter-spacing:var(--font-text-sm-tracking);--tracking-wide:var(--font-tracking-wide);--tracking-normal:var(--font-tracking-normal);--tracking-tight:var(--font-tracking-tight);--shadow-hairline:var(--shadow-hairline)}:root,:where([data-theme]){--gray-500:#5d5d5d;--alpha-0:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-0:color-mix(in oklab, var(--alpha-base) 0%, transparent)}}:root,:where([data-theme]){--alpha-02:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-02:color-mix(in oklab, var(--alpha-base) 2%, transparent)}}:root,:where([data-theme]){--alpha-04:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-04:color-mix(in oklab, var(--alpha-base) 4%, transparent)}}:root,:where([data-theme]){--alpha-05:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-05:color-mix(in oklab, var(--alpha-base) 5%, transparent)}}:root,:where([data-theme]){--alpha-06:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-06:color-mix(in oklab, var(--alpha-base) 6%, transparent)}}:root,:where([data-theme]){--alpha-08:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-08:color-mix(in oklab, var(--alpha-base) 8%, transparent)}}:root,:where([data-theme]){--alpha-10:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-10:color-mix(in oklab, var(--alpha-base) 10%, transparent)}}:root,:where([data-theme]){--alpha-12:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-12:color-mix(in oklab, var(--alpha-base) 12%, transparent)}}:root,:where([data-theme]){--alpha-15:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-15:color-mix(in oklab, var(--alpha-base) 15%, transparent)}}:root,:where([data-theme]){--alpha-16:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-16:color-mix(in oklab, var(--alpha-base) 16%, transparent)}}:root,:where([data-theme]){--alpha-20:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-20:color-mix(in oklab, var(--alpha-base) 20%, transparent)}}:root,:where([data-theme]){--alpha-25:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-25:color-mix(in oklab, var(--alpha-base) 25%, transparent)}}:root,:where([data-theme]){--alpha-30:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-30:color-mix(in oklab, var(--alpha-base) 30%, transparent)}}:root,:where([data-theme]){--alpha-35:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-35:color-mix(in oklab, var(--alpha-base) 35%, transparent)}}:root,:where([data-theme]){--alpha-40:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-40:color-mix(in oklab, var(--alpha-base) 40%, transparent)}}:root,:where([data-theme]){--alpha-50:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-50:color-mix(in oklab, var(--alpha-base) 50%, transparent)}}:root,:where([data-theme]){--alpha-60:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-60:color-mix(in oklab, var(--alpha-base) 60%, transparent)}}:root,:where([data-theme]){--alpha-70:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-70:color-mix(in oklab, var(--alpha-base) 70%, transparent)}}:root,:where([data-theme]){--white:#fff;--black:#000;--green-25:#edfaf2;--green-50:#d9f4e4;--green-75:#b8ebcc;--green-100:#8cdfad;--green-200:#66d492;--green-300:#40c977;--green-400:#04b84c;--green-500:#00a240;--green-600:#008635;--green-700:#00692a;--green-800:#004f1f;--green-900:#003716;--green-950:#011c0b;--green-1000:#001207;--green-a25:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a25:color-mix(in oklab, var(--green-400) 8%, transparent)}}:root,:where([data-theme]){--green-a50:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a50:color-mix(in oklab, var(--green-400) 15%, transparent)}}:root,:where([data-theme]){--green-a75:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a75:color-mix(in oklab, var(--green-400) 29%, transparent)}}:root,:where([data-theme]){--green-a100:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a100:color-mix(in oklab, var(--green-400) 45%, transparent)}}:root,:where([data-theme]){--green-a200:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a200:color-mix(in oklab, var(--green-400) 60%, transparent)}}:root,:where([data-theme]){--green-a300:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a300:color-mix(in oklab, var(--green-400) 75%, transparent)}}:root,:where([data-theme]){--red-25:#fff0f0;--red-50:#ffd9d9;--red-75:#ffc6c5;--red-100:#ffa4a2;--red-200:#ff8583;--red-300:#ff6764;--red-400:#fa423e;--red-500:#e02e2a;--red-600:#ba2623;--red-700:#911e1b;--red-800:#6e1615;--red-900:#4d100e;--red-950:#280b0a;--red-1000:#1f0909;--red-a25:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a25:color-mix(in oklab, var(--red-400) 8%, transparent)}}:root,:where([data-theme]){--red-a50:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a50:color-mix(in oklab, var(--red-400) 16%, transparent)}}:root,:where([data-theme]){--red-a75:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a75:color-mix(in oklab, var(--red-400) 30%, transparent)}}:root,:where([data-theme]){--red-a100:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a100:color-mix(in oklab, var(--red-400) 48%, transparent)}}:root,:where([data-theme]){--red-a200:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a200:color-mix(in oklab, var(--red-400) 64%, transparent)}}:root,:where([data-theme]){--red-a300:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a300:color-mix(in oklab, var(--red-400) 79%, transparent)}}:root,:where([data-theme]){--pink-25:#fff4f9;--pink-50:#ffe8f3;--pink-75:#ffd4e8;--pink-100:#ffbada;--pink-200:#ffa3ce;--pink-300:#ff8cc1;--pink-400:#ff66ad;--pink-500:#e04c91;--pink-600:#ba437a;--pink-700:#963c67;--pink-800:#6e2c4a;--pink-900:#4d1f34;--pink-950:#29101c;--pink-1000:#1a0a11;--pink-a25:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a25:color-mix(in oklab, var(--pink-400) 8%, transparent)}}:root,:where([data-theme]){--pink-a50:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a50:color-mix(in oklab, var(--pink-400) 16%, transparent)}}:root,:where([data-theme]){--pink-a75:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a75:color-mix(in oklab, var(--pink-400) 28%, transparent)}}:root,:where([data-theme]){--pink-a100:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a100:color-mix(in oklab, var(--pink-400) 45%, transparent)}}:root,:where([data-theme]){--pink-a200:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a200:color-mix(in oklab, var(--pink-400) 60%, transparent)}}:root,:where([data-theme]){--pink-a300:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a300:color-mix(in oklab, var(--pink-400) 76%, transparent)}}:root,:where([data-theme]){--orange-25:#fff5f0;--orange-50:#ffe7d9;--orange-75:#ffcfb4;--orange-100:#ffb790;--orange-200:#ff9e6c;--orange-300:#ff8549;--orange-400:#fb6a22;--orange-500:#e25507;--orange-600:#b9480d;--orange-700:#923b0f;--orange-800:#6d2e0f;--orange-900:#4a2206;--orange-950:#281105;--orange-1000:#211107;--orange-a25:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a25:color-mix(in oklab, var(--orange-400) 7%, transparent)}}:root,:where([data-theme]){--orange-a50:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a50:color-mix(in oklab, var(--orange-400) 16%, transparent)}}:root,:where([data-theme]){--orange-a75:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a75:color-mix(in oklab, var(--orange-400) 33%, transparent)}}:root,:where([data-theme]){--orange-a100:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a100:color-mix(in oklab, var(--orange-400) 48%, transparent)}}:root,:where([data-theme]){--orange-a200:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a200:color-mix(in oklab, var(--orange-400) 65%, transparent)}}:root,:where([data-theme]){--orange-a300:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a300:color-mix(in oklab, var(--orange-400) 81%, transparent)}}:root,:where([data-theme]){--yellow-25:#fffbed;--yellow-50:#fff6d9;--yellow-75:#ffeeb8;--yellow-100:#ffe48c;--yellow-200:#ffdb66;--yellow-300:#ffd240;--yellow-400:#ffc300;--yellow-500:#e0ac00;--yellow-600:#ba8e00;--yellow-700:#916f00;--yellow-800:#6e5400;--yellow-900:#4d3b00;--yellow-950:#261d00;--yellow-1000:#1a1400;--yellow-a25:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a25:color-mix(in oklab, var(--yellow-400) 8%, transparent)}}:root,:where([data-theme]){--yellow-a50:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a50:color-mix(in oklab, var(--yellow-400) 15%, transparent)}}:root,:where([data-theme]){--yellow-a75:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a75:color-mix(in oklab, var(--yellow-400) 27%, transparent)}}:root,:where([data-theme]){--yellow-a100:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a100:color-mix(in oklab, var(--yellow-400) 45%, transparent)}}:root,:where([data-theme]){--yellow-a200:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a200:color-mix(in oklab, var(--yellow-400) 59%, transparent)}}:root,:where([data-theme]){--yellow-a300:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a300:color-mix(in oklab, var(--yellow-400) 74%, transparent)}}:root,:where([data-theme]){--purple-25:#f9f5fe;--purple-50:#efe5fe;--purple-75:#e0cefd;--purple-100:#ceb0fb;--purple-200:#be95fa;--purple-300:#ad7bf9;--purple-400:#924ff7;--purple-500:#8046d9;--purple-600:#6b3ab4;--purple-700:#532d8d;--purple-800:#3f226a;--purple-900:#2c184a;--purple-950:#160c25;--purple-1000:#100a19;--purple-a25:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a25:color-mix(in oklab, var(--purple-400) 6%, transparent)}}:root,:where([data-theme]){--purple-a50:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a50:color-mix(in oklab, var(--purple-400) 15%, transparent)}}:root,:where([data-theme]){--purple-a75:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a75:color-mix(in oklab, var(--purple-400) 28%, transparent)}}:root,:where([data-theme]){--purple-a100:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a100:color-mix(in oklab, var(--purple-400) 45%, transparent)}}:root,:where([data-theme]){--purple-a200:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a200:color-mix(in oklab, var(--purple-400) 60%, transparent)}}:root,:where([data-theme]){--purple-a300:var(--purple-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--purple-a300:color-mix(in oklab, var(--purple-400) 75%, transparent)}}:root,:where([data-theme]){--blue-25:#f5faff;--blue-50:#e5f3ff;--blue-75:#cce6ff;--blue-100:#99ceff;--blue-200:#66b5ff;--blue-300:#339cff;--blue-400:#0285ff;--blue-500:#0169cc;--blue-600:#004f99;--blue-700:#003f7a;--blue-800:#013566;--blue-900:#00284d;--blue-950:#000e1a;--blue-1000:#000d19;--blue-a25:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a25:color-mix(in oklab, var(--blue-400) 4%, transparent)}}:root,:where([data-theme]){--blue-a50:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a50:color-mix(in oklab, var(--blue-400) 13%, transparent)}}:root,:where([data-theme]){--blue-a75:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a75:color-mix(in oklab, var(--blue-400) 25%, transparent)}}:root,:where([data-theme]){--blue-a100:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a100:color-mix(in oklab, var(--blue-400) 40%, transparent)}}:root,:where([data-theme]){--blue-a200:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a200:color-mix(in oklab, var(--blue-400) 60%, transparent)}}:root,:where([data-theme]){--blue-a300:var(--blue-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--blue-a300:color-mix(in oklab, var(--blue-400) 80%, transparent)}}:root,:where([data-theme]){--hairline:1px}:where(:root),:where([data-theme=light]){--gray-0:#fff;--gray-25:#fcfcfc;--gray-50:#f9f9f9;--gray-75:#f3f3f3;--gray-100:#ededed;--gray-150:#dfdfdf;--gray-200:#cdcdcd;--gray-250:#b9b9b9;--gray-300:#afafaf;--gray-350:#9f9f9f;--gray-400:#8f8f8f;--gray-450:#767676;--gray-550:#4f4f4f;--gray-600:#414141;--gray-650:#393939;--gray-700:#303030;--gray-750:#282828;--gray-800:#212121;--gray-850:#1c1c1c;--gray-900:#181818;--gray-925:#161616;--gray-950:#131313;--gray-975:#101010;--gray-1000:#0d0d0d;--alpha-base:#0d0d0d}:where([data-theme=dark]){--gray-0:#0d0d0d;--gray-25:#101010;--gray-50:#131313;--gray-75:#161616;--gray-100:#181818;--gray-150:#1c1c1c;--gray-200:#212121;--gray-250:#282828;--gray-300:#303030;--gray-350:#393939;--gray-400:#414141;--gray-450:#4f4f4f;--gray-550:#767676;--gray-600:#8f8f8f;--gray-650:#9f9f9f;--gray-700:#afafaf;--gray-750:#b9b9b9;--gray-800:#cdcdcd;--gray-850:#dcdcdc;--gray-900:#ededed;--gray-925:#f3f3f3;--gray-950:#f3f3f3;--gray-975:#f9f9f9;--gray-1000:#fff;--alpha-base:#fff}@media (min-resolution:150dpi),(min-resolution:1.5x){:root,:where([data-theme]){--hairline:.5px}}:root,:where([data-theme]){--shadow-color:0 0 0;--elevation-100-geo:0 1px 2px -1px;--elevation-200-geo:0 2px 4px -1px;--elevation-300-geo:0 4px 8px -2px;--elevation-400-geo:0 8px 16px -4px}:where(:root),:where([data-theme=light]){--shadow-alpha-100:.08;--shadow-alpha-200:.08;--shadow-alpha-300:.1;--shadow-alpha-400:.12;--shadow-hairline-width:1px;--shadow-hairline-color:#00000014}@media (min-resolution:150dpi),(min-resolution:1.5x){:where(:root),:where([data-theme=light]){--shadow-hairline-width:.5px;--shadow-hairline-color:#0000001a}}:where([data-theme=dark]){--shadow-alpha-100:.2;--shadow-alpha-200:.2;--shadow-alpha-300:.36;--shadow-alpha-400:.3;--shadow-hairline-width:1px;--shadow-hairline-color:#ffffff1a}@media (min-resolution:150dpi),(min-resolution:1.5x){:where([data-theme=dark]){--shadow-hairline-width:.5px;--shadow-hairline-color:#ffffff1f}}:where([data-theme=dark]) [data-surface=elevated]{--shadow-hairline:0 0 #0000}:root,:where([data-theme]){--color-text:var(--gray-1000);--color-text-inverse:var(--gray-0);--color-text-primary:var(--color-text);--color-text-primary-soft:var(--color-text);--color-background-primary-soft-alt:var(--alpha-02);--color-border-primary-soft-alt:var(--alpha-06);--color-text-primary-soft-alt:var(--color-text);--color-text-primary-surface:var(--color-text);--color-text-primary-solid:var(--color-text-inverse);--color-text-primary-outline:var(--color-text);--color-text-primary-outline-hover:var(--color-text);--color-text-primary-ghost:var(--color-text);--color-text-primary-ghost-hover:var(--color-text);--color-ring-primary:var(--color-ring);--color-ring-primary-soft:var(--color-ring-primary);--color-ring-primary-solid:var(--color-ring-primary);--color-ring-primary-outline:var(--color-ring-primary);--color-ring-primary-ghost:var(--color-ring-primary);--color-text-secondary-soft:var(--color-text);--color-background-secondary-soft-alt:var(--alpha-02);--color-border-secondary-soft-alt:var(--alpha-06);--color-text-secondary-soft-alt:var(--color-text);--color-text-secondary-solid:var(--white);--color-text-secondary-outline:var(--color-text-secondary);--color-text-secondary-outline-hover:var(--color-text);--color-text-secondary-ghost:var(--color-text-secondary);--color-text-secondary-ghost-hover:var(--color-text);--color-ring-secondary:var(--color-ring);--color-ring-secondary-soft:var(--color-ring-secondary);--color-ring-secondary-solid:var(--color-ring-secondary);--color-ring-secondary-outline:var(--color-ring-secondary);--color-ring-secondary-ghost:var(--color-ring-secondary);--color-background-info-soft:var(--blue-50);--color-background-info-soft-hover:var(--blue-75);--color-background-info-soft-active:var(--blue-75);--color-background-info-soft-alpha:var(--blue-a50);--color-background-info-soft-alpha-hover:var(--blue-a75);--color-background-info-soft-alpha-active:var(--blue-a75);--color-background-info-solid:var(--blue-400);--color-background-info-solid-hover:var(--blue-500);--color-background-info-solid-active:var(--blue-500);--color-text-info-solid:var(--white);--color-background-info-outline-hover:var(--blue-a25);--color-background-info-outline-active:var(--blue-a25);--color-border-info-outline:var(--blue-500);--color-border-info-outline-hover:var(--blue-500);--color-text-info-outline:var(--blue-500);--color-text-info-outline-hover:var(--blue-500);--color-background-info-ghost-hover:var(--blue-a50);--color-background-info-ghost-active:var(--blue-a50);--color-ring-info:var(--color-ring);--color-ring-info-soft:var(--color-ring-info);--color-ring-info-solid:var(--color-ring-info);--color-ring-info-outline:var(--color-ring-info);--color-ring-info-ghost:var(--color-ring-info);--color-background-warning-soft:var(--orange-50);--color-background-warning-soft-hover:var(--orange-75);--color-background-warning-soft-active:var(--orange-75);--color-background-warning-soft-alpha:var(--orange-a50);--color-background-warning-soft-alpha-hover:var(--orange-a75);--color-background-warning-soft-alpha-active:var(--orange-a75);--color-background-warning-solid:var(--orange-500);--color-background-warning-solid-hover:var(--orange-600);--color-background-warning-solid-active:var(--orange-600);--color-text-warning-solid:var(--white);--color-background-warning-outline-hover:var(--orange-a25);--color-background-warning-outline-active:var(--orange-a25);--color-border-warning-outline:var(--orange-500);--color-border-warning-outline-hover:var(--orange-500);--color-text-warning-outline:var(--orange-500);--color-text-warning-outline-hover:var(--orange-500);--color-background-warning-ghost-hover:var(--orange-a50);--color-background-warning-ghost-active:var(--orange-a50);--color-text-warning-ghost:var(--orange-500);--color-text-warning-ghost-hover:var(--orange-500);--color-ring-warning:var(--color-ring);--color-ring-warning-soft:var(--color-ring-warning);--color-ring-warning-solid:var(--color-ring-warning);--color-ring-warning-outline:var(--color-ring-warning);--color-ring-warning-ghost:var(--color-ring-warning);--color-text-caution-hover:var(--yellow-800);--color-background-caution-soft:var(--yellow-50);--color-background-caution-soft-hover:var(--yellow-75);--color-background-caution-soft-active:var(--yellow-75);--color-background-caution-soft-alpha:var(--yellow-a50);--color-background-caution-soft-alpha-hover:var(--yellow-a75);--color-background-caution-soft-alpha-active:var(--yellow-a75);--color-background-caution-solid:var(--yellow-600);--color-background-caution-solid-hover:var(--yellow-700);--color-background-caution-solid-active:var(--yellow-700);--color-text-caution-solid:var(--white);--color-background-caution-outline-hover:var(--yellow-a25);--color-background-caution-outline-active:var(--yellow-a25);--color-border-caution-outline:var(--yellow-700);--color-border-caution-outline-hover:var(--yellow-700);--color-text-caution-outline:var(--yellow-700);--color-text-caution-outline-hover:var(--yellow-700);--color-background-caution-ghost-hover:var(--yellow-a50);--color-background-caution-ghost-active:var(--yellow-a50);--color-text-caution-ghost:var(--yellow-700);--color-text-caution-ghost-hover:var(--yellow-700);--color-ring-caution:var(--color-ring);--color-ring-caution-soft:var(--color-ring-caution);--color-ring-caution-solid:var(--color-ring-caution);--color-ring-caution-outline:var(--color-ring-caution);--color-ring-caution-ghost:var(--color-ring-caution);--color-background-danger-soft:var(--red-50);--color-background-danger-soft-hover:var(--red-75);--color-background-danger-soft-active:var(--red-75);--color-background-danger-soft-alpha:var(--red-a50);--color-background-danger-soft-alpha-hover:var(--red-a75);--color-background-danger-soft-alpha-active:var(--red-a75);--color-background-danger-solid:var(--red-500);--color-background-danger-solid-hover:var(--red-600);--color-background-danger-solid-active:var(--red-600);--color-text-danger-solid:var(--white);--color-background-danger-outline-hover:var(--red-a25);--color-background-danger-outline-active:var(--red-a25);--color-border-danger-outline:var(--red-500);--color-border-danger-outline-hover:var(--red-500);--color-text-danger-outline:var(--red-500);--color-text-danger-outline-hover:var(--red-500);--color-background-danger-ghost-hover:var(--red-a50);--color-background-danger-ghost-active:var(--red-a50);--color-text-danger-ghost:var(--red-500);--color-text-danger-ghost-hover:var(--red-500);--color-ring-danger:var(--red-200);--color-ring-danger-soft:var(--color-ring-danger);--color-ring-danger-solid:var(--color-ring-danger);--color-ring-danger-outline:var(--color-ring-danger);--color-ring-danger-ghost:var(--color-ring-danger);--color-background-success-soft:var(--green-50);--color-background-success-soft-hover:var(--green-75);--color-background-success-soft-active:var(--green-75);--color-background-success-soft-alpha:var(--green-a50);--color-background-success-soft-alpha-hover:var(--green-a75);--color-background-success-soft-alpha-active:var(--green-a75);--color-text-success-solid:var(--white);--color-background-success-outline-hover:var(--green-a25);--color-background-success-outline-active:var(--green-a25);--color-text-success-outline:var(--green-500);--color-text-success-outline-hover:var(--green-500);--color-background-success-ghost-hover:var(--green-a50);--color-background-success-ghost-active:var(--green-a50);--color-text-success-ghost:var(--green-500);--color-text-success-ghost-hover:var(--green-500);--color-ring-success:var(--color-ring);--color-ring-success-soft:var(--color-ring-info);--color-ring-success-solid:var(--color-ring-info);--color-ring-success-outline:var(--color-ring-info);--color-ring-success-ghost:var(--color-ring-info);--color-background-discovery-soft:var(--purple-50);--color-background-discovery-soft-hover:var(--purple-75);--color-background-discovery-soft-active:var(--purple-75);--color-background-discovery-soft-alpha:var(--purple-a50);--color-background-discovery-soft-alpha-hover:var(--purple-a75);--color-background-discovery-soft-alpha-active:var(--purple-a75);--color-background-discovery-solid:var(--purple-400);--color-background-discovery-solid-hover:var(--purple-500);--color-background-discovery-solid-active:var(--purple-500);--color-text-discovery-solid:var(--white);--color-background-discovery-outline-hover:var(--purple-a25);--color-background-discovery-outline-active:var(--purple-a25);--color-border-discovery-outline:var(--purple-500);--color-border-discovery-outline-hover:var(--purple-500);--color-background-discovery-ghost-hover:var(--purple-a50);--color-background-discovery-ghost-active:var(--purple-a50);--color-text-discovery-ghost:var(--purple-500);--color-text-discovery-ghost-hover:var(--purple-500);--color-ring-discovery:var(--color-ring);--color-ring-discovery-soft:var(--color-ring);--color-ring-discovery-solid:var(--color-ring);--color-ring-discovery-outline:var(--color-ring);--color-ring-discovery-ghost:var(--color-ring);--color-background-disabled:var(--alpha-05);--color-border-disabled:var(--alpha-06);--font-tracking-wide:0em;--font-tracking-normal:0em;--font-tracking-tight:0em;--font-heading-5xl-size:4.5rem;--font-heading-5xl-line-height:4.5rem;--font-heading-5xl-weight:var(--font-weight-semibold);--font-heading-5xl-tracking:var(--tracking-tight);--font-heading-4xl-size:3.75rem;--font-heading-4xl-line-height:3.75rem;--font-heading-4xl-weight:var(--font-weight-semibold);--font-heading-4xl-tracking:var(--tracking-tight);--font-heading-3xl-size:3rem;--font-heading-3xl-line-height:3rem;--font-heading-3xl-weight:var(--font-weight-semibold);--font-heading-3xl-tracking:var(--tracking-tight);--font-heading-2xl-size:2.25rem;--font-heading-2xl-line-height:2.625rem;--font-heading-2xl-weight:var(--font-weight-semibold);--font-heading-2xl-tracking:var(--tracking-tight);--font-heading-xl-size:2rem;--font-heading-xl-line-height:2.375rem;--font-heading-xl-weight:var(--font-weight-semibold);--font-heading-xl-tracking:var(--tracking-tight);--font-heading-lg-size:1.5rem;--font-heading-lg-line-height:1.75rem;--font-heading-lg-weight:var(--font-weight-semibold);--font-heading-lg-tracking:var(--tracking-normal);--font-heading-md-size:1.25rem;--font-heading-md-line-height:1.625rem;--font-heading-md-weight:var(--font-weight-semibold);--font-heading-md-tracking:var(--tracking-normal);--font-heading-sm-size:1.125rem;--font-heading-sm-line-height:1.625rem;--font-heading-sm-weight:var(--font-weight-semibold);--font-heading-sm-tracking:var(--tracking-normal);--font-heading-xs-size:1rem;--font-heading-xs-line-height:1.5rem;--font-heading-xs-weight:var(--font-weight-semibold);--font-heading-xs-tracking:var(--tracking-normal);--font-text-lg-size:1.125rem;--font-text-lg-line-height:1.8125rem;--font-text-lg-weight:var(--font-weight-normal);--font-text-lg-tracking:var(--tracking-normal);--font-text-md-size:1rem;--font-text-md-line-height:1.5rem;--font-text-md-weight:var(--font-weight-normal);--font-text-md-tracking:var(--tracking-normal);--font-text-sm-size:.875rem;--font-text-sm-line-height:1.25rem;--font-text-sm-weight:var(--font-weight-normal);--font-text-sm-tracking:var(--tracking-normal);--font-text-xs-size:.75rem;--font-text-xs-line-height:1.125rem;--font-text-xs-weight:var(--font-weight-normal);--font-text-xs-tracking:var(--tracking-wide);--font-text-2xs-size:.625rem;--font-text-2xs-line-height:.875rem;--font-text-2xs-weight:var(--font-weight-normal);--font-text-2xs-tracking:var(--tracking-wide);--font-text-3xs-size:.5rem;--font-text-3xs-line-height:.75rem;--font-text-3xs-weight:var(--font-weight-normal);--font-text-3xs-tracking:var(--tracking-wide);--control-size-3xs:1.375rem;--control-size-2xs:1.5rem;--control-size-xs:1.625rem;--control-size-sm:1.75rem;--control-size-md:2rem;--control-size-lg:2.25rem;--control-size-xl:2.5rem;--control-size-2xl:2.75rem;--control-size-3xl:3rem;--control-gutter-2xs:.375rem;--control-gutter-xs:.5rem;--control-gutter-sm:.625rem;--control-gutter-md:.75rem;--control-gutter-lg:.875rem;--control-gutter-xl:1rem;--control-gutter-pill-scaling:1.33;--control-radius-sm:var(--radius-sm);--control-radius-md:var(--radius-md);--control-radius-lg:var(--radius-lg);--control-radius-xl:var(--radius-xl);--control-font-size-sm:var(--font-text-xs-size);--control-font-size-md:var(--font-text-sm-size);--control-font-size-lg:var(--font-text-md-size);--control-icon-size-xs:.875rem;--control-icon-size-sm:1rem;--control-icon-size-md:1.125rem;--control-icon-size-lg:1.25rem;--control-icon-size-xl:1.375rem;--control-icon-size-2xl:1.5rem;--cubic-enter:cubic-bezier(.19, 1, .22, 1);--cubic-exit:cubic-bezier(.8, 0, .4, 1);--cubic-exit-snappy:cubic-bezier(.65, 0, .4, 1);--cubic-move:cubic-bezier(.65, 0, .35, 1);--transition-duration-basic:.15s;--transition-ease-basic:ease;--scrollbar-color:var(--alpha-30);--shadow-hairline:0 0 0 var(--shadow-hairline-width) var(--shadow-hairline-color);--shadow-100:var(--elevation-100-geo) rgb(var(--shadow-color) / var(--shadow-alpha-100));--shadow-100-strong:var(--elevation-100-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-100) * 1.25));--shadow-100-stronger:var(--elevation-100-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-100) * 1.6));--shadow-200:var(--elevation-200-geo) rgb(var(--shadow-color) / var(--shadow-alpha-200));--shadow-200-strong:var(--elevation-200-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-200) * 1.25));--shadow-200-stronger:var(--elevation-200-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-200) * 1.6));--shadow-300:var(--elevation-300-geo) rgb(var(--shadow-color) / var(--shadow-alpha-300));--shadow-300-strong:var(--elevation-300-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-300) * 1.25));--shadow-300-stronger:var(--elevation-300-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-300) * 1.6));--shadow-400:var(--elevation-400-geo) rgb(var(--shadow-color) / var(--shadow-alpha-400));--shadow-400-strong:var(--elevation-400-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-400) * 1.25));--shadow-400-stronger:var(--elevation-400-geo) rgb(var(--shadow-color) / calc(var(--shadow-alpha-400) * 1.6))}:where(:root),:where([data-theme=light]){--color-text-secondary:var(--gray-500);--color-text-tertiary:var(--gray-400);--color-ring:var(--blue-500);--color-background-primary-soft:var(--gray-100);--color-background-primary-soft-hover:var(--gray-150);--color-background-primary-soft-active:var(--gray-200);--color-background-primary-soft-alpha:var(--alpha-08);--color-background-primary-soft-alpha-hover:var(--alpha-12);--color-background-primary-soft-alpha-active:var(--alpha-16);--color-background-primary-surface:var(--alpha-05);--color-border-primary-surface:var(--alpha-05);--color-background-primary-solid:var(--gray-900);--color-background-primary-solid-hover:var(--gray-700);--color-background-primary-solid-active:var(--gray-600);--color-background-primary-outline-hover:var(--alpha-02);--color-background-primary-outline-active:var(--alpha-04);--color-border-primary-outline:var(--alpha-16);--color-border-primary-outline-hover:var(--alpha-20);--color-background-primary-ghost-hover:var(--alpha-08);--color-background-primary-ghost-active:var(--alpha-12);--color-background-secondary-soft:var(--gray-100);--color-background-secondary-soft-hover:var(--gray-150);--color-background-secondary-soft-active:var(--gray-200);--color-background-secondary-soft-alpha:var(--alpha-08);--color-background-secondary-soft-alpha-hover:var(--alpha-12);--color-background-secondary-soft-alpha-active:var(--alpha-16);--color-background-secondary-solid:var(--gray-500);--color-background-secondary-solid-hover:var(--gray-600);--color-background-secondary-solid-active:var(--gray-700);--color-background-secondary-outline-hover:var(--alpha-02);--color-background-secondary-outline-active:var(--alpha-04);--color-border-secondary-outline:var(--alpha-16);--color-border-secondary-outline-hover:var(--alpha-20);--color-background-secondary-ghost-hover:var(--alpha-08);--color-background-secondary-ghost-active:var(--alpha-12);--color-text-info:var(--blue-500);--color-text-info-soft:var(--blue-600);--color-background-info-surface:var(--blue-a25);--color-border-info-surface:var(--blue-a25);--color-text-info-surface:var(--blue-600);--color-text-info-ghost:var(--blue-500);--color-text-info-ghost-hover:var(--blue-500);--color-text-warning:var(--orange-700);--color-text-warning-soft:var(--orange-700);--color-background-warning-surface:var(--orange-a25);--color-border-warning-surface:var(--orange-a25);--color-text-warning-surface:var(--orange-700);--color-text-caution:var(--yellow-700);--color-text-caution-soft:var(--yellow-800);--color-background-caution-surface:var(--yellow-a25);--color-border-caution-surface:var(--yellow-a25);--color-text-caution-surface:var(--yellow-800);--color-text-danger:var(--red-700);--color-text-danger-soft:var(--red-600);--color-background-danger-surface:var(--red-a25);--color-border-danger-surface:var(--red-a25);--color-text-danger-surface:var(--red-600);--color-text-success:var(--green-700);--color-text-success-soft:var(--green-600);--color-background-success-surface:var(--green-a25);--color-border-success-surface:var(--green-a25);--color-text-success-surface:var(--green-600);--color-background-success-solid:var(--green-500);--color-background-success-solid-hover:var(--green-500);--color-background-success-solid-active:var(--green-500);--color-border-success-outline:var(--green-500);--color-border-success-outline-hover:var(--green-500);--color-text-discovery:var(--purple-700);--color-text-discovery-soft:var(--purple-600);--color-background-discovery-surface:var(--purple-a25);--color-border-discovery-surface:var(--purple-a25);--color-text-discovery-surface:var(--purple-600);--color-text-discovery-outline:var(--purple-500);--color-text-discovery-outline-hover:var(--purple-500);--color-text-disabled:var(--gray-400);--color-border-subtle:var(--alpha-05);--color-border:var(--alpha-10);--color-border-strong:var(--alpha-15);--shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--color-surface:var(--gray-0);--color-surface-secondary:var(--gray-50);--color-surface-tertiary:var(--gray-75);--color-surface-elevated:var(--gray-0);--color-surface-elevated-secondary:var(--gray-50)}:where([data-theme=dark]){--color-text-secondary:var(--gray-700);--color-text-tertiary:var(--gray-600);--color-ring:var(--blue-400);--color-background-primary-soft:var(--gray-300);--color-background-primary-soft-hover:var(--gray-350);--color-background-primary-soft-active:var(--gray-400);--color-background-primary-soft-alpha:var(--alpha-12);--color-background-primary-soft-alpha-hover:var(--alpha-16);--color-background-primary-soft-alpha-active:var(--alpha-20);--color-background-primary-surface:var(--alpha-08);--color-border-primary-surface:var(--alpha-08);--color-background-primary-solid:var(--gray-950);--color-background-primary-solid-hover:var(--gray-900);--color-background-primary-solid-active:var(--gray-850);--color-background-primary-outline-hover:var(--alpha-04);--color-background-primary-outline-active:var(--alpha-06);--color-border-primary-outline:var(--alpha-25);--color-border-primary-outline-hover:var(--alpha-30);--color-background-primary-ghost-hover:var(--alpha-12);--color-background-primary-ghost-active:var(--alpha-16);--color-background-secondary-soft:var(--gray-300);--color-background-secondary-soft-hover:var(--gray-350);--color-background-secondary-soft-active:var(--gray-400);--color-background-secondary-soft-alpha:var(--alpha-12);--color-background-secondary-soft-alpha-hover:var(--alpha-16);--color-background-secondary-soft-alpha-active:var(--alpha-20);--color-background-secondary-solid:var(--gray-400);--color-background-secondary-solid-hover:var(--gray-450);--color-background-secondary-solid-active:var(--gray-500);--color-background-secondary-outline-hover:var(--alpha-04);--color-background-secondary-outline-active:var(--alpha-06);--color-border-secondary-outline:var(--alpha-25);--color-border-secondary-outline-hover:var(--alpha-30);--color-background-secondary-ghost-hover:var(--alpha-12);--color-background-secondary-ghost-active:var(--alpha-16);--color-text-info:var(--blue-200);--color-text-info-soft:var(--blue-300);--color-background-info-surface:var(--blue-a50);--color-border-info-surface:var(--blue-a50);--color-text-info-surface:var(--blue-300);--color-text-info-ghost:var(--blue-200);--color-text-info-ghost-hover:var(--blue-200);--color-text-warning:var(--orange-500);--color-text-warning-soft:var(--orange-400);--color-background-warning-surface:var(--orange-a50);--color-border-warning-surface:var(--orange-a50);--color-text-warning-surface:var(--orange-400);--color-text-caution:var(--yellow-500);--color-text-caution-soft:var(--yellow-400);--color-background-caution-surface:var(--yellow-a50);--color-border-caution-surface:var(--yellow-a50);--color-text-caution-surface:var(--yellow-400);--color-text-danger:var(--red-500);--color-text-danger-soft:var(--red-400);--color-background-danger-surface:var(--red-a50);--color-border-danger-surface:var(--red-a50);--color-text-danger-surface:var(--red-400);--color-text-success:var(--green-400);--color-text-success-soft:var(--green-400);--color-background-success-surface:var(--green-a50);--color-border-success-surface:var(--green-a50);--color-text-success-surface:var(--green-400);--color-background-success-solid:var(--green-600);--color-background-success-solid-hover:var(--green-600);--color-background-success-solid-active:var(--green-600);--color-border-success-outline:var(--green-600);--color-border-success-outline-hover:var(--green-600);--color-text-discovery:var(--purple-500);--color-text-discovery-soft:var(--purple-200);--color-background-discovery-surface:var(--purple-a50);--color-border-discovery-surface:var(--purple-a50);--color-text-discovery-surface:var(--purple-200);--color-text-discovery-outline:var(--purple-400);--color-text-discovery-outline-hover:var(--purple-400);--color-text-disabled:var(--gray-500);--color-border-subtle:var(--alpha-06);--color-border:var(--alpha-12);--color-border-strong:var(--alpha-20);--shadow:0 10px 15px -3px #0003, 0 4px 6px -4px #0003;--color-surface:var(--gray-200);--color-surface-secondary:var(--gray-100);--color-surface-tertiary:var(--gray-50);--color-surface-elevated:var(--gray-300);--color-surface-elevated-secondary:var(--gray-400)}:root,:where([data-theme]){--alert-border-radius:var(--radius-xl);--alert-gap:calc(var(--spacing) * 3);--alert-gutter:calc(var(--spacing) * 4);--alert-font-size:var(--font-text-sm-size);--alert-line-height:var(--font-text-sm-line-height);--alert-title-font-weight:var(--font-weight-semibold);--avatar-radius:var(--radius-full);--avatar-size:28px;--avatar-font-size-scaling:.5;--avatar-overflow-font-size-scaling-one:.45;--avatar-overflow-font-size-scaling-two:.37;--avatar-overflow-font-size-scaling-three:.3;--avatar-group-cutout-width:3px;--avatar-group-cutout-color:var(--color-surface);--avatar-group-spacing:-8px;--badge-gutter-sm:calc(var(--control-gutter-2xs) - 1px);--badge-gutter-md:var(--control-gutter-2xs);--badge-gutter-lg:var(--control-gutter-xs);--badge-size-sm:calc(var(--control-size-3xs) - 2px);--badge-size-md:var(--control-size-3xs);--badge-size-lg:var(--control-size-2xs);--badge-radius-sm:var(--radius-xs);--badge-radius-md:var(--radius-xs);--badge-radius-lg:var(--radius-sm);--badge-font-size-sm:var(--font-text-xs-size);--badge-font-size-md:var(--font-text-sm-size);--badge-font-size-lg:var(--font-text-sm-size);--badge-tracking-sm:var(--tracking-wide);--badge-tracking-md:var(--tracking-normal);--badge-tracking-lg:var(--tracking-normal);--badge-font-weight-sm:var(--font-weight-semibold);--badge-font-weight-md:var(--font-weight-semibold);--badge-font-weight-lg:var(--font-weight-semibold);--badge-icon-font-size-sm:var(--font-text-xs-size);--badge-icon-font-size-md:var(--font-text-md-size);--badge-icon-font-size-lg:var(--font-text-md-size);--badge-indicator-size-sm:var(--font-text-xs-size);--badge-indicator-size-md:var(--font-text-xs-size);--badge-indicator-size-lg:var(--font-text-sm-size);--button-gap-sm:3px;--button-gap-md:4px;--button-gap-lg:6px;--button-font-weight:var(--font-weight-medium);--input-gap-xs:4px;--input-gap-sm:6px;--input-gap-md:8px;--input-gap-lg:10px;--input-text-color:var(--color-text);--input-placeholder-text-color:var(--color-text-tertiary);--input-outline-border-color:var(--color-border-primary-outline);--input-outline-border-color-focus:var(--alpha-50);--input-soft-background-color:var(--color-background-primary-soft-alpha);--input-soft-border-color-focus:var(--alpha-20);--link-font-weight:inherit;--link-gap:calc(var(--spacing) * .5);--link-radius:var(--radius-sm);--link-underline-decoration-offset:.1em;--chat-max-width:800px;--chat-gutter:calc(var(--spacing) * 5);--chat-background-color:var(--color-surface);--thread-gutter:calc(var(--spacing) * 4);--composer-gutter:calc(var(--spacing) * 3);--composer-compact-gutter:calc(var(--spacing) * 2);--composer-radius:var(--radius-4xl);--composer-background-color:var(--color-surface-elevated);--smoothing-background-color:var(--color-surface);--user-message-text-color:var(--color-text);--source-list-gutter:var(--thread-gutter);--codeblock-background-color:var(--gray-25);--codeblock-syntax-4:var(--pink-500);--dialog-min-width:250px;--dialog-max-width:450px;--dialog-container-inner-padding:calc(var(--spacing) * 5);--dialog-backdrop-fade-background:var(--color-surface-elevated)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--dialog-backdrop-fade-background:color-mix(in oklab, var(--color-surface-elevated) 60%, transparent)}}:root,:where([data-theme]){--menu-gutter:calc(var(--spacing) * 1.5);--menu-radius:var(--radius-xl);--menu-font-size:var(--font-text-sm-size);--menu-line-height:var(--font-text-sm-line-height);--menu-item-padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);--menu-item-gap:calc(var(--spacing) * 1.5);--menu-separator-gutter:var(--menu-gutter) calc(-1 * var(--menu-gutter));--menu-separator-background-color:var(--color-border);--menu-radio-indicator-size:var(--font-text-lg-size);--menu-radio-indicator-hole-size:var(--font-text-3xs-size);--menu-checkbox-indicator-size:var(--font-text-lg-size);--modal-container-inner-padding:calc(var(--spacing) * 5);--popover-radius:var(--radius-xl);--radio-group-col-gap:calc(var(--spacing) * 2.5);--radio-group-row-gap:calc(var(--spacing) * 5);--radio-group-item-gap:calc(var(--spacing) * 1.5);--radio-group-item-font-size:var(--font-text-sm-size);--radio-group-item-line-height:var(--font-text-sm-line-height);--radio-group-indicator-size:var(--font-text-md-size);--radio-group-indicator-border-color:var(--color-border-primary-outline);--radio-group-indicator-border-color-hover:var(--alpha-25);--radio-group-indicator-background-color:var(--color-background-primary-solid);--radio-group-indicator-hole-size:.375rem;--radio-group-indicator-hole-background-color:var(--color-text-primary-solid);--segmented-control-gap:2px;--segmented-control-gutter:2px;--segmented-control-font-weight:var(--font-weight-semibold);--segmented-control-thumb-shadow:0 1px 4px -1px #0003;--segmented-control-option-highlight-gutter:1px;--select-control-font-weight:var(--font-weight-medium);--switch-track-width:32px;--switch-track-height:19px;--switch-thumb-offset:3px;--switch-thumb-size:calc(var(--switch-track-height) - 2 * var(--switch-thumb-offset));--switch-thumb-shadow:0 1px 2px #0003;--switch-label-gap:calc(var(--spacing) * 2)}:where(:root),:where([data-theme=light]){--avatar-image-border-color:var(--alpha-04);--input-outline-border-color-hover:var(--alpha-25);--input-border-color-invalid:var(--red-500);--link-primary-text-color:var(--blue-500);--link-primary-text-color-hover:var(--blue-800);--user-message-background-color:var(--alpha-05);--codeblock-syntax-1:#c0660d;--codeblock-syntax-2:var(--blue-500);--codeblock-syntax-3:var(--green-600);--codeblock-syntax-5:var(--purple-500);--dialog-backdrop-dim-background:#0000004d;--menu-item-background-color:var(--alpha-08);--modal-backdrop-background:#0000004d;--segmented-control-background:var(--gray-100);--segmented-control-thumb-background:var(--gray-0);--segmented-control-option-highlight-background-color:var(--gray-200);--slider-track-color:var(--gray-150);--slider-range-color:var(--gray-450);--switch-track-color:var(--gray-150);--switch-track-color-hover:var(--gray-200);--switch-track-color-checked:var(--gray-900);--switch-track-color-checked-disabled:var(--gray-300);--switch-track-color-disabled:var(--gray-100);--switch-thumb-color:var(--gray-0);--switch-thumb-color-disabled:var(--gray-0)}:where([data-theme=dark]){--avatar-image-border-color:var(--alpha-15);--input-outline-border-color-hover:var(--alpha-30);--input-border-color-invalid:var(--red-600);--link-primary-text-color:var(--blue-300);--link-primary-text-color-hover:var(--blue-400);--user-message-background-color:var(--alpha-08);--codeblock-syntax-1:var(--yellow-100);--codeblock-syntax-2:var(--blue-200);--codeblock-syntax-3:var(--green-300);--codeblock-syntax-5:var(--purple-300);--dialog-backdrop-dim-background:#00000080;--menu-item-background-color:var(--alpha-10);--modal-backdrop-background:#00000080;--segmented-control-background:var(--gray-0);--segmented-control-thumb-background:var(--gray-300);--segmented-control-option-highlight-background-color:var(--gray-300);--slider-track-color:var(--gray-400);--slider-range-color:var(--gray-600);--switch-track-color:var(--gray-400);--switch-track-color-hover:var(--gray-450);--switch-track-color-checked:var(--blue-400);--switch-track-color-checked-disabled:var(--blue-700);--switch-track-color-disabled:var(--gray-300);--switch-thumb-color:var(--gray-1000);--switch-thumb-color-disabled:var(--gray-800)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}html,:host{font-synthesis-weight:none}textarea{resize:none}img,svg{flex-grow:0;flex-shrink:0}input,textarea,select,optgroup{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;filter:none;outline-offset:0;outline-width:2px}a,button,input,label,select,textarea,:where([aria-role=button]){touch-action:manipulation}button{text-transform:none;vertical-align:middle}button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}pre{white-space:pre-wrap}table{border-spacing:0}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}html,:host{color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;letter-spacing:var(--tracking-normal)}[data-theme=light]{color-scheme:light}[data-theme=dark]{color-scheme:dark}*{scrollbar-color:var(--scrollbar-color) transparent;scrollbar-width:thin}[data-exiting]{pointer-events:none}::placeholder{color:var(--color-text-tertiary)}b,strong{font-weight:var(--font-weight-semibold)}@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_AMS-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Caligraphic-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Caligraphic-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Fraktur-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Fraktur-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-BoldItalic.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Main-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Math-BoldItalic.woff2)format("woff2")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Math-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Bold.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Italic.woff2)format("woff2")}@font-face{font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_SansSerif-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Script-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size1-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size2-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size3-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Size4-Regular.woff2)format("woff2")}@font-face{font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(https://cdn.openai.com/common/fonts/katex/KaTeX_Typewriter-Regular.woff2)format("woff2")}.katex{text-indent:0;text-rendering:auto;font:1.21em/1.2 KaTeX_Main,Times New Roman,serif}.katex *{border-color:currentColor;-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.16.0"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{white-space:nowrap;width:min-content;position:relative}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;table-layout:fixed;display:inline-table}.katex .vlist-r{display:table-row}.katex .vlist{vertical-align:bottom;display:table-cell;position:relative}.katex .vlist>span{height:0;display:block;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{width:0;overflow:hidden}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{vertical-align:bottom;width:2px;min-width:2px;font-size:1px;display:table-cell}.katex .vbox{flex-direction:column;align-items:baseline;display:inline-flex}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{flex-direction:row;display:inline-flex}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline{border-bottom-style:dashed;width:100%;display:inline-block}.katex .sqrt>.root{margin-left:.277778em;margin-right:-.555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.833333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.714286em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.857143em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14286em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71429em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96286em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55429em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.416667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.583333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.833333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.347222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.416667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.486111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.694444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.833333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44028em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.289352em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.347222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.405093em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.520833em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.578704em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.694444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.833333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.289296em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.385728em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.433944em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.578592em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.694311em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.833173em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.200965em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.241158em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.281351em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.321543em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.361736em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.401929em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.482315em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.694534em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.833601em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{width:.12em;display:inline-block}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{min-width:1px;display:inline-block}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{width:100%;height:inherit;fill:currentColor;fill-opacity:1;fill-rule:nonzero;stroke:currentColor;stroke-dasharray:none;stroke-dashoffset:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-width:1px;display:block;position:absolute}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;max-width:none;min-height:0;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{width:50.2%;position:absolute;left:0;overflow:hidden}.katex .halfarrow-right{width:50.2%;position:absolute;right:0;overflow:hidden}.katex .brace-left{width:25.1%;position:absolute;left:0;overflow:hidden}.katex .brace-center{width:50%;position:absolute;left:25%;overflow:hidden}.katex .brace-right{width:25.1%;position:absolute;right:0;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{text-align:left;display:inline-block;position:absolute;right:calc(50% + .3em)}.katex .cd-label-right{text-align:right;display:inline-block;position:absolute;left:calc(50% + .3em)}.katex-display{text-align:center;margin:1em 0;display:block}.katex-display>.katex{text-align:center;white-space:nowrap;display:block}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.bottom-0{bottom:0}.left-0{left:0}.container{width:100%}@media (min-width:380px){.container{max-width:380px}}@media (min-width:576px){.container{max-width:576px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.mx-px{margin-inline:1px}.mt-1{margin-top:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.\!hidden{display:none!important}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.h-0{height:0}.h-\[var\(--button-icon-size\)\]{height:var(--button-icon-size)}.w-\[var\(--button-icon-size\)\]{width:var(--button-icon-size)}.w-full{width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-\[120px\]{min-width:120px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-default{border-color:var(--color-border)}.border-subtle{border-color:var(--color-border-subtle)}.bg-surface{background-color:var(--color-surface)}.fill-secondary{fill:var(--color-text-secondary)}.p-4{padding:calc(var(--spacing) * 4)}.pt-4{padding-top:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-right{text-align:right}.heading-lg{font-size:var(--font-heading-lg-size);font-weight:var(--font-heading-lg-weight);letter-spacing:var(--font-heading-lg-tracking);line-height:var(--font-heading-lg-line-height)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));letter-spacing:var(--tw-tracking,var(--text-sm--letter-spacing));font-weight:var(--tw-font-weight,var(--text-sm--font-weight))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-ellipsis{text-overflow:ellipsis}.text-secondary{color:var(--color-text-secondary)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.shadow-lg{--tw-shadow:var(--shadow-300);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (min-width:576px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}:root{--background:0 0% 100%;--foreground:240 10% 3.9%;--card:0 0% 100%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--accent:240 4.8% 95.9%;--destructive:0 72% 51%;--border:240 5.9% 90%;--ring:240 5.9% 10%;--radius:.5rem;--canvas:240 5% 97.3%;--panel:0 0% 100%;--feature-link:208 100% 47.45%;color-scheme:light;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif}*{box-sizing:border-box}html,body,#root{overscroll-behavior:none;height:100%;margin:0;overflow:hidden}#root{position:fixed;top:0;right:0;bottom:0;left:0}body{background:hsl(var(--canvas));color:hsl(var(--foreground));-webkit-font-smoothing:antialiased}.icon{flex-shrink:0;width:16px;height:16px}.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}*{scrollbar-width:thin;scrollbar-color:hsl(var(--foreground) / .18) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--foreground) / .18);background-clip:content-box;border:2px solid #0000;border-radius:999px}::-webkit-scrollbar-thumb:hover{background:hsl(var(--foreground) / .32);background-clip:content-box}::-webkit-scrollbar-corner{background:0 0}.layout{height:100dvh;min-height:0;display:flex;overflow:hidden}.main-shell{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sidebar{background:0 0;flex-direction:column;flex-shrink:0;width:236px;height:100%;min-height:0;transition:width .22s cubic-bezier(.22,1,.36,1);display:flex;position:relative}.sidebar.is-collapsed{width:56px}@media (max-width:860px){.sidebar{width:204px}}.sidebar-top{flex-direction:column;gap:2px;padding:0 10px 8px;display:flex}.sidebar-brand-row{align-items:center;gap:6px;height:54px;min-height:54px;padding:0 0 0 10px;display:flex}.sidebar:not(.is-collapsed) .sidebar-top{padding-right:0}.sidebar:not(.is-collapsed) .sidebar-brand-row{padding-right:10px}.brand{min-width:0;color:inherit;cursor:pointer;letter-spacing:-.01em;text-align:left;background:0 0;border:0;flex:1;align-items:center;gap:9px;padding:0;font-family:inherit;font-size:15px;font-weight:600;display:flex}.brand-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.brand-logo,.brand-title,.brand{cursor:pointer}.login-brand-logo,.login-brand,.login-title{cursor:text}.sidebar-collapse-toggle{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;flex:0 0 28px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.sidebar-collapse-toggle:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.sidebar-collapse-toggle .icon{width:17px;height:17px}.sidebar.is-collapsed .sidebar-brand-row{justify-content:center;padding-inline:0}.sidebar.is-collapsed .brand{display:none}.brand-logo,.login-brand-logo{object-fit:contain;flex:0 0 20px;width:20px;min-width:20px;max-width:20px;height:20px;min-height:20px;max-height:20px;display:block}.new-chat{height:36px;min-height:36px;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:10px;padding:8px 10px;font-size:14px;transition:background .12s;display:flex}.new-chat .icon{width:18px;height:18px}.new-chat:hover,.new-chat.is-active{background:hsl(var(--foreground) / .05)}.sidebar-beta-badge{color:#976507;background:#fac70f29;border:1px solid #ce8b0d47;border-radius:999px;flex:none;padding:1px 5px;font-size:9.5px;font-weight:600;line-height:1.3}.new-chat--conversation>.icon{transform-origin:50%}.new-chat--conversation:hover>.icon{animation:.65s cubic-bezier(.22,1,.36,1) both sidebar-plus-return}.sidebar-agent-face{overflow:visible}.sidebar-agent-face__eye{transform-box:fill-box;transform-origin:50%;animation:1s ease-in-out infinite sidebar-agent-blink}@keyframes sidebar-plus-return{0%{transform:rotate(0)}48%{transform:rotate(48deg)}to{transform:rotate(0)}}@keyframes sidebar-agent-blink{0%,42%,58%,to{transform:scaleY(1)}50%{transform:scaleY(.08)}}@media (prefers-reduced-motion:reduce){.new-chat--conversation:hover>.icon,.sidebar-agent-face__eye{animation:none}}.studio-update-action{color:#fff;min-width:104px;min-height:40px;box-shadow:none;-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);cursor:pointer;font:inherit;background:#111;border:0;border-radius:999px;justify-content:center;align-items:center;gap:7px;padding:0 17px;font-size:12.5px;font-weight:650;transition:background-color .24s cubic-bezier(.22,1,.36,1),color .18s,box-shadow .24s,-webkit-backdrop-filter .24s,backdrop-filter .24s;display:inline-flex}.studio-update-action:not(:disabled):hover{color:#fff;background:#29292b;border:0;box-shadow:0 7px 18px #00000029}.studio-update-action:focus-visible{outline:2px solid hsl(var(--ring) / .55);outline-offset:2px}.studio-update-action:disabled{cursor:default;opacity:.42}.sidebar.is-collapsed .new-chat{white-space:nowrap;align-self:center;gap:0;width:36px;height:36px;min-height:36px;padding:9px;overflow:hidden}.sidebar.is-collapsed .sidebar-nav-label,.sidebar.is-collapsed .sidebar-beta-badge,.sidebar.is-collapsed .sidebar-history{display:none}.agentsel{--agentsel-available-width: calc(100vw - 250px) ;z-index:32;width:min(320px,var(--agentsel-available-width));background:0 0;border:0;flex-flow:wrap;align-content:stretch;align-items:stretch;gap:8px;margin-left:6px;animation:.16s ease-out agentsel-in;display:flex;position:absolute;top:8px;left:100%;overflow:visible;container-type:inline-size}.agentsel.has-detail{width:min(688px,var(--agentsel-available-width))}.agentsel--navbar{z-index:44;width:min(clamp(264px,26vw,288px),100vw - 48px);height:min(640px,100dvh - 74px);margin-left:0;position:absolute;top:calc(100% + 7px);left:0}.agentsel--navbar .agentsel-main{flex-basis:auto;width:100%}.sidebar.is-collapsed .agentsel{--agentsel-available-width: calc(100vw - 70px) }.agentsel-main{border:1px solid hsl(var(--border));background:hsl(var(--background));width:320px;min-width:min(240px,100%);height:100%;min-height:0;max-height:100%;box-shadow:0 12px 40px hsl(var(--foreground) / .14);border-radius:12px;flex-direction:column;flex:320px;display:flex;overflow:hidden}.agentsel-detail{border:1px solid hsl(var(--border));background:hsl(var(--background));width:360px;min-width:min(280px,100%);height:100%;min-height:0;max-height:100%;box-shadow:0 12px 40px hsl(var(--foreground) / .14);border-radius:12px;flex-direction:column;flex:360px;display:flex;overflow:hidden}.agentsel-preview{animation:.16s cubic-bezier(.22,1,.36,1) agentsel-preview-in}@container (max-width:527px){.agentsel.has-detail>.agentsel-main,.agentsel.has-detail>.agentsel-detail{height:calc(50% - 4px);max-height:calc(50% - 4px)}}.agentsel-preview-head{padding:7px 14px}.agentsel-detail-tabs{border:1px solid hsl(var(--border) / .58);background:hsl(var(--secondary) / .58);border-radius:9px;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;height:36px;padding:3px;display:grid;position:relative;overflow:hidden}.agentsel-detail-tabs-slider{z-index:0;border:1px solid hsl(var(--border) / .72);background:hsl(var(--background));border-radius:6px;width:calc(50% - 3px);transition:transform .24s cubic-bezier(.22,1,.36,1);position:absolute;top:3px;bottom:3px;left:3px;transform:translate(0)}.agentsel-detail-tabs.is-runtime .agentsel-detail-tabs-slider{transform:translate(100%)}.agentsel-detail-tabs button{z-index:1;min-width:0;color:hsl(var(--muted-foreground));font:inherit;text-align:center;cursor:pointer;background:0 0;border:0;border-radius:6px;font-size:12px;font-weight:550;transition:color .16s;position:relative}.agentsel-detail-tabs button:hover,.agentsel-detail-tabs button[aria-selected=true]{color:hsl(var(--foreground))}.agentsel-detail-tabs button:focus-visible{outline:2px solid hsl(var(--ring) / .24);outline-offset:-2px}.agentsel-tab-panel{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.agentsel-tab-panel[hidden]{display:none}.agentsel-detail-body{overscroll-behavior-y:contain;scrollbar-gutter:stable;flex:1;min-width:0;min-height:0;padding:12px 14px;overflow:hidden auto}.agentsel-panel-state{min-height:120px;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:7px;font-size:12.5px;display:flex}.agentsel-panel-state .icon{width:15px;height:15px}.agentsel-panel-empty{text-align:center;color:hsl(var(--muted-foreground));overflow-wrap:anywhere;flex-direction:column;gap:6px;padding:24px 8px;font-size:12.5px;display:flex}.agentsel-panel-empty small{color:hsl(var(--muted-foreground) / .75);-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:11px;line-height:1.45;display:-webkit-box;overflow:hidden}.agentsel-identity,.agentsel-runtime-identity{align-items:flex-start;gap:10px;min-width:0;display:flex}.agentsel-identity{padding-bottom:12px}.agentsel-identity-icon,.agentsel-runtime-identity>.icon{width:18px;height:18px;color:hsl(var(--muted-foreground));flex-shrink:0;margin-top:1px}.agentsel-identity-copy,.agentsel-runtime-identity>div{flex-direction:column;flex:1;gap:3px;min-width:0;display:flex}.agentsel-identity-copy strong,.agentsel-runtime-identity strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;font-weight:650;overflow:hidden}.agentsel-identity-copy span,.agentsel-runtime-identity span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.agentsel-runtime-identity{border-bottom:1px solid hsl(var(--border));margin-bottom:14px;padding-bottom:12px}.agentsel-info-section{border-top:1px solid hsl(var(--border));min-width:0;padding:11px 0}.agentsel-info-section h3{color:hsl(var(--muted-foreground));align-items:center;gap:6px;margin:0 0 8px;font-size:11.5px;font-weight:600;display:flex}.agentsel-info-section h3 .icon{width:13px;height:13px}.agentsel-description{white-space:pre-wrap;overflow-wrap:anywhere;max-height:104px;color:hsl(var(--foreground));margin:0;font-size:12.5px;line-height:1.65;overflow-y:auto}.agentsel-chips{flex-wrap:wrap;gap:5px;min-width:0;display:flex}.agentsel-chip{border:1px solid hsl(var(--border));background:hsl(var(--canvas) / .7);max-width:100%;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;border-radius:5px;padding:3px 7px;font-size:11.5px;line-height:1.35;display:block;overflow:hidden}.agentsel-info-list{flex-direction:column;gap:6px;min-width:0;display:flex}.agentsel-info-list-item{background:hsl(var(--canvas) / .72);border-radius:6px;flex-direction:column;gap:2px;min-width:0;padding:7px 8px;display:flex}.agentsel-info-list-item>strong,.agentsel-component-head>strong{text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:600;overflow:hidden}.agentsel-info-list-item>span{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:11px;line-height:1.45;display:-webkit-box;overflow:hidden}.agentsel-component-head{align-items:center;gap:8px;min-width:0;display:flex}.agentsel-component-head>strong{flex:1;min-width:0}.agentsel-component-head>span{background:hsl(var(--foreground) / .06);color:hsl(var(--muted-foreground));border-radius:4px;flex-shrink:0;padding:1px 5px;font-size:10px}.agentsel-kv{flex-direction:column;gap:8px;margin:0;display:flex}.agentsel-kv-row{grid-template-columns:52px 1fr;gap:8px;font-size:12.5px;display:grid}.agentsel-kv-row dt{color:hsl(var(--muted-foreground))}.agentsel-kv-row dd{min-width:0;color:hsl(var(--foreground));overflow-wrap:anywhere;margin:0}.agentsel-envs{margin-top:14px}.agentsel-envs-head{color:hsl(var(--muted-foreground));margin-bottom:6px;font-size:12px;font-weight:600}.agentsel-env{flex-direction:column;gap:1px;margin-bottom:6px;display:flex}.agentsel-env-k{overflow-wrap:anywhere;color:hsl(var(--muted-foreground));font-family:inherit;font-size:11px}.agentsel-env-v{overflow-wrap:anywhere;color:hsl(var(--foreground));font-family:inherit;font-size:11.5px}.agentsel-head-actions{align-items:center;gap:2px;display:flex}.agentsel-pager{flex:0 0 36px;justify-content:center;align-items:center;gap:14px;padding:6px 10px 0;display:flex}.agentsel-pager button{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;padding:2px;display:flex}.agentsel-pager button:hover:not(:disabled){color:hsl(var(--foreground))}.agentsel-pager button:disabled{opacity:.3;cursor:default}.agentsel-pager button .icon{width:18px;height:18px}.agentsel-pager-label{color:hsl(var(--muted-foreground));text-align:center;min-width:40px;font-size:13px}@keyframes agentsel-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes agentsel-preview-in{0%{opacity:0;transform:translate(-6px)}to{opacity:1;transform:translate(0)}}.agentsel-head{box-sizing:border-box;border-bottom:1px solid hsl(var(--border));flex-shrink:0;justify-content:space-between;align-items:center;height:52px;padding:0 14px;display:flex}.agentsel-title{text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:8px;min-width:0;font-size:14px;font-weight:600;display:flex;overflow:hidden}.agentsel-title .icon{width:17px;height:17px}.agentsel-refresh{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;border-radius:6px;padding:4px;display:flex}.agentsel-refresh:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.agentsel-refresh .icon{width:16px;height:16px}.agentsel-body{overscroll-behavior-y:contain;scrollbar-gutter:stable;flex:1;min-height:0;padding:10px;overflow-y:auto}.agentsel-body--cloud{scrollbar-gutter:auto;flex-direction:column;display:flex;overflow:hidden}.agentsel-tools{flex-direction:column;gap:8px;margin-bottom:10px;display:flex}.agentsel-search{border:1px solid hsl(var(--border));border-radius:8px;align-items:center;gap:8px;padding:7px 10px;display:flex}.agentsel-search .icon{width:15px;height:15px;color:hsl(var(--muted-foreground))}.agentsel-search input{font:inherit;color:hsl(var(--foreground));background:0 0;border:none;outline:none;flex:1;font-size:13px}.agentsel-mine{color:hsl(var(--muted-foreground));cursor:pointer;align-items:center;gap:7px;font-size:12.5px;display:flex}.agentsel-list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.agentsel-listwrap{min-height:220px;position:relative}.agentsel-body--cloud .agentsel-listwrap{overscroll-behavior-y:contain;scrollbar-gutter:auto;flex:1;min-height:0;overflow-y:auto}.agentsel-loading{color:hsl(var(--muted-foreground));background:hsl(var(--background) / .72);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);border-radius:8px;justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex;position:absolute;top:0;right:0;bottom:0;left:0}.agentsel-loading .icon{width:16px;height:16px}.agentsel-item{width:100%;min-height:46px;color:hsl(var(--foreground));font:inherit;text-align:left;background:0 0;border:none;border-radius:8px;align-items:center;gap:9px;padding:4px 0;font-size:13.5px;display:flex}.agentsel-main button.agentsel-item{cursor:pointer;min-height:0;padding:9px 10px}.agentsel-item:hover{background:hsl(var(--foreground) / .05);box-shadow:none;transform:none}.agentsel-runtime-item:hover{background:0 0}.agentsel-item.active{background:hsl(var(--foreground) / .08);font-weight:600}.agentsel-item.is-previewed{background:hsl(var(--foreground) / .055)}.agentsel-runtime-item.active,.agentsel-runtime-item.is-previewed{background:0 0}.agentsel-item .icon{width:16px;height:16px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-item-main{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.agentsel-item-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;font-weight:550;overflow:hidden}.agentsel-item-meta{align-items:center;gap:4px;min-width:0;display:flex}.agentsel-item-actions{flex-shrink:0;align-items:center;gap:1px;display:flex}.agentsel-connect,.agentsel-info{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px}.agentsel-connect{min-width:38px;height:28px;padding:0 5px;font-size:11.5px;font-weight:550}.agentsel-info{place-items:center;width:28px;height:28px;padding:0;display:grid}.agentsel-connect:hover:not(:disabled),.agentsel-info:hover{background:hsl(var(--foreground) / .07);color:hsl(var(--foreground));box-shadow:none}.agentsel-info.active{color:hsl(var(--foreground));box-shadow:none;background:0 0}.agentsel-connect:disabled{opacity:.55;cursor:default}.agentsel-info .icon{width:15px;height:15px}.agentsel-rt{flex-direction:column;display:flex}.agentsel-rt-row{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;text-align:left;background:0 0;border:none;border-radius:8px;align-items:center;gap:7px;padding:9px 8px;font-size:13.5px;display:flex}.agentsel-rt-row:hover{background:hsl(var(--foreground) / .05)}.agentsel-rt-row .icon{width:15px;height:15px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-rt-name{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.runtime-owner-badge{color:#0b68cb;background:#007bff1f;border-radius:999px;flex-shrink:0;padding:1px 6px;font-size:10px;font-weight:600}.agentsel-status{border-radius:999px;flex-shrink:0;padding:1px 6px;font-size:10px}.agentsel-status.is-ok{color:#238b49;background:#21c45d24}.agentsel-status.is-warn{color:#b86614;background:#f59f0a29}.agentsel-status.is-bad{color:#ca2b2b;background:#dc282824}.agentsel-status.is-muted{background:hsl(var(--muted));color:hsl(var(--muted-foreground))}.agentsel-apps{flex-direction:column;gap:2px;padding:2px 0 6px 20px;display:flex}.agentsel-app{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;text-align:left;background:0 0;border:none;border-radius:7px;align-items:center;gap:8px;padding:7px 10px;font-size:13px;display:flex}.agentsel-app:hover{background:hsl(var(--foreground) / .05)}.agentsel-app.active{background:hsl(var(--foreground) / .08);font-weight:600}.agentsel-app .icon{width:14px;height:14px;color:hsl(var(--muted-foreground));flex-shrink:0}.agentsel-apps-note{color:hsl(var(--muted-foreground));align-items:center;gap:7px;padding:7px 10px;font-size:12.5px;display:flex}.agentsel-apps-note .icon{width:14px;height:14px}.agentsel-apps-note--muted{font-style:italic}.agentsel-empty{text-align:center;color:hsl(var(--muted-foreground));padding:24px 10px;font-size:13px}.agentsel-error{overflow-wrap:anywhere;color:#bd2828;white-space:pre-wrap;background:#dc282814;border-radius:8px;min-width:0;max-width:100%;margin:4px 0 10px;padding:8px 10px;font-size:12.5px;overflow:hidden}.agentsel-more{border:1px dashed hsl(var(--border));width:100%;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border-radius:8px;margin-top:8px;padding:9px;font-size:13px}.agentsel-more:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}@media (max-width:860px){.agentsel{--agentsel-available-width: calc(100vw - 218px) }}.sidebar-history{flex-direction:column;flex:1;min-height:0;display:flex}.history-head{color:hsl(var(--foreground));justify-content:space-between;align-items:center;padding:8px 10px 6px 20px;font-size:13px;font-weight:600;display:flex}.history-refresh{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;padding:2px;display:flex}.history-refresh:hover{color:hsl(var(--foreground))}.history-new-chat{width:24px;height:24px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;margin:-4px 0;padding:0;transition:color .12s;display:inline-flex}.history-new-chat .icon{width:15px;height:15px}.history-new-chat:hover{color:hsl(var(--foreground));background:0 0}.history-list{flex-direction:column;flex:1;gap:2px;padding:4px 10px 12px;display:flex;overflow-y:auto}.history-empty{color:hsl(var(--muted-foreground));text-align:center;padding:16px 8px;font-size:13px}.history-item{border-radius:8px;align-items:center;transition:background .12s;display:flex;position:relative}.history-item:hover{background:hsl(var(--foreground) / .05)}.history-item.active{background:hsl(var(--foreground) / .08)}.history-item-btn{text-align:left;min-width:0;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;flex:1;align-items:center;gap:7px;padding:9px 10px;font-size:14px;display:flex}.history-title{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.history-streaming{background:#22c55e;border-radius:50%;flex-shrink:0;width:7px;height:7px;margin-right:4px;animation:1.4s ease-in-out infinite history-pulse;box-shadow:0 0 #22c55e80}@keyframes history-pulse{0%,to{box-shadow:0 0 #22c55e80}50%{box-shadow:0 0 0 4px #22c55e00}}.history-evaluating-status{color:#956718;flex-shrink:0;align-items:center;gap:5px;font-size:10.5px;font-weight:600;line-height:1;display:inline-flex}.history-evaluating{background:#f59f0a;border-radius:50%;flex-shrink:0;width:7px;height:7px;animation:1.4s ease-in-out infinite history-evaluation-pulse;box-shadow:0 0 #f59f0a6b}@keyframes history-evaluation-pulse{0%,to{box-shadow:0 0 #f59f0a6b}50%{box-shadow:0 0 0 4px #f59f0a00}}@media (prefers-reduced-motion:reduce){.history-streaming,.history-evaluating{box-shadow:none;animation:none}}.history-more{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;opacity:0;background:0 0;border:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;margin-right:4px;transition:opacity .12s,background .12s;display:flex}.history-item:hover .history-more{opacity:1}.history-more:hover{background:hsl(var(--border));color:hsl(var(--foreground))}.menu-scrim{z-index:30;position:fixed;top:0;right:0;bottom:0;left:0}.history-menu{z-index:31;background:hsl(var(--background));border:1px solid hsl(var(--border));min-width:120px;box-shadow:0 6px 20px hsl(var(--foreground) / .12);border-radius:8px;margin-top:2px;padding:4px;position:absolute;top:100%;right:4px}.menu-item{width:100%;font:inherit;cursor:pointer;color:hsl(var(--foreground));background:0 0;border:none;border-radius:6px;align-items:center;gap:8px;padding:7px 10px;font-size:13px;display:flex}.menu-item:hover{background:hsl(var(--accent))}.menu-item--danger{color:hsl(var(--destructive))}.menu-item .icon{width:15px;height:15px}.main{background:hsl(var(--panel));border:1px solid hsl(var(--border));border-radius:12px;flex-direction:column;flex:1;min-width:0;min-height:0;margin:10px;display:flex;position:relative;overflow:hidden}.error{z-index:3;border-radius:var(--radius);background:hsl(var(--destructive) / .1);width:calc(100% - 32px);max-width:768px;color:hsl(var(--destructive));overflow-wrap:anywhere;margin:10px auto 0;padding:10px 12px;font-size:13px;position:relative}.case-return-bar{flex:none;justify-content:center;padding:12px 16px 0;display:flex}.case-return-bar button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-height:32px;color:hsl(var(--foreground));cursor:pointer;font:inherit;box-shadow:0 1px 2px hsl(var(--foreground) / .05);border-radius:999px;align-items:center;gap:7px;padding:0 11px;font-size:12px;font-weight:620;display:inline-flex}.case-return-bar button:hover{background:hsl(var(--secondary) / .55)}.case-return-bar svg{width:14px;height:14px}.transcript{flex:1;padding:28px 16px 8px;overflow-y:auto}.transcript.is-streaming{overflow-anchor:none}.welcome{flex-direction:column;flex:1;justify-content:center;align-items:center;gap:32px;padding:0 16px clamp(88px,16vh,136px);display:flex;position:relative}.welcome-primary{flex-direction:column;align-items:center;gap:32px;width:100%;display:flex;position:relative}.welcome-heading{z-index:10;flex-direction:column;align-items:center;gap:72px;display:flex;position:relative}.welcome-feature-pill{background:hsl(var(--muted));height:36px;color:hsl(var(--muted-foreground));white-space:nowrap;border-radius:999px;align-items:center;gap:12px;padding:0 16px;font-size:13px;font-weight:500;line-height:1;display:inline-flex;position:relative}.welcome-feature-divider{background:hsl(var(--border));width:1px;height:16px}.welcome-feature-link{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:hsl(var(--feature-link));font:inherit;line-height:inherit;cursor:pointer;background:0 0;border:0;padding:0}.welcome-feature-link:focus-visible{outline:2px solid hsl(var(--feature-link) / .35);outline-offset:3px;border-radius:3px}.welcome-feature-pill:has(.studio-update-trigger--feature)>.welcome-feature-link:not(.studio-update-trigger--feature),.welcome-feature-pill:has(.studio-update-trigger--feature)>.welcome-feature-popover{display:none}.welcome-feature-popover{z-index:40;border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(340px,100vw - 32px);box-shadow:0 14px 36px hsl(var(--foreground) / .12);color:hsl(var(--foreground));text-align:left;white-space:normal;opacity:0;pointer-events:none;border-radius:14px;padding:16px;transition:opacity .16s,transform .16s;position:absolute;top:50%;left:calc(100% + 12px);transform:translate(-4px,-50%)}.welcome-feature-pill:hover .welcome-feature-popover,.welcome-feature-pill:focus-within .welcome-feature-popover{opacity:1;pointer-events:auto;transform:translateY(-50%)}.welcome-feature-popover>strong{margin-bottom:12px;font-size:13px;font-weight:600;display:block}.welcome-feature-popover ul{gap:12px;margin:0;padding:0;list-style:none;display:grid}.welcome-feature-popover li{gap:3px;display:grid}.welcome-feature-popover li span{color:hsl(var(--foreground));font-size:13px;font-weight:500;line-height:1.4}.welcome-feature-popover p{color:hsl(var(--muted-foreground));margin:0;font-size:12px;line-height:1.55}@media (max-width:900px){.welcome-feature-popover{top:calc(100% + 10px);left:50%;transform:translate(-50%,-4px)}.welcome-feature-pill:hover .welcome-feature-popover,.welcome-feature-pill:focus-within .welcome-feature-popover{transform:translate(-50%)}}.welcome-title,.composer-placeholder-reveal{animation:.9s cubic-bezier(.22,1,.36,1) both welcome-text-reveal}@keyframes welcome-text-reveal{0%{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0)}}@media (prefers-reduced-motion:reduce){.welcome-title,.composer-placeholder-reveal{opacity:1;clip-path:none;animation:none}.welcome-feature-popover{transition:none}}.welcome-title{letter-spacing:-.02em;margin:0;font-size:26px;font-weight:600}.welcome .composer{padding:0}.turn{flex-direction:column;gap:8px;max-width:768px;margin:0 auto 22px;display:flex}.turn:last-child{margin-bottom:0}.turn--user{align-items:flex-end}.turn--assistant{align-items:flex-start}.turn--assistant.is-feedback-target{border-radius:12px;animation:2.4s ease-out feedback-target-pulse}@keyframes feedback-target-pulse{0%{background:hsl(var(--foreground) / .07);box-shadow:0 0 0 8px hsl(var(--foreground) / .05)}to{box-shadow:0 0 hsl(var(--foreground) / 0);background:0 0}}.transcript.is-streaming>.turn--assistant:last-child{min-height:max(0px,100% - 180px)}.turn--subagent{isolation:isolate;width:100%;max-width:768px;box-shadow:none;background:0 0;border:0;border-radius:14px;gap:10px;margin-top:42px;margin-bottom:22px;padding:30px 16px 14px;position:relative}.turn--subagent:before{z-index:-1;border-radius:inherit;-webkit-backdrop-filter:blur(18px)saturate(115%);content:"";pointer-events:none;background:radial-gradient(circle at 12% 8%,#e3ebf28c,#0000 38%),radial-gradient(circle at 88% 78%,#e3e6ed6b,#0000 42%),linear-gradient(120deg,#ffffff8f,#f2f4f742);border:1px solid #dadfe7d1;position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.turn--subagent:has(>.turn-meta){padding-bottom:0}.turn--subagent:has(>.turn-meta):before{bottom:44px}.transcript.is-streaming>.turn--subagent:last-child{min-height:0}.subagent-run-label{background:hsl(var(--background));max-width:calc(100% - 28px);min-height:36px;box-shadow:none;border:1px solid #d5dae2;border-radius:10px;align-items:center;gap:8px;padding:4px 9px 4px 4px;display:inline-flex;position:absolute;top:0;left:14px;transform:translateY(-50%)}.subagent-run-handoff{color:#606b7b;white-space:nowrap;background:#eff2f5;border-radius:7px;flex:none;align-items:center;gap:5px;height:26px;padding:0 8px 0 6px;font-size:12px;font-weight:400;display:inline-flex}.subagent-run-handoff svg{flex:0 0 15px;width:15px;height:15px}.subagent-run-title{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:14.5px;font-weight:400;overflow:hidden}.subagent-run-description{color:#636c79;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;padding:0 2px 4px;font-size:13.5px;line-height:1.6;display:-webkit-box;overflow:hidden}.turn--subagent .turn-meta{margin:20px -16px 0;position:static}@media (max-width:700px){.turn--subagent{width:100%;padding:30px 10px 12px}.turn--subagent:has(>.turn-meta){padding-bottom:0}.turn--subagent .turn-meta{margin-left:-10px;margin-right:-10px}.subagent-run-label{max-width:calc(100% - 20px);left:10px}}.bubble{font-size:14.5px;line-height:1.65}.turn--user .bubble{background:hsl(var(--secondary));border-radius:18px;max-width:85%;padding:10px 16px}.turn--assistant .bubble{max-width:100%}.md{font-size:14.5px;line-height:1.65}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:0 0 .7em}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{letter-spacing:-.01em;margin:1.1em 0 .5em;font-weight:650;line-height:1.3}.md h1{font-size:1.4em}.md h2{font-size:1.25em}.md h3{font-size:1.1em}.md h4,.md h5,.md h6{font-size:1em}.md ul{list-style:outside}.md ol{list-style:decimal}.md ul ul{list-style-type:circle}.md ul ul ul{list-style-type:square}.md ol ol{list-style-type:lower-alpha}.md ol ol ol{list-style-type:lower-roman}.md li,.md li>ul,.md li>ol{margin:.15em 0}.md a{color:hsl(var(--primary));text-underline-offset:2px;text-decoration:underline}.md a:hover{opacity:.8}.md blockquote{border-left:3px solid hsl(var(--border));color:hsl(var(--muted-foreground));margin:0 0 .7em;padding:.1em .9em}.md strong{font-weight:650}.md code{background:hsl(var(--muted));border-radius:5px;padding:.12em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.875em}.md pre{background:hsl(var(--muted));border-radius:8px;margin:0 0 .7em;padding:12px 14px;line-height:1.55;overflow-x:auto}.md pre code{background:0 0;border-radius:0;padding:0;font-size:12.5px}.md table{border-collapse:collapse;width:100%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));border-radius:12px;margin:0 0 .7em;font-size:.95em;overflow:hidden}.md table thead th,.md table th{background:hsl(var(--muted));border:1px solid hsl(var(--border));text-align:left;padding:12px 16px;font-size:.98em;font-weight:650}.md table tbody td,.md table td{border:1px solid hsl(var(--border));text-align:left;vertical-align:top;padding:12px 16px;line-height:1.65}.md table tbody tr:nth-child(2n){background:hsl(var(--muted) / .25)}.md table tbody tr:hover{background:hsl(var(--accent))}.md table caption{caption-side:top;text-align:left;color:hsl(var(--muted-foreground));padding:0 0 8px;font-size:.9em;font-weight:600}.md table colgroup,.md table col{display:table-column}.md table thead,.md table tbody,.md table tfoot{display:table-row-group}.md table tr{display:table-row}.md strong,.md b{font-weight:650}.md em,.md i{font-style:italic}.md del,.md s{text-decoration:line-through}.md ins,.md u{text-decoration:underline}.md mark{background:#fff3c2b3;border-radius:4px;padding:.1em .3em}.md sub{vertical-align:sub;font-size:.8em}.md sup{vertical-align:super;font-size:.8em}.md code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.md pre{overflow-x:auto}@media (max-width:640px){.md table{font-size:.85em}.md table thead th,.md table th,.md table tbody td,.md table td{padding:8px 10px}}.md p{line-height:1.7}.md br{content:"";margin:.4em 0;display:block}.md hr{border:none;border-top:1px solid hsl(var(--border));margin:1.5em 0}.md blockquote{border-left:3px solid hsl(var(--primary) / .4);background:hsl(var(--muted) / .3);border-radius:0 8px 8px 0;margin:.8em 0;padding:.6em 1em}.md ul,.md ol{margin:.6em 0;padding-left:1.6em}.md li{margin:.3em 0;line-height:1.6}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{margin-top:1.2em;margin-bottom:.5em;line-height:1.3}.md h1{font-size:1.6em;font-weight:700}.md h2{font-size:1.4em;font-weight:650}.md h3{font-size:1.2em;font-weight:600}.md h4{font-size:1.1em;font-weight:600}.md h5,.md h6{font-size:1em;font-weight:600}.md .image-preview-trigger{background:hsl(var(--muted));width:fit-content;max-width:40%;box-shadow:0 0 0 1px hsl(var(--border));cursor:zoom-in;border:0;border-radius:10px;margin:0 0 .7em;padding:0;line-height:0;display:block;position:relative;overflow:hidden}.md .image-preview-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:3px}.md .image-preview-trigger img{border-radius:inherit;width:auto;max-width:100%;height:auto;transition:filter .18s,transform .18s;display:block}.md .image-preview-trigger:hover img{filter:brightness(.92);transform:scale(1.01)}.image-preview-hint{color:#fff;opacity:0;background:#131316ad;border:1px solid #fff3;border-radius:8px;place-items:center;width:28px;height:28px;transition:opacity .16s,transform .16s;display:grid;position:absolute;bottom:8px;right:8px;transform:translateY(3px)}.image-preview-hint svg{width:14px;height:14px}.image-preview-trigger:hover .image-preview-hint,.image-preview-trigger:focus-visible .image-preview-hint{opacity:1;transform:translateY(0)}.md .video-container{gap:6px;margin:0 0 .7em;display:grid}.md .video-caption{color:hsl(var(--muted-foreground));font-size:.9em}.md .video-link-text{color:inherit;text-decoration:none;transition:color .15s}.md .video-link-text:hover{color:hsl(var(--foreground));text-decoration:underline}.md .video-preview-trigger{background:hsl(var(--muted));width:fit-content;max-width:80%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));cursor:pointer;border:0;border-radius:12px;padding:0;line-height:0;transition:box-shadow .18s,transform .18s;display:block;position:relative;overflow:hidden}.md .video-preview-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:3px}.md .video-preview-trigger:hover{box-shadow:0 4px 16px hsl(var(--foreground) / .15),0 0 0 1px hsl(var(--border));transform:translateY(-1px)}.md .video-preview-trigger .video-thumbnail{border-radius:inherit;width:auto;max-width:100%;height:auto;transition:filter .18s,transform .18s;display:block}.md .video-preview-trigger:hover .video-thumbnail{filter:brightness(.9);transform:scale(1.01)}.video-preview-hint{color:#fff;opacity:0;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#131316b3;border:1px solid #fff3;border-radius:10px;place-items:center;width:32px;height:32px;transition:opacity .16s,transform .16s;display:grid;position:absolute;bottom:10px;right:10px;transform:translateY(4px)}.video-preview-hint svg{width:16px;height:16px}.video-preview-trigger:hover .video-preview-hint,.video-preview-trigger:focus-visible .video-preview-hint{opacity:1;transform:translateY(0)}.md .video-inline{max-width:100%;box-shadow:0 2px 8px hsl(var(--foreground) / .1),0 0 0 1px hsl(var(--border));border-radius:12px;margin:0 0 .7em}.video-viewer-backdrop{z-index:90;-webkit-backdrop-filter:blur(16px)saturate(.85);backdrop-filter:blur(16px)saturate(.85);background:#131316c7;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.video-viewer{border:1px solid hsl(var(--foreground) / .15);background:hsl(var(--background));border-radius:18px;flex-direction:column;width:min(1080px,94vw);max-height:min(880px,90vh);display:flex;overflow:hidden;box-shadow:0 32px 100px #07070885}.video-viewer-header{background:hsl(var(--muted) / .3);border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;min-height:56px;padding:10px 16px;display:flex}.video-viewer-title{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;max-width:70%;font-weight:500;overflow:hidden}.video-viewer-nav{gap:6px;display:flex}.video-viewer-download,.video-viewer-close{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:9px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.video-viewer-download:hover,.video-viewer-close:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.video-viewer-download svg,.video-viewer-close svg{width:17px;height:17px}.video-viewer-body{background:#161618;flex:1;place-items:center;min-height:0;padding:20px;display:grid;overflow:hidden}.video-viewer-body .video-fullscreen{background:#000;border-radius:12px;max-width:100%;max-height:calc(90vh - 96px);box-shadow:0 4px 20px #0006}@media (max-width:640px){.md .video-preview-trigger{max-width:100%}.video-viewer-backdrop{padding:0}.video-viewer{border:none;border-radius:0;width:100vw;max-height:100vh}.video-viewer-body .video-fullscreen{border-radius:0;max-height:calc(100vh - 96px)}}.turn--user .md code,.turn--user .md pre{background:hsl(var(--background) / .55)}.block-thinking,.block-tool{width:100%}.think-head,.tool-head{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;display:inline-flex}.think-head{gap:8px;min-height:32px;padding:3px 7px 3px 3px}.think-icon{flex:0 0 20px;place-items:center;width:20px;height:26px;display:grid}.think-icon>svg{width:18px;height:18px}.spark{color:hsl(var(--muted-foreground))}.spark.pulse{animation:1.4s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.5}}.chev{opacity:.58;flex:0 0 13px;width:13px;height:13px;transition:transform .18s}.chev.open{transform:rotate(90deg)}.think-label{font-size:14.5px;font-weight:400;line-height:1.35}.think-label--done{color:hsl(var(--muted-foreground))}.tool-head{color:hsl(var(--muted-foreground));transition:color .12s}.tool-head:hover{color:hsl(var(--foreground))}.tool-head--generic{gap:8px;min-height:32px;padding:3px 7px 3px 3px}.tool-name{color:inherit;font-size:14.5px;font-weight:400;line-height:1.35}.tool-icon{flex:0 0 20px;place-items:center;width:20px;height:26px;display:grid}.tool-icon>svg{width:18px;height:18px}.tool-icon--generic{color:hsl(var(--muted-foreground))}.tool-chevron{opacity:.58;flex:0 0 13px;width:13px;height:13px;transition:transform .18s}.tool-chevron.is-open{transform:rotate(90deg)}.tool-detail{flex-direction:column;gap:8px;margin:6px 0 4px;padding-left:3px;display:flex}.tool-section-label{text-transform:uppercase;letter-spacing:.04em;color:hsl(var(--muted-foreground));margin-bottom:4px;font-size:11px}.tool-result{max-height:240px;overflow:auto}.think-collapse{grid-template-rows:0fr;transition:grid-template-rows .28s;display:grid}.think-collapse.open{grid-template-rows:1fr}.think-collapse-inner{overflow:hidden}.think-body{color:hsl(var(--muted-foreground));white-space:pre-wrap;border-left:0;max-height:220px;margin:0;padding:0;font-size:14px;line-height:1.7;overflow-y:auto}.tool-args{background:hsl(var(--muted));white-space:pre-wrap;border-radius:6px;margin:0;padding:8px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.5;overflow-x:auto}.turn-meta{color:hsl(var(--muted-foreground));opacity:0;align-items:center;gap:10px;margin-top:2px;font-size:12px;transition:opacity .15s;display:flex}.turn-empty{color:hsl(var(--muted-foreground));margin-top:2px;font-size:13px;font-style:italic}.auth-card{border:1px solid hsl(var(--border));background:hsl(var(--card));border-radius:12px;width:100%;max-width:640px;margin:2px 0;padding:18px 20px}.auth-card-head{align-items:center;gap:8px;margin-bottom:6px;display:flex}.auth-card-icon{color:#f59f0a;width:18px;height:18px}.auth-card-icon--done{color:#1eae53}.auth-card-collapsed{border:1px solid hsl(var(--border));background:hsl(var(--card));color:hsl(var(--muted-foreground));border-radius:9px;align-items:center;gap:7px;margin:2px 0;padding:6px 12px;font-size:13px;font-weight:500;display:inline-flex}.auth-card-code{background:hsl(var(--muted));color:hsl(var(--foreground));word-break:break-all;border-radius:5px;padding:1px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.auth-card-title{font-size:14px;font-weight:600}.auth-card-desc{color:hsl(var(--muted-foreground));margin:0 0 14px;font-size:13px;line-height:1.6}.auth-card-btn{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font:inherit;cursor:pointer;border:none;border-radius:9px;align-items:center;gap:7px;padding:8px 16px;font-size:13px;font-weight:600;transition:opacity .12s;display:inline-flex}.auth-card-btn:hover:not(:disabled){opacity:.88}.auth-card-btn:disabled{opacity:.55;cursor:default}.auth-card-btn .cw-i{width:15px;height:15px}.auth-card-done{color:#1eae53;align-items:center;gap:6px;font-size:13px;font-weight:500;display:inline-flex}.auth-card-done .cw-i{width:16px;height:16px}.auth-card-err{color:hsl(var(--destructive));margin-top:8px;font-size:12px}.artifact-list{gap:8px;width:min(100%,440px);margin:6px 0;display:grid}.artifact-card{width:100%;color:hsl(var(--foreground));text-align:left;background:#f5f9ff;border:1px solid #d1e1fa;border-radius:12px;align-items:center;gap:12px;padding:12px 14px;display:flex}.artifact-card__icon{color:#2371e7;background:#d8e7fd;border-radius:10px;flex:none;justify-content:center;align-items:center;width:36px;height:36px;display:inline-flex}.artifact-card__icon svg{width:18px;height:18px}.artifact-card__copy{flex:auto;gap:3px;min-width:0;display:grid}.artifact-card__name{text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;overflow:hidden}.artifact-card__hint{color:hsl(var(--muted-foreground));font-size:12px}.artifact-card__actions{flex:none;gap:6px;margin-left:auto;display:flex}.artifact-card__action{background:hsl(var(--background));color:#315b9b;white-space:nowrap;cursor:pointer;border:1px solid #becde4;border-radius:8px;flex:none;align-items:center;gap:5px;min-height:30px;padding:0 10px;font-size:12px;font-weight:600;display:inline-flex}.artifact-card__action:hover:not(:disabled){background:#ebf3ff}.artifact-card__action:disabled{cursor:default;opacity:.55}.artifact-card__action svg{width:14px;height:14px}.artifact-card__action--primary{color:#fff;background:#2c77e8;border-color:#3e81e5}.artifact-card__action--primary:hover:not(:disabled){background:#1867dc}.artifact-card__error{color:hsl(var(--destructive));font-size:12px}.artifact-preview{z-index:1200;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.artifact-preview__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);cursor:default;background:#0b182b94;border:0;position:absolute;top:0;right:0;bottom:0;left:0}.artifact-preview__panel{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:16px;grid-template-rows:auto minmax(0,1fr);width:min(1120px,92vw);max-height:90vh;display:grid;position:relative;overflow:hidden;box-shadow:0 26px 80px #0b182b4d}.artifact-preview__header{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;gap:16px;min-height:52px;padding:0 16px 0 20px;font-size:14px;font-weight:600;display:flex}.artifact-preview__header button{width:32px;height:32px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:center;align-items:center;display:inline-flex}.artifact-preview__header button:hover{background:hsl(var(--muted))}.artifact-preview__header svg{width:17px;height:17px}.artifact-preview__canvas{background:#eceff3;min-height:0;padding:18px;overflow:auto}.artifact-preview__canvas img{border-radius:8px;width:100%;height:auto;display:block;box-shadow:0 6px 24px #0b182b29}.turn-actions{align-items:center;gap:2px;display:inline-flex}.turn-actions--right{opacity:0;align-self:flex-end;margin-top:2px;transition:opacity .15s}.turn--assistant:hover .turn-meta,.turn--user:hover .turn-actions--right{opacity:1}.icon-btn{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;transition:background .12s,color .12s;display:inline-flex}.icon-btn:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.icon-btn:disabled{opacity:.35;cursor:default}.icon-btn:disabled:hover{color:hsl(var(--muted-foreground));background:0 0}.icon-btn .icon{width:15px;height:15px}.feedback-btn:hover,.feedback-btn--good,.feedback-btn--bad,.feedback-btn--good:hover,.feedback-btn--bad:hover{color:hsl(var(--foreground));background:0 0}.feedback-btn[aria-busy=true]{opacity:1}.feedback-btn--good[aria-busy=true]:hover,.feedback-btn--bad[aria-busy=true]:hover{color:hsl(var(--foreground))}.feedback-btn .icon{width:18px;height:18px}.meta-text{white-space:nowrap;color:hsl(var(--muted-foreground));font-size:12px}.turn-actions--right{gap:6px}.drawer-scrim{background:hsl(var(--foreground) / .2);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:40;animation:.2s fade;position:fixed;top:0;right:0;bottom:0;left:0}@keyframes fade{0%{opacity:0}to{opacity:1}}.drawer{background:hsl(var(--background));border-left:1px solid hsl(var(--border));width:min(560px,92vw);box-shadow:-12px 0 40px hsl(var(--foreground) / .14);z-index:41;flex-direction:column;animation:.24s cubic-bezier(.22,1,.36,1) slidein;display:flex;position:fixed;top:0;bottom:0;right:0}@keyframes slidein{0%{transform:translate(100%)}to{transform:translate(0)}}.drawer-head{border-bottom:1px solid hsl(var(--border));background:hsl(var(--canvas));justify-content:space-between;align-items:center;padding:15px 18px;display:flex}.drawer-title{letter-spacing:-.01em;font-size:15px;font-weight:650}.drawer-sub{color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;margin-top:3px;font-size:12px}.drawer-close{cursor:pointer;color:hsl(var(--muted-foreground));background:0 0;border:none;border-radius:6px;padding:6px;display:flex}.drawer-close:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.drawer-body{flex:1;padding:16px 18px;overflow:auto}.drawer-loading,.drawer-empty{color:hsl(var(--muted-foreground));align-items:center;gap:8px;font-size:14px;display:flex}.drawer-loading{flex:1;justify-content:center;padding:24px}.drawer-empty{padding:20px 0}.drawer--trace{width:min(1080px,96vw)}.trace-split{flex:1;min-height:0;display:flex}.trace-tree{border-right:1px solid hsl(var(--border));flex:1.25;min-width:0;padding:8px 6px;overflow:auto}.trace-row{cursor:pointer;width:100%;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;gap:10px;padding:5px 8px;transition:background .1s;display:flex}.trace-row:hover{background:hsl(var(--foreground) / .04)}.trace-row.active{background:hsl(var(--primary) / .07);box-shadow:inset 2px 0 hsl(var(--primary) / .55)}.trace-label{flex:1;align-items:center;gap:6px;min-width:0;display:flex}.trace-caret{width:16px;height:16px;color:hsl(var(--muted-foreground));flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.trace-caret.hidden{visibility:hidden}.trace-caret .chev{width:13px;height:13px;transition:transform .18s}.trace-caret.open .chev{transform:rotate(90deg)}.trace-dot{border-radius:50%;flex-shrink:0;width:8px;height:8px}.trace-name{white-space:nowrap;text-overflow:ellipsis;font-size:13px;overflow:hidden}.trace-dur{text-align:right;width:66px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;flex-shrink:0;font-size:11px}.trace-track{background:hsl(var(--foreground) / .05);border-radius:5px;flex:0 0 34%;height:16px;position:relative}.trace-bar{opacity:.9;border-radius:4px;min-width:3px;height:8px;position:absolute;top:4px}.trace-detail{flex:1;min-width:0;padding:18px 20px;overflow:auto}.td-title{letter-spacing:-.01em;word-break:break-all;font-size:15px;font-weight:600}.td-dur{color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;align-items:center;gap:7px;margin-top:4px;font-size:12px;display:flex}.td-dot{border-radius:50%;width:8px;height:8px}.td-section{letter-spacing:.01em;color:hsl(var(--foreground));margin:22px 0 9px;font-size:12px;font-weight:650}.td-props{flex-direction:column;display:flex}.td-prop{border-bottom:1px solid hsl(var(--border));gap:16px;padding:7px 0;font-size:13px;display:flex}.td-key{color:hsl(var(--muted-foreground));flex-shrink:0;min-width:140px}.td-val{text-align:right;word-break:break-word;font-variant-numeric:tabular-nums;flex:1;min-width:0}.td-pre{background:hsl(var(--canvas));border:1px solid hsl(var(--border));white-space:pre-wrap;word-break:break-word;border-radius:8px;max-height:320px;margin:0;padding:11px 13px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.55;overflow:auto}.composer{width:100%;max-width:768px;margin:0 auto;padding:6px 16px 18px}.conversation-composer-slot{padding:6px 16px 18px}.conversation-composer-slot>.composer-slot>.composer{padding:0}.composer--new-chat{position:relative}.composer-box{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:26px;align-items:flex-end;gap:6px;padding:6px 6px 6px 8px;display:flex;position:relative}.composer--new-chat .composer-box{border-color:hsl(var(--border) / .55);border-radius:16px;min-height:136px;padding:10px;display:block;box-shadow:0 8px 32px #00000007,0 24px 72px 8px #00000005}.composer-input-stack{flex-direction:column;flex:1;min-width:0;display:flex;position:relative}.composer-input-stack .comp-input{width:100%}.composer--new-chat .composer-input-stack{min-height:114px}.composer--new-chat .comp-input{min-height:76px;padding:4px 10px}.composer--new-chat .comp-input::placeholder{color:#0000}.composer-placeholder-reveal{z-index:1;width:max-content;max-width:calc(100% - 20px);color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;pointer-events:none;font-size:15px;line-height:1.5;position:absolute;top:4px;left:10px;overflow:hidden}.composer--new-chat .composer-menu-wrap{height:36px;position:absolute;bottom:10px;left:10px}.composer--new-chat .new-chat-mode{align-items:center;min-height:36px;display:flex;position:absolute;bottom:10px;left:52px}.composer--new-chat.composer--has-task .new-chat-mode{left:138px}.composer--new-chat.composer--task-image .new-chat-mode,.composer--new-chat.composer--task-video .new-chat-mode{left:176px}.composer--new-chat.composer--skill-mode .new-chat-mode{left:10px}.new-chat-task-chip{z-index:2;color:#7a5bae;width:78px;height:36px;font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;gap:7px;padding:0 10px;font-size:15px;line-height:1;transition:background .15s,transform .15s;display:inline-flex;position:absolute;bottom:10px;left:52px}.new-chat-task-chip--image,.new-chat-task-chip--video{width:116px}.new-chat-task-chip--skill{width:86px;left:10px}.new-chat-task-chip>span:last-child{white-space:nowrap;flex:none}.new-chat-task-chip:hover,.new-chat-task-chip:focus-visible{background:#f4f1f8;outline:none}.new-chat-task-chip:active{transform:scale(.97)}.new-chat-task-chip:disabled{cursor:default;opacity:.5}.new-chat-task-chip__icon{border-radius:50%;flex:0 0 20px;place-items:center;width:20px;height:20px;display:grid;position:relative}.new-chat-task-chip__task-icon,.new-chat-task-chip__remove-icon{width:18px;height:18px;transition:opacity .12s,transform .15s;position:absolute}.new-chat-task-chip__remove-icon{color:#fff;opacity:0;box-sizing:content-box;background:#896bbd;border-radius:50%;width:12px;height:12px;padding:3px;transform:scale(.72)}.new-chat-task-chip:hover .new-chat-task-chip__task-icon,.new-chat-task-chip:focus-visible .new-chat-task-chip__task-icon{opacity:0;transform:scale(.72)}.new-chat-task-chip:hover .new-chat-task-chip__remove-icon,.new-chat-task-chip:focus-visible .new-chat-task-chip__remove-icon{opacity:1;transform:scale(1)}.composer--new-chat .comp-send{position:absolute;bottom:10px;right:10px}.composer--new-chat .comp-send .icon{width:20px;height:20px}.task-shortcuts{z-index:1;flex-wrap:wrap;justify-content:center;gap:10px;width:100%;display:flex;position:absolute;top:calc(100% + 18px);left:0}.task-shortcut{border:1px solid hsl(var(--border) / .72);background:hsl(var(--background));min-width:92px;height:40px;color:hsl(var(--muted-foreground));font:inherit;white-space:nowrap;cursor:pointer;opacity:0;border-radius:999px;flex:none;justify-content:center;align-items:center;gap:8px;padding:0 18px;font-size:13px;line-height:1;transition:border-color .14s,background .14s,color .14s,transform .14s;animation:.32s cubic-bezier(.22,1,.36,1) forwards task-shortcut-enter;display:inline-flex;transform:translateY(6px)}.task-shortcut>span{white-space:nowrap}.task-shortcut:nth-child(2){animation-delay:45ms}.task-shortcut:nth-child(3){animation-delay:90ms}.task-shortcut:nth-child(4){animation-delay:.135s}.task-shortcut:hover{color:#7454ab;background:#f6f5fa;border-color:#8970b257;transform:translateY(-1px)}.task-shortcut:focus-visible{outline-offset:2px;outline:2px solid #8970b257}.task-shortcut:disabled{cursor:not-allowed;opacity:.5}.task-shortcut>svg{stroke:currentColor;flex:none;width:18px;height:18px}.prompt-suggestions{z-index:1;gap:3px;width:100%;display:grid;position:absolute;top:calc(100% + 18px);left:0}.prompt-suggestion{width:100%;min-height:46px;color:hsl(var(--muted-foreground));font:inherit;text-align:left;cursor:pointer;opacity:0;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:8px 14px;font-size:15px;line-height:1.5;transition:background .14s,color .14s,transform .14s;animation:.44s cubic-bezier(.22,1,.36,1) forwards prompt-suggestion-enter;display:flex;transform:translateY(10px)}.prompt-suggestion:nth-child(2){animation-delay:65ms}.prompt-suggestion:nth-child(3){animation-delay:.13s}.prompt-suggestion:nth-child(4){animation-delay:.195s}.prompt-suggestion:hover{background:hsl(var(--foreground) / .025);color:hsl(var(--foreground))}.prompt-suggestion:focus-visible{outline:2px solid hsl(var(--primary) / .42);outline-offset:-2px}.prompt-suggestion:disabled{cursor:not-allowed;opacity:.5}.prompt-suggestion>svg{stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.35px;transform-origin:50%;flex:none;width:18px;height:18px;transition:transform .22s cubic-bezier(.22,1,.36,1)}.prompt-suggestion>span{white-space:nowrap;text-overflow:ellipsis;min-width:0;max-height:1.5em;transition:max-height .22s cubic-bezier(.22,1,.36,1);display:block;overflow:hidden}.prompt-suggestion:hover>span,.prompt-suggestion:focus-visible>span{white-space:normal;text-overflow:clip;max-height:4.5em}.prompt-suggestion:first-child:hover>svg{transform:rotate(-8deg)scale(1.06)}.prompt-suggestion:nth-child(2):hover>svg{transform:rotate(6deg)scale(1.07)}.prompt-suggestion:nth-child(3):hover>svg{transform:rotate(-5deg)scale(1.06)}.prompt-suggestion:nth-child(4):hover>svg{transform:rotate(5deg)scale(1.06)}@keyframes prompt-suggestion-enter{to{opacity:1;transform:translateY(0)}}@keyframes task-shortcut-enter{to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.task-shortcut,.prompt-suggestion,.new-chat-task-chip,.new-chat-task-chip__task-icon,.new-chat-task-chip__remove-icon{opacity:1;transition:none;animation:none;transform:none}.prompt-suggestion>svg,.prompt-suggestion>span{transition:none}.prompt-suggestion:hover>svg{transform:none}}.composer-meta{min-width:0;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:8px;padding:7px 12px 0;font-size:11px;line-height:1.4;display:flex}.composer-session-line{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex}.composer-session-id{text-overflow:ellipsis;max-width:300px;font-family:inherit;overflow:hidden}.composer-session-copy{width:18px;height:18px;color:inherit;cursor:pointer;opacity:.72;background:0 0;border:0;border-radius:4px;flex:0 0 18px;place-items:center;padding:0;transition:background .12s,color .12s,opacity .12s;display:inline-grid}.composer-session-copy:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground));opacity:1}.composer-session-copy svg{width:11px;height:11px}.composer-meta-separator{opacity:.55}.comp-input{resize:none;color:hsl(var(--foreground));font:inherit;background:0 0;border:none;outline:none;flex:1;max-height:200px;padding:8px 4px;font-size:15px;line-height:1.5;overflow-y:auto}.comp-input::placeholder{color:hsl(var(--muted-foreground))}.comp-icon{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:background .12s,color .12s;display:flex}.comp-icon:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.comp-send{background:hsl(var(--primary));width:36px;height:36px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,transform .1s;display:flex}.comp-send:hover:not(:disabled){opacity:.85}.comp-send:active:not(:disabled){transform:scale(.94)}.comp-send:disabled{opacity:.3;cursor:default}.invocation-chips{flex-wrap:wrap;gap:6px;min-width:0;display:flex}.composer>.invocation-chips{padding:0 8px 8px}.turn--user>.invocation-chips{justify-content:flex-end;margin-bottom:6px}.invocation-chip{border:1px solid hsl(var(--border));background:hsl(var(--background));max-width:260px;min-height:28px;color:hsl(var(--foreground));box-shadow:0 1px 2px hsl(var(--foreground) / .025);border-radius:8px;align-items:center;gap:5px;padding:4px 8px;font-size:12px;font-weight:560;line-height:1.2;display:inline-flex}.invocation-chip--skill{color:#267848}.invocation-chip--agent{color:#2762b0}.invocation-chip>svg{flex:none;width:13px;height:13px}.invocation-chip>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.invocation-chip button{color:currentColor;cursor:pointer;opacity:.55;background:0 0;border:none;border-radius:5px;justify-content:center;align-items:center;width:17px;height:17px;margin:-1px -3px -1px 1px;padding:0;display:inline-flex}.invocation-chip button:hover{background:hsl(var(--accent));opacity:1}.invocation-chip button svg{width:11px;height:11px}.composer-command-menu{z-index:34;border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(500px,100vw - 48px);box-shadow:0 2px 7px hsl(var(--foreground) / .08),0 22px 60px -24px hsl(var(--foreground) / .28);transform-origin:0 100%;border-radius:14px;animation:.13s ease-out command-menu-in;position:absolute;bottom:calc(100% + 10px);left:0;overflow:hidden}@keyframes command-menu-in{0%{opacity:0;transform:translateY(5px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.composer-command-head{border-bottom:1px solid hsl(var(--border));height:38px;color:hsl(var(--muted-foreground));letter-spacing:.02em;align-items:center;gap:7px;padding:0 10px 0 12px;font-size:11px;font-weight:650;display:flex}.composer-command-head>svg{width:13px;height:13px}.composer-command-head>span{flex:1}.composer-command-menu kbd{border:1px solid hsl(var(--border));background:hsl(var(--canvas));min-width:22px;color:hsl(var(--muted-foreground));text-align:center;border-radius:5px;padding:2px 5px;font:10px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace}.composer-command-list{max-height:min(330px,42vh);padding:5px;display:grid;overflow-y:auto}.composer-command-item{width:100%;min-height:52px;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:9px;grid-template-columns:34px minmax(0,1fr) auto;align-items:center;gap:9px;padding:6px 8px;display:grid}.composer-command-item.is-active{background:hsl(var(--accent))}.composer-command-icon{border-radius:9px;justify-content:center;align-items:center;width:34px;height:34px;display:inline-flex}.composer-command-icon--skill{color:#218349;background:#e7f8ee}.composer-command-icon--agent{color:#2664b5;background:#e9f1fc}.composer-command-icon svg{width:16px;height:16px}.composer-command-copy{gap:3px;min-width:0;display:grid}.composer-command-copy strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:620;line-height:1.2;overflow:hidden}.composer-command-copy>span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11px;line-height:1.3;overflow:hidden}.composer-command-empty{min-height:68px;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:7px;padding:14px;font-size:12px;display:flex}.composer-command-empty svg{width:14px;height:14px}.composer-menu-wrap{flex-shrink:0;position:relative}.composer-menu{z-index:31;background:hsl(var(--background));border:1px solid hsl(var(--border));min-width:168px;box-shadow:0 6px 20px hsl(var(--foreground) / .12);border-radius:12px;margin-bottom:6px;padding:4px;position:absolute;bottom:100%;left:0}.media-grid{flex-wrap:wrap;gap:8px;max-width:min(620px,100%);display:flex}.turn--user .media-grid{justify-content:flex-end}.composer>.media-grid{justify-content:flex-start;padding:0 8px 9px}.media-card{border:1px solid hsl(var(--border));background:hsl(var(--background));width:272px;min-width:0;box-shadow:0 1px 2px hsl(var(--foreground) / .025);border-radius:14px;transition:border-color .16s,box-shadow .16s,transform .16s;position:relative;overflow:visible}.media-card:hover{border-color:hsl(var(--foreground) / .2);box-shadow:0 8px 28px -20px hsl(var(--foreground) / .28);transform:translateY(-1px)}.media-card--image{width:176px}.media-grid--compact .media-card{width:224px}.media-grid--compact .media-card--image{width:92px}.media-card-main{border-radius:inherit;width:100%;min-width:0;height:68px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:11px;padding:10px 12px;display:flex}.media-card-main:disabled{cursor:default}.media-card--image .media-card-main{height:132px;padding:4px;display:block}.media-grid--compact .media-card-main{height:58px;padding:8px 10px}.media-grid--compact .media-card--image .media-card-main{height:72px;padding:3px}.media-card-image{object-fit:cover;background:hsl(var(--muted));border-radius:10px;width:100%;height:100%;display:block}.media-card--image .media-card-copy,.media-card--image .media-card-open{display:none}.media-card-icon{width:40px;height:44px;color:hsl(var(--muted-foreground));background:hsl(var(--muted));border-radius:9px;flex:none;justify-content:center;align-items:center;display:inline-flex}.media-card--pdf .media-card-icon{color:#db2a24;background:#fdeded}.media-card--video .media-card-icon{color:#226cd3;background:#edf3fd}.media-card--markdown .media-card-icon{color:#259353;background:#ebfaf1}.media-card-icon svg{width:21px;height:21px}.media-card-video-container{background:#131316;place-items:center;width:100%;height:100%;display:grid;position:relative;overflow:hidden}.media-card-video{object-fit:cover;opacity:.85;width:100%;height:100%}.media-card-video-play{color:#fff;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#0000008c;border-radius:50%;place-items:center;width:48px;height:48px;transition:transform .18s,background .18s;display:grid;position:absolute;transform:scale(1)}.media-card-video-play svg{width:20px;height:20px;margin-left:3px}.media-card-main:hover .media-card-video-play{background:#000000b3;transform:scale(1.08)}.media-card-copy{flex:1;gap:5px;min-width:0;display:grid}.media-card-name{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:560;line-height:1.2;overflow:hidden}.media-card-meta{min-width:0;color:hsl(var(--muted-foreground));align-items:center;gap:5px;font-size:11px;line-height:1.2;display:flex}.media-card-type{letter-spacing:.06em;font-size:9px;font-weight:700}.media-card-open{width:14px;height:14px;color:hsl(var(--muted-foreground));opacity:0;flex:none;transition:opacity .15s}.media-card:hover .media-card-open{opacity:1}.media-card-spinner{width:12px;height:12px;animation:.85s linear infinite spin}.media-card--error{border-color:hsl(var(--destructive) / .42)}.media-card--error .media-card-meta{color:hsl(var(--destructive))}.media-card-remove{z-index:2;border:1px solid hsl(var(--border));background:hsl(var(--background));width:21px;height:21px;color:hsl(var(--muted-foreground));box-shadow:0 2px 8px hsl(var(--foreground) / .12);cursor:pointer;border-radius:999px;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:-7px;right:-7px}.media-card-remove:hover{color:hsl(var(--foreground))}.media-card-remove svg{width:12px;height:12px}.media-viewer-backdrop{z-index:90;-webkit-backdrop-filter:blur(12px)saturate(.8);backdrop-filter:blur(12px)saturate(.8);background:#131316b8;place-items:center;padding:28px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.media-viewer{border:1px solid hsl(var(--foreground) / .13);background:hsl(var(--background));border-radius:18px;flex-direction:column;width:min(1080px,94vw);height:min(820px,90vh);display:flex;overflow:hidden;box-shadow:0 32px 100px #07070875}.media-viewer-header{border-bottom:1px solid hsl(var(--border));background:hsl(var(--background) / .94);justify-content:space-between;align-items:center;gap:18px;min-height:58px;padding:9px 12px 9px 18px;display:flex}.media-viewer-header>div{gap:2px;min-width:0;display:grid}.media-viewer-header strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:620;overflow:hidden}.media-viewer-header span{color:hsl(var(--muted-foreground));font-size:11px}.media-viewer-header nav{gap:4px;display:flex}.media-viewer-header a,.media-viewer-header button{width:36px;height:36px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;border-radius:9px;justify-content:center;align-items:center;padding:0;display:inline-flex}.media-viewer-header a:hover,.media-viewer-header button:hover{background:hsl(var(--accent));color:hsl(var(--foreground))}.media-viewer-header svg{width:17px;height:17px}.media-viewer-body{background:hsl(var(--canvas));flex:1;min-height:0;overflow:auto}.media-viewer-body--image,.media-viewer-body--video{background:#161618;place-items:center;padding:24px;display:grid}.media-viewer-body--image img,.media-viewer-body--video video{object-fit:contain;border-radius:8px;max-width:100%;max-height:100%}.media-viewer-video-wrapper{place-items:center;width:100%;display:grid}.media-viewer-video{background:#000;border-radius:12px;max-width:100%;max-height:calc(90vh - 140px);box-shadow:0 4px 20px #0006}.media-viewer-body--pdf iframe{background:#fff;border:none;width:100%;height:100%;display:block}.media-document{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(820px,100% - 48px);box-shadow:0 12px 38px -30px hsl(var(--foreground) / .3);border-radius:12px;margin:24px auto;padding:34px 40px}.media-document--plain{white-space:pre-wrap;word-break:break-word;min-height:calc(100% - 48px);font:13px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace}.media-viewer-loading{height:100%;color:hsl(var(--muted-foreground));justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex}.media-viewer-loading svg{width:17px;height:17px;animation:.85s linear infinite spin}@media (max-width:640px){.composer-command-menu{width:auto;right:0}.media-card{width:min(272px,82vw)}.media-viewer-backdrop{padding:0}.media-viewer{border:none;border-radius:0;width:100vw;height:100vh}.media-document{width:calc(100% - 24px);margin:12px auto;padding:22px 18px}.md .image-preview-trigger{max-width:100%}}.a2ui-surface{width:100%;max-width:360px;font-size:14px}.a2ui-card{background:hsl(var(--card));border:1px solid hsl(var(--border));box-shadow:0 1px 2px hsl(var(--foreground) / .04),0 8px 24px -16px hsl(var(--foreground) / .18);border-radius:8px;padding:18px}.a2ui-column,.a2ui-row{gap:10px}.a2ui-text{color:hsl(var(--foreground));margin:0;line-height:1.5}.a2ui-text--h1{letter-spacing:0;font-size:19px;font-weight:650}.a2ui-text--h2{letter-spacing:0;font-size:16px;font-weight:650}.a2ui-text--h3{font-size:14px;font-weight:600}.a2ui-text--h4{color:hsl(var(--muted-foreground));text-transform:uppercase;letter-spacing:0;font-size:12px;font-weight:600}.a2ui-text--caption{color:hsl(var(--muted-foreground));font-size:12px}.a2ui-text--body{font-size:14px}.a2ui-icon{color:hsl(var(--muted-foreground));justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.a2ui-divider--h{background:hsl(var(--border));width:100%;height:1px;margin:4px 0}.a2ui-divider--v{background:hsl(var(--border));align-self:stretch;width:1px}.a2ui-button{background:hsl(var(--secondary));color:hsl(var(--secondary-foreground));cursor:pointer;font:inherit;border:1px solid #0000;border-radius:10px;padding:8px 14px;font-size:13px;font-weight:500;transition:background .15s,opacity .15s}.a2ui-button:hover{background:hsl(var(--accent))}.a2ui-button--primary{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.a2ui-button--primary:hover{background:hsl(var(--primary));opacity:.88}.a2ui-button--borderless{color:hsl(var(--foreground));background:0 0}.a2ui-button--borderless:hover{background:hsl(var(--accent))}.a2ui-surface[data-a2ui-surface^=flight-]{max-width:520px}.a2ui-surface[data-a2ui-surface^=flight-] .a2ui-card{background:linear-gradient(180deg,#f6fbfe,hsl(var(--card)) 42%),hsl(var(--card));box-shadow:0 1px 2px hsl(var(--foreground) / .05),0 18px 48px -28px #283d5359;border-color:#d7e0ea;padding:0;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-content]{gap:16px;padding:18px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-top]{gap:12px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-brand]{min-width:0}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-brand-icon]{color:#004fa3;background:#006fe61a;border-radius:999px;width:28px;height:28px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-title]{color:#41454e;white-space:nowrap;text-overflow:ellipsis;font-size:13px;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-chip]{background:#e3f8ed;border:1px solid #bbe7d2;border-radius:999px;flex-shrink:0;gap:6px;padding:5px 9px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-chip] .a2ui-icon,.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-status-text]{color:#126e41}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-hero]{background:hsl(var(--background) / .88);border:1px solid #dde6ee;border-radius:8px;gap:16px;padding:18px;position:relative}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination]{flex:1 1 0;gap:2px;min-width:0}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-code],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-code]{color:#191d24;font-size:34px;font-weight:760;line-height:1}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-label],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-label]{color:#717784;font-size:11px;font-weight:700}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-city],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-city]{color:#545964;font-size:13px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-mark]{flex:none;gap:3px;padding:0 4px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-icon]{color:#0054ad;background:#006fe61f;border-radius:999px;width:34px;height:34px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-duration],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-aircraft]{white-space:nowrap;font-size:11px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-times],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-details]{gap:10px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-time],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-time],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding]{background:#f3f4f6;border:1px solid #e5e7eb;border-radius:8px;flex:1 1 0;gap:2px;min-width:0;padding:11px 12px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-value]{font-size:14px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-departure-airport],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-arrival-airport]{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate-value],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding-value]{font-size:20px;line-height:1.15}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-footer]{gap:10px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-divider]{background:#d9e0e8;margin:0}@media (max-width:520px){.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-content]{padding:14px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-hero],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-times],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-details]{flex-wrap:wrap}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-route-mark]{order:3;width:100%}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-terminal],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-gate],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-boarding]{min-width:120px}.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-origin-code],.a2ui-surface[data-a2ui-surface^=flight-] [data-a2ui-id=flight-destination-code]{font-size:34px}}.a2ui-fallback{background:hsl(var(--muted));border:1px solid hsl(var(--border));color:hsl(var(--muted-foreground));border-radius:10px;padding:8px 10px;font-size:12px}.a2ui-fallback pre{margin:6px 0 0;overflow-x:auto}.boot{background:hsl(var(--background));height:100vh}.boot-error{color:hsl(var(--foreground));flex-direction:column;justify-content:center;align-items:center;gap:12px;font-size:14px;display:flex}.boot-error p{margin:0}.boot-error button,.login-provider-error button{border:1px solid hsl(var(--border));background:hsl(var(--card));color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:7px 18px;font-size:13px}.boot-error button:hover,.login-provider-error button:hover{background:hsl(var(--accent))}.navbar{background:0 0;flex:0 0 54px;justify-content:space-between;align-items:center;gap:16px;min-height:54px;padding:0 10px;display:flex}.navbar-left,.navbar-right,.navbar-default,.navbar-portal-slot,.navbar-portal-actions{align-items:center;display:flex}.navbar-left{flex:1;min-width:0;container-type:inline-size}.navbar-default{min-width:0}.navbar-title-group{align-items:center;gap:6px;min-width:0;display:flex}.loading-gap-spinner{box-sizing:border-box;border:1.5px solid #111;border-right-color:#0000;border-radius:50%;flex:0 0 16px;width:16px;height:16px;animation:.7s linear infinite loading-gap-spin;display:inline-block}@keyframes loading-gap-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.loading-gap-spinner{animation-duration:1.4s}}.agent-info-trigger{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:7px;flex:0 0 30px;justify-content:center;align-items:center;padding:0;transition:background .15s,color .15s;display:inline-flex}.agent-info-trigger:hover,.agent-info-trigger[aria-expanded=true]{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.agent-info-trigger:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:1px}.agent-info-trigger svg{width:17px;height:17px}.navbar-right{flex:none;gap:10px;min-width:0}.navbar-portal-slot,.navbar-portal-actions{min-width:0}.navbar-portal-slot:empty,.navbar-portal-actions:empty,.navbar-left:has(.navbar-portal-slot:not(:empty))>.navbar-default{display:none}.global-deploy-center{z-index:38;position:relative}.global-deploy-task{border:1px solid hsl(var(--border));background:hsl(var(--background) / .82);max-width:300px;min-height:32px;color:hsl(var(--muted-foreground));font:inherit;white-space:nowrap;cursor:pointer;border-radius:7px;outline:none;align-items:center;gap:7px;padding:0 10px;font-size:12px;transition:border-color .12s,background-color .12s;display:flex}.global-deploy-task:hover{background:hsl(var(--background))}.global-deploy-task:focus-visible{border-color:hsl(var(--ring) / .32);box-shadow:0 0 0 2px hsl(var(--ring) / .07)}.global-deploy-task.is-idle{color:hsl(var(--muted-foreground))}.global-deploy-task.is-running{color:#1863b4;border-color:#0c77e93d}.global-deploy-task.is-success{color:#277c46;border-color:#279b5138}.global-deploy-task.is-error{border-color:hsl(var(--destructive) / .24);color:hsl(var(--destructive))}.global-deploy-task.is-cancelled{color:hsl(var(--muted-foreground))}.global-deploy-task-icon{flex:none;width:14px;height:14px}.global-deploy-task-detail{text-overflow:ellipsis;overflow:hidden}.global-deploy-task-chevron{flex:none;width:13px;height:13px;transition:transform .14s}.global-deploy-task-chevron.is-open{transform:rotate(180deg)}.global-deploy-task-scrim{z-index:1;background:0 0;border:0;padding:0;position:fixed;top:0;right:0;bottom:0;left:0}.global-deploy-popover{z-index:2;border:1px solid hsl(var(--border));background:hsl(var(--background));width:390px;max-width:calc(100vw - 32px);box-shadow:0 14px 36px hsl(var(--foreground) / .14);border-radius:10px;position:absolute;top:40px;right:0;overflow:hidden}.global-deploy-popover-head{border-bottom:1px solid hsl(var(--border));height:44px;color:hsl(var(--foreground));justify-content:space-between;align-items:center;padding:0 14px;font-size:13px;font-weight:650;display:flex}.global-deploy-popover-head span:last-child{background:hsl(var(--secondary));min-width:20px;color:hsl(var(--muted-foreground));text-align:center;border-radius:999px;padding:1px 6px;font-size:11px}.global-deploy-list{max-height:min(520px,100vh - 82px);padding:8px;overflow-y:auto}.global-deploy-empty{color:hsl(var(--muted-foreground));text-align:center;padding:34px 16px;font-size:12.5px}.global-deploy-item{border:1px solid hsl(var(--border) / .8);background:hsl(var(--canvas) / .42);border-radius:8px;padding:12px}.global-deploy-item+.global-deploy-item{margin-top:7px}.global-deploy-item-head{justify-content:space-between;align-items:center;gap:12px;display:flex}.global-deploy-runtime-name{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650;overflow:hidden}.global-deploy-status{color:hsl(var(--muted-foreground));flex:none;font-size:11.5px}.global-deploy-item.is-running .global-deploy-status{color:#1863b4}.global-deploy-item.is-success .global-deploy-status{color:#277c46}.global-deploy-item.is-error .global-deploy-status{color:hsl(var(--destructive))}.global-deploy-item.is-cancelled .global-deploy-status{color:hsl(var(--muted-foreground))}.global-deploy-meta{grid-template-columns:1fr 1fr;gap:9px 14px;margin:11px 0 0;display:grid}.global-deploy-meta>div{min-width:0}.global-deploy-meta dt{color:hsl(var(--muted-foreground));margin-bottom:3px;font-size:10.5px}.global-deploy-meta dd{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:11.5px;overflow:hidden}.global-deploy-message{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;margin:10px 0 0;font-size:11.5px;line-height:1.45;overflow:hidden}.global-deploy-error{color:hsl(var(--muted-foreground));margin-top:10px;font-size:11.5px}.deploy-error-message-text{-webkit-line-clamp:3;overflow-wrap:anywhere;white-space:pre-wrap;-webkit-box-orient:vertical;margin:0;line-height:1.5;display:-webkit-box;overflow:hidden}.deploy-error-message.is-expanded .deploy-error-message-text{-webkit-line-clamp:unset;max-height:280px;display:block;overflow:auto}.deploy-error-message-actions{justify-content:flex-end;gap:2px;margin-top:6px;display:flex}.deploy-error-message-actions button{width:26px;height:26px;color:inherit;cursor:pointer;opacity:.72;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;padding:0;display:inline-flex}.deploy-error-message-actions button:hover{background:hsl(var(--foreground) / .07);opacity:1}.deploy-error-message-actions button:disabled{cursor:default;opacity:.5}.deploy-error-message-actions .deploy-error-retry{width:auto;font:inherit;gap:5px;margin-right:auto;padding:0 8px;font-size:11.5px;font-weight:600}.deploy-error-message-actions svg{width:14px;height:14px}.global-deploy-progress{background:hsl(var(--foreground) / .08);border-radius:999px;height:3px;margin-top:10px;overflow:hidden}.global-deploy-progress span{border-radius:inherit;background:#2581e4;height:100%;transition:width .18s;display:block}.global-deploy-item-actions{justify-content:flex-end;margin-top:9px;display:flex}.global-deploy-item-actions button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-height:27px;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;border-radius:5px;padding:0 9px;font-size:11.5px}.global-deploy-item-actions button:hover:not(:disabled){border-color:hsl(var(--destructive) / .3);background:hsl(var(--destructive) / .05);color:hsl(var(--destructive))}.global-deploy-item-actions button:disabled{opacity:.55;cursor:default}.navbar-title{letter-spacing:-.01em;color:hsl(var(--foreground));padding:5px 8px;font-size:16px;font-weight:650}.agent-dd{min-width:0;max-width:33.333cqw;position:relative}.agent-dd-trigger{color:hsl(var(--foreground));font:inherit;letter-spacing:-.01em;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:5px;max-width:100%;padding:5px 8px;font-size:16px;font-weight:650;transition:background .12s;display:inline-flex}.agent-dd-trigger:hover{background:hsl(var(--foreground) / .05)}.agent-dd-current{white-space:nowrap;text-overflow:ellipsis;min-width:0;max-width:100%;overflow:hidden}.agent-dd-chev{opacity:.6;width:16px;height:16px;transition:transform .2s}.agent-dd-chev.open{transform:rotate(180deg)}.agent-switch{letter-spacing:-.01em;align-items:center;gap:6px;min-width:0;max-width:33.333cqw;padding:5px 8px;font-size:16px;font-weight:650;display:inline-flex}.agent-switch-action{width:28px;height:28px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:7px;flex:0 0 28px;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex}.agent-switch-action:hover{background:hsl(var(--foreground) / .06);color:hsl(var(--foreground))}.agent-switch-action:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:1px}.agent-switch-action svg{width:16px;height:16px}@keyframes ddpop{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.account{position:relative}.account-avatar{isolation:isolate;background:radial-gradient(circle at var(--avatar-x,32%) var(--avatar-y,30%),hsl(var(--avatar-hue-a,202) 100% 92%) 0 12%,hsl(var(--avatar-hue-a,202) 95% 75% / .76) 34%,transparent 62%),radial-gradient(ellipse at 82% 78%,hsl(var(--avatar-hue-c,185) 86% 49% / .88) 0 18%,transparent 58%),linear-gradient(142deg,hsl(var(--avatar-hue-b,222) 94% 83%),hsl(var(--avatar-hue-b,222) 95% 54%) 52%,hsl(var(--avatar-hue-c,185) 74% 62%));color:#152747e0;cursor:pointer;text-shadow:0 1px 2px #ffffff9e;width:32px;height:32px;box-shadow:none;background-position:20% 12%,80% 80%,50%;background-size:180% 180%,160% 160%,100% 100%;border:none;border-radius:9px;flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;transition:filter .16s,transform .16s;animation:9s ease-in-out infinite alternate avatar-smoke-drift;display:flex;position:relative;overflow:hidden}.account-avatar:hover{filter:saturate(1.12)brightness(1.03);transform:scale(1.035)}.account-avatar.has-image{text-shadow:none;animation:none}.account-avatar-image{z-index:1;border-radius:inherit;object-fit:cover;width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0}@keyframes avatar-smoke-drift{0%{background-position:18% 12%,82% 84%,50%}50%{background-position:58% 42%,54% 62%,50%}to{background-position:82% 70%,26% 24%,50%}}.account-avatar--lg{cursor:default;border-radius:11px;width:40px;height:40px;font-size:16px}.account-pop{z-index:31;background:hsl(var(--panel));border:1px solid hsl(var(--border));min-width:220px;box-shadow:0 8px 28px hsl(var(--foreground) / .14);border-radius:14px;padding:12px;animation:.12s ddpop;position:absolute;top:calc(100% + 8px);right:0}.account-head{align-items:center;gap:10px;display:flex}.account-id{flex:1;min-width:0}.account-name-row{align-items:center;gap:6px;min-width:0;display:flex}.account-name{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.account-sub{color:hsl(var(--muted-foreground));white-space:nowrap;text-overflow:ellipsis;font-size:12px;overflow:hidden}.account-action{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:10px;align-items:center;gap:8px;margin-top:10px;padding:9px 10px;font-size:13px;transition:background .12s;display:flex}.account-action+.account-action{margin-top:2px}.account-action:hover{background:hsl(var(--foreground) / .05)}.account-action .icon{width:16px;height:16px;color:hsl(var(--muted-foreground))}.system-info-dialog{width:360px;padding:0;overflow:hidden}.system-info-head{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;margin:0 20px;padding:20px 0 16px;display:flex}.system-info-head h2{margin:0;font-size:17px;font-weight:650}.system-info-meta{margin:0;padding:18px 20px 20px}.system-info-meta div{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.system-info-meta dt{color:hsl(var(--muted-foreground));font-size:13px}.system-info-meta dd{overflow-wrap:anywhere;font-variant-numeric:tabular-nums;max-width:100%;margin:0;font-family:inherit;font-size:13px;font-weight:400}.sidebar-footer{flex-shrink:0;margin-top:auto}.sidebar-feedback{width:calc(100% - 20px);height:36px;color:hsl(var(--foreground));cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:32px minmax(0,1fr);align-items:center;column-gap:9px;margin:0 10px;padding:0 10px 0 8px;font-size:14px;transition:background .12s;display:grid}.sidebar-feedback:hover{background:#fffae6}.sidebar-feedback>.icon{justify-self:center}.sidebar-feedback:focus-visible{box-shadow:inset 0 0 0 2px hsl(var(--ring) / .3);outline:none}.sidebar-user{flex-shrink:0;padding:8px 10px 12px;position:relative}.sidebar-user-btn{width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:10px;align-items:center;gap:9px;padding:7px 8px;transition:background .12s;display:flex}.sidebar-user-btn:hover{background:hsl(var(--foreground) / .05)}.sidebar-user-identity{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.sidebar-user-primary{align-items:center;gap:6px;min-width:0;display:flex}.sidebar-user-name{text-align:left;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden}.sidebar-user-email{text-align:left;min-width:0;color:hsl(var(--muted-foreground));white-space:nowrap;text-overflow:ellipsis;font-size:11px;line-height:1.25;overflow:hidden}.studio-role-badge{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex-shrink:0;padding:2px 5px;font-size:10px;font-weight:600;line-height:1.2}.studio-role-badge--admin{color:#7027b4;background:#8f37e11c;border-color:#7d2cc93d}.studio-role-badge--developer{color:#976507;background:#fac70f2e;border-color:#ce9b0d4d}.studio-role-badge--user{color:#1b7e43;background:#25b15f1f;border-color:#2994543d}.sidebar.is-collapsed .sidebar-user-btn{justify-content:center;gap:0;width:36px;height:36px;padding:2px;overflow:hidden}.sidebar.is-collapsed .sidebar-feedback{grid-template-columns:1fr;justify-content:center;column-gap:0;width:36px;margin-inline:10px;padding:9px;overflow:hidden}.sidebar.is-collapsed .sidebar-user-identity{display:none}.sidebar.is-collapsed .sidebar-user-pop{width:220px;left:8px;right:auto}@media (prefers-reduced-motion:reduce){.sidebar{transition:none}}.sidebar-user-pop{position:absolute;inset:auto 10px calc(100% - 4px)}.skillcenter{flex-direction:column;flex:1;min-width:0;min-height:0;padding:0;display:flex}.skillcenter-regions{border:1px solid hsl(var(--border));background:hsl(var(--canvas) / .62);padding:2px;display:grid}.skillcenter-regions button{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0}.skillcenter-regions button.active{background:hsl(var(--background));color:hsl(var(--foreground));box-shadow:0 1px 2px hsl(var(--foreground) / .07)}.skillcenter-regions button:focus-visible,.skillcenter-pager button:focus-visible,.skill-detail-close:focus-visible{outline:2px solid hsl(var(--ring) / .28);outline-offset:1px}.skillcenter-space-item:focus-visible,.skillcenter-skill-item:focus-visible{background:hsl(var(--muted) / .62);border-color:#0000;outline:none}.skillcenter-regions{border-radius:7px;grid-template-columns:repeat(2,58px)}.skillcenter-regions button{border-radius:5px;height:27px;font-size:11.5px}.skillcenter-browser{flex:1;grid-template-columns:minmax(270px,.9fr) minmax(360px,1.35fr);gap:0;min-width:0;min-height:0;display:grid}.skillcenter-panel{flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.skillcenter-panel+.skillcenter-panel{border-left:1px solid hsl(var(--border))}.skillcenter-panel-head{border-bottom:1px solid hsl(var(--border));flex:0 0 48px;justify-content:space-between;align-items:center;gap:12px;height:48px;padding:0 14px;display:flex}.skillcenter-panel-head>div{align-items:center;gap:8px;min-width:0;display:flex}.skillcenter-panel-head .icon{width:17px;height:17px;color:hsl(var(--muted-foreground))}.skillcenter-panel-head h2{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:13.5px;font-weight:620;overflow:hidden}.skillcenter-panel-head>span{color:hsl(var(--muted-foreground));flex-shrink:0;font-size:11.5px}.skillcenter-count-badge{background:hsl(var(--muted));min-width:25px;height:21px;color:hsl(var(--muted-foreground));border-radius:999px;justify-content:center;align-items:center;padding:0 7px;font-size:11px;font-weight:600;line-height:1;display:inline-flex}.skillcenter-listwrap{overscroll-behavior:contain;flex:1;min-height:0;position:relative;overflow-y:auto}.skillcenter-list{flex-direction:column;gap:6px;padding:8px;display:flex}.skillcenter-space-item,.skillcenter-skill-item{width:100%;min-width:0;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:8px;align-items:flex-start;gap:10px;padding:10px;transition:background-color .12s,border-color .12s;display:flex}.skillcenter-space-item:hover,.skillcenter-skill-item:hover,.skillcenter-space-item.active{background:hsl(var(--muted) / .62);border-color:#0000}.skillcenter-symbol{border:1px solid hsl(var(--border));background:hsl(var(--background));width:30px;height:30px;color:hsl(var(--foreground) / .78);border-radius:7px;flex:0 0 30px;place-items:center;display:grid}.skillcenter-symbol .icon{width:18px;height:18px}.skillcenter-symbol--skill{color:#2764b4;background:#f2f7fd;border-color:#ccdbf0}.skillcenter-item-body{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.skillcenter-item-title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.skillcenter-item-description{min-width:0;color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:17px;display:-webkit-box;overflow:hidden}.skillcenter-item-meta{flex-wrap:wrap;align-items:center;gap:5px 8px;min-width:0;margin-top:2px;display:flex}.skillcenter-status{background:hsl(var(--muted));color:hsl(var(--muted-foreground));border-radius:999px;flex-shrink:0;padding:2px 6px;font-size:10.5px;line-height:16px}.skillcenter-status.is-positive{color:#1d7742;background:#e7f8ee}.skillcenter-status.is-progress{color:#8d5911;background:#fdf5e3}.skillcenter-status.is-danger{color:hsl(var(--destructive));background:hsl(var(--destructive) / .09)}.skillcenter-meta-text{min-width:0;max-width:170px;color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;line-height:16px;overflow:hidden}.skillcenter-pager{border-top:1px solid hsl(var(--border));height:44px;color:hsl(var(--muted-foreground));flex:0 0 44px;justify-content:space-between;align-items:center;gap:12px;padding:0 12px;font-size:11.5px;display:flex}.skillcenter-pager-actions{align-items:center;gap:7px;display:flex}.skillcenter-pager-actions>span{text-align:center;min-width:38px}.skillcenter-pager button,.skill-detail-close{color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid}.skillcenter-pager button{width:26px;height:26px;padding:0}.skillcenter-pager button:hover:not(:disabled),.skill-detail-close:hover{color:hsl(var(--foreground));background:hsl(var(--accent))}.skillcenter-pager button:disabled{opacity:.35;cursor:default}.skillcenter-pager button .icon{width:17px;height:17px}.skillcenter-empty,.skillcenter-loading,.skillcenter-error{min-height:130px;color:hsl(var(--muted-foreground));text-align:center;overflow-wrap:anywhere;justify-content:center;align-items:center;gap:8px;padding:24px;font-size:12.5px;line-height:1.55;display:flex}.skillcenter-error{color:hsl(var(--destructive))}.skillcenter-loading--overlay{z-index:2;background:hsl(var(--background) / .82);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);min-height:0;position:absolute;top:0;right:0;bottom:0;left:0}.skillcenter-loading-mark{border:1.5px solid hsl(var(--foreground) / .16);border-top-color:hsl(var(--foreground) / .62);border-radius:50%;flex-shrink:0;width:14px;height:14px;animation:.8s linear infinite spin}.skill-detail-backdrop{z-index:80;background:hsl(var(--foreground) / .25);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);place-items:center;padding:16px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.skill-detail-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(760px,100%);height:min(760px,100%);min-height:0;box-shadow:0 18px 48px hsl(var(--foreground) / .16);border-radius:12px;flex-direction:column;display:flex;overflow:hidden}.skill-detail-head{border-bottom:1px solid hsl(var(--border));flex-shrink:0;justify-content:space-between;align-items:flex-start;gap:16px;padding:16px 18px 14px;display:flex}.skill-detail-heading{align-items:flex-start;gap:11px;min-width:0;display:flex}.skill-detail-heading>div{min-width:0}.skill-detail-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:1px 0 4px;font-size:16px;font-weight:650;line-height:22px;overflow:hidden}.skill-detail-heading p{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:12px;line-height:17px;display:-webkit-box;overflow:hidden}.skill-detail-close{flex:0 0 30px;width:30px;height:30px;padding:0}.skill-detail-meta{border-bottom:1px solid hsl(var(--border));background:hsl(var(--canvas) / .45);flex-shrink:0;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 18px;margin:0;padding:14px 18px;display:grid}.skill-detail-meta>div{min-width:0}.skill-detail-meta dt{color:hsl(var(--muted-foreground));margin-bottom:3px;font-size:10.5px}.skill-detail-meta dd{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:12px;line-height:17px;overflow:hidden}.skill-detail-content{flex-direction:column;flex:1;min-height:0;display:flex}.skill-detail-content-title{border-bottom:1px solid hsl(var(--border));flex:0 0 40px;align-items:center;height:40px;padding:0 18px;font-size:12px;font-weight:600;display:flex}.skill-detail-content>.skillcenter-loading,.skill-detail-content>.skillcenter-error,.skill-detail-content>.skillcenter-empty{flex:1;min-height:0}.skill-detail-markdown{overflow-wrap:anywhere;flex:1;min-height:0;padding:18px 22px 28px;overflow-y:auto}@media (max-width:760px){.skillcenter-browser{grid-template-rows:repeat(2,minmax(0,1fr));grid-template-columns:minmax(0,1fr)}.skillcenter-panel+.skillcenter-panel{border-top:1px solid hsl(var(--border));border-left:0}.skill-detail-meta{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (max-width:560px){.skillcenter-regions{grid-template-columns:repeat(2,46px)}.skillcenter-browser{gap:8px}.skillcenter-item-meta{gap:4px 6px}.skillcenter-meta-text{max-width:132px}.skill-detail-backdrop{padding:8px}.skill-detail-dialog{border-radius:10px}.skill-detail-meta{grid-template-columns:minmax(0,1fr);gap:8px;max-height:180px;overflow-y:auto}}.addagent{flex:1;justify-content:center;align-items:flex-start;min-height:0;padding:8vh 16px 16px;display:flex;overflow-y:auto}.addagent-card{width:100%;max-width:480px}.addagent-title{letter-spacing:-.01em;margin:0 0 6px;font-size:20px;font-weight:650}.addagent-sub{color:hsl(var(--muted-foreground));margin:0 0 22px;font-size:13px;line-height:1.6}.addagent-field{margin-bottom:14px;display:block}.addagent-label{color:hsl(var(--muted-foreground));margin-bottom:6px;font-size:12.5px;font-weight:500;display:block}.addagent-input{border:1px solid hsl(var(--border));width:100%;font:inherit;background:hsl(var(--background));color:hsl(var(--foreground));border-radius:10px;padding:10px 12px;font-size:14px}.addagent-input:focus{border-color:hsl(var(--ring) / .4);outline:none}.addagent-error{background:hsl(var(--destructive) / .1);color:hsl(var(--destructive));border-radius:10px;margin:4px 0 14px;padding:9px 12px;font-size:12.5px;line-height:1.5}.addagent-actions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}.addagent-btn{font:inherit;cursor:pointer;border:1px solid #0000;border-radius:10px;align-items:center;gap:7px;padding:9px 16px;font-size:14px;font-weight:500;transition:background .12s,opacity .12s;display:inline-flex}.addagent-btn--ghost{border-color:hsl(var(--border));color:hsl(var(--foreground));background:0 0}.addagent-btn--ghost:hover{background:hsl(var(--foreground) / .05)}.addagent-btn--primary{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.addagent-btn--primary:hover:not(:disabled){opacity:.88}.addagent-btn:disabled{opacity:.4;cursor:default}.addagent-btn .icon{width:15px;height:15px}.search{flex-direction:column;flex:1;width:100%;max-width:720px;min-height:0;margin:0 auto;padding:28px 16px 16px;display:flex}.search-box{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:12px;align-items:center;gap:0;padding:5px 6px;transition:border-color .16s,box-shadow .16s;display:flex;position:relative}.search-box:focus-within{border-color:hsl(var(--foreground) / .3);box-shadow:0 0 0 3px hsl(var(--foreground) / .035)}.search-source-picker-wrap{flex:none;position:relative}.search-source-picker{max-width:176px;height:34px;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;gap:5px;padding:0 8px;display:inline-flex}.search-source-picker:hover,.search-source-picker[aria-expanded=true]{background:hsl(var(--foreground) / .045)}.search-source-picker>span{flex:none;font-size:13px;font-weight:550}.search-source-picker>small{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-weight:400;overflow:hidden}.search-source-chevron{width:12px;height:12px;color:hsl(var(--muted-foreground));flex:none;transition:transform .15s}.search-source-chevron.open{transform:rotate(180deg)}.search-source-menu{z-index:30;border:1px solid hsl(var(--border));background:hsl(var(--panel));width:224px;box-shadow:0 12px 28px hsl(var(--foreground) / .1);border-radius:9px;flex-direction:column;padding:5px;display:flex;position:absolute;top:calc(100% + 9px);left:-6px}.search-source-menu>button{min-width:0;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 9px;display:flex}.search-source-menu>button:hover:not(:disabled),.search-source-menu>button[aria-selected=true]{background:hsl(var(--foreground) / .055)}.search-source-menu>button:disabled{color:hsl(var(--muted-foreground));cursor:default}.search-source-menu>button>span{font-size:12.5px;font-weight:550}.search-source-menu>button>small{max-width:100%;color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;overflow:hidden}.search-box-divider{background:hsl(var(--border));width:1px;height:18px;margin:0 11px 0 5px}.search-input{color:hsl(var(--foreground));font:inherit;background:0 0;border:none;outline:none;flex:1;font-size:15px}.search-input::placeholder{color:hsl(var(--muted-foreground))}.search-input:disabled{cursor:default}.search-go{background:hsl(var(--primary));width:34px;height:34px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,transform .1s;display:flex}.search-go:hover:not(:disabled){opacity:.85}.search-go:active:not(:disabled){transform:scale(.94)}.search-go:disabled{opacity:.3;cursor:default}.search-go .icon{width:17px;height:17px}.search-results{flex-direction:column;flex:1;gap:4px;min-height:0;margin-top:12px;display:flex;overflow-y:auto}.search-empty{text-align:center;color:hsl(var(--muted-foreground));padding:40px 8px;font-size:13px}.search-result{text-align:left;width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;background:0 0;border:none;border-radius:12px;align-items:flex-start;gap:12px;padding:12px 14px;transition:background .12s;display:flex}.search-result:hover{background:hsl(var(--foreground) / .05)}.search-result-static{cursor:default;border:1px solid #0000}.search-result-static:hover{border-color:hsl(var(--border));background:hsl(var(--foreground) / .025)}a.search-result{color:inherit;text-decoration:none}.search-result-ext{vertical-align:-1px;opacity:.6;width:12px;height:12px;margin-left:4px}.search-result-icon{width:16px;height:16px;color:hsl(var(--muted-foreground));stroke:currentColor;stroke-width:1.65px;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;margin-top:2px}.search-result-body{flex:1;min-width:0}.search-result-head{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.search-result-title{white-space:nowrap;text-overflow:ellipsis;font-size:14px;font-weight:600;overflow:hidden}.search-result-meta{color:hsl(var(--muted-foreground));flex-shrink:0;font-size:11.5px}.search-result-snippet{color:hsl(var(--muted-foreground));-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:3px;font-size:12.5px;line-height:1.5;display:-webkit-box;overflow:hidden}.search-result-snippet-expanded{-webkit-line-clamp:4;white-space:pre-wrap;overflow-wrap:anywhere}.login{border:1px solid hsl(var(--border));background:hsl(var(--panel));color:hsl(var(--foreground));border-radius:14px;flex-direction:column;display:flex;position:fixed;top:10px;right:10px;bottom:10px;left:10px;overflow:hidden}.login-top{padding:18px 24px}.login-brand{letter-spacing:-.01em;align-items:center;gap:9px;font-size:15px;font-weight:600;display:inline-flex}.login-main{flex:1;justify-content:center;align-items:center;padding:0 24px;display:flex}.login-card{width:100%;max-width:420px}.login-title{letter-spacing:-.02em;margin:0 0 14px;font-size:28px;font-weight:700;line-height:1.2}.login-sub{color:hsl(var(--muted-foreground));margin:0 0 28px;font-size:15px}.login-btn{border:1px solid hsl(var(--border));background:hsl(var(--background));width:100%;color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:14px;justify-content:center;align-items:center;gap:8px;padding:14px 18px;font-size:15px;font-weight:500;transition:background .15s,border-color .15s,transform .1s;display:flex}.login-btn:hover{background:hsl(var(--accent));border-color:hsl(var(--ring) / .3)}.login-btn:active{transform:scale(.99)}.login-btn .icon{width:18px;height:18px}.login-powered{color:hsl(var(--muted-foreground));margin:18px 0 0;font-size:12px}.login-legal{color:hsl(var(--muted-foreground));margin:6px 0 0;font-size:12px}.login-legal a{color:inherit;text-decoration:underline;-webkit-text-decoration-color:hsl(var(--muted-foreground) / .45);text-decoration-color:hsl(var(--muted-foreground) / .45);text-underline-offset:2px;font-weight:600}.login-legal a:hover{color:hsl(var(--foreground))}.login-footer{text-align:center;color:hsl(var(--muted-foreground));padding:18px 24px;font-size:12px}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.001ms!important;animation-duration:.001ms!important;animation-iteration-count:1!important}}.login-providers{flex-direction:column;gap:10px;display:flex}.login-provider-error{color:hsl(var(--destructive));flex-direction:column;align-items:flex-start;gap:12px;font-size:13px;display:flex}.login-provider-error p{margin:0}.login-name{align-items:center;gap:8px;display:flex}.login-name-input{border:1px solid hsl(var(--border));font:inherit;background:hsl(var(--background));color:hsl(var(--foreground));border-radius:14px;flex:1;padding:13px 16px;font-size:15px}.login-name-input:focus{border-color:hsl(var(--ring) / .4);outline:none}.login-name-go{background:hsl(var(--primary));width:36px;height:36px;color:hsl(var(--primary-foreground));cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex}.login-name-go .icon{width:18px;height:18px}.login-name-go:disabled{opacity:.35;cursor:default}.login-hint{min-height:16px;color:hsl(var(--destructive));margin:8px 0 0;font-size:12px;line-height:16px}.session-loading{z-index:5;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .6);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px);justify-content:center;align-items:center;gap:8px;font-size:14px;display:flex;position:absolute;top:0;right:0;bottom:0;left:0}.main{position:relative}.topo{background:hsl(var(--background));border:1px solid hsl(var(--border));width:288px;min-height:0;box-shadow:0 8px 24px hsl(var(--foreground) / .035);z-index:2;border-radius:18px;flex-direction:column;padding:16px;display:flex;position:absolute;top:28px;bottom:18px;right:18px;overflow:hidden}.topo.is-loading{place-items:center;min-height:88px;display:grid;bottom:auto}.topo.is-drawer{width:auto;min-height:0;max-height:none;box-shadow:none;background:0 0;border:0;border-radius:0;padding:22px;position:static;overflow:visible}.topo.is-loading.is-drawer{min-height:112px}.topo-loading-label{font-size:12px;line-height:1.5}.topo-agent-card{border:0;border-bottom:1px solid hsl(var(--border) / .72);background:0 0;border-radius:0;flex:none;min-width:0;padding:0 0 16px}.topo-agent-heading{flex-direction:column;gap:4px;min-width:0;display:flex}.topo-agent-heading h2{color:hsl(var(--foreground));letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:650;line-height:1.4;overflow:hidden}.topo-agent-heading>span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;line-height:1.4;overflow:hidden}.topo-description{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:12px 0 0;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.topo-module-stack{flex:1;grid-template-rows:minmax(124px,.95fr) minmax(142px,1.15fr) minmax(160px,.9fr);gap:0;min-width:0;min-height:0;display:grid}.topo-module-card{background:0 0;border:0;border-radius:0;flex-direction:column;min-width:0;min-height:0;padding:14px 0;display:flex}.topo-module-card+.topo-module-card{border-top:1px solid hsl(var(--border) / .72)}.topo-module-title{min-height:20px;color:hsl(var(--muted-foreground));align-items:center;gap:6px;width:100%;margin-bottom:0;font-size:13px;font-weight:600;line-height:1;display:inline-flex;position:static}.topo-module-label{text-overflow:ellipsis;white-space:nowrap;align-items:center;height:20px;display:inline-flex;overflow:hidden}.topo-section-count{background:hsl(var(--muted) / .72);min-width:18px;height:18px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;padding:0 5px;font-size:11px;font-weight:650;line-height:1;display:inline-flex}.topo-remove-capability:disabled,.topo-capability-add-slot:disabled{cursor:not-allowed;opacity:.45}.topo-module-scroll{box-sizing:border-box;overscroll-behavior:contain;scrollbar-color:hsl(var(--border)) transparent;scrollbar-width:thin;flex:1;min-height:24px;padding-top:9px;overflow-y:auto}.topo-module-scroll::-webkit-scrollbar{width:4px}.topo-module-scroll::-webkit-scrollbar-track{background:0 0}.topo-module-scroll::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:999px}.topo-module-scroll:focus-visible{outline:2px solid hsl(var(--ring) / .45);outline-offset:3px;border-radius:5px}.topo-tools-scroll{max-height:104px}.topo-skills-scroll{max-height:152px}.topo-tool-list{flex-direction:column;min-width:0;display:flex}.topo-tool{min-width:0;color:hsl(var(--foreground));align-items:center;gap:6px;padding:7px 2px 7px 14px;font-size:12.5px;line-height:1.4;display:flex;position:relative}.topo-tool:before{content:"";border:1px solid hsl(var(--muted-foreground) / .7);border-radius:2px;width:5px;height:5px;position:absolute;top:13px;left:2px}.topo-tool:first-child{padding-top:0}.topo-tool:first-child:before{top:6px}.topo-tool:last-child{padding-bottom:1px}.topo-tool+.topo-tool{border-top:1px solid hsl(var(--border) / .72)}.topo-capability-title,.topo-skill-title{align-items:center;gap:6px;min-width:0;display:flex}.topo-capability-title{flex:1}.topo-capability-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;overflow:hidden}.topo-capability-copy{flex-direction:column;gap:1px;min-width:0;display:flex}.topo-capability-copy code{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:9.5px;font-weight:450;line-height:1.25;overflow:hidden}.topo-capability-add-slot{border:1px dashed hsl(var(--border));background:hsl(var(--muted) / .18);width:100%;min-height:34px;color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;border-radius:9px;justify-content:center;align-items:center;gap:6px;margin:0;padding:5px 10px;font-size:11.5px;transition:border-color .15s,background .15s,color .15s;display:flex}.topo-capability-add-dock{background:hsl(var(--background));flex:none;padding-top:6px}.topo-capability-add-slot>span:first-child{font-size:15px;line-height:1}.topo-capability-add-slot:hover:not(:disabled){border-color:hsl(var(--primary) / .55);background:hsl(var(--primary) / .055);color:hsl(var(--primary))}.topo-capability-add-slot:focus-visible{outline:2px solid hsl(var(--ring) / .38);outline-offset:2px}.topo-custom-badge{background:hsl(var(--primary) / .1);height:17px;color:hsl(var(--primary));border-radius:5px;flex-shrink:0;align-items:center;padding:0 5px;font-size:9.5px;font-weight:650;line-height:1;display:inline-flex}.topo-remove-capability{width:20px;height:20px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;margin-left:auto;padding:0;font-size:15px;line-height:1;display:inline-flex}.topo-remove-capability:hover:not(:disabled){background:hsl(var(--destructive) / .1);color:hsl(var(--destructive))}.topo-skill-list{flex-direction:column;min-width:0;display:flex}.topo-skill{flex-direction:column;gap:2px;min-width:0;padding:8px 0;display:flex}.topo-skill:first-child{padding-top:0}.topo-skill:last-child{padding-bottom:1px}.topo-skill+.topo-skill{border-top:1px solid hsl(var(--border) / .72)}.topo-skill-name{min-width:0;color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px;font-weight:500;line-height:1.45;overflow:hidden}.topo-skill-title{width:100%}.topo-skill-description{color:hsl(var(--muted-foreground));overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:1.45;display:-webkit-box;overflow:hidden}.topo-empty{color:hsl(var(--muted-foreground));font-size:11.5px;line-height:1.5}.topo-topology{min-height:0}.topo-canvas-heading{justify-content:space-between;align-items:center;gap:12px;margin-bottom:9px;display:flex}.topo-canvas-expand,.topo-canvas-dialog-header button{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;justify-content:center;align-items:center;padding:0;display:inline-flex}.topo-canvas-expand:hover,.topo-canvas-dialog-header button:hover{background:hsl(var(--muted));color:hsl(var(--foreground))}.topo-canvas-expand:focus-visible,.topo-canvas-dialog-header button:focus-visible{outline:2px solid hsl(var(--ring) / .5);outline-offset:2px}.topo-canvas-expand svg,.topo-canvas-dialog-header button svg{width:16px;height:16px}.topo-canvas-preview{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:12px;flex:1;min-height:120px;position:relative;overflow:hidden}.topo-canvas-preview .abc-root,.topo-canvas-dialog-body .abc-root{border:0;flex:auto;width:100%;min-width:0;height:100%}.topo-canvas-preview .abc-minimap{display:none}.topo-canvas-dialog{z-index:1200;background:hsl(var(--background));flex-direction:column;min-width:0;min-height:0;display:flex;position:fixed;top:0;right:0;bottom:0;left:0}.topo-canvas-dialog-header{border-bottom:1px solid hsl(var(--border));justify-content:space-between;align-items:center;gap:24px;min-height:64px;padding:0 24px;display:flex}.topo-canvas-dialog-header>div{align-items:baseline;gap:10px;min-width:0;display:flex}.topo-canvas-dialog-header strong{font-size:15px;font-weight:600}.topo-canvas-dialog-header span{color:hsl(var(--muted-foreground));text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.topo-canvas-dialog-body{flex:1;min-width:0;min-height:0;padding:16px;display:flex}.topo-canvas-dialog-body .abc-canvas{border:1px solid hsl(var(--border));border-radius:16px;overflow:hidden}@media (max-width:640px){.topo-canvas-dialog-header{padding:0 16px}.topo-canvas-dialog-body{padding:8px}}.topo-canvas-heading .topo-section-count{flex-shrink:0}@media (min-width:1280px){.agent-info-trigger{display:none}.topo:not(.is-drawer) .topo-module-scroll{max-height:none}.main:has(>.topo)>.transcript{padding-right:322px}.main:has(>.topo)>.conversation-composer-slot{padding-left:16px;padding-right:322px}.conversation-composer-slot>.composer-slot>.composer{margin-left:auto;margin-right:auto}}@media (max-width:1279px){.topo{display:none}.topo.is-drawer{display:block}.topo.is-drawer .topo-module-stack{flex-direction:column;display:flex}}@media (prefers-reduced-motion:reduce){.topo-node{transition:none}.topo-node.is-active,.topo-remote{animation:none}}.session-capability-dialog-layer{z-index:110;place-items:center;padding:24px;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.session-capability-dialog-scrim{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#1013187a;border:0;width:100%;height:100%;padding:0;position:absolute;top:0;right:0;bottom:0;left:0}.session-capability-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));border-radius:16px;flex-direction:column;width:min(560px,100vw - 32px);max-height:min(720px,100vh - 48px);animation:.18s cubic-bezier(.22,1,.36,1) session-capability-dialog-in;display:flex;position:relative;overflow:hidden;box-shadow:0 24px 80px #0d121c40,0 2px 8px #0d121c1f}.session-capability-dialog.is-wide{width:min(980px,100vw - 48px);height:min(720px,100dvh - 48px)}@keyframes session-capability-dialog-in{0%{opacity:0;transform:translateY(8px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.session-capability-dialog-head{border-bottom:1px solid hsl(var(--border));grid-template-columns:38px minmax(0,1fr) 32px;align-items:center;gap:12px;min-height:76px;padding:16px 18px;display:grid}.session-capability-dialog-head.is-iconless{grid-template-columns:minmax(0,1fr) 32px}.session-capability-dialog-mark{background:hsl(var(--primary) / .09);width:38px;height:38px;color:hsl(var(--primary));border-radius:11px;place-items:center;display:grid}.session-capability-dialog-mark svg{width:20px;height:20px}.session-capability-dialog-head h2{color:hsl(var(--foreground));letter-spacing:-.01em;margin:0;font-size:15px;font-weight:680}.session-capability-dialog-head p{color:hsl(var(--muted-foreground));margin:4px 0 0;font-size:11.5px;line-height:1.45}.session-capability-dialog-close{width:32px;height:32px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;display:grid}.session-capability-dialog-close:hover{background:hsl(var(--muted) / .7);color:hsl(var(--foreground))}.session-capability-dialog-close svg{width:18px;height:18px}.session-capability-search{border:1px solid hsl(var(--border));background:hsl(var(--background));min-width:0;height:40px;color:hsl(var(--muted-foreground));border-radius:6px;flex:0 0 40px;align-items:center;gap:8px;padding:0 12px;display:flex}.session-capability-search:focus-within{border-color:hsl(var(--ring) / .65);box-shadow:0 0 0 3px hsl(var(--ring) / .1)}.session-capability-search svg{flex:none;width:16px;height:16px}.session-capability-search input{width:100%;min-width:0;height:100%;color:hsl(var(--foreground));font:inherit;background:0 0;border:0;outline:0;padding:0;font-size:12px}.session-capability-search input::placeholder{color:hsl(var(--muted-foreground) / .8)}.session-tool-dialog-body{flex-direction:column;gap:12px;min-height:0;padding:16px;display:flex}.session-tool-picker{overscroll-behavior:contain;flex-direction:column;gap:7px;min-height:120px;display:flex;overflow-y:auto}.session-tool-option,.session-skill-option{border:1px solid hsl(var(--border) / .85);background:hsl(var(--background));border-radius:10px;align-items:center;gap:10px;min-width:0;display:flex}.session-tool-option{min-height:72px;padding:10px 11px}.session-tool-option:hover,.session-skill-option:hover{border-color:hsl(var(--foreground) / .2);background:hsl(var(--muted) / .22)}.session-tool-option-icon{background:hsl(var(--muted) / .75);width:32px;height:32px;color:hsl(var(--foreground) / .78);border-radius:9px;flex:0 0 32px;place-items:center;display:grid}.session-tool-option-icon svg{width:17px;height:17px}.session-tool-option-copy,.session-skill-option-copy{flex-direction:column;flex:1;min-width:0;display:flex}.session-tool-option-copy{gap:2px}.session-tool-option-copy strong,.session-skill-option-copy strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:620;overflow:hidden}.session-skill-option-copy strong{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.session-tool-option-copy code{color:hsl(var(--muted-foreground));font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10px}.session-tool-option-copy>span,.session-skill-option-copy>span{color:hsl(var(--muted-foreground));-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:11px;line-height:1.35;display:-webkit-box;overflow:hidden}.session-tool-option>button,.session-skill-option>button{background:hsl(var(--foreground));min-width:58px;height:30px;color:hsl(var(--background));font:inherit;cursor:pointer;border:0;border-radius:8px;flex:none;justify-content:center;align-items:center;gap:4px;padding:0 10px;font-size:11px;font-weight:600;display:inline-flex}.session-tool-option>button:disabled,.session-skill-option>button:disabled{opacity:.42;cursor:default}.session-skill-option>button svg{width:13px;height:13px}.session-skill-dialog-body{flex-direction:column;flex:1;min-height:0;display:flex}.session-skill-source-tabs{border-bottom:1px solid hsl(var(--border));align-items:stretch;gap:24px;min-height:48px;padding:0 18px;display:flex}.session-skill-source-tabs button{color:hsl(var(--muted-foreground));font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;gap:7px;padding:0 2px;font-size:12.5px;font-weight:600;display:inline-flex;position:relative}.session-skill-source-tabs button:after{content:"";background:0 0;border-radius:2px 2px 0 0;height:2px;position:absolute;bottom:-1px;left:0;right:0}.session-skill-source-tabs button:hover,.session-skill-source-tabs button.is-active{color:hsl(var(--foreground))}.session-skill-source-tabs button.is-active:after{background:hsl(var(--foreground))}.session-skill-source-tabs button>span{background:hsl(var(--muted));height:18px;color:hsl(var(--muted-foreground));border-radius:5px;align-items:center;padding:0 6px;font-size:9.5px;font-weight:600;display:inline-flex}.session-public-skill-browser{flex-direction:column;flex:1;height:min(548px,100vh - 204px);min-height:0;display:flex}.session-public-skill-head{align-items:center;gap:12px;min-height:68px;padding:13px 16px;display:flex}.session-public-skill-head .session-capability-search{flex:1}.session-public-skill-head>span{color:hsl(var(--muted-foreground));flex:none;font-size:10.5px}.session-public-skill-list{overscroll-behavior:contain;flex:1;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:8px;min-height:0;padding:12px;display:grid;overflow-y:auto}.session-public-skill-list>.session-capability-empty,.session-public-skill-list>.session-capability-loading,.session-public-skill-list>.session-capability-error{grid-column:1/-1}.session-public-skill-option{min-height:106px;padding:11px}.session-public-skill-option .session-skill-option-copy small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.session-skill-browser{flex:1;grid-template-columns:minmax(260px,.8fr) minmax(360px,1.4fr);height:min(548px,100vh - 204px);min-height:0;display:grid}.session-skill-spaces,.session-skill-results{flex-direction:column;min-width:0;min-height:0;display:flex}.session-skill-spaces{border-right:1px solid hsl(var(--border));background:hsl(var(--muted) / .16)}.session-skill-pane-head{flex-direction:column;gap:10px;min-height:92px;padding:13px 14px;display:flex}.session-skill-pane-head>div{align-items:center;gap:7px;min-width:0;display:flex}.session-skill-pane-head strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:650;overflow:hidden}.session-skill-pane-head>div>span{background:hsl(var(--muted));min-width:19px;height:18px;color:hsl(var(--muted-foreground));border-radius:999px;justify-content:center;align-items:center;padding:0 5px;font-size:10px;display:inline-flex}.session-skill-pane-list{overscroll-behavior:contain;flex-direction:column;flex:1;gap:7px;min-height:0;padding:10px;display:flex;overflow-y:auto}.session-skill-space{width:100%;min-height:76px;color:hsl(var(--foreground));font:inherit;text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:10px;align-items:flex-start;gap:9px;padding:10px;display:flex}.session-skill-space:hover{background:hsl(var(--background) / .72)}.session-skill-space.is-active{border-color:hsl(var(--primary) / .28);background:hsl(var(--background));box-shadow:0 1px 3px hsl(var(--foreground) / .06)}.session-skill-space>span:last-child{flex-direction:column;flex:1;gap:3px;min-width:0;display:flex}.session-skill-space strong,.session-skill-space small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.session-skill-space strong{font-size:12px;font-weight:620}.session-skill-space small{color:hsl(var(--muted-foreground));font-size:10.5px}.session-skill-space em{color:hsl(var(--muted-foreground));font-size:10px;font-style:normal}.session-skill-option{min-height:82px;padding:11px}.session-skill-option-copy{gap:4px}.session-skill-option-copy small{color:hsl(var(--muted-foreground) / .84);font-size:9.5px}.session-capability-empty,.session-capability-loading,.session-capability-error{min-height:120px;color:hsl(var(--muted-foreground));text-align:center;justify-content:center;align-items:center;font-size:12px;display:flex}.session-capability-error{color:hsl(var(--destructive))}@media (max-width:720px){.session-capability-dialog-layer{padding:12px}.session-capability-dialog.is-wide{width:calc(100vw - 24px);height:calc(100dvh - 24px)}.session-skill-browser{grid-template-rows:minmax(180px,.75fr) minmax(260px,1.25fr);grid-template-columns:1fr;height:min(620px,100vh - 170px)}.session-public-skill-browser{height:min(620px,100vh - 170px)}.session-public-skill-list{grid-template-columns:1fr}.session-skill-spaces{border-right:0;border-bottom:1px solid hsl(var(--border))}}@media (prefers-reduced-motion:reduce){.session-capability-dialog{animation:none}}.drawer--agent-info{border-right:1px solid hsl(var(--border));width:min(400px,92vw);box-shadow:12px 0 40px hsl(var(--foreground) / .14);border-left:0;animation:.22s cubic-bezier(.22,1,.36,1) agent-info-slide-in;left:0;right:auto}.agent-info-drawer-body{overscroll-behavior:contain;flex:1;min-height:0;overflow-y:auto}@keyframes agent-info-slide-in{0%{transform:translate(-100%)}to{transform:translate(0)}}@media (prefers-reduced-motion:reduce){.drawer--agent-info,.agent-info-scrim{animation:none}}.quick-create{flex-direction:column;flex:1;justify-content:center;align-items:center;padding:0 24px 6vh;display:flex}.qc-head{text-align:center;margin-bottom:28px}.qc-title{letter-spacing:-.02em;margin:0;font-size:26px;font-weight:650}.qc-sub{color:hsl(var(--muted-foreground));margin:8px 0 0;font-size:14px}.qc-cards{grid-template-columns:repeat(4,220px);justify-content:center;gap:16px;display:grid}@media (max-width:1240px){.qc-cards{grid-template-columns:repeat(2,220px)}}@media (max-width:560px){.qc-cards{grid-template-columns:minmax(0,320px)}}.qc-card{text-align:left;border:1px solid hsl(var(--border));background:hsl(var(--card));cursor:pointer;font:inherit;border-radius:16px;flex-direction:column;align-items:flex-start;gap:6px;padding:20px;transition:border-color .15s,box-shadow .15s;display:flex;position:relative}.qc-card:hover{border-color:hsl(var(--ring) / .35);box-shadow:0 8px 24px -16px hsl(var(--foreground) / .25)}.qc-card-arrow{width:18px;height:18px;color:hsl(var(--muted-foreground));opacity:0;transition:opacity .15s,transform .15s;position:absolute;top:18px;right:18px;transform:translate(-4px)}.qc-card:hover .qc-card-arrow{opacity:1;transform:translate(0)}.qc-icon{background:hsl(var(--secondary));width:40px;height:40px;color:hsl(var(--foreground));border-radius:12px;justify-content:center;align-items:center;margin-bottom:6px;display:inline-flex}.qc-icon svg{width:20px;height:20px}.qc-card-title{font-size:15px;font-weight:600}.qc-card-desc{color:hsl(var(--muted-foreground));font-size:12px;line-height:1.5}.navbar-title{letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:min(60vw,640px);padding:0;font-size:15px;font-weight:600;overflow:hidden}.create-stub{color:hsl(var(--muted-foreground));flex-direction:column;flex:1;justify-content:center;align-items:center;gap:16px;display:flex}.create-back{font:inherit;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;align-self:flex-start;margin:12px;font-size:13px}.create-back:hover{color:hsl(var(--foreground))}.navbar-crumbs{align-items:center;gap:4px;min-width:0;display:flex}.navbar-crumbs>.crumb:first-child{padding-left:0}.crumb{letter-spacing:-.01em;white-space:nowrap;border-radius:6px;padding:2px 4px;font-size:15px;font-weight:600}.crumb-link{font:inherit;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:none;font-weight:500;transition:background .12s,color .12s}.crumb-link:hover{color:hsl(var(--foreground));background:hsl(var(--foreground) / .05)}.crumb-current{color:hsl(var(--foreground))}.crumb-sep{width:15px;height:15px;color:hsl(var(--muted-foreground));flex-shrink:0}.confirm-scrim{z-index:60;background:hsl(var(--foreground) / .25);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);justify-content:center;align-items:center;display:flex;position:fixed;top:0;right:0;bottom:0;left:0}.confirm-box{background:hsl(var(--background));border:1px solid hsl(var(--border));width:340px;max-width:calc(100vw - 32px);box-shadow:0 16px 48px -16px hsl(var(--foreground) / .3);border-radius:14px;padding:20px}.confirm-title{margin-bottom:6px;font-size:15px;font-weight:600}.confirm-text{color:hsl(var(--muted-foreground));margin-bottom:18px;font-size:13px;line-height:1.6}.confirm-actions{justify-content:flex-end;gap:8px;display:flex}.confirm-btn{border:1px solid hsl(var(--border));background:hsl(var(--background));color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:7px 14px;font-size:13px;transition:background .12s}.confirm-btn:hover{background:hsl(var(--foreground) / .05)}.confirm-btn--danger{background:hsl(var(--destructive));color:#fff;border-color:#0000}.confirm-btn--danger:hover{background:hsl(var(--destructive) / .9)}.studio-confirm-backdrop{z-index:1200;background:hsl(var(--foreground) / .22);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);place-items:center;padding:32px;animation:.14s ease-out studio-confirm-fade-in;display:grid;position:fixed;top:0;right:0;bottom:0;left:0}.studio-confirm-dialog{border:1px solid hsl(var(--border));background:hsl(var(--background));width:min(420px,100vw - 40px);height:auto;min-height:0;box-shadow:0 24px 64px hsl(var(--foreground) / .16);border-radius:12px;flex-direction:column;animation:.18s cubic-bezier(.2,.8,.2,1) studio-confirm-rise-in;display:flex;overflow:hidden}.studio-confirm-head{border-bottom:1px solid hsl(var(--border));flex:0 0 58px;justify-content:space-between;align-items:center;gap:20px;padding:0 16px 0 18px;display:flex}.studio-confirm-title-wrap{align-items:center;gap:10px;min-width:0;display:flex}.studio-confirm-title-icon{color:#ba6708;background:#f59f0a1f;border-radius:7px;flex:none;place-items:center;width:30px;height:30px;display:grid}.studio-confirm-title-icon svg,.studio-confirm-close svg{width:16px;height:16px}.studio-confirm-title-wrap h2{min-width:0;color:hsl(var(--foreground));margin:0;font-size:14px;font-weight:650;line-height:1.35}.studio-confirm-close{width:30px;height:30px;color:hsl(var(--muted-foreground));cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;place-items:center;padding:0;transition:background .16s,color .16s;display:grid}.studio-confirm-close:hover:not(:disabled){background:hsl(var(--secondary));color:hsl(var(--foreground))}.studio-confirm-close:focus-visible,.studio-confirm-actions button:focus-visible{outline:2px solid hsl(var(--primary) / .34);outline-offset:2px}.studio-confirm-close:disabled{cursor:not-allowed;opacity:.48}.studio-confirm-body{padding:24px 20px}.studio-confirm-body p{color:hsl(var(--foreground));margin:0;font-size:14px;line-height:1.65}.studio-confirm-actions{border-top:1px solid hsl(var(--border));justify-content:flex-end;gap:8px;padding:12px 16px;display:flex}.studio-confirm-actions button{border:1px solid hsl(var(--border));background:hsl(var(--background));min-width:76px;height:34px;color:hsl(var(--foreground));font:inherit;cursor:pointer;border-radius:8px;padding:0 14px;font-size:12px;font-weight:600}.studio-confirm-actions button:hover:not(:disabled){background:hsl(var(--secondary))}.studio-confirm-actions button:disabled{cursor:not-allowed;opacity:.6}.studio-confirm-actions .studio-confirm-primary{border-color:hsl(var(--primary));background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.studio-confirm-actions .studio-confirm-primary:hover:not(:disabled){background:hsl(var(--primary) / .9)}.studio-confirm-dialog--warning .studio-confirm-title-icon{color:#ba6708;background:#f59f0a1f}.studio-confirm-dialog--danger .studio-confirm-title-icon{background:hsl(var(--destructive) / .1);color:hsl(var(--destructive))}.studio-confirm-dialog--danger .studio-confirm-actions .studio-confirm-primary{border-color:hsl(var(--destructive));background:hsl(var(--destructive));color:#fff}.studio-confirm-dialog--danger .studio-confirm-actions .studio-confirm-primary:hover:not(:disabled){background:hsl(var(--destructive) / .9)}@keyframes studio-confirm-fade-in{0%{opacity:0}to{opacity:1}}@keyframes studio-confirm-rise-in{0%{opacity:0;transform:translateY(6px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.studio-confirm-backdrop,.studio-confirm-dialog{animation:none}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}.abc-root{--cw-workbench-toolbar-height: 64px;--cw-workspace-ink: 222 24% 13%;--cw-workspace-accent: 162 44% 32%;--cw-workspace-accent-soft: 156 34% 92%;--cw-workspace-warm: 42 28% 96%;flex:0 1 52%;min-width:460px;min-height:0;display:flex;flex-direction:column;overflow:hidden;border-right:0;background:hsl(var(--background))}.abc-canvas{flex:1;min-height:0;background:hsl(var(--background))}.abc-canvas .react-flow__pane{cursor:grab}.abc-canvas .react-flow__pane:active{cursor:grabbing}.abc-node{--abc-type-tone: 220 9% 24%;--abc-type-soft: 220 10% 97%;--abc-type-border: 220 9% 78%;position:relative;width:220px;height:88px;display:grid;grid-template-columns:38px minmax(0,1fr);align-items:center;gap:9px;padding:12px 14px;border:.5px solid hsl(var(--abc-type-border) / .62);border-radius:13px;background:hsl(var(--panel));box-shadow:0 10px 30px hsl(var(--foreground) / .055);color:hsl(var(--foreground));transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.abc-node:hover{border-color:hsl(var(--abc-type-tone) / .36);box-shadow:0 13px 34px hsl(var(--foreground) / .08)}.abc-node.is-selected{border-color:hsl(var(--abc-type-tone) / .62);box-shadow:0 0 0 1px hsl(var(--abc-type-tone) / .06),0 14px 38px hsl(var(--foreground) / .09)}.abc-node.is-llm{grid-template-columns:minmax(0,1fr);background:hsl(var(--panel))}.abc-node.is-a2a{--abc-type-tone: 213 18% 38%;--abc-type-soft: 214 20% 94%;--abc-type-border: 213 15% 72%;background:linear-gradient(145deg,hsl(var(--abc-type-soft)),hsl(var(--panel)) 58%)}.abc-canvas .react-flow__node-group{padding:0;border:0;border-radius:18px;background:transparent}.abc-group{--abc-type-tone: 213 40% 40%;--abc-type-soft: 214 45% 96%;--abc-type-border: 213 32% 62%;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border:.5px solid hsl(var(--abc-type-border) / .5);border-radius:18px;background:linear-gradient(180deg,hsl(var(--abc-type-soft) / .88),transparent 88px),hsl(var(--panel) / .72);box-shadow:0 14px 42px hsl(var(--foreground) / .055);transition:border-color .15s ease,box-shadow .15s ease}.abc-group.is-selected{border-color:hsl(var(--abc-type-tone) / .62);box-shadow:0 0 0 1px hsl(var(--abc-type-tone) / .06),0 16px 46px hsl(var(--foreground) / .08)}.abc-group.is-parallel{--abc-type-tone: 40 43% 38%;--abc-type-soft: 43 52% 94%;--abc-type-border: 40 38% 58%;border-style:solid}.abc-group.is-sequential{--abc-type-tone: 213 40% 40%;--abc-type-soft: 214 45% 96%;--abc-type-border: 213 32% 62%}.abc-group.is-llm{--abc-type-tone: 220 9% 24%;--abc-type-soft: 220 10% 97%;--abc-type-border: 220 9% 66%}.abc-group.is-loop{--abc-type-tone: 151 34% 34%;--abc-type-soft: 148 32% 94%;--abc-type-border: 151 28% 55%}.abc-group-head{position:relative;height:64px;display:flex;align-items:center;justify-content:center;padding:9px 56px;border-bottom:1px solid hsl(var(--border) / .75)}.abc-group.is-compact-empty .abc-group-head{border-bottom:0}.abc-group-head>span:first-child{width:100%;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;text-align:center}.abc-group-head strong{color:hsl(var(--abc-type-tone));font-size:13px;letter-spacing:-.02em}.abc-group-head small{display:-webkit-box;overflow:hidden;color:hsl(var(--muted-foreground));font-size:9.5px;line-height:1.3;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}.abc-group-add{height:40px;display:flex;align-items:center;justify-content:center;gap:7px;border:1px dashed hsl(var(--abc-type-tone) / .42);border-radius:10px;background:hsl(var(--background) / .58);color:hsl(var(--muted-foreground));cursor:pointer;font:inherit;font-size:10px;font-weight:600;transition:border-color .15s ease,background-color .15s ease,color .15s ease}.abc-group-boundary-actions{position:absolute;top:64px;right:0;bottom:0;left:0;z-index:2;pointer-events:none}.abc-group-boundary-add{position:absolute;top:50%;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--abc-type-tone) / .32);border-radius:50%;background:hsl(var(--background) / .94);box-shadow:0 6px 18px hsl(var(--foreground) / .08);color:hsl(var(--abc-type-tone));cursor:pointer;opacity:.72;pointer-events:auto;transform:translateY(-50%);transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease,opacity .15s ease}.abc-group-boundary-add.is-start{left:18px}.abc-group-boundary-add.is-end{right:18px}.abc-root.is-vertical .abc-group-boundary-actions{top:64px;right:0;bottom:0;left:0}.abc-root.is-vertical .abc-group-boundary-add{left:50%;transform:translate(-50%)}.abc-root.is-vertical .abc-group-boundary-add.is-start{top:18px}.abc-root.is-vertical .abc-group-boundary-add.is-end{top:auto;right:auto;bottom:18px}.abc-group-boundary-add:hover{border-color:hsl(var(--abc-type-tone) / .64);background:hsl(var(--abc-type-soft) / .92);box-shadow:0 8px 22px hsl(var(--foreground) / .1);opacity:1}.abc-group-boundary-add:focus-visible{outline:2px solid hsl(var(--abc-type-tone) / .5);outline-offset:2px;opacity:1}.abc-group-boundary-add svg{width:14px;height:14px}.abc-group-add-empty,.abc-group-add-bottom{position:absolute;right:24px;bottom:24px;left:24px}.abc-group-add:hover{border-color:hsl(var(--abc-type-tone) / .72);background:hsl(var(--abc-type-soft) / .86);color:hsl(var(--abc-type-tone))}.abc-group-add:focus-visible{outline:2px solid hsl(var(--abc-type-tone) / .5);outline-offset:2px}.abc-group-add svg{width:14px;height:14px}.abc-node.is-contained-in-parallel .abc-handle{opacity:0}.abc-node-icon{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;border-radius:10px;background:hsl(var(--abc-type-soft));color:hsl(var(--abc-type-tone))}.abc-node-icon svg{width:17px;height:17px}.abc-node-copy{min-width:0;display:flex;flex-direction:column;gap:2px;padding-right:18px}.abc-node-delete{position:absolute;z-index:3;top:7px;right:7px;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--border));border-radius:7px;background:hsl(var(--panel) / .96);box-shadow:0 4px 12px hsl(var(--foreground) / .08);color:hsl(var(--muted-foreground));cursor:pointer;opacity:0;pointer-events:none;transform:translateY(-2px) scale(.92);transition:opacity .12s ease,transform .12s ease,border-color .12s ease,color .12s ease}.abc-node:hover>.abc-node-delete,.abc-node:focus-within>.abc-node-delete,.abc-group:hover>.abc-node-delete,.abc-group:focus-within>.abc-node-delete,.abc-node-delete:focus-visible{opacity:1;pointer-events:auto;transform:translateY(0) scale(1)}.abc-node-delete:hover{border-color:hsl(var(--destructive) / .32);color:hsl(var(--destructive))}.abc-node-delete:focus-visible{outline:2px solid hsl(var(--destructive) / .34);outline-offset:2px}.abc-node-delete svg{width:12px;height:12px}.abc-group>.abc-node-delete{top:19px;right:12px}.abc-group>.abc-node-delete+.abc-handle{z-index:4}.abc-loop-handle{left:50%!important;opacity:0;pointer-events:none}.abc-node-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;color:hsl(var(--abc-type-tone));font-size:9px;font-weight:700;letter-spacing:.04em}.abc-node-copy>strong{overflow:hidden;font-size:13px;letter-spacing:-.015em;text-overflow:ellipsis;white-space:nowrap}.abc-node-copy>small{display:-webkit-box;overflow:hidden;color:hsl(var(--muted-foreground));font-size:9.5px;line-height:1.35;-webkit-box-orient:vertical;-webkit-line-clamp:2}.abc-terminal{width:96px;height:34px;display:flex;align-items:center;justify-content:center;border:.5px solid hsl(var(--border) / .68);border-radius:999px;background:hsl(var(--secondary) / .68);box-shadow:none;color:hsl(var(--foreground) / .76);font-size:10.5px;font-weight:650;letter-spacing:.03em}.abc-handle{width:7px!important;height:7px!important;border:0!important;background:transparent!important;opacity:0!important;pointer-events:none}.abc-group.is-sequential>.abc-handle{background:#3d628f!important}.abc-group.is-parallel>.abc-handle{background:#8b6f37!important}.abc-group.is-loop>.abc-handle,.abc-node.is-contained-in-loop .abc-loop-handle{background:#397458!important}.abc-canvas .react-flow__edge-path{transition:stroke-width .12s ease}.abc-canvas .react-flow__edge:hover .react-flow__edge-path{stroke-width:2.2}.abc-edge-tools{position:absolute;z-index:1002;display:inline-flex;align-items:center;justify-content:center;gap:3px;padding:0;border-radius:999px;pointer-events:all}.abc-canvas .react-flow__edgelabel-renderer{z-index:1002}.abc-edge-hover-path{fill:none;stroke:transparent;stroke-width:22px;pointer-events:stroke}.abc-edge-label{position:absolute;bottom:calc(100% + 1px);left:50%;padding:2px 5px;border-radius:5px;background:hsl(var(--background) / .92);color:hsl(var(--muted-foreground));font-size:10px;font-weight:600;transform:translate(-50%);white-space:nowrap}.abc-edge-add{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid hsl(var(--cw-workspace-accent) / .28);border-radius:50%;background:hsl(var(--background));box-shadow:0 4px 12px hsl(var(--foreground) / .1);color:hsl(var(--cw-workspace-accent));cursor:pointer;opacity:0;transform:scale(.82);transition:opacity .14s ease,transform .14s ease,border-color .14s ease}.abc-edge-tools.is-visible .abc-edge-add,.abc-edge-tools:hover .abc-edge-add,.abc-edge-add:focus-visible{border-color:hsl(var(--cw-workspace-accent) / .68);opacity:1;transform:scale(1)}.abc-edge-add:focus-visible{outline:2px solid hsl(var(--cw-workspace-accent) / .5);outline-offset:2px}.abc-edge-add svg{width:11px;height:11px}@media (hover: none){.abc-edge-add{opacity:.88;transform:scale(1)}.abc-node-delete{opacity:1;pointer-events:auto;transform:none}}@media (prefers-reduced-motion: reduce){.abc-node-delete,.abc-edge-add{transition:none}}.abc-canvas .react-flow__controls{overflow:hidden;border:1px solid hsl(var(--border));border-radius:9px;box-shadow:0 8px 24px hsl(var(--foreground) / .08)}.abc-canvas .react-flow__controls-button{border-bottom-color:hsl(var(--border));background:hsl(var(--panel));color:hsl(var(--foreground))}.abc-minimap{width:168px!important;height:104px!important;overflow:hidden;border:1px solid hsl(var(--border));border-radius:9px;background:hsl(var(--panel))!important;box-shadow:0 8px 24px hsl(var(--foreground) / .06)}.abc-minimap-node .abc-minimap-shell,.abc-minimap-node .abc-minimap-icon-mark,.abc-minimap-node .abc-minimap-group-divider{vector-effect:non-scaling-stroke}.abc-minimap-node-agent .abc-minimap-shell{fill:hsl(var(--panel));stroke:#585e6ab8;stroke-width:1.4px}.abc-minimap-node-agent.is-a2a .abc-minimap-shell{fill:#f0f5fa;stroke:#4788aec7}.abc-minimap-agent-icon{fill:#edeff3}.abc-minimap-node-agent.is-a2a .abc-minimap-agent-icon{fill:#dae9f1}.abc-minimap-icon-mark{fill:none;stroke:#4f5f72;stroke-width:1.25px}.abc-minimap-icon-eye{fill:#4f5f72}.abc-minimap-copy-line{fill:hsl(var(--muted-foreground) / .34)}.abc-minimap-copy-line.is-primary{fill:hsl(var(--foreground) / .7)}.abc-minimap-node-terminal .abc-minimap-shell{fill:hsl(var(--cw-workspace-ink));stroke:hsl(var(--panel));stroke-width:1.5px;vector-effect:non-scaling-stroke}.abc-minimap-terminal-dot{fill:hsl(var(--panel) / .82)}.abc-minimap-node-group .abc-minimap-shell{fill:hsl(var(--panel) / .32);stroke:#3d628fc7;stroke-width:1.5px}.abc-minimap-node-group.is-parallel .abc-minimap-shell{stroke:#8b6f37d1}.abc-minimap-node-group.is-sequential .abc-minimap-shell{stroke:#3d628fd1}.abc-minimap-node-group.is-llm .abc-minimap-shell{stroke:#585e6ac7}.abc-minimap-node-group.is-loop .abc-minimap-shell{stroke:#397458d6}.abc-minimap-group-divider{stroke:hsl(var(--border));stroke-width:1px}.abc-minimap-group-title{fill:hsl(var(--muted-foreground) / .42)}.abc-minimap-node.is-selected .abc-minimap-shell{stroke-width:2.5px}.abc-minimap-node-agent.is-selected .abc-minimap-shell{stroke:#2e3138}.abc-minimap-node-group.is-sequential.is-selected .abc-minimap-shell{stroke:#314e72}.abc-minimap-node-group.is-parallel.is-selected .abc-minimap-shell{stroke:#6d572c}.abc-minimap-node-group.is-loop.is-selected .abc-minimap-shell{stroke:#2d5c46}@media (max-width: 1080px){.abc-root{min-width:360px}}@media (max-width: 860px){.abc-root{flex:none;width:100%;min-width:0;height:480px;border-right:0;border-bottom:0}.abc-minimap{display:none}}@media (max-width: 520px){.abc-root{height:430px}}.text-shimmer.text-shimmer{color:transparent;background-size:200% auto;background-position:200% center;background-clip:text;-webkit-background-clip:text;animation:text-shimmer 4s linear infinite}@keyframes text-shimmer{to{background-position:-200% center}}@media (prefers-reduced-motion: reduce){.text-shimmer.text-shimmer{animation:none;background-position:50% center}}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! Theme: GitHub Description: Light theme as seen on github.com Author: github.com diff --git a/veadk/webui/index.html b/veadk/webui/index.html index b58a441e..3d3a479c 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,8 +5,8 @@ AgentKit Studio - - + +