diff --git a/.github/workflows/publish-studio-release.yaml b/.github/workflows/publish-studio-release.yaml index c2791ba2..1a1cb2f1 100644 --- a/.github/workflows/publish-studio-release.yaml +++ b/.github/workflows/publish-studio-release.yaml @@ -124,6 +124,8 @@ jobs: env: RELEASE_SERVER_URL: ${{ secrets.STUDIO_RELEASE_SERVER_URL }} RELEASE_SERVER_API_KEY: ${{ secrets.STUDIO_RELEASE_SERVER_API_KEY }} + STUDIO_APMPLUS_AID: ${{ vars.STUDIO_APMPLUS_AID }} + STUDIO_APMPLUS_TOKEN: ${{ secrets.STUDIO_APMPLUS_TOKEN }} steps: - name: Validate release server configuration @@ -142,6 +144,20 @@ jobs: echo "STUDIO_RELEASE_SERVER_API_KEY must contain at least 32 characters." >&2 exit 1 fi + if [[ -n "$STUDIO_APMPLUS_AID$STUDIO_APMPLUS_TOKEN" ]]; then + test -n "$STUDIO_APMPLUS_AID" || { + echo "STUDIO_APMPLUS_AID is required when STUDIO_APMPLUS_TOKEN is configured." >&2 + exit 1 + } + test -n "$STUDIO_APMPLUS_TOKEN" || { + echo "STUDIO_APMPLUS_TOKEN is required when STUDIO_APMPLUS_AID is configured." >&2 + exit 1 + } + [[ "$STUDIO_APMPLUS_AID" =~ ^[0-9]+$ ]] || { + echo "STUDIO_APMPLUS_AID must be an integer." >&2 + exit 1 + } + fi echo "RELEASE_SERVER_URL=$release_server_url" >> "$GITHUB_ENV" - name: Request Studio release @@ -166,14 +182,20 @@ jobs: f"{os.environ['GITHUB_RUN_ID']}-" f"{os.environ['GITHUB_RUN_ATTEMPT']}" ) - payload = json.dumps( - { - "repository": os.environ["GITHUB_REPOSITORY"], - "gitSha": os.environ["GITHUB_SHA"], - "requestId": job_id, - "changelog": [os.environ["STUDIO_CHANGELOG"]], + payload_data = { + "repository": os.environ["GITHUB_REPOSITORY"], + "gitSha": os.environ["GITHUB_SHA"], + "requestId": job_id, + "changelog": [os.environ["STUDIO_CHANGELOG"]], + } + studio_apmplus_aid = os.getenv("STUDIO_APMPLUS_AID", "").strip() + studio_apmplus_token = os.getenv("STUDIO_APMPLUS_TOKEN", "").strip() + if studio_apmplus_aid and studio_apmplus_token: + payload_data["studioApmplus"] = { + "aid": studio_apmplus_aid, + "token": studio_apmplus_token, } - ).encode() + payload = json.dumps(payload_data).encode() request = urllib.request.Request( f"{os.environ['RELEASE_SERVER_URL']}/release", data=payload, diff --git a/docs/studio-apmplus-telemetry-implementation-plan.md b/docs/studio-apmplus-telemetry-implementation-plan.md new file mode 100644 index 00000000..646cc790 --- /dev/null +++ b/docs/studio-apmplus-telemetry-implementation-plan.md @@ -0,0 +1,475 @@ +# Studio APMPlus 前端埋点实现方案 + +## 背景 + +Studio 通过 APMPlus Client / WebPro 统计部署实例、登录使用情况和 Agent 部署结果。当前 +方案上报以下自定义事件: + +- `studio_instance_loaded`:Studio 前端成功读取 `/web/ui-config` 后上报。 +- `studio_user_authenticated`:用户身份解析完成,且 `/web/access` 返回用户身份后上报。 +- `studio_agent_deploy_succeeded`:用户确认部署后,Agent Runtime 部署成功时上报。 +- `studio_agent_deploy_failed`:用户确认部署后,Agent Runtime 部署失败时上报。 +- `studio_sandbox_create_succeeded`:用户确认创建 Sandbox 后,Sandbox Session 创建成功时上报。 +- `studio_sandbox_create_failed`:用户确认创建 Sandbox 后,Sandbox Session 创建失败时上报。 + +`veadk studio deploy` 会把 Studio 部署到 VeFaaS,并注入部署 ID、部署者 ID、用户池 ID、 +区域、项目等环境变量。Studio 运行时通过 `/web/ui-config` 把部署元信息下发给前端; +通过 `/web/access` 返回当前登录用户 ID 和角色。 + +## 目标 + +- 统计被访问过的 Studio 实例数量。 +- 统计访问过 Studio 的用户池数量。 +- 统计登录使用 Studio 的用户数量。 +- 统计 Studio 页面加载量和登录使用量。 +- 统计 Agent Runtime 成功部署数和部署失败数。 +- 统计 Sandbox 创建成功数和创建失败数。 +- APMPlus 配置缺失或上报失败时,不影响 Studio 正常使用。 + +## 非目标 + +- 不把前端埋点当作严格的 CLI 成功部署审计。纯前端事件只能统计“部署后至少被打开过” + 的 Studio 实例。 +- 不在本方案中实现 APMPlus 控制台看板或 SQL 查询。 +- 不采集 prompt、对话内容、生成代码、环境变量值、构建日志等内容型数据。 +- 不采集 `VOLCENGINE_SECRET_KEY`、`VOLCENGINE_SESSION_TOKEN`、`OAUTH2_CLIENT_SECRET`、 + Runtime API key 或其他密钥。 + +## 指标口径 + +| 指标 | 推荐事件 | 理想聚合方式 | 说明 | +| --- | --- | --- | --- | +| 被访问过的 Studio 实例数 | `studio_instance_loaded` | `count(distinct studio_deploy_id)` | 同一个实例被多人访问仍只算一个实例。 | +| 用户池数 | `studio_instance_loaded` 或 `studio_user_authenticated` | `count(distinct user_pool_id)` | 访问维度用实例加载事件;登录维度用用户认证事件。 | +| 登录用户数 | `studio_user_authenticated` | `count(distinct user_id)` | 登录成功并拿到后端权限身份后上报。 | +| Studio 页面加载量 | `studio_instance_loaded` | `count(*)` | 页面每次加载可计一次。 | +| 某个实例的登录用户数 | `studio_user_authenticated` | `count(distinct user_id) group by studio_deploy_id` | 观察单个 Studio 的覆盖范围。 | +| 成功部署 Agent 数 | `studio_agent_deploy_succeeded` | `count(*)` | 一次成功部署或更新对应一条成功事件。 | +| 部署失败次数 | `studio_agent_deploy_failed` | `count(*)` | 不包含用户取消和只打开确认弹窗的情况。 | +| 有结果的部署操作数 | `studio_agent_deploy_succeeded` + `studio_agent_deploy_failed` | 两个事件上报量相加 | 若看板不支持跨事件相加,则拆成两个卡片展示。 | +| Sandbox 创建成功数 | `studio_sandbox_create_succeeded` | `count(*)` | 一次成功创建 Sandbox Session 对应一条成功事件。 | +| Sandbox 创建失败数 | `studio_sandbox_create_failed` | `count(*)` | 不包含用户取消和只打开确认弹窗的情况。 | +| 有结果的 Sandbox 创建操作数 | `studio_sandbox_create_succeeded` + `studio_sandbox_create_failed` | 两个事件上报量相加 | 若看板不支持跨事件相加,则拆成两个卡片展示。 | + +当前 WebPro 自定义分析看板如果只能选择 `COUNT` 等普通聚合,则字段级 +`count(distinct )` 可能需要用明细导出、查询能力或额外离线分析完成;前端埋点仍按 +可去重的维度字段上报。 + +## 事件设计 + +### `studio_instance_loaded` + +触发时机: + +- 前端成功读取 `/web/ui-config`。 +- APMPlus SDK 已完成初始化。 +- 每次页面加载最多上报一次。 + +用途: + +- 统计被访问过的 Studio 实例数。 +- 统计用户池覆盖范围。 +- 统计 Studio 页面加载量。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 每次 `veadk studio deploy` 生成并注入的唯一 ID。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `agents_source` | string | `cloud` | `/web/ui-config` 返回的 Agent 来源。 | + +`studio_instance_loaded` 不包含 `user_id`、`user_role`、`user_source`,避免实例加载事件和用户 +登录事件的语义混在一起。 + +### `studio_user_authenticated` + +触发时机: + +- `resolveIdentity()` 返回 `status === "authenticated"`。 +- `/web/access` 返回非空 `telemetry.userId`。 +- 当前页面生命周期内对同一个 `studio_deploy_id + user_id + user_role` 最多上报一次。 + +用途: + +- 统计不同用户池下的登录使用人数。 +- 统计某个 Studio 实例被多少用户使用。 +- 统计不同角色的登录使用量。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 关联 Studio 实例。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `user_id` | string | `123456` | 后端根据 Studio 权限身份解析出的登录用户 ID。 | +| `user_role` | string | `admin` | `/web/access` 返回的 Studio 角色。 | +| `user_source` | string | `sso` | 区分 SSO 和本地用户名模式。 | + +### `studio_agent_deploy_succeeded` + +触发时机: + +- 用户在确认弹窗里确认部署或更新。 +- `ProjectPreview.performDeployment()` 调用 `onDeploy()` 成功返回 `DeployResult`。 + +用途: + +- 统计成功部署或更新的 Agent Runtime 数量。 +- 按创建入口、区域、网络类型拆分部署结果。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 关联 Studio 实例。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `user_id` | string | `123456` | 当前登录用户 ID。 | +| `user_role` | string | `admin` | 当前登录用户的 Studio 角色。 | +| `user_source` | string | `sso` | 区分 SSO 和本地用户名模式。 | +| `deploy_source` | string | `custom_create` | 创建入口:`custom_create`、`intelligent_create`、`code_package` 或 `unknown`。 | +| `deploy_action` | string | `create` | `create` 表示新建 Runtime,`update` 表示更新已有 Runtime。 | +| `deploy_region` | string | `cn-beijing` | Agent Runtime 部署区域。 | +| `runtime_network_type` | string | `public` | Runtime 网络类型:`public`、`private` 或 `both`。 | +| `feishu_enabled` | string | `false` | 是否启用飞书 Channel。 | +| `runtime_id` | string | `runtime-id` | 成功部署后返回的 Runtime ID。 | + +看板主口径: + +```text +事件 = studio_agent_deploy_succeeded +指标 = 上报量 / COUNT +``` + +### `studio_agent_deploy_failed` + +触发时机: + +- 用户在确认弹窗里确认部署或更新。 +- `ProjectPreview.performDeployment()` 调用 `onDeploy()` 后抛出非取消异常。 + +用途: + +- 统计部署失败次数。 +- 按创建入口、区域、网络类型和失败阶段拆分失败分布。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 关联 Studio 实例。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `user_id` | string | `123456` | 当前登录用户 ID。 | +| `user_role` | string | `admin` | 当前登录用户的 Studio 角色。 | +| `user_source` | string | `sso` | 区分 SSO 和本地用户名模式。 | +| `deploy_source` | string | `custom_create` | 创建入口:`custom_create`、`intelligent_create`、`code_package` 或 `unknown`。 | +| `deploy_action` | string | `create` | `create` 表示新建 Runtime,`update` 表示更新已有 Runtime。 | +| `deploy_region` | string | `cn-beijing` | Agent Runtime 部署区域。 | +| `runtime_network_type` | string | `public` | Runtime 网络类型:`public`、`private` 或 `both`。 | +| `feishu_enabled` | string | `false` | 是否启用飞书 Channel。 | +| `failed_phase` | string | `build` | 失败时最近的部署阶段。 | +| `error_kind` | string | `build_failed` | 归类后的错误类型,不上报完整错误文案。 | + +看板主口径: + +```text +事件 = studio_agent_deploy_failed +指标 = 上报量 / COUNT +``` + +### `studio_sandbox_create_succeeded` + +触发时机: + +- 用户在确认弹窗里确认创建 Sandbox。 +- `sandboxClient.startSession()` 或 `sandboxClient.startAgentSession()` 成功返回 + `SandboxSession`。 + +用途: + +- 统计 Sandbox Session 创建成功数。 +- 按 Sandbox 类型和入口拆分创建结果。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 关联 Studio 实例。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `user_id` | string | `123456` | 当前登录用户 ID。 | +| `user_role` | string | `admin` | 当前登录用户的 Studio 角色。 | +| `user_source` | string | `sso` | 区分 SSO 和本地用户名模式。 | +| `sandbox_kind` | string | `codex` | Sandbox 类型:`codex`、`openclaw` 或 `hermes`。 | +| `sandbox_source` | string | `new_chat` | 创建入口:`new_chat` 或 `my_agents`。 | +| `sandbox_session_id` | string | `session-id` | 成功创建后返回的 Sandbox Session ID。 | + +看板主口径: + +```text +事件 = studio_sandbox_create_succeeded +指标 = 上报量 / COUNT +``` + +### `studio_sandbox_create_failed` + +触发时机: + +- 用户在确认弹窗里确认创建 Sandbox。 +- `sandboxClient.startSession()` 或 `sandboxClient.startAgentSession()` 抛出非取消异常。 + +用途: + +- 统计 Sandbox Session 创建失败数。 +- 按 Sandbox 类型、入口和错误类型拆分失败分布。 + +字段: + +| 字段 | 类型 | 示例 | 说明 | +| --- | --- | --- | --- | +| `studio_deploy_id` | string | `stddep_...` | 关联 Studio 实例。 | +| `user_pool_id` | string | `up-...` | Studio 绑定的用户池 ID。 | +| `vefaas_application_id` | string | `app-id` | VeFaaS Application ID。 | +| `vefaas_function_id` | string | `func-id` | VeFaaS Function ID。 | +| `studio_region` | string | `cn-beijing` | Studio 部署区域。 | +| `studio_project` | string | `default` | VeFaaS 项目。 | +| `studio_version` | string | `bundled` | Studio 版本。 | +| `user_id` | string | `123456` | 当前登录用户 ID。 | +| `user_role` | string | `admin` | 当前登录用户的 Studio 角色。 | +| `user_source` | string | `sso` | 区分 SSO 和本地用户名模式。 | +| `sandbox_kind` | string | `codex` | Sandbox 类型:`codex`、`openclaw` 或 `hermes`。 | +| `sandbox_source` | string | `new_chat` | 创建入口:`new_chat` 或 `my_agents`。 | +| `error_kind` | string | `unknown` | 归类后的错误类型,不上报完整错误文案。 | + +看板主口径: + +```text +事件 = studio_sandbox_create_failed +指标 = 上报量 / COUNT +``` + +## 部署元信息 + +`veadk studio deploy` 成功部署并二阶段 release 时,除现有环境变量外再注入: + +| 环境变量 | 示例 | 说明 | +| --- | --- | --- | +| `VEADK_STUDIO_DEPLOY_ID` | `stddep_...` | 本次 Studio 部署的稳定 ID。 | +| `VEADK_STUDIO_USER_POOL_ID` | `up-...` | Studio 绑定的用户池 ID。 | +| `VEADK_STUDIO_DEPLOY_REGION` | `cn-beijing` | Studio 部署区域。 | +| `VEADK_STUDIO_PROJECT` | `default` | VeFaaS 项目。 | + +`VEADK_STUDIO_DEPLOY_ID` 生成规则: + +```text +stddep_ +``` + +`veadk studio deploy` 使用的火山 AK 仅用于部署云资源,不会作为前端埋点维度下发或上报。 +如果后续产品需要“真实部署人”维度,需要接入云身份查询或审计侧数据,而不是使用部署 AK。 + +## `/web/ui-config` 字段 + +`UiConfig` 增加 `telemetry` 配置: + +```json +{ + "telemetry": { + "enabled": true, + "provider": "apmplus", + "apmplus": { + "aid": 123456, + "token": "", + "domain": "apmplus.volces.com", + "env": "production" + }, + "studio": { + "deployId": "stddep_...", + "userPoolId": "up-...", + "applicationId": "app-id", + "functionId": "func-id", + "region": "cn-beijing", + "project": "default", + "version": "bundled" + } + } +} +``` + +APMPlus 配置来源: + +| 环境变量 | 说明 | +| --- | --- | +| `VEADK_STUDIO_APMPLUS_AID` | APMPlus Web 应用 ID;不内置默认值,由 release server 或部署环境注入。 | +| `VEADK_STUDIO_APMPLUS_TOKEN` | APMPlus Web SDK token;不内置默认值,由 release server 或部署环境注入。 | +| `VEADK_STUDIO_APMPLUS_DOMAIN` | 上报域名,默认固定为 `apmplus.volces.com`。 | +| `VEADK_STUDIO_APMPLUS_ENV` | 上报环境,默认固定为 `production`。 | + +`Publish Studio Release` 会把 GitHub Environment 中配置的 APMPlus AID/token 发送给 release +server。release server 构建 bundle 时把它们写入内部发布配置;Studio 自更新解包后读取该配置, +删除内部配置文件,再把 `VEADK_STUDIO_APMPLUS_AID` 和 `VEADK_STUDIO_APMPLUS_TOKEN` +注入最终 VeFaaS Function 环境。 + +Python 侧埋点配置集中在 `veadk/cli/studio_telemetry.py`:部署参数校验、release AID/token +校验、`/web/ui-config.telemetry` payload 生成都走同一个模块,避免后续重构 +`cli_frontend.py` 或 release 打包逻辑时出现多份规则漂移。 + +## 前端实现 + +`frontend/src/adk/telemetry.ts` 负责: + +- 初始化 `@apmplus/web`。 +- 维护全局 Studio telemetry context。 +- 提供 `trackStudioEvent(name, categories, metrics)`。 +- 对上报做错误兜底,失败只 `console.warn`,不抛出到业务流程。 +- 通过内存 Set 对单页面生命周期内的关键事件去重。 + +关键接口: + +```ts +export interface StudioTelemetryContext { + deployId: string; + userPoolId: string; + applicationId: string; + functionId: string; + region: string; + project: string; + version: string; +} + +export function initStudioTelemetry(config: UiConfig["telemetry"]): void; + +export function identifyStudioTelemetryUser(args: { + userId: string; + role?: StudioRole; + local: boolean; +}): void; + +export function trackStudioEvent( + name: StudioTelemetryEventName, + categories?: Record, + metrics?: Record, +): void; +``` + +接入点: + +| 位置 | 改动 | +| --- | --- | +| `frontend/src/adk/client.ts` | 扩展 `UiConfig` 类型,解析 `telemetry`。 | +| `frontend/src/App.tsx` 的 `getUiConfig()` effect | 调用 `initStudioTelemetry(cfg.telemetry)`,随后上报 `studio_instance_loaded`。 | +| `frontend/src/App.tsx` 的 `/web/access` effect | 后端返回 role 与 `telemetry.userId` 后调用 `identifyStudioTelemetryUser()`,再上报 `studio_user_authenticated`。 | +| `frontend/src/ui/ProjectPreview.tsx` 的 `performDeployment()` | `onDeploy()` 成功后上报 `studio_agent_deploy_succeeded`;非取消异常上报 `studio_agent_deploy_failed`。 | +| `frontend/src/App.tsx` 的 `launchSandboxSession()` | Sandbox Session 创建成功后上报 `studio_sandbox_create_succeeded`;非取消异常上报 `studio_sandbox_create_failed`。 | + +去重策略: + +- `studio_instance_loaded`:单页面生命周期一次。 +- `studio_user_authenticated`:`studio_deploy_id + user_id + user_role` 单页面生命周期一次。 +- `studio_agent_deploy_succeeded` / `studio_agent_deploy_failed`:不去重,每个有结果的部署操作上报一次。 +- `studio_sandbox_create_succeeded` / `studio_sandbox_create_failed`:不去重,每个有结果的创建操作上报一次。 + +字段规范: + +- APMPlus `sendEvent` 的 `categories` 仅放字符串维度。 +- 数值型耗时、数量放 `metrics`。 +- Boolean 转成 `"true"` / `"false"`,避免控制台维度类型不稳定。 +- 错误不上报完整 message,只上报归类后的 `error_kind`。 +- Agent 部署结果第一版不依赖 `metrics`;看板用成功/失败事件的上报量统计。 +- Sandbox 创建结果第一版不依赖 `metrics`;看板用成功/失败事件的上报量统计。 + +## 后端实现 + +`veadk/cli/cli_frontend.py` 负责: + +1. `frontend_deploy()` 生成部署元信息。 +2. `veadk_environments` 注入 APMPlus 配置和部署元信息。 +3. 二阶段 `release_environment` 同步注入 `VEADK_STUDIO_DEPLOY_ID`、 + `VEADK_STUDIO_USER_POOL_ID`。 +4. `/web/ui-config` 返回 `telemetry` 配置。 +5. `/web/access` 返回 `telemetry.userId`。 + +## 测试 + +后端测试: + +- `tests/cli/test_frontend_runtime_proxy.py` + - `/web/ui-config` 在 APMPlus env 缺失时使用默认 WebPro 配置。 + - `/web/ui-config` 在 env 完整时支持覆盖 telemetry 配置。 + - 返回部署元信息字段使用当前 schema。 + +- `tests/cli/test_studio_deploy_target.py` + - `veadk studio deploy` 生成 `VEADK_STUDIO_DEPLOY_ID`。 + - `veadk studio deploy` 注入 `VEADK_STUDIO_USER_POOL_ID`。 + - 二阶段 release 环境包含 telemetry 元信息。 + +- `tests/cli/test_studio_rbac.py` + - `/web/access` 返回当前登录用户的 `telemetry.userId`。 + +前端测试: + +- `frontend/tests/studioTelemetry.test.mjs` + - `initStudioTelemetry` 调用 SDK init/start。 + - `trackStudioEvent` 使用自定义事件上报,并带上 Studio context。 + - 除 `studio_instance_loaded` 外,登录和部署结果事件都带用户字段。 + - Agent 部署只上报 `studio_agent_deploy_succeeded` 和 + `studio_agent_deploy_failed`,不额外上报 started 事件。 + - Sandbox 创建只上报 `studio_sandbox_create_succeeded` 和 + `studio_sandbox_create_failed`,不额外上报 started 事件。 + +- `frontend/tests/studioAccess.test.mjs` + - 覆盖 `/web/access` schema 中的 `telemetry.userId`。 + +## 安全与隐私 + +- 禁止上传 `VOLCENGINE_SECRET_KEY`、`VOLCENGINE_SESSION_TOKEN`、 + `OAUTH2_CLIENT_SECRET`。 +- 禁止上传 Runtime API key、构建日志、错误详情全文、环境变量全集、prompt、对话内容、 + 生成代码或 Agent 输出。 +- `user_pool_id`、`user_id`、`vefaas_application_id`、`vefaas_function_id` + 会作为统计维度原值进入 APMPlus。它们便于在看板中排查和分组,但需要按内部数据治理要求 + 控制看板权限。 +- 部署使用的火山 AK 不会作为 `deployer_id` 下发到前端或进入 APMPlus。 +- APMPlus token 属于前端 SDK token,可通过 `/web/ui-config` 下发;若产品侧认为 token + 也需要隐藏,则改用服务端代理上报。 + +## 验收标准 + +- 配置 APMPlus token 后,打开 Studio 能看到 `studio_instance_loaded`。 +- 登录成功后能看到 `studio_user_authenticated`。 +- `studio_instance_loaded` 不包含 `user_id`。 +- `studio_user_authenticated` 包含 `user_id`、`user_role`、`user_source`。 +- `/web/ui-config` 不返回任何云密钥明文。 +- 前端 `npm test`、`npm run build` 通过。 +- 修改过的 Python 测试通过。 + +## 待确认项 + +- APMPlus 控制台是否支持字段级去重聚合;如果不支持,需要用查询、导出或离线分析实现 + `count(distinct ...)`。 +- 当前不做 CLI/服务端部署成功上报;本方案只统计被打开和登录使用过的 Studio。 +- 是否需要按天、周、月分别做去重口径;这属于看板或数据分析配置,不影响事件采集。 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8523db7f..0bece1ff 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "veadk-a2ui-frontend", "version": "0.1.0", "dependencies": { + "@apmplus/web": "^2.10.1", "@codemirror/lang-javascript": "^6.2.5", "@codemirror/lang-json": "^6.0.2", "@codemirror/lang-markdown": "^6.5.1", @@ -42,6 +43,12 @@ "vite": "^5.4.11" } }, + "node_modules/@apmplus/web": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/@apmplus/web/-/web-2.10.1.tgz", + "integrity": "sha512-6a7opvDBRgn/bLg7lYdyhipsE6paqootdF2wuDGuBK7vgmE4DrjxqSV3mD/YvFzyVWXnR2HR4Y/Bdw99LgcumQ==", + "license": "MIT" + }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.29.7.tgz", diff --git a/frontend/package.json b/frontend/package.json index 222ae002..16750f3f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,6 +11,7 @@ "preview": "vite preview" }, "dependencies": { + "@apmplus/web": "^2.10.1", "@codemirror/lang-javascript": "^6.2.5", "@codemirror/lang-json": "^6.0.2", "@codemirror/lang-markdown": "^6.5.1", diff --git a/frontend/service/studio_release_server/__init__.py b/frontend/service/studio_release_server/__init__.py index de629868..4d08ac82 100644 --- a/frontend/service/studio_release_server/__init__.py +++ b/frontend/service/studio_release_server/__init__.py @@ -23,6 +23,7 @@ ReleaseStatus, SourceUpload, SourceUploadRequest, + StudioApmplusReleaseConfig, ) from frontend.service.studio_release_server.service import ReleaseService @@ -34,6 +35,7 @@ "ReleaseStatus", "SourceUpload", "SourceUploadRequest", + "StudioApmplusReleaseConfig", "StudioReleaseBuilder", "create_app", ] diff --git a/frontend/service/studio_release_server/builder.py b/frontend/service/studio_release_server/builder.py index c4f4e11c..a1bc0261 100644 --- a/frontend/service/studio_release_server/builder.py +++ b/frontend/service/studio_release_server/builder.py @@ -584,6 +584,13 @@ def _run_publisher( "npm_config_replace_registry_host": "always", } ) + if request.studio_apmplus is not None: + env.update( + { + "VEADK_STUDIO_APMPLUS_AID": request.studio_apmplus.aid, + "VEADK_STUDIO_APMPLUS_TOKEN": request.studio_apmplus.token, + } + ) log_path = output_dir.parent / "publisher.log" with log_path.open("wb") as output: completed = subprocess.run( diff --git a/frontend/service/studio_release_server/models.py b/frontend/service/studio_release_server/models.py index 11478156..48990e1d 100644 --- a/frontend/service/studio_release_server/models.py +++ b/frontend/service/studio_release_server/models.py @@ -30,6 +30,29 @@ ReleaseState = Literal["queued", "running", "succeeded", "failed"] +class StudioApmplusReleaseConfig(BaseModel): + """APMPlus Web SDK config passed through the release request.""" + + aid: str + token: str + + @field_validator("aid") + @classmethod + def _validate_aid(cls, value: str) -> str: + value = value.strip() + if not value.isdigit(): + raise ValueError("Studio APMPlus aid must be an integer") + return value + + @field_validator("token") + @classmethod + def _validate_token(cls, value: str) -> str: + value = value.strip() + if not value: + raise ValueError("Studio APMPlus token is required") + return value + + @dataclass(frozen=True) class ReleaseServerSettings: """Runtime settings injected into the VeFaaS Function.""" @@ -89,6 +112,10 @@ class ReleaseRequest(BaseModel): request_id: str = Field(alias="requestId") changelog: tuple[str, ...] = () source_key: str = Field(default="", alias="sourceKey") + studio_apmplus: StudioApmplusReleaseConfig | None = Field( + default=None, + alias="studioApmplus", + ) @field_validator("repository") @classmethod diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ec161ca1..4576e11b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -271,6 +271,15 @@ import { authenticationRestored, isAuthenticationPending, } from "./adk/authSession"; +import { + identifyStudioTelemetryUser, + initStudioTelemetry, +} from "./adk/telemetry"; +import { + trackSandboxCreateFailed, + trackSandboxCreateSucceeded, + trackStudioLoaded, +} from "./adk/telemetryEvents"; import type { A2uiAction, A2uiComponent } from "./a2ui/types"; import { buildSurfaces } from "./a2ui/Surface"; @@ -1725,6 +1734,8 @@ export default function App() { // chat; privileged pages remain explicit navigation destinations. useEffect(() => { getUiConfig().then((cfg) => { + initStudioTelemetry(cfg.telemetry); + trackStudioLoaded({ agentsSource: cfg.agentsSource }); setFeatures(cfg.features); setAgentsSource(cfg.agentsSource); setSiteBranding(cfg.branding); @@ -1733,6 +1744,15 @@ export default function App() { }); }, []); + useEffect(() => { + if (authStatus !== "authenticated" || !userInfo || !access) return; + identifyStudioTelemetryUser({ + userId: access.telemetry.userId, + role: access.role, + local: localMode, + }); + }, [access, authStatus, localMode, userInfo]); + useEffect(() => { if (!access) return; if (!access.capabilities.createAgents) { @@ -2066,6 +2086,11 @@ export default function App() { signal: controller.signal, }); if (sandboxLaunchAbortRef.current !== controller) return; + trackSandboxCreateSucceeded({ + kind: sandboxLaunchKind, + source: sandboxLaunchFromAgents ? "my_agents" : "new_chat", + sessionId: createdSession.id, + }); if (sandboxLaunchFromAgents) { setSandboxAgentRefreshKey((current) => current + 1); setSandboxLaunchOpen(false); @@ -2105,6 +2130,11 @@ export default function App() { } catch (launchError) { if ((launchError as Error)?.name === "AbortError") return; if (sandboxLaunchAbortRef.current !== controller) return; + trackSandboxCreateFailed({ + kind: sandboxLaunchKind, + source: sandboxLaunchFromAgents ? "my_agents" : "new_chat", + error: launchError, + }); setSandboxLaunchError( launchError instanceof Error ? launchError.message diff --git a/frontend/src/adk/client.ts b/frontend/src/adk/client.ts index 4a82a2ad..8db3cbd8 100644 --- a/frontend/src/adk/client.ts +++ b/frontend/src/adk/client.ts @@ -1992,6 +1992,30 @@ export interface SiteBranding { logoUrl: string; } +export interface StudioTelemetryApmplusConfig { + aid: number; + token: string; + domain: string; + env: string; +} + +export interface StudioTelemetryContext { + deployId: string; + userPoolId: string; + applicationId: string; + functionId: string; + region: string; + project: string; + version: string; +} + +export interface StudioTelemetryConfig { + enabled: boolean; + provider?: "apmplus"; + apmplus?: StudioTelemetryApmplusConfig; + studio?: StudioTelemetryContext; +} + export interface UiConfig { studio: boolean; version: string; @@ -2001,6 +2025,7 @@ export interface UiConfig { /** Where the agent picker sources agents: local apps (`--dev`) or the user's * cloud AgentKit runtimes (default). */ agentsSource: "local" | "cloud"; + telemetry: StudioTelemetryConfig; } export const DEFAULT_SITE_BRANDING: SiteBranding = { @@ -2008,6 +2033,10 @@ export const DEFAULT_SITE_BRANDING: SiteBranding = { logoUrl: "", }; +const DISABLED_STUDIO_TELEMETRY: StudioTelemetryConfig = { + enabled: false, +}; + const DEFAULT_UI_CONFIG: UiConfig = { studio: false, version: "", @@ -2024,8 +2053,55 @@ const DEFAULT_UI_CONFIG: UiConfig = { }, defaultView: "chat", agentsSource: "local", + telemetry: DISABLED_STUDIO_TELEMETRY, }; +function normalizeStudioTelemetryConfig(value: unknown): StudioTelemetryConfig { + if (!value || typeof value !== "object") return DISABLED_STUDIO_TELEMETRY; + const config = value as Partial; + if (!config.enabled) return DISABLED_STUDIO_TELEMETRY; + const apmplus = config.apmplus; + if ( + !apmplus || + typeof apmplus.aid !== "number" || + !Number.isFinite(apmplus.aid) || + typeof apmplus.token !== "string" || + !apmplus.token + ) { + return DISABLED_STUDIO_TELEMETRY; + } + const studio = (config.studio ?? {}) as Partial; + return { + enabled: true, + provider: config.provider === "apmplus" ? "apmplus" : undefined, + apmplus: { + aid: apmplus.aid, + token: apmplus.token, + domain: typeof apmplus.domain === "string" && apmplus.domain + ? apmplus.domain + : "apmplus.volces.com", + env: typeof apmplus.env === "string" && apmplus.env + ? apmplus.env + : "production", + }, + studio: { + deployId: typeof studio.deployId === "string" ? studio.deployId : "", + userPoolId: typeof studio.userPoolId === "string" + ? studio.userPoolId + : "", + applicationId: typeof studio.applicationId === "string" + ? studio.applicationId + : "", + functionId: typeof studio.functionId === "string" + ? studio.functionId + : "", + region: typeof studio.region === "string" ? studio.region : "", + project: typeof studio.project === "string" ? studio.project : "", + version: typeof studio.version === "string" ? studio.version : "", + }, + }; +} + /** Fetch the UI feature gates; falls back to all-enabled on any error. */ export async function getUiConfig(): Promise { try { @@ -2049,6 +2125,7 @@ export async function getUiConfig(): Promise { features: { ...DEFAULT_UI_CONFIG.features, ...(d.features ?? {}) }, defaultView: d.defaultView ?? "chat", agentsSource: d.agentsSource === "cloud" ? "cloud" : "local", + telemetry: normalizeStudioTelemetryConfig(d.telemetry), }; } catch { return DEFAULT_UI_CONFIG; @@ -2060,6 +2137,9 @@ export type RuntimeScope = "all" | "mine"; export interface StudioAccess { role: StudioRole; + telemetry: { + userId: string; + }; capabilities: { createAgents: boolean; manageAgents: boolean; @@ -2070,6 +2150,9 @@ export interface StudioAccess { /** Least-privileged fallback while access is loading or unavailable. */ export const DEFAULT_STUDIO_ACCESS: StudioAccess = { role: "user", + telemetry: { + userId: "", + }, capabilities: { createAgents: false, manageAgents: false, @@ -2084,6 +2167,7 @@ export async function getStudioAccess(): Promise { const access = (await res.json()) as StudioAccess; if ( !["admin", "developer", "user"].includes(access.role) || + typeof access.telemetry?.userId !== "string" || typeof access.capabilities?.createAgents !== "boolean" || typeof access.capabilities?.manageAgents !== "boolean" || !["all", "mine"].includes(access.capabilities?.runtimeScope) diff --git a/frontend/src/adk/telemetry.ts b/frontend/src/adk/telemetry.ts new file mode 100644 index 00000000..3b08d2e8 --- /dev/null +++ b/frontend/src/adk/telemetry.ts @@ -0,0 +1,227 @@ +import type { + StudioRole, + StudioTelemetryConfig, + StudioTelemetryContext, +} from "./client"; + +export type StudioTelemetryEventName = + | "studio_instance_loaded" + | "studio_user_authenticated" + | "studio_agent_deploy_succeeded" + | "studio_agent_deploy_failed" + | "studio_sandbox_create_succeeded" + | "studio_sandbox_create_failed"; + +export interface StudioTelemetryEventOptions { + dedupeKey?: string; + dailyDedupeKey?: string; +} + +interface ApmplusInitConfig { + aid: number; + token: string; + domain: string; + env: string; + release?: string; + userId?: string; +} + +interface ApmplusCustomEvent { + name: string; + categories?: Record; + metrics?: Record; +} + +interface ApmplusCustomReport { + ev_type: "custom"; + payload: ApmplusCustomEvent & { + type: "event"; + }; + extra: { + timestamp: number; + }; +} + +interface ApmplusClient { + (method: "init", config: ApmplusInitConfig): void; + (method: "start"): void; + (method: "config", config: Partial): void; + (method: "report", data: ApmplusCustomReport): void; +} + +const MAX_PENDING_EVENTS = 50; +const sentKeys = new Set(); + +let telemetryConfig: StudioTelemetryConfig = { enabled: false }; +let telemetryContext: StudioTelemetryContext | undefined; +let apmplusClient: ApmplusClient | null = null; +let initPromise: Promise | null = null; +let userId = ""; +let userRole: StudioRole | "unknown" = "unknown"; +let userSource: "sso" | "local" | "unknown" = "unknown"; +let pendingEvents: ApmplusCustomEvent[] = []; + +function stringifyCategory(value: unknown): string { + if (value === undefined || value === null) return ""; + if (typeof value === "string") return value; + if (typeof value === "number" || typeof value === "boolean") return String(value); + return JSON.stringify(value); +} + +function normalizeCategories( + categories: Record, +): Record { + return Object.fromEntries( + Object.entries(categories) + .filter(([, value]) => value !== undefined && value !== null) + .map(([key, value]) => [key, stringifyCategory(value)]), + ); +} + +function normalizeMetrics(metrics?: Record): Record { + if (!metrics) return {}; + return Object.fromEntries( + Object.entries(metrics).filter(([, value]) => Number.isFinite(value)), + ); +} + +function today(): string { + return new Date().toISOString().slice(0, 10); +} + +function consumeDedupe(options?: StudioTelemetryEventOptions): boolean { + if (!options) return true; + if (options.dedupeKey) { + if (sentKeys.has(options.dedupeKey)) return false; + sentKeys.add(options.dedupeKey); + } + if (options.dailyDedupeKey && typeof localStorage !== "undefined") { + const key = `veadk.studio.telemetry.${today()}.${options.dailyDedupeKey}`; + try { + if (localStorage.getItem(key) === "1") return false; + localStorage.setItem(key, "1"); + } catch { + /* ignore storage failures */ + } + } + return true; +} + +function enqueueOrSend(event: ApmplusCustomEvent): void { + if (apmplusClient) { + try { + apmplusClient("report", { + ev_type: "custom", + payload: { + ...event, + type: "event", + }, + extra: { + timestamp: Date.now(), + }, + }); + } catch (error) { + console.warn("[telemetry] failed to send Studio event:", error); + } + return; + } + pendingEvents = [...pendingEvents.slice(-(MAX_PENDING_EVENTS - 1)), event]; +} + +function flushPendingEvents(): void { + if (!apmplusClient) return; + const events = pendingEvents; + pendingEvents = []; + for (const event of events) enqueueOrSend(event); +} + +export function initStudioTelemetry(config: StudioTelemetryConfig): void { + telemetryConfig = config; + telemetryContext = config.studio; + if (!config.enabled || !config.apmplus) return; + if (initPromise) return; + const apmplus = config.apmplus; + initPromise = import("@apmplus/web") + .then((module) => { + const client = module.default as unknown as ApmplusClient; + client("init", { + aid: apmplus.aid, + token: apmplus.token, + domain: apmplus.domain, + env: apmplus.env, + release: config.studio?.version, + userId: userId || undefined, + }); + client("start"); + apmplusClient = client; + flushPendingEvents(); + }) + .catch((error) => { + console.warn("[telemetry] APMPlus SDK failed to initialize:", error); + telemetryConfig = { enabled: false }; + pendingEvents = []; + }); +} + +export function trackStudioEvent( + name: StudioTelemetryEventName, + categories: Record = {}, + metrics?: Record, + options?: StudioTelemetryEventOptions, +): void { + if (!telemetryConfig.enabled || !telemetryConfig.apmplus) return; + if (!consumeDedupe(options)) return; + const userCategories = name !== "studio_instance_loaded" + ? { + user_id: userId, + user_role: userRole, + user_source: userSource, + } + : {}; + enqueueOrSend({ + name, + categories: normalizeCategories({ + studio_deploy_id: telemetryContext?.deployId, + user_pool_id: telemetryContext?.userPoolId, + vefaas_application_id: telemetryContext?.applicationId, + vefaas_function_id: telemetryContext?.functionId, + studio_region: telemetryContext?.region, + studio_project: telemetryContext?.project, + studio_version: telemetryContext?.version, + ...userCategories, + ...categories, + }), + metrics: normalizeMetrics(metrics), + }); +} + +export function identifyStudioTelemetryUser(args: { + userId: string; + role?: StudioRole; + local: boolean; +}): void { + userId = args.userId.trim(); + if (!userId) return; + userRole = args.role ?? "unknown"; + userSource = args.local ? "local" : "sso"; + if (apmplusClient) { + try { + apmplusClient("config", { userId }); + } catch (error) { + console.warn("[telemetry] failed to update Studio user id:", error); + } + } + trackStudioEvent( + "studio_user_authenticated", + {}, + undefined, + { + dailyDedupeKey: [ + "studio_user_authenticated", + telemetryContext?.deployId ?? "", + userId, + userRole, + ].join(":"), + }, + ); +} diff --git a/frontend/src/adk/telemetryClassifiers.ts b/frontend/src/adk/telemetryClassifiers.ts new file mode 100644 index 00000000..ebb2b7b9 --- /dev/null +++ b/frontend/src/adk/telemetryClassifiers.ts @@ -0,0 +1,21 @@ +export function sandboxCreateErrorKind(error: unknown): string { + if ((error as Error | undefined)?.name === "AbortError") return "abort"; + if (error instanceof Error && error.name && error.name !== "Error") { + return error.name; + } + return "unknown"; +} + +export function agentDeployErrorKind(error: unknown, phase: string): string { + if (phase === "build") return "build_failed"; + if ((error as Error | undefined)?.name === "RuntimeProbeError") { + return "runtime_probe_error"; + } + if (error instanceof DOMException && error.name === "AbortError") { + return "abort"; + } + if (error instanceof Error && error.name && error.name !== "Error") { + return error.name; + } + return "unknown"; +} diff --git a/frontend/src/adk/telemetryEvents.ts b/frontend/src/adk/telemetryEvents.ts new file mode 100644 index 00000000..4b0fbe23 --- /dev/null +++ b/frontend/src/adk/telemetryEvents.ts @@ -0,0 +1,104 @@ +import { + agentDeployErrorKind, + sandboxCreateErrorKind, +} from "./telemetryClassifiers"; +import { trackStudioEvent } from "./telemetry"; +import type { SandboxAgentKind } from "./sandbox"; + +export type DeploymentTelemetrySource = + | "custom_create" + | "intelligent_create" + | "code_package" + | "unknown"; + +export interface StudioLoadedTelemetry { + agentsSource: "local" | "cloud"; +} + +export type SandboxTelemetryKind = "codex" | SandboxAgentKind; + +export interface AgentDeployTelemetryBase { + source: DeploymentTelemetrySource; + action: "create" | "update"; + region: string; + networkType: string; + feishuEnabled: boolean; +} + +export interface AgentDeploySucceededTelemetry extends AgentDeployTelemetryBase { + runtimeId: string; +} + +export interface AgentDeployFailedTelemetry extends AgentDeployTelemetryBase { + phase: string; + error: unknown; +} + +export interface SandboxCreateTelemetryBase { + kind: SandboxTelemetryKind; + source: "my_agents" | "new_chat"; +} + +export interface SandboxCreateSucceededTelemetry extends SandboxCreateTelemetryBase { + sessionId: string; +} + +export interface SandboxCreateFailedTelemetry extends SandboxCreateTelemetryBase { + error: unknown; +} + +function agentDeployCategories(args: AgentDeployTelemetryBase) { + return { + deploy_source: args.source, + deploy_action: args.action, + deploy_region: args.region, + runtime_network_type: args.networkType, + feishu_enabled: args.feishuEnabled, + }; +} + +export function trackStudioLoaded(args: StudioLoadedTelemetry): void { + trackStudioEvent( + "studio_instance_loaded", + { + agents_source: args.agentsSource, + }, + undefined, + { dedupeKey: "studio_instance_loaded" }, + ); +} + +export function trackAgentDeploySucceeded( + args: AgentDeploySucceededTelemetry, +): void { + trackStudioEvent("studio_agent_deploy_succeeded", { + ...agentDeployCategories(args), + runtime_id: args.runtimeId, + }); +} + +export function trackAgentDeployFailed(args: AgentDeployFailedTelemetry): void { + trackStudioEvent("studio_agent_deploy_failed", { + ...agentDeployCategories(args), + failed_phase: args.phase, + error_kind: agentDeployErrorKind(args.error, args.phase), + }); +} + +export function trackSandboxCreateSucceeded( + args: SandboxCreateSucceededTelemetry, +): void { + trackStudioEvent("studio_sandbox_create_succeeded", { + sandbox_kind: args.kind, + sandbox_source: args.source, + sandbox_session_id: args.sessionId, + }); +} + +export function trackSandboxCreateFailed(args: SandboxCreateFailedTelemetry): void { + trackStudioEvent("studio_sandbox_create_failed", { + sandbox_kind: args.kind, + sandbox_source: args.source, + error_kind: sandboxCreateErrorKind(args.error), + }); +} diff --git a/frontend/src/create/CodePackageCreate.tsx b/frontend/src/create/CodePackageCreate.tsx index e9670f75..06653240 100644 --- a/frontend/src/create/CodePackageCreate.tsx +++ b/frontend/src/create/CodePackageCreate.tsx @@ -190,6 +190,7 @@ export function CodePackageCreate({ onNetworkChange={setNetwork} deployRegion={deployRegion} onDeployRegionChange={setDeployRegion} + deploymentTelemetrySource="code_package" onBack={onBack} backLabel="返回创建方式" deployDisabled={!project || reading} diff --git a/frontend/src/create/CustomCreate.tsx b/frontend/src/create/CustomCreate.tsx index 1ba41ac5..ea6f6162 100644 --- a/frontend/src/create/CustomCreate.tsx +++ b/frontend/src/create/CustomCreate.tsx @@ -4060,6 +4060,7 @@ export function CustomCreate({ } deployRegion={deployRegion} onDeployRegionChange={setDeployRegion} + deploymentTelemetrySource="custom_create" onExportYaml={() => downloadText( `${draft.name || "agent"}.yaml`, diff --git a/frontend/src/create/IntelligentCreate.tsx b/frontend/src/create/IntelligentCreate.tsx index 801b8291..c7ef191e 100644 --- a/frontend/src/create/IntelligentCreate.tsx +++ b/frontend/src/create/IntelligentCreate.tsx @@ -471,6 +471,7 @@ export function IntelligentCreate({ onDeploy={handleDeploy} onAgentAdded={onAgentAdded} onDeploymentTaskChange={onDeploymentTaskChange} + deploymentTelemetrySource="intelligent_create" /> ) : (
diff --git a/frontend/src/ui/ProjectPreview.tsx b/frontend/src/ui/ProjectPreview.tsx index eb71a314..3f78c6af 100644 --- a/frontend/src/ui/ProjectPreview.tsx +++ b/frontend/src/ui/ProjectPreview.tsx @@ -77,6 +77,11 @@ import { type DeployStage, type IdentityUserPool, } from "../adk/client"; +import { + trackAgentDeployFailed, + trackAgentDeploySucceeded, + type DeploymentTelemetrySource, +} from "../adk/telemetryEvents"; import feishuLogo from "../assets/feishu-logo.svg"; import { buildZip } from "./zip"; import { ProjectCodeBrowser } from "./CodeBrowserDialog"; @@ -700,6 +705,8 @@ export interface ProjectPreviewProps { deployRegion?: string; /** Called when the user changes the deploy region. */ onDeployRegionChange?: (region: string) => void; + /** Creation entry used to group Studio deployment telemetry. */ + deploymentTelemetrySource?: DeploymentTelemetrySource; /** Deploy-page toolbar actions. */ onBack?: () => void; backLabel?: string; @@ -825,6 +832,7 @@ export function ProjectPreview({ onNetworkChange, deployRegion = "cn-beijing", onDeployRegionChange, + deploymentTelemetrySource = "unknown", onBack, backLabel = "返回配置", onExportYaml, @@ -987,6 +995,13 @@ export function ProjectPreview({ const selectedFile = project.files.find((f) => f.path === selected) ?? null; const networkMode = network?.mode ?? "public"; + const deploymentTelemetryBase = () => ({ + source: deploymentTelemetrySource, + action: deploymentRuntimeId ? "update" as const : "create" as const, + region: deployRegion, + networkType: networkMode, + feishuEnabled, + }); const automaticEnvRows = runtimeEnvDisplayRows( feishuEnabled ? [...deploymentEnv, ...FEISHU_ENV] : deploymentEnv, deploymentEnvValues, @@ -1299,6 +1314,10 @@ export function ProjectPreview({ setDeployResult(result); setActivePhase(null); } + trackAgentDeploySucceeded({ + ...deploymentTelemetryBase(), + runtimeId: result.runtimeId || deploymentRuntimeId || "", + }); onDeploymentTaskChange?.({ id: taskId, runtimeName: result.agentName || taskRuntimeName, @@ -1351,6 +1370,11 @@ export function ProjectPreview({ if (mountedRef.current) setDeployError(message); const buildLog = mergeBuildFailureLog(message); const failedInBuild = Boolean(buildLog); + trackAgentDeployFailed({ + ...deploymentTelemetryBase(), + phase: latestPhase, + error: err, + }); onDeploymentTaskChange?.({ id: taskId, runtimeName: taskRuntimeName, diff --git a/frontend/tests/studioAccess.test.mjs b/frontend/tests/studioAccess.test.mjs index 7c2981c0..cdb0e5f8 100644 --- a/frontend/tests/studioAccess.test.mjs +++ b/frontend/tests/studioAccess.test.mjs @@ -19,7 +19,9 @@ const cliFrontendSource = readFileSync( test("Studio access fails closed until the server-derived role is known", () => { assert.match(clientSource, /export type StudioRole = "admin" \| "developer" \| "user"/); - assert.match(clientSource, /export const DEFAULT_STUDIO_ACCESS[\s\S]*?createAgents: false[\s\S]*?manageAgents: false[\s\S]*?runtimeScope: "mine"/); + assert.match(clientSource, /telemetry:\s*\{\s*userId: string;\s*\}/); + assert.match(clientSource, /export const DEFAULT_STUDIO_ACCESS[\s\S]*?userId: ""[\s\S]*?createAgents: false[\s\S]*?manageAgents: false[\s\S]*?runtimeScope: "mine"/); + assert.match(clientSource, /typeof access\.telemetry\?\.userId !== "string"/); assert.match(clientSource, /apiFetch\("\/web\/access"\)/); assert.match(appSource, /if \(!access\) \{\s*return
;\s*\}/); assert.match(appSource, /setAccess\(DEFAULT_STUDIO_ACCESS\)/); diff --git a/frontend/tests/studioTelemetry.test.mjs b/frontend/tests/studioTelemetry.test.mjs new file mode 100644 index 00000000..4f6ef623 --- /dev/null +++ b/frontend/tests/studioTelemetry.test.mjs @@ -0,0 +1,148 @@ +import assert from "node:assert/strict"; +import { readdirSync, readFileSync, statSync } from "node:fs"; +import test from "node:test"; + +const srcRoot = new URL("../src/", import.meta.url); + +const appSource = readFileSync( + new URL("../src/App.tsx", import.meta.url), + "utf8", +); +const clientSource = readFileSync( + new URL("../src/adk/client.ts", import.meta.url), + "utf8", +); +const telemetrySource = readFileSync( + new URL("../src/adk/telemetry.ts", import.meta.url), + "utf8", +); +const telemetryEventsSource = readFileSync( + new URL("../src/adk/telemetryEvents.ts", import.meta.url), + "utf8", +); +const telemetryClassifiersSource = readFileSync( + new URL("../src/adk/telemetryClassifiers.ts", import.meta.url), + "utf8", +); +const projectPreviewSource = readFileSync( + new URL("../src/ui/ProjectPreview.tsx", import.meta.url), + "utf8", +); +const customCreateSource = readFileSync( + new URL("../src/create/CustomCreate.tsx", import.meta.url), + "utf8", +); +const intelligentCreateSource = readFileSync( + new URL("../src/create/IntelligentCreate.tsx", import.meta.url), + "utf8", +); +const codePackageCreateSource = readFileSync( + new URL("../src/create/CodePackageCreate.tsx", import.meta.url), + "utf8", +); + +function sourceFiles(dirUrl) { + return readdirSync(dirUrl, { withFileTypes: true }).flatMap((entry) => { + const entryUrl = new URL(`${entry.name}${entry.isDirectory() ? "/" : ""}`, dirUrl); + if (entry.isDirectory()) return sourceFiles(entryUrl); + if (!entry.name.endsWith(".ts") && !entry.name.endsWith(".tsx")) return []; + return [entryUrl]; + }); +} + +function relativeSourcePath(fileUrl) { + return decodeURIComponent(fileUrl.pathname) + .split("/frontend/src/") + .at(-1); +} + +test("normalizes Studio telemetry from /web/ui-config", () => { + assert.match(clientSource, /export interface StudioTelemetryConfig/); + assert.match(clientSource, /function normalizeStudioTelemetryConfig/); + assert.match(clientSource, /telemetry: normalizeStudioTelemetryConfig\(d\.telemetry\)/); + assert.match(clientSource, /DISABLED_STUDIO_TELEMETRY/); +}); + +test("initializes APMPlus lazily and sends Studio custom events", () => { + assert.match(telemetrySource, /import\("@apmplus\/web"\)/); + assert.match(telemetrySource, /client\("init"/); + assert.match(telemetrySource, /client\("start"\)/); + assert.match(telemetrySource, /apmplusClient\("config", \{ userId \}\)/); + assert.match(telemetrySource, /apmplusClient\("report"/); + assert.match(telemetrySource, /ev_type: "custom"/); +}); + +test("tracks Studio load, authenticated users, Agent deploy results, and Sandbox creation results", () => { + assert.match(appSource, /initStudioTelemetry\(cfg\.telemetry\)/); + assert.match(appSource, /trackStudioLoaded/); + assert.match(telemetryEventsSource, /"studio_instance_loaded"/); + assert.match(appSource, /identifyStudioTelemetryUser/); + assert.match(appSource, /userId: access\.telemetry\.userId/); + assert.doesNotMatch(telemetrySource, /function identityName/); + assert.match(telemetrySource, /name !== "studio_instance_loaded"/); + assert.match(telemetrySource, /"studio_agent_deploy_succeeded"/); + assert.match(telemetrySource, /"studio_agent_deploy_failed"/); + assert.match(telemetrySource, /"studio_sandbox_create_succeeded"/); + assert.match(telemetrySource, /"studio_sandbox_create_failed"/); + assert.match(telemetrySource, /user_id: userId/); + assert.doesNotMatch(clientSource, /deployerId/); + assert.doesNotMatch(telemetrySource, /deployer_id/); + assert.match(telemetryEventsSource, /trackStudioEvent\("studio_agent_deploy_succeeded"/); + assert.match(telemetryEventsSource, /trackStudioEvent\("studio_agent_deploy_failed"/); + assert.match(telemetryEventsSource, /runtime_id: args\.runtimeId/); + assert.match(telemetryEventsSource, /failed_phase: args\.phase/); + assert.match(telemetryEventsSource, /error_kind: agentDeployErrorKind\(args\.error, args\.phase\)/); + assert.match(projectPreviewSource, /trackAgentDeploySucceeded/); + assert.match(projectPreviewSource, /trackAgentDeployFailed/); + assert.doesNotMatch(projectPreviewSource, /trackStudioEvent/); + assert.doesNotMatch(projectPreviewSource, /function deploymentErrorKind/); + assert.doesNotMatch(projectPreviewSource, /studio_agent_deploy_started/); + assert.match(telemetryEventsSource, /trackStudioEvent\("studio_sandbox_create_succeeded"/); + assert.match(telemetryEventsSource, /trackStudioEvent\("studio_sandbox_create_failed"/); + assert.match(telemetryEventsSource, /sandbox_kind: args\.kind/); + assert.match(telemetryEventsSource, /sandbox_source: args\.source/); + assert.match(telemetryEventsSource, /sandbox_session_id: args\.sessionId/); + assert.match(telemetryEventsSource, /error_kind: sandboxCreateErrorKind\(args\.error\)/); + assert.match(appSource, /trackSandboxCreateSucceeded/); + assert.match(appSource, /trackSandboxCreateFailed/); + assert.doesNotMatch(appSource, /trackStudioEvent/); + assert.doesNotMatch(appSource, /function sandboxTelemetryErrorKind/); + assert.doesNotMatch(appSource, /studio_sandbox_create_started/); + assert.doesNotMatch(telemetrySource, /studio_sandbox_create_started/); +}); + +test("keeps telemetry event schema and error classification outside UI components", () => { + assert.match(telemetryEventsSource, /export type DeploymentTelemetrySource/); + assert.match(telemetryEventsSource, /agentsSource: "local" \| "cloud"/); + assert.match(telemetryEventsSource, /export type SandboxTelemetryKind = "codex" \| SandboxAgentKind/); + assert.match(telemetryEventsSource, /function agentDeployCategories/); + assert.match(telemetryClassifiersSource, /export function agentDeployErrorKind/); + assert.match(telemetryClassifiersSource, /export function sandboxCreateErrorKind/); + assert.match(telemetryClassifiersSource, /name === "RuntimeProbeError"/); + assert.doesNotMatch(telemetryClassifiersSource, /from "\.\/client"/); + assert.doesNotMatch(projectPreviewSource, /export type DeploymentTelemetrySource/); + assert.doesNotMatch(projectPreviewSource, /deploy_source:/); + assert.doesNotMatch(projectPreviewSource, /runtime_network_type:/); + assert.doesNotMatch(appSource, /sandbox_kind:/); + assert.doesNotMatch(appSource, /sandbox_session_id:/); +}); + +test("keeps raw Studio event reporting behind telemetry event wrappers", () => { + const allowed = new Set(["adk/telemetry.ts", "adk/telemetryEvents.ts"]); + const offenders = sourceFiles(srcRoot) + .filter((fileUrl) => statSync(fileUrl).isFile()) + .map((fileUrl) => ({ + path: relativeSourcePath(fileUrl), + source: readFileSync(fileUrl, "utf8"), + })) + .filter(({ path, source }) => !allowed.has(path) && /\btrackStudioEvent\(/.test(source)) + .map(({ path }) => path); + + assert.deepEqual(offenders, []); +}); + +test("tags deploy telemetry with the creation workflow source", () => { + assert.match(customCreateSource, /deploymentTelemetrySource="custom_create"/); + assert.match(intelligentCreateSource, /deploymentTelemetrySource="intelligent_create"/); + assert.match(codePackageCreateSource, /deploymentTelemetrySource="code_package"/); +}); diff --git a/tests/cli/test_frontend_runtime_proxy.py b/tests/cli/test_frontend_runtime_proxy.py index 7d5e48d5..a6ee3b01 100644 --- a/tests/cli/test_frontend_runtime_proxy.py +++ b/tests/cli/test_frontend_runtime_proxy.py @@ -19,7 +19,7 @@ from pathlib import Path from threading import Barrier from types import SimpleNamespace -from typing import Any +from typing import Any, ClassVar import httpx import pytest @@ -29,9 +29,10 @@ from veadk.cli.cli_frontend import ( _build_agentkit_proxy_headers, _frontend_allow_origins, - _runtime_regions, _run_frontend_server, + _runtime_regions, ) +from veadk.consts import STUDIO_APMPLUS_DOMAIN, STUDIO_APMPLUS_ENV def _create_frontend_app( @@ -146,6 +147,79 @@ def test_ui_config_serves_custom_branding( assert logo_response.content == logo +def test_ui_config_serves_studio_telemetry_config( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_AID", "12345") + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_TOKEN", "client-token") + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_DOMAIN", "apmplus.example.com") + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_ENV", "test") + monkeypatch.setenv("VEADK_STUDIO_DEPLOY_ID", "stddep_test") + monkeypatch.setenv("VEADK_STUDIO_USER_POOL_ID", "pool-id") + monkeypatch.setenv("VEADK_STUDIO_APPLICATION_ID", "app-id") + monkeypatch.setenv("VEADK_STUDIO_FUNCTION_ID", "func-id") + monkeypatch.setenv("VEADK_STUDIO_DEPLOY_REGION", "cn-beijing") + monkeypatch.setenv("VEADK_STUDIO_PROJECT", "studio-project") + app = _create_frontend_app(monkeypatch, tmp_path) + + with TestClient(app) as client: + response = client.get("/web/ui-config") + + assert response.status_code == 200 + telemetry = response.json()["telemetry"] + assert telemetry["enabled"] is True + assert telemetry["provider"] == "apmplus" + assert telemetry["apmplus"] == { + "aid": 12345, + "token": "client-token", + "domain": "apmplus.example.com", + "env": "test", + } + assert telemetry["studio"]["deployId"] == "stddep_test" + assert telemetry["studio"]["userPoolId"] == "pool-id" + assert telemetry["studio"]["applicationId"] == "app-id" + assert telemetry["studio"]["functionId"] == "func-id" + assert telemetry["studio"]["region"] == "cn-beijing" + assert telemetry["studio"]["project"] == "studio-project" + + +def test_ui_config_uses_fixed_studio_apmplus_domain_and_env( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_AID", "12345") + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_TOKEN", "client-token") + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_DOMAIN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_ENV", raising=False) + app = _create_frontend_app(monkeypatch, tmp_path) + + with TestClient(app) as client: + response = client.get("/web/ui-config") + + assert response.status_code == 200 + assert response.json()["telemetry"]["apmplus"] == { + "aid": 12345, + "token": "client-token", + "domain": STUDIO_APMPLUS_DOMAIN, + "env": STUDIO_APMPLUS_ENV, + } + + +def test_ui_config_disables_studio_telemetry_without_token( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_AID", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_TOKEN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_DOMAIN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_ENV", raising=False) + app = _create_frontend_app(monkeypatch, tmp_path) + + with TestClient(app) as client: + response = client.get("/web/ui-config") + + assert response.status_code == 200 + assert response.json()["telemetry"] == {"enabled": False} + + def test_runtime_list_paginates_across_regions( monkeypatch: pytest.MonkeyPatch, tmp_path: Path ) -> None: @@ -424,7 +498,7 @@ def get_runtime(self, request: Any) -> SimpleNamespace: class _FakeUpstreamResponse: status_code = 200 - headers = {"content-type": "application/json"} + headers: ClassVar[dict[str, str]] = {"content-type": "application/json"} async def aiter_raw(self): yield b'["demo_agent"]' @@ -503,7 +577,7 @@ def get_runtime(self, request: Any) -> SimpleNamespace: class _FakeUpstreamResponse: status_code = 200 - headers = {"content-type": "application/json"} + headers: ClassVar[dict[str, str]] = {"content-type": "application/json"} async def aiter_raw(self): yield b"{}" @@ -725,7 +799,7 @@ def get_runtime(self, request: Any) -> SimpleNamespace: class _FakeUpstreamResponse: status_code = 200 - headers = {"content-type": "application/json"} + headers: ClassVar[dict[str, str]] = {"content-type": "application/json"} async def aiter_raw(self): yield b"{}" diff --git a/tests/cli/test_studio_deploy_target.py b/tests/cli/test_studio_deploy_target.py index a550b291..f2421e17 100644 --- a/tests/cli/test_studio_deploy_target.py +++ b/tests/cli/test_studio_deploy_target.py @@ -20,17 +20,25 @@ import pytest from click.testing import CliRunner -from volcenginesdkcore.rest import ApiException +from typing_extensions import Self from volcenginesdkcore.interceptor.interceptors.build_request_interceptor import ( sanitize_for_serialization, ) +from volcenginesdkcore.rest import ApiException from veadk.cli.cli_frontend import ( _resolve_studio_cloud_credentials, _resolve_studio_identity_region, studio, ) +from veadk.cli.studio_telemetry import ( + studio_apmplus_environment_from_options, +) from veadk.config import veadk_environments +from veadk.consts import ( + STUDIO_APMPLUS_DOMAIN, + STUDIO_APMPLUS_ENV, +) from veadk.integrations.ve_identity.identity_client import IdentityClient @@ -369,6 +377,160 @@ def register_callback_for_user_pool_client(self, **kwargs: object) -> None: assert callback["skip_consent_enabled"] is True +def test_studio_deploy_persists_telemetry_environment( + monkeypatch: pytest.MonkeyPatch, +) -> None: + captured: dict[str, object] = {} + + class _FakeVefaasService: + def update_function_envs_and_release( + self, + function_id: str, + environment: dict[str, str], + ) -> None: + captured["release_function_id"] = function_id + captured["release_environment"] = environment + + class _FakeCloudAgentEngine: + def __init__(self, **_: object) -> None: + self._vefaas_service = _FakeVefaasService() + + def deploy(self, **_: object) -> SimpleNamespace: + return SimpleNamespace( + vefaas_endpoint="https://studio.example.com", + vefaas_application_id="app-id", + vefaas_function_id="function-id", + ) + + monkeypatch.setattr( + "veadk.cloud.cloud_agent_engine.CloudAgentEngine", _FakeCloudAgentEngine + ) + monkeypatch.setattr( + "veadk.cli.cli_frontend._resolve_studio_identity_region", + lambda **_: "cn-beijing", + ) + monkeypatch.setattr( + "veadk.integrations.ve_identity.identity_client.IdentityClient.register_callback_for_user_pool_client", + lambda *_args, **_kwargs: None, + ) + result = CliRunner().invoke( + studio, + [ + "deploy", + "--user-pool-id", + "pool-id", + "--allowed-client-id", + "client-id", + "--vefaas-app-name", + "studio-app", + "--sandbox-chat-codex-tool-id", + "chat-code-env-id", + "--sandbox-chat-openclaw-tool-id", + "openclaw-tool-id", + "--sandbox-chat-hermes-tool-id", + "hermes-tool-id", + "--sandbox-skill-creator-tool-id", + "skill-code-env-id", + "--iam-role", + "trn:iam::role/test", + "--gateway-name", + "gateway", + "--volcengine-access-key", + "ak-for-deployer", + "--volcengine-secret-key", + "sk-for-deployer", + "--apmplus-aid", + "12345", + "--apmplus-token", + "client-token", + "--apmplus-domain", + "apmplus.example.com", + "--apmplus-env", + "test", + ], + ) + + assert result.exit_code == 0, result.output + deploy_id = veadk_environments["VEADK_STUDIO_DEPLOY_ID"] + assert deploy_id.startswith("stddep_") + assert veadk_environments["VEADK_STUDIO_USER_POOL_ID"] == "pool-id" + assert veadk_environments["VEADK_STUDIO_DEPLOY_REGION"] == "cn-beijing" + assert veadk_environments["VEADK_STUDIO_APMPLUS_AID"] == "12345" + assert veadk_environments["VEADK_STUDIO_APMPLUS_TOKEN"] == "client-token" + assert veadk_environments["VEADK_STUDIO_APMPLUS_DOMAIN"] == ("apmplus.example.com") + assert veadk_environments["VEADK_STUDIO_APMPLUS_ENV"] == "test" + + assert captured["release_function_id"] == "function-id" + release_environment = captured["release_environment"] + assert isinstance(release_environment, dict) + assert release_environment["OAUTH2_REDIRECT_URI"] == ( + "https://studio.example.com/oauth2/callback" + ) + assert release_environment["VEADK_STUDIO_DEPLOY_ID"] == deploy_id + assert release_environment["VEADK_STUDIO_USER_POOL_ID"] == "pool-id" + assert release_environment["VEADK_STUDIO_APMPLUS_AID"] == "12345" + assert release_environment["VEADK_STUDIO_APPLICATION_ID"] == "app-id" + assert release_environment["VEADK_STUDIO_FUNCTION_ID"] == "function-id" + + +def test_studio_apmplus_options_are_empty_without_token( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_AID", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_TOKEN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_DOMAIN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_ENV", raising=False) + + values = studio_apmplus_environment_from_options( + apmplus_aid="", + apmplus_token="", + apmplus_domain="", + apmplus_env="", + ) + + assert values == {} + + +def test_studio_apmplus_options_require_aid_with_token( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_AID", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_TOKEN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_DOMAIN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_ENV", raising=False) + + with pytest.raises(Exception, match="requires both --apmplus-aid"): + studio_apmplus_environment_from_options( + apmplus_aid="", + apmplus_token="client-token", + apmplus_domain="", + apmplus_env="", + ) + + +def test_studio_apmplus_options_use_fixed_domain_and_production_env( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_AID", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_TOKEN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_DOMAIN", raising=False) + monkeypatch.delenv("VEADK_STUDIO_APMPLUS_ENV", raising=False) + + values = studio_apmplus_environment_from_options( + apmplus_aid="12345", + apmplus_token="client-token", + apmplus_domain="", + apmplus_env="", + ) + + assert values == { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + "VEADK_STUDIO_APMPLUS_DOMAIN": STUDIO_APMPLUS_DOMAIN, + "VEADK_STUDIO_APMPLUS_ENV": STUDIO_APMPLUS_ENV, + } + + def test_studio_deploy_creates_distinct_sandbox_tools_when_ids_are_omitted( monkeypatch: pytest.MonkeyPatch, ) -> None: @@ -796,7 +958,7 @@ def _fake_build(command: list[str], check: bool) -> None: (output_dir / "veadk_python-test-py3-none-any.whl").write_bytes(b"wheel") class _FakeWheelResponse: - def __enter__(self) -> "_FakeWheelResponse": + def __enter__(self) -> Self: return self def __exit__(self, *_: object) -> None: diff --git a/tests/cli/test_studio_rbac.py b/tests/cli/test_studio_rbac.py index ffe9f704..5bdffa74 100644 --- a/tests/cli/test_studio_rbac.py +++ b/tests/cli/test_studio_rbac.py @@ -577,7 +577,9 @@ def test_access_endpoint_resolves_local_roles_and_blocks_user_management( assert admin.json()["role"] == "admin" assert developer.json()["role"] == "developer" + assert developer.json()["telemetry"] == {"userId": "developer"} assert user.json()["role"] == "user" + assert user.json()["telemetry"]["userId"] == "reader" assert forbidden.status_code == 403 assert skill_creator_forbidden.status_code == 403 diff --git a/tests/cli/test_studio_release.py b/tests/cli/test_studio_release.py index 863867e5..7e4daf43 100644 --- a/tests/cli/test_studio_release.py +++ b/tests/cli/test_studio_release.py @@ -26,6 +26,11 @@ stage_studio_dependency_wheels, write_studio_dependency_manifest, ) +from veadk.cli.studio_package import ( + STUDIO_RELEASE_ENVIRONMENT_FILENAME, + read_studio_release_environment, + write_studio_package, +) from veadk.cli.studio_release import ( StudioReleaseError, StudioReleaseManifest, @@ -314,7 +319,27 @@ def test_write_dependency_manifest_uses_pinned_wheel_metadata( } -def test_publish_workflow_sends_only_release_metadata() -> None: +def test_studio_package_carries_release_environment(tmp_path: Path) -> None: + package = tmp_path / "package" + + write_studio_package( + package, + requirements="veadk-python\n", + site_logo=None, + release_environment={ + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + }, + ) + + assert read_studio_release_environment(package, remove=True) == { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + } + assert not (package / STUDIO_RELEASE_ENVIRONMENT_FILENAME).exists() + + +def test_publish_workflow_sends_release_request_to_server() -> None: workflow = ( Path(__file__).parents[2] / ".github/workflows/publish-studio-release.yaml" ).read_text(encoding="utf-8") @@ -325,6 +350,18 @@ def test_publish_workflow_sends_only_release_metadata() -> None: assert 'source_root = Path(os.environ["GITHUB_WORKSPACE"])' in workflow +def test_publish_workflow_sends_studio_apmplus_release_config() -> None: + workflow = ( + Path(__file__).parents[2] / ".github/workflows/publish-studio-release.yaml" + ).read_text(encoding="utf-8") + + assert "STUDIO_APMPLUS_AID: ${{ vars.STUDIO_APMPLUS_AID }}" in workflow + assert "STUDIO_APMPLUS_TOKEN: ${{ secrets.STUDIO_APMPLUS_TOKEN }}" in workflow + assert 'payload_data["studioApmplus"]' in workflow + assert '"domain"' not in workflow + assert '"env"' not in workflow + + def test_build_release_uses_prepared_frontend_and_wheels( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, @@ -336,7 +373,7 @@ def test_build_release_uses_prepared_frontend_and_wheels( (frontend_assets / "index.html").write_text("studio", encoding="utf-8") dependency_wheels = tmp_path / "prepared-wheels" dependency_wheels.mkdir() - captured: dict[str, Path | None] = {} + captured: dict[str, object] = {} def fail_frontend_build(*_args: object) -> None: raise AssertionError("Prepared frontend must skip npm build") @@ -359,8 +396,10 @@ def write_package( *, requirements: str, site_logo: object, + release_environment: dict[str, str], ) -> None: del site_logo + captured["release_environment"] = release_environment (package_dir / "requirements.txt").write_text( requirements, encoding="utf-8", @@ -378,6 +417,8 @@ def write_package( "veadk.cli.studio_package.write_studio_package", write_package, ) + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_AID", "12345") + monkeypatch.setenv("VEADK_STUDIO_APMPLUS_TOKEN", "client-token") bundle, manifest = build_studio_release( source_root=source_root, @@ -393,4 +434,8 @@ def write_package( assert captured == { "frontend": frontend_assets, "wheels": dependency_wheels, + "release_environment": { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + }, } diff --git a/tests/cli/test_studio_self_update.py b/tests/cli/test_studio_self_update.py index 445fcffd..38334369 100644 --- a/tests/cli/test_studio_self_update.py +++ b/tests/cli/test_studio_self_update.py @@ -14,6 +14,7 @@ """Tests for the VeFaaS-hosted Studio self-update service.""" import hashlib +import json import time import zipfile from pathlib import Path @@ -25,6 +26,7 @@ from fastapi.testclient import TestClient from veadk.cli.frontend_branding import SiteLogo +from veadk.cli.studio_package import STUDIO_RELEASE_ENVIRONMENT_FILENAME from veadk.cli.studio_release import StudioReleaseError, StudioReleaseManifest from veadk.cli.studio_self_update import ( StudioSelfUpdater, @@ -90,10 +92,20 @@ def _settings() -> StudioUpdateSettings: ) -def _bundle(path: Path, *, unsafe_name: str | None = None) -> None: +def _bundle( + path: Path, + *, + unsafe_name: str | None = None, + release_environment: dict[str, str] | None = None, +) -> None: with zipfile.ZipFile(path, "w") as archive: archive.writestr("run.sh", "#!/bin/bash\n") archive.writestr("requirements.txt", "veadk-python\n") + if release_environment: + archive.writestr( + STUDIO_RELEASE_ENVIRONMENT_FILENAME, + json.dumps(release_environment), + ) if unsafe_name: archive.writestr(unsafe_name, "unsafe") @@ -132,7 +144,13 @@ def test_submit_latest_uses_fixed_deployment_ids_and_sts( tmp_path: Path, ) -> None: archive = tmp_path / "source.zip" - _bundle(archive) + _bundle( + archive, + release_environment={ + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + }, + ) content = archive.read_bytes() manifest = StudioReleaseManifest( version="20260724153045", @@ -164,6 +182,7 @@ def submit_application_code_bundle_update(self, **kwargs: Any) -> None: package = Path(str(kwargs["path"])) assert (package / "run.sh").is_file() assert (package / "requirements.txt").is_file() + assert not (package / STUDIO_RELEASE_ENVIRONMENT_FILENAME).exists() captured["update"] = kwargs updater = StudioSelfUpdater( @@ -188,7 +207,9 @@ def submit_application_code_bundle_update(self, **kwargs: Any) -> None: assert update["application_id"] == "application-id" assert update["function_id"] == "function-id" assert update["environment_overrides"] == { - "VEADK_STUDIO_RELEASE_VERSION": manifest.version + "VEADK_STUDIO_RELEASE_VERSION": manifest.version, + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", } status = updater.status() assert status["state"] == "updating" diff --git a/tests/cli/test_studio_telemetry.py b/tests/cli/test_studio_telemetry.py new file mode 100644 index 00000000..2f851476 --- /dev/null +++ b/tests/cli/test_studio_telemetry.py @@ -0,0 +1,116 @@ +# 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. + +import pytest + +from veadk.cli.studio_telemetry import ( + StudioTelemetryConfigurationError, + normalize_studio_apmplus_release_environment, + studio_apmplus_environment_from_options, + studio_apmplus_release_environment_from_env, + studio_telemetry_config, +) +from veadk.consts import STUDIO_APMPLUS_DOMAIN, STUDIO_APMPLUS_ENV + + +def test_studio_telemetry_config_builds_ui_payload_from_environment() -> None: + config = studio_telemetry_config( + "20260805120000", + environ={ + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + "VEADK_STUDIO_DEPLOY_ID": "stddep_123", + "VEADK_STUDIO_USER_POOL_ID": "pool-id", + "VEADK_STUDIO_APPLICATION_ID": "app-id", + "VEADK_STUDIO_FUNCTION_ID": "function-id", + "VEADK_STUDIO_DEPLOY_REGION": "cn-beijing", + "VEADK_STUDIO_PROJECT": "default", + }, + ) + + assert config == { + "enabled": True, + "provider": "apmplus", + "apmplus": { + "aid": 12345, + "token": "client-token", + "domain": STUDIO_APMPLUS_DOMAIN, + "env": STUDIO_APMPLUS_ENV, + }, + "studio": { + "deployId": "stddep_123", + "userPoolId": "pool-id", + "applicationId": "app-id", + "functionId": "function-id", + "region": "cn-beijing", + "project": "default", + "version": "20260805120000", + }, + } + + +def test_studio_apmplus_environment_from_options_requires_aid_and_token() -> None: + with pytest.raises( + StudioTelemetryConfigurationError, + match="requires both --apmplus-aid", + ): + studio_apmplus_environment_from_options( + apmplus_aid="", + apmplus_token="client-token", + apmplus_domain="", + apmplus_env="", + environ={}, + ) + + +def test_studio_apmplus_environment_from_options_uses_fixed_defaults() -> None: + assert studio_apmplus_environment_from_options( + apmplus_aid="12345", + apmplus_token="client-token", + apmplus_domain="", + apmplus_env="", + environ={}, + ) == { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + "VEADK_STUDIO_APMPLUS_DOMAIN": STUDIO_APMPLUS_DOMAIN, + "VEADK_STUDIO_APMPLUS_ENV": STUDIO_APMPLUS_ENV, + } + + +def test_release_environment_carries_only_aid_and_token() -> None: + assert studio_apmplus_release_environment_from_env( + environ={ + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + "VEADK_STUDIO_APMPLUS_DOMAIN": "apmplus.example.com", + }, + ) == { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + } + + +def test_release_environment_rejects_unknown_internal_keys() -> None: + with pytest.raises( + StudioTelemetryConfigurationError, + match="Unsupported Studio release environment key", + ): + normalize_studio_apmplus_release_environment( + { + "VEADK_STUDIO_APMPLUS_AID": "12345", + "VEADK_STUDIO_APMPLUS_TOKEN": "client-token", + "VEADK_STUDIO_APMPLUS_DOMAIN": "apmplus.example.com", + } + ) diff --git a/tests/test_studio_release_server.py b/tests/test_studio_release_server.py index 91a6f7fd..adeadd7b 100644 --- a/tests/test_studio_release_server.py +++ b/tests/test_studio_release_server.py @@ -188,6 +188,31 @@ def _request(request_id: str = "12345-1") -> ReleaseRequest: ) +def test_release_request_accepts_studio_apmplus_config() -> None: + request = ReleaseRequest( + repository="volcengine/veadk-python", + gitSha="a" * 40, + requestId="12345-1", + changelog=("发布 Studio 更新",), + studioApmplus={"aid": " 12345 ", "token": " client-token "}, + ) + + assert request.studio_apmplus is not None + assert request.studio_apmplus.aid == "12345" + assert request.studio_apmplus.token == "client-token" + + +def test_release_request_rejects_invalid_studio_apmplus_config() -> None: + with pytest.raises(ValueError, match="Studio APMPlus aid"): + ReleaseRequest( + repository="volcengine/veadk-python", + gitSha="a" * 40, + requestId="12345-1", + changelog=("发布 Studio 更新",), + studioApmplus={"aid": "not-an-aid", "token": "client-token"}, + ) + + def _service() -> ReleaseService: settings = _settings() source_store = _MemorySourceStore() @@ -423,6 +448,51 @@ def test_builder_prefers_domestic_source_and_node_mirrors() -> None: ) +def test_builder_passes_studio_apmplus_to_publisher_environment( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + request = ReleaseRequest( + repository="volcengine/veadk-python", + gitSha="a" * 40, + requestId="12345-1", + changelog=("发布 Studio 更新",), + studioApmplus={"aid": "12345", "token": "client-token"}, + ) + captured: dict[str, dict[str, str]] = {} + + monkeypatch.setattr( + release_builder, + "resolve_credentials", + lambda: SimpleNamespace( + access_key="release-ak", + secret_key="release-sk", + session_token="release-sts", + ), + ) + + def _run(command: list[str], **kwargs: Any) -> subprocess.CompletedProcess[Any]: + captured["env"] = kwargs["env"] + return subprocess.CompletedProcess(command, 0) + + monkeypatch.setattr(release_builder.subprocess, "run", _run) + builder = StudioReleaseBuilder(_settings()) + + builder._run_publisher( + request=request, + source_root=tmp_path, + output_dir=tmp_path / "dist", + version="20260805170000", + node_bin=None, + uv=Path("/bin/uv"), + frontend_assets=None, + dependency_wheels=None, + ) + + assert captured["env"]["VEADK_STUDIO_APMPLUS_AID"] == "12345" + assert captured["env"]["VEADK_STUDIO_APMPLUS_TOKEN"] == "client-token" + assert captured["env"]["VOLCENGINE_ACCESS_KEY"] == "release-ak" + + def test_builder_shallow_clones_only_main_build_files( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index 951c98a0..9507f5c3 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -31,19 +31,25 @@ import tempfile import unicodedata import zipfile - from collections.abc import Iterable from concurrent.futures import ThreadPoolExecutor from pathlib import Path from time import monotonic from typing import Any, Literal from urllib.parse import urlparse +from uuid import uuid4 import click from pydantic import BaseModel, Field from veadk.cli.agentkit_sandbox_region import is_agentkit_resource_not_found from veadk.cli.frontend_branding import normalize_site_title, resolve_site_logo +from veadk.cli.studio_telemetry import ( + StudioTelemetryConfigurationError, + studio_apmplus_environment_from_options, + studio_telemetry_config, +) +from veadk.consts import STUDIO_APMPLUS_ENV from veadk.utils.logger import get_logger logger = get_logger(__name__) @@ -282,6 +288,10 @@ def _safe_exception_detail( return "\nCaused by:\n".join(parts) +def _new_studio_deploy_id() -> str: + return f"stddep_{uuid4().hex}" + + def _claims_from_forwarded_jwt(authorization: str | None) -> dict | None: """Decode the JWT an upstream API gateway forwarded in the Authorization header, WITHOUT re-verifying its signature. @@ -1103,7 +1113,11 @@ async def _web_access(request: Request): principal = _current_principal(request) if access_policy.enabled and principal is None: raise HTTPException(status_code=401, detail="Studio identity is required") - return access_policy.access_payload(principal) + payload = access_policy.access_payload(principal) + payload["telemetry"] = { + "userId": principal.owner_id if principal else "", + } + return payload def _resolve_ve_credentials() -> tuple[str, str, str | None]: """Resolve cloud credentials as (access_key, secret_key, session_token). @@ -1444,9 +1458,10 @@ async def _web_ui_config(): as `veadk frontend` — all modules (chat/search/skill-center/history + add/manage agent) enabled, landing on the chat view. The `studio` flag is informational.""" + version = current_studio_display_version() return { "studio": studio, - "version": current_studio_display_version(), + "version": version, "branding": { "title": branding_title, "logoUrl": "/web/site-logo" if branding_logo is not None else "", @@ -1466,6 +1481,7 @@ async def _web_ui_config(): "generatedAgentTestRunDisabledReason": "", }, "defaultView": "chat", + "telemetry": studio_telemetry_config(version), } @app.get("/web/agent-info/{app_name}") @@ -6528,6 +6544,30 @@ def _resolve_studio_cloud_credentials( envvar="VEADK_STUDIO_UPDATE_PREFIX", help="TOS object prefix for the Studio main release channel.", ) +@click.option( + "--apmplus-aid", + default="", + envvar="VEADK_STUDIO_APMPLUS_AID", + help="APMPlus Client aid for Studio frontend telemetry.", +) +@click.option( + "--apmplus-token", + default="", + envvar="VEADK_STUDIO_APMPLUS_TOKEN", + help="APMPlus Client token for Studio frontend telemetry.", +) +@click.option( + "--apmplus-domain", + default="", + envvar="VEADK_STUDIO_APMPLUS_DOMAIN", + help="APMPlus Client reporting domain. Default: apmplus.volces.com.", +) +@click.option( + "--apmplus-env", + default="", + envvar="VEADK_STUDIO_APMPLUS_ENV", + help=f"APMPlus environment name. Default: {STUDIO_APMPLUS_ENV}.", +) def frontend_deploy( user_pool_id: str, allowed_client_id: str, @@ -6555,6 +6595,10 @@ def frontend_deploy( studio_update_bucket: str, studio_update_region: str | None, studio_update_prefix: str, + apmplus_aid: str, + apmplus_token: str, + apmplus_domain: str, + apmplus_env: str, ) -> None: """Deploy the SSO web frontend to VeFaaS. @@ -6572,6 +6616,15 @@ def frontend_deploy( branding_logo = resolve_site_logo(site_logo) except ValueError as error: raise click.ClickException(str(error)) from error + try: + apmplus_environment = studio_apmplus_environment_from_options( + apmplus_aid=apmplus_aid, + apmplus_token=apmplus_token, + apmplus_domain=apmplus_domain, + apmplus_env=apmplus_env, + ) + except StudioTelemetryConfigurationError as error: + raise click.ClickException(str(error)) from error ak, sk, session_token = _resolve_studio_cloud_credentials( volcengine_access_key, @@ -6787,6 +6840,11 @@ def frontend_deploy( veadk_environments["VEADK_STUDIO_UPDATE_REGION"] = studio_update_region or region veadk_environments["VEADK_STUDIO_UPDATE_PREFIX"] = studio_update_prefix veadk_environments["VEADK_STUDIO_PROJECT"] = project + studio_deploy_id = _new_studio_deploy_id() + veadk_environments["VEADK_STUDIO_DEPLOY_ID"] = studio_deploy_id + veadk_environments["VEADK_STUDIO_USER_POOL_ID"] = user_pool_id + veadk_environments["VEADK_STUDIO_DEPLOY_REGION"] = region + veadk_environments.update(apmplus_environment) if client_secret: veadk_environments["OAUTH2_CLIENT_SECRET"] = client_secret @@ -6900,7 +6958,15 @@ def frontend_deploy( function_id = getattr(app, "vefaas_function_id", "") if url and function_id: click.echo(f"Setting OAUTH2_REDIRECT_URI={redirect_uri} and re-releasing…") - release_environment = {"OAUTH2_REDIRECT_URI": redirect_uri} + release_environment = { + "OAUTH2_REDIRECT_URI": redirect_uri, + "VEADK_STUDIO_DEPLOY_ID": studio_deploy_id, + "VEADK_STUDIO_USER_POOL_ID": veadk_environments[ + "VEADK_STUDIO_USER_POOL_ID" + ], + "VEADK_STUDIO_DEPLOY_REGION": region, + } + release_environment.update(apmplus_environment) if studio_update_bucket: release_environment.update( { diff --git a/veadk/cli/studio_package.py b/veadk/cli/studio_package.py index f204e20a..db9c76bb 100644 --- a/veadk/cli/studio_package.py +++ b/veadk/cli/studio_package.py @@ -16,14 +16,21 @@ from __future__ import annotations +import json import shutil import subprocess import sys from pathlib import Path from veadk.cli.studio_dependencies import stage_studio_dependency_wheels +from veadk.cli.studio_telemetry import ( + normalize_studio_apmplus_release_environment, + studio_apmplus_release_environment_from_env, +) from veadk.cli.frontend_branding import SiteLogo +STUDIO_RELEASE_ENVIRONMENT_FILENAME = ".studio-release-environment.json" + def studio_run_script(site_logo_filename: str | None = None) -> str: """Return the authenticated VeFaaS entrypoint used by Studio.""" @@ -71,6 +78,7 @@ def write_studio_package( *, requirements: str, site_logo: SiteLogo | None, + release_environment: dict[str, str] | None = None, ) -> None: """Write the Studio entrypoint, requirements, and optional logo.""" package_dir.mkdir(parents=True, exist_ok=True) @@ -83,6 +91,38 @@ def write_studio_package( if site_logo is not None and logo_filename is not None: (package_dir / logo_filename).write_bytes(site_logo.content) (package_dir / "requirements.txt").write_text(requirements, encoding="utf-8") + environment = normalize_studio_apmplus_release_environment( + release_environment or {} + ) + if environment: + (package_dir / STUDIO_RELEASE_ENVIRONMENT_FILENAME).write_text( + json.dumps(environment, ensure_ascii=True, sort_keys=True), + encoding="utf-8", + ) + + +def studio_release_environment_from_env() -> dict[str, str]: + """Return release-time Studio environment defaults from the publisher env.""" + return studio_apmplus_release_environment_from_env() + + +def read_studio_release_environment( + package_dir: Path, + *, + remove: bool = False, +) -> dict[str, str]: + """Read release-time Studio environment defaults from an extracted bundle.""" + path = package_dir / STUDIO_RELEASE_ENVIRONMENT_FILENAME + if not path.is_file(): + return {} + try: + payload = json.loads(path.read_text(encoding="utf-8")) + except json.JSONDecodeError as error: + raise ValueError("Studio release environment is not valid JSON.") from error + environment = normalize_studio_apmplus_release_environment(payload) + if remove: + path.unlink(missing_ok=True) + return environment def build_local_studio_requirements( diff --git a/veadk/cli/studio_release.py b/veadk/cli/studio_release.py index 07261936..19c4e07d 100644 --- a/veadk/cli/studio_release.py +++ b/veadk/cli/studio_release.py @@ -347,6 +347,7 @@ def build_studio_release( from veadk.cli.studio_package import ( build_frontend_assets, build_local_studio_requirements, + studio_release_environment_from_env, write_studio_package, ) @@ -370,10 +371,15 @@ def build_studio_release( frontend_assets=resolved_frontend_assets, dependency_wheels=dependency_wheels, ) + try: + release_environment = studio_release_environment_from_env() + except ValueError as error: + raise StudioReleaseError(str(error)) from error write_studio_package( package_dir, requirements=requirements, site_logo=None, + release_environment=release_environment, ) bundle = output_dir / f"studio-bundle-{version}.zip" _zip_directory(package_dir, bundle) diff --git a/veadk/cli/studio_self_update.py b/veadk/cli/studio_self_update.py index 930ec03a..22d3cbd5 100644 --- a/veadk/cli/studio_self_update.py +++ b/veadk/cli/studio_self_update.py @@ -36,7 +36,10 @@ from fastapi import HTTPException, Request from veadk.cli.frontend_branding import SiteLogo -from veadk.cli.studio_package import studio_run_script +from veadk.cli.studio_package import ( + read_studio_release_environment, + studio_run_script, +) from veadk.cli.studio_release import ( DEFAULT_RELEASE_PREFIX, StudioReleaseError, @@ -349,6 +352,10 @@ def submit_version(self, version: str | None) -> StudioReleaseManifest: self._set_progress("preparing", "正在准备 VeFaaS Function 代码") extract_studio_bundle(archive, package_dir) self._preserve_branding(package_dir) + release_environment = read_studio_release_environment( + package_dir, + remove=True, + ) from veadk.integrations.ve_faas.ve_faas import VeFaaS service = VeFaaS( @@ -365,6 +372,7 @@ def submit_version(self, version: str | None) -> StudioReleaseManifest: path=str(package_dir), environment_overrides={ "VEADK_STUDIO_RELEASE_VERSION": manifest.version, + **release_environment, }, ) self._submitted_version = manifest.version diff --git a/veadk/cli/studio_telemetry.py b/veadk/cli/studio_telemetry.py new file mode 100644 index 00000000..2d33fbf7 --- /dev/null +++ b/veadk/cli/studio_telemetry.py @@ -0,0 +1,236 @@ +# 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. + +"""Studio telemetry configuration helpers. + +This module is the Python-side boundary for Studio WebPro/APMPlus telemetry. +Keep the environment variable names, validation, and /web/ui-config payload +shape here so CLI deploy, release publishing, and runtime config cannot drift. +""" + +from __future__ import annotations + +import os +from collections.abc import Mapping +from typing import Any + +from veadk.consts import ( + STUDIO_APMPLUS_AID, + STUDIO_APMPLUS_DOMAIN, + STUDIO_APMPLUS_ENV, + STUDIO_APMPLUS_TOKEN, +) +from veadk.utils.logger import get_logger + +logger = get_logger(__name__) + +STUDIO_APMPLUS_AID_ENV = "VEADK_STUDIO_APMPLUS_AID" +STUDIO_APMPLUS_TOKEN_ENV = "VEADK_STUDIO_APMPLUS_TOKEN" +STUDIO_APMPLUS_DOMAIN_ENV = "VEADK_STUDIO_APMPLUS_DOMAIN" +STUDIO_APMPLUS_ENV_ENV = "VEADK_STUDIO_APMPLUS_ENV" + +STUDIO_DEPLOY_ID_ENV = "VEADK_STUDIO_DEPLOY_ID" +STUDIO_USER_POOL_ID_ENV = "VEADK_STUDIO_USER_POOL_ID" +STUDIO_APPLICATION_ID_ENV = "VEADK_STUDIO_APPLICATION_ID" +STUDIO_FUNCTION_ID_ENV = "VEADK_STUDIO_FUNCTION_ID" +STUDIO_DEPLOY_REGION_ENV = "VEADK_STUDIO_DEPLOY_REGION" +STUDIO_PROJECT_ENV = "VEADK_STUDIO_PROJECT" +AGENTKIT_SANDBOX_REGION_ENV = "AGENTKIT_SANDBOX_REGION" + +STUDIO_APMPLUS_RELEASE_ENVIRONMENT_KEYS = frozenset( + { + STUDIO_APMPLUS_AID_ENV, + STUDIO_APMPLUS_TOKEN_ENV, + } +) + + +class StudioTelemetryConfigurationError(ValueError): + """Raised when Studio telemetry configuration is incomplete or invalid.""" + + +def _environment(environ: Mapping[str, str] | None) -> Mapping[str, str]: + return os.environ if environ is None else environ + + +def _env_value( + environ: Mapping[str, str], + key: str, + default: str = "", +) -> str: + return str(environ.get(key, default) or "").strip() + + +def studio_telemetry_config( + version: str, + *, + environ: Mapping[str, str] | None = None, +) -> dict[str, Any]: + """Return the /web/ui-config telemetry payload for the Studio frontend.""" + current_env = _environment(environ) + aid_text = _env_value(current_env, STUDIO_APMPLUS_AID_ENV) or STUDIO_APMPLUS_AID + token = _env_value(current_env, STUDIO_APMPLUS_TOKEN_ENV) or STUDIO_APMPLUS_TOKEN + if not aid_text or not token: + return {"enabled": False} + try: + aid = int(aid_text) + except ValueError: + logger.warning( + "%s must be an integer; telemetry disabled", STUDIO_APMPLUS_AID_ENV + ) + return {"enabled": False} + + region = _env_value(current_env, STUDIO_DEPLOY_REGION_ENV) or _env_value( + current_env, AGENTKIT_SANDBOX_REGION_ENV + ) + return { + "enabled": True, + "provider": "apmplus", + "apmplus": { + "aid": aid, + "token": token, + "domain": _env_value( + current_env, + STUDIO_APMPLUS_DOMAIN_ENV, + STUDIO_APMPLUS_DOMAIN, + ) + or STUDIO_APMPLUS_DOMAIN, + "env": _env_value( + current_env, + STUDIO_APMPLUS_ENV_ENV, + STUDIO_APMPLUS_ENV, + ) + or STUDIO_APMPLUS_ENV, + }, + "studio": { + "deployId": _env_value(current_env, STUDIO_DEPLOY_ID_ENV), + "userPoolId": _env_value(current_env, STUDIO_USER_POOL_ID_ENV), + "applicationId": _env_value(current_env, STUDIO_APPLICATION_ID_ENV), + "functionId": _env_value(current_env, STUDIO_FUNCTION_ID_ENV), + "region": region, + "project": _env_value(current_env, STUDIO_PROJECT_ENV), + "version": version, + }, + } + + +def studio_apmplus_environment_from_options( + *, + apmplus_aid: str, + apmplus_token: str, + apmplus_domain: str, + apmplus_env: str, + environ: Mapping[str, str] | None = None, +) -> dict[str, str]: + """Return VeFaaS environment overrides for Studio APMPlus telemetry.""" + current_env = _environment(environ) + configured_aid = apmplus_aid.strip() or _env_value( + current_env, STUDIO_APMPLUS_AID_ENV + ) + configured_token = apmplus_token.strip() or _env_value( + current_env, STUDIO_APMPLUS_TOKEN_ENV + ) + configured_domain = apmplus_domain.strip() or _env_value( + current_env, STUDIO_APMPLUS_DOMAIN_ENV + ) + configured_env = apmplus_env.strip() or _env_value( + current_env, + STUDIO_APMPLUS_ENV_ENV, + ) + if not any([configured_aid, configured_token, configured_domain, configured_env]): + return {} + values = { + STUDIO_APMPLUS_AID_ENV: configured_aid or STUDIO_APMPLUS_AID, + STUDIO_APMPLUS_TOKEN_ENV: configured_token or STUDIO_APMPLUS_TOKEN, + STUDIO_APMPLUS_DOMAIN_ENV: configured_domain or STUDIO_APMPLUS_DOMAIN, + STUDIO_APMPLUS_ENV_ENV: configured_env or STUDIO_APMPLUS_ENV, + } + _validate_studio_apmplus_pair( + values[STUDIO_APMPLUS_AID_ENV], + values[STUDIO_APMPLUS_TOKEN_ENV], + message=( + "Studio APMPlus telemetry requires both --apmplus-aid and " + "--apmplus-token when any APMPlus option is configured." + ), + ) + return values + + +def studio_apmplus_release_environment_from_env( + *, + environ: Mapping[str, str] | None = None, +) -> dict[str, str]: + """Return release-time APMPlus defaults from the publisher environment.""" + current_env = _environment(environ) + aid = _env_value(current_env, STUDIO_APMPLUS_AID_ENV) + token = _env_value(current_env, STUDIO_APMPLUS_TOKEN_ENV) + if not aid and not token: + return {} + _validate_studio_apmplus_pair( + aid, + token, + message=( + "Studio APMPlus release environment requires both " + f"{STUDIO_APMPLUS_AID_ENV} and {STUDIO_APMPLUS_TOKEN_ENV}." + ), + ) + return { + STUDIO_APMPLUS_AID_ENV: aid, + STUDIO_APMPLUS_TOKEN_ENV: token, + } + + +def normalize_studio_apmplus_release_environment(value: object) -> dict[str, str]: + """Validate the internal release-bundle telemetry environment payload.""" + if not isinstance(value, dict): + raise StudioTelemetryConfigurationError( + "Studio release environment must be a JSON object." + ) + environment: dict[str, str] = {} + for key, item in value.items(): + if key not in STUDIO_APMPLUS_RELEASE_ENVIRONMENT_KEYS: + raise StudioTelemetryConfigurationError( + f"Unsupported Studio release environment key: {key}." + ) + if not isinstance(item, str) or not item.strip(): + raise StudioTelemetryConfigurationError( + f"Studio release environment value is invalid: {key}." + ) + environment[key] = item.strip() + _validate_studio_apmplus_pair( + environment.get(STUDIO_APMPLUS_AID_ENV, ""), + environment.get(STUDIO_APMPLUS_TOKEN_ENV, ""), + message=( + "Studio release environment requires both " + f"{STUDIO_APMPLUS_AID_ENV} and {STUDIO_APMPLUS_TOKEN_ENV}." + ), + ) + return environment + + +def _validate_studio_apmplus_pair( + aid: str, + token: str, + *, + message: str, +) -> None: + if bool(aid) != bool(token): + raise StudioTelemetryConfigurationError(message) + if aid: + try: + int(aid) + except ValueError as error: + raise StudioTelemetryConfigurationError( + f"{STUDIO_APMPLUS_AID_ENV} must be an integer." + ) from error diff --git a/veadk/consts.py b/veadk/consts.py index bb8caf2f..2e0f9d78 100644 --- a/veadk/consts.py +++ b/veadk/consts.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import time import os +import time + from veadk.utils.misc import getenv from veadk.version import VERSION @@ -43,6 +44,10 @@ DEFAULT_APMPLUS_OTEL_EXPORTER_ENDPOINT = "http://apmplus-cn-beijing.volces.com:4317" DEFAULT_APMPLUS_OTEL_EXPORTER_SERVICE_NAME = "veadk_tracing" +STUDIO_APMPLUS_AID = "" +STUDIO_APMPLUS_TOKEN = "" +STUDIO_APMPLUS_DOMAIN = "apmplus.volces.com" +STUDIO_APMPLUS_ENV = "production" DEFAULT_COZELOOP_OTEL_EXPORTER_ENDPOINT = ( "https://api.coze.cn/v1/loop/opentelemetry/v1/traces" diff --git a/veadk/webui/assets/CodeEditor-5JK9IWJx.js b/veadk/webui/assets/CodeEditor-Bb0D1gBv.js similarity index 99% rename from veadk/webui/assets/CodeEditor-5JK9IWJx.js rename to veadk/webui/assets/CodeEditor-Bb0D1gBv.js index 4bf4cb4d..cbfa4367 100644 --- a/veadk/webui/assets/CodeEditor-5JK9IWJx.js +++ b/veadk/webui/assets/CodeEditor-Bb0D1gBv.js @@ -1,4 +1,4 @@ -import{L as xe,D as sf}from"./index-CIzoU_y6.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-B6938Hbh.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-DyNPLGxa.js b/veadk/webui/assets/MarkdownPromptEditor-CAzekCWa.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-DyNPLGxa.js rename to veadk/webui/assets/MarkdownPromptEditor-CAzekCWa.js index c23f188a..82482f60 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-DyNPLGxa.js +++ b/veadk/webui/assets/MarkdownPromptEditor-CAzekCWa.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-CIzoU_y6.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-B6938Hbh.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ni.map(i=>d[i]); -var lG=Object.defineProperty;var Q2=e=>{throw TypeError(e)};var cG=(e,t,n)=>t in e?lG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Z2=(e,t,n)=>cG(e,typeof t!="symbol"?t+"":t,n),J2=(e,t,n)=>t.has(e)||Q2("Cannot "+n);var As=(e,t,n)=>(J2(e,t,"read from private field"),n?n.call(e):t.get(e)),eC=(e,t,n)=>t.has(e)?Q2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),gE=(e,t,n,i)=>(J2(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function uG(e,t){for(var n=0;ni[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var Al=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Of(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var WD={exports:{}},p1={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-CAzekCWa.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var vG=Object.defineProperty;var rC=e=>{throw TypeError(e)};var wG=(e,t,n)=>t in e?vG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var aC=(e,t,n)=>wG(e,typeof t!="symbol"?t+"":t,n),oC=(e,t,n)=>t.has(e)||rC("Cannot "+n);var Rs=(e,t,n)=>(oC(e,t,"read from private field"),n?n.call(e):t.get(e)),lC=(e,t,n)=>t.has(e)?rC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_E=(e,t,n,i)=>(oC(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function _G(e,t){for(var n=0;ni[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var Il=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r3={exports:{}},v1={};/** * @license React * react-jsx-runtime.production.js * @@ -7,7 +7,7 @@ var lG=Object.defineProperty;var Q2=e=>{throw TypeError(e)};var cG=(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 dG=Symbol.for("react.transitional.element"),fG=Symbol.for("react.fragment");function XD(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:dG,type:e,key:i,ref:t!==void 0?t:null,props:n}}p1.Fragment=fG;p1.jsx=XD;p1.jsxs=XD;WD.exports=p1;var o=WD.exports,QD={exports:{}},It={};/** + */var SG=Symbol.for("react.transitional.element"),NG=Symbol.for("react.fragment");function a3(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:SG,type:e,key:i,ref:t!==void 0?t:null,props:n}}v1.Fragment=NG;v1.jsx=a3;v1.jsxs=a3;r3.exports=v1;var o=r3.exports,o3={exports:{}},Ct={};/** * @license React * react.production.js * @@ -15,7 +15,7 @@ var lG=Object.defineProperty;var Q2=e=>{throw TypeError(e)};var cG=(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 TN=Symbol.for("react.transitional.element"),hG=Symbol.for("react.portal"),pG=Symbol.for("react.fragment"),mG=Symbol.for("react.strict_mode"),gG=Symbol.for("react.profiler"),bG=Symbol.for("react.consumer"),yG=Symbol.for("react.context"),xG=Symbol.for("react.forward_ref"),EG=Symbol.for("react.suspense"),vG=Symbol.for("react.memo"),ZD=Symbol.for("react.lazy"),wG=Symbol.for("react.activity"),tC=Symbol.iterator;function _G(e){return e===null||typeof e!="object"?null:(e=tC&&e[tC]||e["@@iterator"],typeof e=="function"?e:null)}var JD={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},e3=Object.assign,t3={};function Mf(e,t,n){this.props=e,this.context=t,this.refs=t3,this.updater=n||JD}Mf.prototype.isReactComponent={};Mf.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")};Mf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function n3(){}n3.prototype=Mf.prototype;function kN(e,t,n){this.props=e,this.context=t,this.refs=t3,this.updater=n||JD}var AN=kN.prototype=new n3;AN.constructor=kN;e3(AN,Mf.prototype);AN.isPureReactComponent=!0;var nC=Array.isArray;function Mw(){}var Xn={H:null,A:null,T:null,S:null},i3=Object.prototype.hasOwnProperty;function CN(e,t,n){var i=n.ref;return{$$typeof:TN,type:e,key:t,ref:i!==void 0?i:null,props:n}}function SG(e,t){return CN(e.type,t,e.props)}function IN(e){return typeof e=="object"&&e!==null&&e.$$typeof===TN}function NG(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var iC=/\/+/g;function bE(e,t){return typeof e=="object"&&e!==null&&e.key!=null?NG(""+e.key):t.toString(36)}function TG(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Mw,Mw):(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 ed(e,t,n,i,s){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 TN:case hG:a=!0;break;case ZD:return a=e._init,ed(a(e._payload),t,n,i,s)}}if(a)return s=s(e),a=i===""?"."+bE(e,0):i,nC(s)?(n="",a!=null&&(n=a.replace(iC,"$&/")+"/"),ed(s,t,n,"",function(u){return u})):s!=null&&(IN(s)&&(s=SG(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(iC,"$&/")+"/")+a)),t.push(s)),1;a=0;var l=i===""?".":i+":";if(nC(e))for(var c=0;c{throw TypeError(e)};var cG=(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(A,j){var P=A.length;A.push(j);e:for(;0>>1,R=A[$];if(0>>1;$s(B,P))tes(z,B)?(A[$]=z,A[te]=P,$=te):(A[$]=B,A[Z]=P,$=Z);else if(tes(z,P))A[$]=z,A[te]=P,$=te;else break e}}return j}function s(A,j){var P=A.sortIndex-j.sortIndex;return P!==0?P:A.id-j.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,g=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(A){for(var j=n(u);j!==null;){if(j.callback===null)i(u);else if(j.startTime<=A)i(u),j.sortIndex=j.expirationTime,t(c,j);else break;j=n(u)}}function N(A){if(g=!1,w(A),!m)if(n(c)!==null)m=!0,_||(_=!0,M());else{var j=n(u);j!==null&&F(N,j.startTime-A)}}var _=!1,T=-1,k=5,C=-1;function I(){return v?!0:!(e.unstable_now()-CA&&I());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var R=$(f.expirationTime<=A);if(A=e.unstable_now(),typeof R=="function"){f.callback=R,w(A),j=!0;break t}f===n(c)&&i(c),w(A)}else i(c);f=n(c)}if(f!==null)j=!0;else{var Y=n(u);Y!==null&&F(N,Y.startTime-A),j=!1}}break e}finally{f=null,h=P,p=!1}j=void 0}}finally{j?M():_=!1}}}var M;if(typeof E=="function")M=function(){E(O)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,D=G.port2;G.port1.onmessage=O,M=function(){D.postMessage(null)}}else M=function(){y(O,0)};function F(A,j){T=y(function(){A(e.unstable_now())},j)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125$?(A.sortIndex=P,t(u,A),n(c)===null&&A===n(u)&&(g?(x(T),T=-1):g=!0,F(N,P-$))):(A.sortIndex=R,t(c,A),m||p||(m=!0,_||(_=!0,M()))),A},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(A){var j=h;return function(){var P=h;h=j;try{return A.apply(this,arguments)}finally{h=P}}}})(a3);r3.exports=a3;var CG=r3.exports,o3={exports:{}},Ys={};/** + */(function(e){function t(A,j){var P=A.length;A.push(j);e:for(;0>>1,R=A[$];if(0>>1;$s(B,P))tes(K,B)?(A[$]=K,A[te]=P,$=te):(A[$]=B,A[Z]=P,$=Z);else if(tes(K,P))A[$]=K,A[te]=P,$=te;else break e}}return j}function s(A,j){var P=A.sortIndex-j.sortIndex;return P!==0?P:A.id-j.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,g=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(A){for(var j=n(u);j!==null;){if(j.callback===null)i(u);else if(j.startTime<=A)i(u),j.sortIndex=j.expirationTime,t(c,j);else break;j=n(u)}}function N(A){if(g=!1,w(A),!m)if(n(c)!==null)m=!0,_||(_=!0,L());else{var j=n(u);j!==null&&F(N,j.startTime-A)}}var _=!1,T=-1,k=5,C=-1;function I(){return v?!0:!(e.unstable_now()-CA&&I());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var R=$(f.expirationTime<=A);if(A=e.unstable_now(),typeof R=="function"){f.callback=R,w(A),j=!0;break t}f===n(c)&&i(c),w(A)}else i(c);f=n(c)}if(f!==null)j=!0;else{var Y=n(u);Y!==null&&F(N,Y.startTime-A),j=!1}}break e}finally{f=null,h=P,p=!1}j=void 0}}finally{j?L():_=!1}}}var L;if(typeof E=="function")L=function(){E(O)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,D=G.port2;G.port1.onmessage=O,L=function(){D.postMessage(null)}}else L=function(){y(O,0)};function F(A,j){T=y(function(){A(e.unstable_now())},j)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125$?(A.sortIndex=P,t(u,A),n(c)===null&&A===n(u)&&(g?(x(T),T=-1):g=!0,F(N,P-$))):(A.sortIndex=R,t(c,A),m||p||(m=!0,_||(_=!0,L()))),A},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(A){var j=h;return function(){var P=h;h=j;try{return A.apply(this,arguments)}finally{h=P}}}})(g3);m3.exports=g3;var HG=m3.exports,b3={exports:{}},Xs={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var lG=Object.defineProperty;var Q2=e=>{throw TypeError(e)};var cG=(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 IG=b;function l3(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c3)}catch(e){console.error(e)}}c3(),o3.exports=Ys;var Ss=o3.exports;/** + */var zG=b;function y3(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x3)}catch(e){console.error(e)}}x3(),b3.exports=Xs;var ks=b3.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var lG=Object.defineProperty;var Q2=e=>{throw TypeError(e)};var cG=(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 ns=CG,u3=b,OG=Ss;function Ae(e){var t="https://react.dev/errors/"+e;if(1dd||(e.current=Fw[dd],Fw[dd]=null,dd--)}function Un(e,t){dd++,Fw[dd]=e.current,e.current=t}var Qa=no(null),Wp=no(null),Dl=no(null),Kb=no(null);function qb(e,t){switch(Un(Dl,t),Un(Wp,e),Un(Qa,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?fI(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=fI(t),e=D5(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}hs(Qa),Un(Qa,e)}function Jd(){hs(Qa),hs(Wp),hs(Dl)}function $w(e){e.memoizedState!==null&&Un(Kb,e);var t=Qa.current,n=D5(t,e.type);t!==n&&(Un(Wp,e),Un(Qa,n))}function Yb(e){Wp.current===e&&(hs(Qa),hs(Wp)),Kb.current===e&&(hs(Kb),am._currentValue=Bc)}var yE,oC;function vc(e){if(yE===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);yE=t&&t[1]||"",oC=-1hd||(e.current=qw[hd],qw[hd]=null,hd--)}function Gn(e,t){hd++,qw[hd]=e.current,e.current=t}var Za=io(null),Jp=io(null),Bl=io(null),Zb=io(null);function Jb(e,t){switch(Gn(Bl,t),Gn(Jp,e),Gn(Za,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?EI(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=EI(t),e=K5(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ms(Za),Gn(Za,e)}function tf(){ms(Za),ms(Jp),ms(Bl)}function Yw(e){e.memoizedState!==null&&Gn(Zb,e);var t=Za.current,n=K5(t,e.type);t!==n&&(Gn(Jp,e),Gn(Za,n))}function ey(e){Jp.current===e&&(ms(Za),ms(Jp)),Zb.current===e&&(ms(Zb),um._currentValue=Uc)}var NE,mC;function wc(e){if(NE===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);NE=t&&t[1]||"",mC=-1)":-1s||c[i]!==u[s]){var d=` -`+c[i].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=i&&0<=s);break}}}finally{xE=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?vc(n):""}function BG(e,t){switch(e.tag){case 26:case 27:case 5:return vc(e.type);case 16:return vc("Lazy");case 13:return e.child!==t&&t!==null?vc("Suspense Fallback"):vc("Suspense");case 19:return vc("SuspenseList");case 0:case 15:return EE(e.type,!1);case 11:return EE(e.type.render,!1);case 1:return EE(e.type,!0);case 31:return vc("Activity");default:return""}}function lC(e){try{var t="",n=null;do t+=BG(e,n),n=e,e=e.return;while(e);return t}catch(i){return` +`+c[i].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=i&&0<=s);break}}}finally{TE=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?wc(n):""}function QG(e,t){switch(e.tag){case 26:case 27:case 5:return wc(e.type);case 16:return wc("Lazy");case 13:return e.child!==t&&t!==null?wc("Suspense Fallback"):wc("Suspense");case 19:return wc("SuspenseList");case 0:case 15:return kE(e.type,!1);case 11:return kE(e.type.render,!1);case 1:return kE(e.type,!0);case 31:return wc("Activity");default:return""}}function gC(e){try{var t="",n=null;do t+=QG(e,n),n=e,e=e.return;while(e);return t}catch(i){return` Error generating stack: `+i.message+` -`+i.stack}}var Hw=Object.prototype.hasOwnProperty,ON=ns.unstable_scheduleCallback,vE=ns.unstable_cancelCallback,UG=ns.unstable_shouldYield,FG=ns.unstable_requestPaint,vr=ns.unstable_now,$G=ns.unstable_getCurrentPriorityLevel,b3=ns.unstable_ImmediatePriority,y3=ns.unstable_UserBlockingPriority,Wb=ns.unstable_NormalPriority,HG=ns.unstable_LowPriority,x3=ns.unstable_IdlePriority,zG=ns.log,VG=ns.unstable_setDisableYieldValue,Hm=null,wr=null;function Cl(e){if(typeof zG=="function"&&VG(e),wr&&typeof wr.setStrictMode=="function")try{wr.setStrictMode(Hm,e)}catch{}}var _r=Math.clz32?Math.clz32:qG,GG=Math.log,KG=Math.LN2;function qG(e){return e>>>=0,e===0?32:31-(GG(e)/KG|0)|0}var t0=256,n0=262144,i0=4194304;function wc(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 b1(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var s=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=i&134217727;return l!==0?(i=l&~r,i!==0?s=wc(i):(a&=l,a!==0?s=wc(a):n||(n=l&~e,n!==0&&(s=wc(n))))):(l=i&~r,l!==0?s=wc(l):a!==0?s=wc(a):n||(n=i&~e,n!==0&&(s=wc(n)))),s===0?0:t!==0&&t!==s&&!(t&r)&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function zm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function YG(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 E3(){var e=i0;return i0<<=1,!(i0&62914560)&&(i0=4194304),e}function wE(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function WG(e,t,n,i,s,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 tK=/[\n"\\]/g;function Hr(e){return e.replace(tK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Gw(e,t,n,i,s,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=""+Dr(t)):e.value!==""+Dr(t)&&(e.value=""+Dr(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?Kw(e,a,Dr(t)):n!=null?Kw(e,a,Dr(n)):i!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+Dr(l):e.removeAttribute("name")}function C3(e,t,n,i,s,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)){Vw(e);return}n=n!=null?""+Dr(n):"",t=t!=null?""+Dr(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}i=i??s,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=l?e.checked:!!i,e.defaultChecked=!!i,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),Vw(e)}function Kw(e,t,n){t==="number"&&Xb(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Bd(e,t,n,i){if(e=e.options,t){t={};for(var s=0;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yw=!1;if(Fo)try{var Nh={};Object.defineProperty(Nh,"passive",{get:function(){Yw=!0}}),window.addEventListener("test",Nh,Nh),window.removeEventListener("test",Nh,Nh)}catch{Yw=!1}var Il=null,UN=null,rb=null;function M3(){if(rb)return rb;var e,t=UN,n=t.length,i,s="value"in Il?Il.value:Il.textContent,r=s.length;for(e=0;e=pp),xC=" ",EC=!1;function D3(e,t){switch(e){case"keyup":return CK.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function P3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pd=!1;function RK(e,t){switch(e){case"compositionend":return P3(t);case"keypress":return t.which!==32?null:(EC=!0,xC);case"textInput":return e=t.data,e===xC&&EC?null:e;default:return null}}function jK(e,t){if(pd)return e==="compositionend"||!$N&&D3(e,t)?(e=M3(),rb=UN=Il=null,pd=!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=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=NC(n)}}function $3(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$3(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function H3(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xb(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=Xb(e.document)}return t}function HN(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 FK=Fo&&"documentMode"in document&&11>=document.documentMode,md=null,Ww=null,gp=null,Xw=!1;function kC(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xw||md==null||md!==Xb(i)||(i=md,"selectionStart"in i&&HN(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),gp&&Zp(gp,i)||(gp=i,i=py(Ww,"onSelect"),0>=a,s-=a,qa=1<<32-_r(t)+s|n<k?(C=T,T=null):C=T.sibling;var I=h(y,T,E[k],w);if(I===null){T===null&&(T=C);break}e&&T&&I.alternate===null&&t(y,T),x=r(I,x,k),_===null?N=I:_.sibling=I,_=I,T=C}if(k===E.length)return n(y,T),Qt&&_o(y,k),N;if(T===null){for(;kk?(C=T,T=null):C=T.sibling;var O=h(y,T,I.value,w);if(O===null){T===null&&(T=C);break}e&&T&&O.alternate===null&&t(y,T),x=r(O,x,k),_===null?N=O:_.sibling=O,_=O,T=C}if(I.done)return n(y,T),Qt&&_o(y,k),N;if(T===null){for(;!I.done;k++,I=E.next())I=f(y,I.value,w),I!==null&&(x=r(I,x,k),_===null?N=I:_.sibling=I,_=I);return Qt&&_o(y,k),N}for(T=i(T);!I.done;k++,I=E.next())I=p(T,y,k,I.value,w),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?k:I.key),x=r(I,x,k),_===null?N=I:_.sibling=I,_=I);return e&&T.forEach(function(M){return t(y,M)}),Qt&&_o(y,k),N}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===ud&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case e0:e:{for(var N=E.key;x!==null;){if(x.key===N){if(N=E.type,N===ud){if(x.tag===7){n(y,x.sibling),w=s(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===xl&&_c(N)===x.type){n(y,x.sibling),w=s(x,E.props),kh(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===ud?(w=Uc(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),kh(w,E),w.return=y,y=w)}return a(y);case Yh:e:{for(N=E.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=s(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=RE(E,y.mode,w),w.return=y,y=w}return a(y);case xl:return E=_c(E),v(y,x,E,w)}if(Wh(E))return m(y,x,E,w);if(Sh(E)){if(N=Sh(E),typeof N!="function")throw Error(Ae(150));return E=N.call(E),g(y,x,E,w)}if(typeof E.then=="function")return v(y,x,o0(E),w);if(E.$$typeof===To)return v(y,x,a0(y,E),w);l0(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=s(x,E),w.return=y,y=w):(n(y,x),w=IE(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{tm=0;var N=v(y,x,E,w);return $d=null,N}catch(T){if(T===Uf||T===_1)throw T;var _=br(29,T,null,y.mode);return _.lanes=w,_.return=y,_}finally{}}}var Jc=i4(!0),s4=i4(!1),El=!1;function QN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function i_(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 Bl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ul(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,un&2){var s=i.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),i.pending=t,t=Zb(e),W3(e,null,n),t}return w1(e,i,t,n),Zb(e)}function yp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,w3(e,n)}}function OE(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var s=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?s=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:i.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var s_=!1;function xp(){if(s_){var e=Fd;if(e!==null)throw e}}function Ep(e,t,n,i){s_=!1;var s=e.updateQueue;El=!1;var r=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.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=s.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(qt&h)===h:(i&h)===h){h!==0&&h===nf&&(s_=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,g=l;h=t;var v=n;switch(g.tag){case 1:if(m=g.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=g.payload,h=typeof m=="function"?m.call(v,f,h):m,h==null)break e;f=Zn({},f,h);break e;case 2:El=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=s.callbacks,p===null?s.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=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,r===null&&(s.shared.lanes=0),Ql|=a,e.lanes=a,e.memoizedState=f}}function r4(e,t){if(typeof e!="function")throw Error(Ae(191,e));e.call(t)}function a4(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,uT(e,!1,t,n);try{var c=s(),u=vt.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=WK(c,i);vp(e,t,d,Sr(e))}else vp(e,t,i,Sr(e))}catch(f){vp(e,t,{then:function(){},status:"rejected",reason:f},Sr())}finally{dn.p=r,a!==null&&l.types!==null&&(a.types=l.types),vt.T=a}}function tq(){}function c_(e,t,n,i){if(e.tag!==5)throw Error(Ae(476));var s=R4(e).queue;I4(e,s,t,Bc,n===null?tq:function(){return j4(e),n(i)})}function R4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Bc,baseState:Bc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:Bc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function j4(e){var t=R4(e);t.next===null&&(t=e.alternate.memoizedState),vp(e,t.next.queue,{},Sr())}function cT(){return vs(am)}function O4(){return Li().memoizedState}function M4(){return Li().memoizedState}function nq(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Sr();e=Bl(n);var i=Ul(t,e,n);i!==null&&(ar(i,t,n),yp(i,t,n)),t={cache:YN()},e.payload=t;return}t=t.return}}function iq(e,t,n){var i=Sr();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},k1(e)?D4(t,n):(n=VN(e,t,n,i),n!==null&&(ar(n,e,i),P4(n,t,i)))}function L4(e,t,n){var i=Sr();vp(e,t,n,i)}function vp(e,t,n,i){var s={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(k1(e))D4(t,s);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(s.hasEagerState=!0,s.eagerState=l,kr(l,a))return w1(e,t,s,0),In===null&&v1(),!1}catch{}finally{}if(n=VN(e,t,s,i),n!==null)return ar(n,e,i),P4(n,t,i),!0}return!1}function uT(e,t,n,i){if(i={lane:2,revertLane:xT(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},k1(e)){if(t)throw Error(Ae(479))}else t=VN(e,n,i,2),t!==null&&ar(t,e,2)}function k1(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function D4(e,t){Hd=sy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function P4(e,t,n){if(n&4194048){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,w3(e,n)}}var im={readContext:vs,use:N1,useCallback:_i,useContext:_i,useEffect:_i,useImperativeHandle:_i,useLayoutEffect:_i,useInsertionEffect:_i,useMemo:_i,useReducer:_i,useRef:_i,useState:_i,useDebugValue:_i,useDeferredValue:_i,useTransition:_i,useSyncExternalStore:_i,useId:_i,useHostTransitionStatus:_i,useFormState:_i,useActionState:_i,useOptimistic:_i,useMemoCache:_i,useCacheRefresh:_i};im.useEffectEvent=_i;var B4={readContext:vs,use:N1,useCallback:function(e,t){return $s().memoizedState=[e,t===void 0?null:t],e},useContext:vs,useEffect:HC,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ub(4194308,4,N4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ub(4194308,4,e,t)},useInsertionEffect:function(e,t){ub(4,2,e,t)},useMemo:function(e,t){var n=$s();t=t===void 0?null:t;var i=e();if(eu){Cl(!0);try{e()}finally{Cl(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=$s();if(n!==void 0){var s=n(t);if(eu){Cl(!0);try{n(t)}finally{Cl(!1)}}}else s=t;return i.memoizedState=i.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},i.queue=e,e=e.dispatch=iq.bind(null,Rt,e),[i.memoizedState,e]},useRef:function(e){var t=$s();return e={current:e},t.memoizedState=e},useState:function(e){e=o_(e);var t=e.queue,n=L4.bind(null,Rt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:oT,useDeferredValue:function(e,t){var n=$s();return lT(n,e,t)},useTransition:function(){var e=o_(!1);return e=I4.bind(null,Rt,e.queue,!0,!1),$s().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Rt,s=$s();if(Qt){if(n===void 0)throw Error(Ae(407));n=n()}else{if(n=t(),In===null)throw Error(Ae(349));qt&127||d4(i,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,HC(h4.bind(null,i,r,e),[e]),i.flags|=2048,rf(9,{destroy:void 0},f4.bind(null,i,r,n,t),null),n},useId:function(){var e=$s(),t=In.identifierPrefix;if(Qt){var n=Ya,i=qa;n=(i&~(1<<32-_r(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ry++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof i.is=="string"?a.createElement("select",{is:i.is}):a.createElement("select"),i.multiple?r.multiple=!0:i.size&&(r.size=i.size);break;default:r=typeof i.is=="string"?a.createElement(s,{is:i.is}):a.createElement(s)}}r[ys]=t,r[cr]=i;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(_s(r,s,i),s){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&po(t)}}return Kn(t),$E(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&po(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(Ae(166));if(e=Dl.current,Fu(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,s=xs,s!==null)switch(s.tag){case 27:case 5:i=s.memoizedProps}e[ys]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||L5(e.nodeValue,n)),e||Wl(t,!0)}else e=my(e).createTextNode(i),e[ys]=t,t.stateNode=e}return Kn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Fu(t),n!==null){if(e===null){if(!i)throw Error(Ae(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ae(557));e[ys]=t}else Qc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kn(t),e=!1}else n=jE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(gr(t),t):(gr(t),null);if(t.flags&128)throw Error(Ae(558))}return Kn(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Fu(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(Ae(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Ae(317));s[ys]=t}else Qc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kn(t),s=!1}else s=jE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(gr(t),t):(gr(t),null)}return gr(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,s=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(s=i.alternate.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==s&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),c0(t,t.updateQueue),Kn(t),null);case 4:return Jd(),e===null&&ET(t.stateNode.containerInfo),Kn(t),null;case 10:return Oo(t.type),Kn(t),null;case 19:if(hs(ji),i=t.memoizedState,i===null)return Kn(t),null;if(s=(t.flags&128)!==0,r=i.rendering,r===null)if(s)Ah(i,!1);else{if(Ni!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=iy(e),r!==null){for(t.flags|=128,Ah(i,!1),e=r.updateQueue,t.updateQueue=e,c0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)X3(n,e),n=n.sibling;return Un(ji,ji.current&1|2),Qt&&_o(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&vr()>cy&&(t.flags|=128,s=!0,Ah(i,!1),t.lanes=4194304)}else{if(!s)if(e=iy(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,c0(t,e),Ah(i,!0),i.tail===null&&i.tailMode==="hidden"&&!r.alternate&&!Qt)return Kn(t),null}else 2*vr()-i.renderingStartTime>cy&&n!==536870912&&(t.flags|=128,s=!0,Ah(i,!1),t.lanes=4194304);i.isBackwards?(r.sibling=t.child,t.child=r):(e=i.last,e!==null?e.sibling=r:t.child=r,i.last=r)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=vr(),e.sibling=null,n=ji.current,Un(ji,s?n&1|2:n&1),Qt&&_o(t,i.treeForkCount),e):(Kn(t),null);case 22:case 23:return gr(t),ZN(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Kn(t),t.subtreeFlags&6&&(t.flags|=8192)):Kn(t),n=t.updateQueue,n!==null&&c0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&hs(Fc),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Oo(Ki),Kn(t),null;case 25:return null;case 30:return null}throw Error(Ae(156,t.tag))}function lq(e,t){switch(qN(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Oo(Ki),Jd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Yb(t),null;case 31:if(t.memoizedState!==null){if(gr(t),t.alternate===null)throw Error(Ae(340));Qc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(gr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ae(340));Qc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return hs(ji),null;case 4:return Jd(),null;case 10:return Oo(t.type),null;case 22:case 23:return gr(t),ZN(),e!==null&&hs(Fc),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Oo(Ki),null;case 25:return null;default:return null}}function X4(e,t){switch(qN(t),t.tag){case 3:Oo(Ki),Jd();break;case 26:case 27:case 5:Yb(t);break;case 4:Jd();break;case 31:t.memoizedState!==null&&gr(t);break;case 13:gr(t);break;case 19:hs(ji);break;case 10:Oo(t.type);break;case 22:case 23:gr(t),ZN(),e!==null&&hs(Fc);break;case 24:Oo(Ki)}}function Wm(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var s=i.next;n=s;do{if((n.tag&e)===e){i=void 0;var r=n.create,a=n.inst;i=r(),a.destroy=i}n=n.next}while(n!==s)}}catch(l){En(t,t.return,l)}}function Xl(e,t,n){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var r=s.next;i=r;do{if((i.tag&e)===e){var a=i.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,s=t;var c=n,u=l;try{u()}catch(d){En(s,c,d)}}}i=i.next}while(i!==r)}}catch(d){En(t,t.return,d)}}function Q4(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{a4(t,n)}catch(i){En(e,e.return,i)}}}function Z4(e,t,n){n.props=tu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){En(e,t,i)}}function wp(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(s){En(e,t,s)}}function Wa(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(s){En(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){En(e,t,s)}else n.current=null}function J4(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(s){En(e,e.return,s)}}function HE(e,t,n){try{var i=e.stateNode;Iq(i,e.type,n,t),i[cr]=t}catch(s){En(e,e.return,s)}}function e5(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rc(e.type)||e.tag===4}function zE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||e5(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&&rc(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 p_(e,t,n){var i=e.tag;if(i===5||i===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=ko));else if(i!==4&&(i===27&&rc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(p_(e,t,n),e=e.sibling;e!==null;)p_(e,t,n),e=e.sibling}function ly(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&rc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ly(e,t,n),e=e.sibling;e!==null;)ly(e,t,n),e=e.sibling}function t5(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);_s(t,i,n),t[ys]=e,t[cr]=n}catch(r){En(e,e.return,r)}}var So=!1,Gi=!1,VE=!1,tI=typeof WeakSet=="function"?WeakSet:Set,cs=null;function cq(e,t){if(e=e.containerInfo,v_=xy,e=H3(e),HN(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var s=i.anchorOffset,r=i.focusNode;i=i.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||s!==0&&f.nodeType!==3||(l=a+s),f!==r||i!==0&&f.nodeType!==3||(c=a+i),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===s&&(l=a),h===r&&++d===i&&(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(w_={focusedElem:e,selectionRange:n},xy=!1,cs=t;cs!==null;)if(t=cs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,cs=e;else for(;cs!==null;){switch(t=cs,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"))),_s(r,i,n),r[ys]=e,us(r),i=r;break e;case"link":var a=vI("link","href",s).get(i+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=g,g=a);var y=TC(l,g),x=TC(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(),g>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=b_,b_=null;var r=$l,a=Mo;if(ts=0,of=$l=null,Mo=0,un&6)throw Error(Ae(331));var l=un;if(un|=4,f5(r.current),c5(r,r.current,a,n),un=l,Xm(0,!1),wr&&typeof wr.onPostCommitFiberRoot=="function")try{wr.onPostCommitFiberRoot(Hm,r)}catch{}return!0}finally{dn.p=s,vt.T=i,k5(e,t)}}function rI(e,t,n){t=zr(n,t),t=d_(e.stateNode,t,2),e=Ul(e,t,2),e!==null&&(Vm(e,2),io(e))}function En(e,t,n){if(e.tag===3)rI(e,e,n);else for(;t!==null;){if(t.tag===3){rI(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Fl===null||!Fl.has(i))){e=zr(n,e),n=z4(2),i=Ul(t,n,2),i!==null&&(V4(n,i,t,e),Vm(i,2),io(i));break}}t=t.return}}function KE(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new fq;var s=new Set;i.set(t,s)}else s=i.get(t),s===void 0&&(s=new Set,i.set(t,s));s.has(n)||(gT=!0,s.add(n),e=bq.bind(null,e,t,n),t.then(e,e))}function bq(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,In===e&&(qt&n)===n&&(Ni===4||Ni===3&&(qt&62914560)===qt&&300>vr()-A1?!(un&2)&&lf(e,0):bT|=n,af===qt&&(af=0)),io(e)}function C5(e,t){t===0&&(t=E3()),e=bu(e,t),e!==null&&(Vm(e,t),io(e))}function yq(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),C5(e,n)}function xq(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(Ae(314))}i!==null&&i.delete(t),C5(e,n)}function Eq(e,t){return ON(e,t)}var fy=null,nd=null,x_=!1,hy=!1,qE=!1,Ol=0;function io(e){e!==nd&&e.next===null&&(nd===null?fy=nd=e:nd=nd.next=e),hy=!0,x_||(x_=!0,wq())}function Xm(e,t){if(!qE&&hy){qE=!0;do for(var n=!1,i=fy;i!==null;){if(e!==0){var s=i.pendingLanes;if(s===0)var r=0;else{var a=i.suspendedLanes,l=i.pingedLanes;r=(1<<31-_r(42|e)+1)-1,r&=s&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,aI(i,r))}else r=qt,r=b1(i,i===In?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(r&3)||zm(i,r)||(n=!0,aI(i,r));i=i.next}while(n);qE=!1}}function vq(){I5()}function I5(){hy=x_=!1;var e=0;Ol!==0&&jq()&&(e=Ol);for(var t=vr(),n=null,i=fy;i!==null;){var s=i.next,r=R5(i,t);r===0?(i.next=null,n===null?fy=s:n.next=s,s===null&&(nd=n)):(n=i,(e!==0||r&3)&&(hy=!0)),i=s}ts!==0&&ts!==5||Xm(e),Ol!==0&&(Ol=0)}function R5(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&dI(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function F5(e,t,n){var i=$f;if(i&&typeof t=="string"&&t){var s=Hr(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),yI.has(s)||(yI.add(s),e={rel:e,crossOrigin:n,href:t},i.querySelector(s)===null&&(t=i.createElement("link"),_s(t,"link",e),us(t),i.head.appendChild(t)))}}function $q(e){Xo.D(e),F5("dns-prefetch",e,null)}function Hq(e,t){Xo.C(e,t),F5("preconnect",e,t)}function zq(e,t,n){Xo.L(e,t,n);var i=$f;if(i&&e&&t){var s='link[rel="preload"][as="'+Hr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Hr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Hr(n.imageSizes)+'"]')):s+='[href="'+Hr(e)+'"]';var r=s;switch(t){case"style":r=cf(e);break;case"script":r=Hf(e)}Xr.has(r)||(e=Zn({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xr.set(r,e),i.querySelector(s)!==null||t==="style"&&i.querySelector(Qm(r))||t==="script"&&i.querySelector(Zm(r))||(t=i.createElement("link"),_s(t,"link",e),us(t),i.head.appendChild(t)))}}function Vq(e,t){Xo.m(e,t);var n=$f;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Hr(i)+'"][href="'+Hr(e)+'"]',r=s;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Hf(e)}if(!Xr.has(r)&&(e=Zn({rel:"modulepreload",href:e},t),Xr.set(r,e),n.querySelector(s)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Zm(r)))return}i=n.createElement("link"),_s(i,"link",e),us(i),n.head.appendChild(i)}}}function Gq(e,t,n){Xo.S(e,t,n);var i=$f;if(i&&e){var s=Pd(i).hoistableStyles,r=cf(e);t=t||"default";var a=s.get(r);if(!a){var l={loading:0,preload:null};if(a=i.querySelector(Qm(r)))l.loading=5;else{e=Zn({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xr.get(r))&&vT(e,n);var c=a=i.createElement("link");us(c),_s(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,pb(a,t,i)}a={type:"stylesheet",instance:a,count:1,state:l},s.set(r,a)}}}function Kq(e,t){Xo.X(e,t);var n=$f;if(n&&e){var i=Pd(n).hoistableScripts,s=Hf(e),r=i.get(s);r||(r=n.querySelector(Zm(s)),r||(e=Zn({src:e,async:!0},t),(t=Xr.get(s))&&wT(e,t),r=n.createElement("script"),us(r),_s(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(s,r))}}function qq(e,t){Xo.M(e,t);var n=$f;if(n&&e){var i=Pd(n).hoistableScripts,s=Hf(e),r=i.get(s);r||(r=n.querySelector(Zm(s)),r||(e=Zn({src:e,async:!0,type:"module"},t),(t=Xr.get(s))&&wT(e,t),r=n.createElement("script"),us(r),_s(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(s,r))}}function xI(e,t,n,i){var s=(s=Dl.current)?gy(s):null;if(!s)throw Error(Ae(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=cf(n.href),n=Pd(s).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=cf(n.href);var r=Pd(s).hoistableStyles,a=r.get(e);if(a||(s=s.ownerDocument||s,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=s.querySelector(Qm(e)))&&!r._p&&(a.instance=r,a.state.loading=5),Xr.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},Xr.set(e,n),r||Yq(s,e,n,a.state))),t&&i===null)throw Error(Ae(528,""));return a}if(t&&i!==null)throw Error(Ae(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Hf(n),n=Pd(s).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(Ae(444,e))}}function cf(e){return'href="'+Hr(e)+'"'}function Qm(e){return'link[rel="stylesheet"]['+e+"]"}function $5(e){return Zn({},e,{"data-precedence":e.precedence,precedence:null})}function Yq(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),_s(t,"link",n),us(t),e.head.appendChild(t))}function Hf(e){return'[src="'+Hr(e)+'"]'}function Zm(e){return"script[async]"+e}function EI(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Hr(n.href)+'"]');if(i)return t.instance=i,us(i),i;var s=Zn({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),us(i),_s(i,"style",s),pb(i,n.precedence,e),t.instance=i;case"stylesheet":s=cf(n.href);var r=e.querySelector(Qm(s));if(r)return t.state.loading|=4,t.instance=r,us(r),r;i=$5(n),(s=Xr.get(s))&&vT(i,s),r=(e.ownerDocument||e).createElement("link"),us(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),_s(r,"link",i),t.state.loading|=4,pb(r,n.precedence,e),t.instance=r;case"script":return r=Hf(n.src),(s=e.querySelector(Zm(r)))?(t.instance=s,us(s),s):(i=n,(s=Xr.get(r))&&(i=Zn({},n),wT(i,s)),e=e.ownerDocument||e,s=e.createElement("script"),us(s),_s(s,"link",i),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(Ae(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,pb(i,n.precedence,e));return t.instance}function pb(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=i.length?i[i.length-1]:null,r=s,a=0;a title"):null)}function Wq(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 H5(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Xq(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=cf(i.href),r=t.querySelector(Qm(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=by.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,us(r);return}r=t.ownerDocument||t,i=$5(i),(s=Xr.get(s))&&vT(i,s),r=r.createElement("link"),us(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),_s(r,"link",i),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=by.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var JE=0;function Qq(e,t){return e.stylesheets&&e.count===0&&gb(e,e.stylesheets),0JE?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(s)}}:null}function by(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yy=null;function gb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yy=new Map,t.forEach(Zq,e),yy=null,by.call(e))}function Zq(e,t){if(!(t.state.loading&4)){var n=yy.get(e);if(n)var i=n.get(null);else{n=new Map,yy.set(e,n);for(var s=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(X5)}catch(e){console.error(e)}}X5(),s3.exports=m1;var aY=s3.exports;const oY=Of(aY),kT=b.createContext({});function O1(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const M1=b.createContext(null),cm=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class lY extends b.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cY({children:e,isPresent:t}){const n=b.useId(),i=b.useRef(null),s=b.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=b.useContext(cm);return b.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=s.current;if(t||!i.current||!a||!l)return;i.current.dataset.motionPopId=n;const d=document.createElement("style");return r&&(d.nonce=r),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+i.stack}}var Ww=Object.prototype.hasOwnProperty,$N=ss.unstable_scheduleCallback,AE=ss.unstable_cancelCallback,ZG=ss.unstable_shouldYield,JG=ss.unstable_requestPaint,_r=ss.unstable_now,eK=ss.unstable_getCurrentPriorityLevel,k3=ss.unstable_ImmediatePriority,A3=ss.unstable_UserBlockingPriority,ty=ss.unstable_NormalPriority,tK=ss.unstable_LowPriority,C3=ss.unstable_IdlePriority,nK=ss.log,iK=ss.unstable_setDisableYieldValue,qm=null,Sr=null;function Rl(e){if(typeof nK=="function"&&iK(e),Sr&&typeof Sr.setStrictMode=="function")try{Sr.setStrictMode(qm,e)}catch{}}var Nr=Math.clz32?Math.clz32:aK,sK=Math.log,rK=Math.LN2;function aK(e){return e>>>=0,e===0?32:31-(sK(e)/rK|0)|0}var a0=256,o0=262144,l0=4194304;function _c(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 S1(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var s=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=i&134217727;return l!==0?(i=l&~r,i!==0?s=_c(i):(a&=l,a!==0?s=_c(a):n||(n=l&~e,n!==0&&(s=_c(n))))):(l=i&~r,l!==0?s=_c(l):a!==0?s=_c(a):n||(n=i&~e,n!==0&&(s=_c(n)))),s===0?0:t!==0&&t!==s&&!(t&r)&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function Ym(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function oK(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 I3(){var e=l0;return l0<<=1,!(l0&62914560)&&(l0=4194304),e}function CE(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lK(e,t,n,i,s,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 pK=/[\n"\\]/g;function Vr(e){return e.replace(pK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Zw(e,t,n,i,s,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=""+Br(t)):e.value!==""+Br(t)&&(e.value=""+Br(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?Jw(e,a,Br(t)):n!=null?Jw(e,a,Br(n)):i!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+Br(l):e.removeAttribute("name")}function U3(e,t,n,i,s,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)){Qw(e);return}n=n!=null?""+Br(n):"",t=t!=null?""+Br(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}i=i??s,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=l?e.checked:!!i,e.defaultChecked=!!i,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),Qw(e)}function Jw(e,t,n){t==="number"&&ny(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function $d(e,t,n,i){if(e=e.options,t){t={};for(var s=0;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),t_=!1;if(Ho)try{var Ch={};Object.defineProperty(Ch,"passive",{get:function(){t_=!0}}),window.addEventListener("test",Ch,Ch),window.removeEventListener("test",Ch,Ch)}catch{t_=!1}var jl=null,qN=null,ub=null;function V3(){if(ub)return ub;var e,t=qN,n=t.length,i,s="value"in jl?jl.value:jl.textContent,r=s.length;for(e=0;e=yp),kC=" ",AC=!1;function K3(e,t){switch(e){case"keyup":return HK.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gd=!1;function VK(e,t){switch(e){case"compositionend":return q3(t);case"keypress":return t.which!==32?null:(AC=!0,kC);case"textInput":return e=t.data,e===kC&&AC?null:e;default:return null}}function GK(e,t){if(gd)return e==="compositionend"||!WN&&K3(e,t)?(e=V3(),ub=qN=jl=null,gd=!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=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=OC(n)}}function Q3(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Q3(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Z3(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ny(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=ny(e.document)}return t}function XN(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 JK=Ho&&"documentMode"in document&&11>=document.documentMode,bd=null,n_=null,Ep=null,i_=!1;function LC(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;i_||bd==null||bd!==ny(i)||(i=bd,"selectionStart"in i&&XN(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ep&&nm(Ep,i)||(Ep=i,i=Ey(n_,"onSelect"),0>=a,s-=a,Ya=1<<32-Nr(t)+s|n<k?(C=T,T=null):C=T.sibling;var I=h(y,T,E[k],w);if(I===null){T===null&&(T=C);break}e&&T&&I.alternate===null&&t(y,T),x=r(I,x,k),_===null?N=I:_.sibling=I,_=I,T=C}if(k===E.length)return n(y,T),Yt&&No(y,k),N;if(T===null){for(;kk?(C=T,T=null):C=T.sibling;var O=h(y,T,I.value,w);if(O===null){T===null&&(T=C);break}e&&T&&O.alternate===null&&t(y,T),x=r(O,x,k),_===null?N=O:_.sibling=O,_=O,T=C}if(I.done)return n(y,T),Yt&&No(y,k),N;if(T===null){for(;!I.done;k++,I=E.next())I=f(y,I.value,w),I!==null&&(x=r(I,x,k),_===null?N=I:_.sibling=I,_=I);return Yt&&No(y,k),N}for(T=i(T);!I.done;k++,I=E.next())I=p(T,y,k,I.value,w),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?k:I.key),x=r(I,x,k),_===null?N=I:_.sibling=I,_=I);return e&&T.forEach(function(L){return t(y,L)}),Yt&&No(y,k),N}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===fd&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case r0:e:{for(var N=E.key;x!==null;){if(x.key===N){if(N=E.type,N===fd){if(x.tag===7){n(y,x.sibling),w=s(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===vl&&Sc(N)===x.type){n(y,x.sibling),w=s(x,E.props),Rh(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===fd?(w=Fc(E.props.children,y.mode,w,E.key),w.return=y,y=w):(w=fb(E.type,E.key,E.props,null,y.mode,w),Rh(w,E),w.return=y,y=w)}return a(y);case Zh:e:{for(N=E.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=s(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=BE(E,y.mode,w),w.return=y,y=w}return a(y);case vl:return E=Sc(E),v(y,x,E,w)}if(Jh(E))return m(y,x,E,w);if(Ah(E)){if(N=Ah(E),typeof N!="function")throw Error(ke(150));return E=N.call(E),g(y,x,E,w)}if(typeof E.then=="function")return v(y,x,f0(E),w);if(E.$$typeof===Ao)return v(y,x,d0(y,E),w);h0(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=s(x,E),w.return=y,y=w):(n(y,x),w=PE(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{rm=0;var N=v(y,x,E,w);return Vd=null,N}catch(T){if(T===Hf||T===I1)throw T;var _=xr(29,T,null,y.mode);return _.lanes=w,_.return=y,_}finally{}}}var tu=h4(!0),p4=h4(!1),wl=!1;function rT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function u_(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 Fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $l(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,hn&2){var s=i.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),i.pending=t,t=sy(e),r4(e,null,n),t}return C1(e,i,t,n),sy(e)}function wp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,j3(e,n)}}function FE(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var s=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?s=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:i.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var d_=!1;function _p(){if(d_){var e=zd;if(e!==null)throw e}}function Sp(e,t,n,i){d_=!1;var s=e.updateQueue;wl=!1;var r=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.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=s.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(Gt&h)===h:(i&h)===h){h!==0&&h===rf&&(d_=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,g=l;h=t;var v=n;switch(g.tag){case 1:if(m=g.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=g.payload,h=typeof m=="function"?m.call(v,f,h):m,h==null)break e;f=ni({},f,h);break e;case 2:wl=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=s.callbacks,p===null?s.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=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,r===null&&(s.shared.lanes=0),Jl|=a,e.lanes=a,e.memoizedState=f}}function m4(e,t){if(typeof e!="function")throw Error(ke(191,e));e.call(t)}function g4(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;er?r:8;var a=wt.T,l={};wt.T=l,yT(e,!1,t,n);try{var c=s(),u=wt.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=lq(c,i);Np(e,t,d,Tr(e))}else Np(e,t,i,Tr(e))}catch(f){Np(e,t,{then:function(){},status:"rejected",reason:f},Tr())}finally{pn.p=r,a!==null&&l.types!==null&&(a.types=l.types),wt.T=a}}function pq(){}function g_(e,t,n,i){if(e.tag!==5)throw Error(ke(476));var s=$4(e).queue;F4(e,s,t,Uc,n===null?pq:function(){return H4(e),n(i)})}function $4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Uc,baseState:Uc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:Uc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function H4(e){var t=$4(e);t.next===null&&(t=e.alternate.memoizedState),Np(e,t.next.queue,{},Tr())}function bT(){return Ss(um)}function z4(){return Bi().memoizedState}function V4(){return Bi().memoizedState}function mq(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tr();e=Fl(n);var i=$l(t,e,n);i!==null&&(lr(i,t,n),wp(i,t,n)),t={cache:nT()},e.payload=t;return}t=t.return}}function gq(e,t,n){var i=Tr();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},M1(e)?K4(t,n):(n=ZN(e,t,n,i),n!==null&&(lr(n,e,i),q4(n,t,i)))}function G4(e,t,n){var i=Tr();Np(e,t,n,i)}function Np(e,t,n,i){var s={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(M1(e))K4(t,s);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(s.hasEagerState=!0,s.eagerState=l,Cr(l,a))return C1(e,t,s,0),Mn===null&&A1(),!1}catch{}finally{}if(n=ZN(e,t,s,i),n!==null)return lr(n,e,i),q4(n,t,i),!0}return!1}function yT(e,t,n,i){if(i={lane:2,revertLane:kT(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},M1(e)){if(t)throw Error(ke(479))}else t=ZN(e,n,i,2),t!==null&&lr(t,e,2)}function M1(e){var t=e.alternate;return e===It||t!==null&&t===It}function K4(e,t){Gd=uy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function q4(e,t,n){if(n&4194048){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,j3(e,n)}}var om={readContext:Ss,use:j1,useCallback:Ti,useContext:Ti,useEffect:Ti,useImperativeHandle:Ti,useLayoutEffect:Ti,useInsertionEffect:Ti,useMemo:Ti,useReducer:Ti,useRef:Ti,useState:Ti,useDebugValue:Ti,useDeferredValue:Ti,useTransition:Ti,useSyncExternalStore:Ti,useId:Ti,useHostTransitionStatus:Ti,useFormState:Ti,useActionState:Ti,useOptimistic:Ti,useMemoCache:Ti,useCacheRefresh:Ti};om.useEffectEvent=Ti;var Y4={readContext:Ss,use:j1,useCallback:function(e,t){return zs().memoizedState=[e,t===void 0?null:t],e},useContext:Ss,useEffect:XC,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,mb(4194308,4,L4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mb(4194308,4,e,t)},useInsertionEffect:function(e,t){mb(4,2,e,t)},useMemo:function(e,t){var n=zs();t=t===void 0?null:t;var i=e();if(nu){Rl(!0);try{e()}finally{Rl(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=zs();if(n!==void 0){var s=n(t);if(nu){Rl(!0);try{n(t)}finally{Rl(!1)}}}else s=t;return i.memoizedState=i.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},i.queue=e,e=e.dispatch=gq.bind(null,It,e),[i.memoizedState,e]},useRef:function(e){var t=zs();return e={current:e},t.memoizedState=e},useState:function(e){e=p_(e);var t=e.queue,n=G4.bind(null,It,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:mT,useDeferredValue:function(e,t){var n=zs();return gT(n,e,t)},useTransition:function(){var e=p_(!1);return e=F4.bind(null,It,e.queue,!0,!1),zs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=It,s=zs();if(Yt){if(n===void 0)throw Error(ke(407));n=n()}else{if(n=t(),Mn===null)throw Error(ke(349));Gt&127||v4(i,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,XC(_4.bind(null,i,r,e),[e]),i.flags|=2048,of(9,{destroy:void 0},w4.bind(null,i,r,n,t),null),n},useId:function(){var e=zs(),t=Mn.identifierPrefix;if(Yt){var n=Wa,i=Ya;n=(i&~(1<<32-Nr(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=dy++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof i.is=="string"?a.createElement("select",{is:i.is}):a.createElement("select"),i.multiple?r.multiple=!0:i.size&&(r.size=i.size);break;default:r=typeof i.is=="string"?a.createElement(s,{is:i.is}):a.createElement(s)}}r[vs]=t,r[dr]=i;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(Ts(r,s,i),s){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&go(t)}}return Wn(t),YE(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&go(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(ke(166));if(e=Bl.current,Hu(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,s=ws,s!==null)switch(s.tag){case 27:case 5:i=s.memoizedProps}e[vs]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||G5(e.nodeValue,n)),e||Ql(t,!0)}else e=vy(e).createTextNode(i),e[vs]=t,t.stateNode=e}return Wn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Hu(t),n!==null){if(e===null){if(!i)throw Error(ke(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ke(557));e[vs]=t}else Jc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),e=!1}else n=UE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(yr(t),t):(yr(t),null);if(t.flags&128)throw Error(ke(558))}return Wn(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Hu(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(ke(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ke(317));s[vs]=t}else Jc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),s=!1}else s=UE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(yr(t),t):(yr(t),null)}return yr(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,s=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(s=i.alternate.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==s&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),p0(t,t.updateQueue),Wn(t),null);case 4:return tf(),e===null&&AT(t.stateNode.containerInfo),Wn(t),null;case 10:return Lo(t.type),Wn(t),null;case 19:if(ms(Li),i=t.memoizedState,i===null)return Wn(t),null;if(s=(t.flags&128)!==0,r=i.rendering,r===null)if(s)jh(i,!1);else{if(Ai!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=cy(e),r!==null){for(t.flags|=128,jh(i,!1),e=r.updateQueue,t.updateQueue=e,p0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)a4(n,e),n=n.sibling;return Gn(Li,Li.current&1|2),Yt&&No(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&_r()>my&&(t.flags|=128,s=!0,jh(i,!1),t.lanes=4194304)}else{if(!s)if(e=cy(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,p0(t,e),jh(i,!0),i.tail===null&&i.tailMode==="hidden"&&!r.alternate&&!Yt)return Wn(t),null}else 2*_r()-i.renderingStartTime>my&&n!==536870912&&(t.flags|=128,s=!0,jh(i,!1),t.lanes=4194304);i.isBackwards?(r.sibling=t.child,t.child=r):(e=i.last,e!==null?e.sibling=r:t.child=r,i.last=r)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=_r(),e.sibling=null,n=Li.current,Gn(Li,s?n&1|2:n&1),Yt&&No(t,i.treeForkCount),e):(Wn(t),null);case 22:case 23:return yr(t),aT(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Wn(t),t.subtreeFlags&6&&(t.flags|=8192)):Wn(t),n=t.updateQueue,n!==null&&p0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&ms($c),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Lo(Yi),Wn(t),null;case 25:return null;case 30:return null}throw Error(ke(156,t.tag))}function vq(e,t){switch(tT(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Lo(Yi),tf(),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(yr(t),t.alternate===null)throw Error(ke(340));Jc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ke(340));Jc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ms(Li),null;case 4:return tf(),null;case 10:return Lo(t.type),null;case 22:case 23:return yr(t),aT(),e!==null&&ms($c),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Lo(Yi),null;case 25:return null;default:return null}}function a5(e,t){switch(tT(t),t.tag){case 3:Lo(Yi),tf();break;case 26:case 27:case 5:ey(t);break;case 4:tf();break;case 31:t.memoizedState!==null&&yr(t);break;case 13:yr(t);break;case 19:ms(Li);break;case 10:Lo(t.type);break;case 22:case 23:yr(t),aT(),e!==null&&ms($c);break;case 24:Lo(Yi)}}function eg(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var s=i.next;n=s;do{if((n.tag&e)===e){i=void 0;var r=n.create,a=n.inst;i=r(),a.destroy=i}n=n.next}while(n!==s)}}catch(l){wn(t,t.return,l)}}function Zl(e,t,n){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var r=s.next;i=r;do{if((i.tag&e)===e){var a=i.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,s=t;var c=n,u=l;try{u()}catch(d){wn(s,c,d)}}}i=i.next}while(i!==r)}}catch(d){wn(t,t.return,d)}}function o5(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{g4(t,n)}catch(i){wn(e,e.return,i)}}}function l5(e,t,n){n.props=iu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){wn(e,t,i)}}function Tp(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(s){wn(e,t,s)}}function Xa(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(s){wn(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){wn(e,t,s)}else n.current=null}function c5(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(s){wn(e,e.return,s)}}function WE(e,t,n){try{var i=e.stateNode;zq(i,e.type,n,t),i[dr]=t}catch(s){wn(e,e.return,s)}}function u5(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&oc(e.type)||e.tag===4}function XE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||u5(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&&oc(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 v_(e,t,n){var i=e.tag;if(i===5||i===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=Co));else if(i!==4&&(i===27&&oc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(v_(e,t,n),e=e.sibling;e!==null;)v_(e,t,n),e=e.sibling}function py(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&oc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(py(e,t,n),e=e.sibling;e!==null;)py(e,t,n),e=e.sibling}function d5(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Ts(t,i,n),t[vs]=e,t[dr]=n}catch(r){wn(e,e.return,r)}}var To=!1,qi=!1,QE=!1,cI=typeof WeakSet=="function"?WeakSet:Set,ds=null;function wq(e,t){if(e=e.containerInfo,A_=Ny,e=Z3(e),XN(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var s=i.anchorOffset,r=i.focusNode;i=i.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||s!==0&&f.nodeType!==3||(l=a+s),f!==r||i!==0&&f.nodeType!==3||(c=a+i),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===s&&(l=a),h===r&&++d===i&&(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(C_={focusedElem:e,selectionRange:n},Ny=!1,ds=t;ds!==null;)if(t=ds,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ds=e;else for(;ds!==null;){switch(t=ds,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"))),Ts(r,i,n),r[vs]=e,fs(r),i=r;break e;case"link":var a=CI("link","href",s).get(i+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=g,g=a);var y=MC(l,g),x=MC(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(),g>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,wt.T=null,n=S_,S_=null;var r=zl,a=Do;if(is=0,cf=zl=null,Do=0,hn&6)throw Error(ke(331));var l=hn;if(hn|=4,w5(r.current),x5(r,r.current,a,n),hn=l,tg(0,!1),Sr&&typeof Sr.onPostCommitFiberRoot=="function")try{Sr.onPostCommitFiberRoot(qm,r)}catch{}return!0}finally{pn.p=s,wt.T=i,P5(e,t)}}function hI(e,t,n){t=Gr(n,t),t=y_(e.stateNode,t,2),e=$l(e,t,2),e!==null&&(Wm(e,2),so(e))}function wn(e,t,n){if(e.tag===3)hI(e,e,n);else for(;t!==null;){if(t.tag===3){hI(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Hl===null||!Hl.has(i))){e=Gr(n,e),n=J4(2),i=$l(t,n,2),i!==null&&(e5(n,i,t,e),Wm(i,2),so(i));break}}t=t.return}}function JE(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new Nq;var s=new Set;i.set(t,s)}else s=i.get(t),s===void 0&&(s=new Set,i.set(t,s));s.has(n)||(ST=!0,s.add(n),e=Iq.bind(null,e,t,n),t.then(e,e))}function Iq(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Mn===e&&(Gt&n)===n&&(Ai===4||Ai===3&&(Gt&62914560)===Gt&&300>_r()-L1?!(hn&2)&&uf(e,0):NT|=n,lf===Gt&&(lf=0)),so(e)}function U5(e,t){t===0&&(t=I3()),e=xu(e,t),e!==null&&(Wm(e,t),so(e))}function Rq(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),U5(e,n)}function jq(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(ke(314))}i!==null&&i.delete(t),U5(e,n)}function Oq(e,t){return $N(e,t)}var yy=null,sd=null,T_=!1,xy=!1,ev=!1,Ll=0;function so(e){e!==sd&&e.next===null&&(sd===null?yy=sd=e:sd=sd.next=e),xy=!0,T_||(T_=!0,Lq())}function tg(e,t){if(!ev&&xy){ev=!0;do for(var n=!1,i=yy;i!==null;){if(e!==0){var s=i.pendingLanes;if(s===0)var r=0;else{var a=i.suspendedLanes,l=i.pingedLanes;r=(1<<31-Nr(42|e)+1)-1,r&=s&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,pI(i,r))}else r=Gt,r=S1(i,i===Mn?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(r&3)||Ym(i,r)||(n=!0,pI(i,r));i=i.next}while(n);ev=!1}}function Mq(){F5()}function F5(){xy=T_=!1;var e=0;Ll!==0&&Gq()&&(e=Ll);for(var t=_r(),n=null,i=yy;i!==null;){var s=i.next,r=$5(i,t);r===0?(i.next=null,n===null?yy=s:n.next=s,s===null&&(sd=n)):(n=i,(e!==0||r&3)&&(xy=!0)),i=s}is!==0&&is!==5||tg(e),Ll!==0&&(Ll=0)}function $5(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&xI(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function X5(e,t,n){var i=Vf;if(i&&typeof t=="string"&&t){var s=Vr(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),TI.has(s)||(TI.add(s),e={rel:e,crossOrigin:n,href:t},i.querySelector(s)===null&&(t=i.createElement("link"),Ts(t,"link",e),fs(t),i.head.appendChild(t)))}}function eY(e){Zo.D(e),X5("dns-prefetch",e,null)}function tY(e,t){Zo.C(e,t),X5("preconnect",e,t)}function nY(e,t,n){Zo.L(e,t,n);var i=Vf;if(i&&e&&t){var s='link[rel="preload"][as="'+Vr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Vr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Vr(n.imageSizes)+'"]')):s+='[href="'+Vr(e)+'"]';var r=s;switch(t){case"style":r=df(e);break;case"script":r=Gf(e)}Zr.has(r)||(e=ni({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Zr.set(r,e),i.querySelector(s)!==null||t==="style"&&i.querySelector(ng(r))||t==="script"&&i.querySelector(ig(r))||(t=i.createElement("link"),Ts(t,"link",e),fs(t),i.head.appendChild(t)))}}function iY(e,t){Zo.m(e,t);var n=Vf;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Vr(i)+'"][href="'+Vr(e)+'"]',r=s;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Gf(e)}if(!Zr.has(r)&&(e=ni({rel:"modulepreload",href:e},t),Zr.set(r,e),n.querySelector(s)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ig(r)))return}i=n.createElement("link"),Ts(i,"link",e),fs(i),n.head.appendChild(i)}}}function sY(e,t,n){Zo.S(e,t,n);var i=Vf;if(i&&e){var s=Fd(i).hoistableStyles,r=df(e);t=t||"default";var a=s.get(r);if(!a){var l={loading:0,preload:null};if(a=i.querySelector(ng(r)))l.loading=5;else{e=ni({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Zr.get(r))&&CT(e,n);var c=a=i.createElement("link");fs(c),Ts(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,xb(a,t,i)}a={type:"stylesheet",instance:a,count:1,state:l},s.set(r,a)}}}function rY(e,t){Zo.X(e,t);var n=Vf;if(n&&e){var i=Fd(n).hoistableScripts,s=Gf(e),r=i.get(s);r||(r=n.querySelector(ig(s)),r||(e=ni({src:e,async:!0},t),(t=Zr.get(s))&&IT(e,t),r=n.createElement("script"),fs(r),Ts(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(s,r))}}function aY(e,t){Zo.M(e,t);var n=Vf;if(n&&e){var i=Fd(n).hoistableScripts,s=Gf(e),r=i.get(s);r||(r=n.querySelector(ig(s)),r||(e=ni({src:e,async:!0,type:"module"},t),(t=Zr.get(s))&&IT(e,t),r=n.createElement("script"),fs(r),Ts(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(s,r))}}function kI(e,t,n,i){var s=(s=Bl.current)?wy(s):null;if(!s)throw Error(ke(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=df(n.href),n=Fd(s).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=df(n.href);var r=Fd(s).hoistableStyles,a=r.get(e);if(a||(s=s.ownerDocument||s,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=s.querySelector(ng(e)))&&!r._p&&(a.instance=r,a.state.loading=5),Zr.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},Zr.set(e,n),r||oY(s,e,n,a.state))),t&&i===null)throw Error(ke(528,""));return a}if(t&&i!==null)throw Error(ke(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Gf(n),n=Fd(s).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ke(444,e))}}function df(e){return'href="'+Vr(e)+'"'}function ng(e){return'link[rel="stylesheet"]['+e+"]"}function Q5(e){return ni({},e,{"data-precedence":e.precedence,precedence:null})}function oY(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ts(t,"link",n),fs(t),e.head.appendChild(t))}function Gf(e){return'[src="'+Vr(e)+'"]'}function ig(e){return"script[async]"+e}function AI(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Vr(n.href)+'"]');if(i)return t.instance=i,fs(i),i;var s=ni({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),fs(i),Ts(i,"style",s),xb(i,n.precedence,e),t.instance=i;case"stylesheet":s=df(n.href);var r=e.querySelector(ng(s));if(r)return t.state.loading|=4,t.instance=r,fs(r),r;i=Q5(n),(s=Zr.get(s))&&CT(i,s),r=(e.ownerDocument||e).createElement("link"),fs(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ts(r,"link",i),t.state.loading|=4,xb(r,n.precedence,e),t.instance=r;case"script":return r=Gf(n.src),(s=e.querySelector(ig(r)))?(t.instance=s,fs(s),s):(i=n,(s=Zr.get(r))&&(i=ni({},n),IT(i,s)),e=e.ownerDocument||e,s=e.createElement("script"),fs(s),Ts(s,"link",i),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(ke(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,xb(i,n.precedence,e));return t.instance}function xb(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=i.length?i[i.length-1]:null,r=s,a=0;a title"):null)}function lY(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 Z5(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function cY(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=df(i.href),r=t.querySelector(ng(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=_y.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,fs(r);return}r=t.ownerDocument||t,i=Q5(i),(s=Zr.get(s))&&CT(i,s),r=r.createElement("link"),fs(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ts(r,"link",i),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=_y.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var av=0;function uY(e,t){return e.stylesheets&&e.count===0&&vb(e,e.stylesheets),0av?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(s)}}:null}function _y(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Sy=null;function vb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Sy=new Map,t.forEach(dY,e),Sy=null,_y.call(e))}function dY(e,t){if(!(t.state.loading&4)){var n=Sy.get(e);if(n)var i=n.get(null);else{n=new Map,Sy.set(e,n);for(var s=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(a6)}catch(e){console.error(e)}}a6(),p3.exports=w1;var xY=p3.exports;const EY=Df(xY),LT=b.createContext({});function F1(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const $1=b.createContext(null),hm=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class vY extends b.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function wY({children:e,isPresent:t}){const n=b.useId(),i=b.useRef(null),s=b.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=b.useContext(hm);return b.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=s.current;if(t||!i.current||!a||!l)return;i.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,457 +55,457 @@ Error generating stack: `+i.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(lY,{isPresent:t,childRef:i,sizeRef:s,children:b.cloneElement(e,{ref:i})})}const uY=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:r,mode:a})=>{const l=O1(dY),c=b.useId(),u=b.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;i&&i()},[l,i]),d=b.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return b.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),b.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),a==="popLayout"&&(e=o.jsx(cY,{isPresent:n,children:e})),o.jsx(M1.Provider,{value:d,children:e})};function dY(){return new Map}function Q5(e=!0){const t=b.useContext(M1);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=t,r=b.useId();b.useEffect(()=>{e&&s(r)},[e]);const a=b.useCallback(()=>e&&i&&i(r),[r,i,e]);return!n&&i?[!1,a]:[!0]}const m0=e=>e.key||"";function CI(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const AT=typeof window<"u",Z5=AT?b.useLayoutEffect:b.useEffect,Co=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=Q5(a),u=b.useMemo(()=>CI(e),[e]),d=a&&!l?[]:u.map(m0),f=b.useRef(!0),h=b.useRef(u),p=O1(()=>new Map),[m,g]=b.useState(u),[v,y]=b.useState(u);Z5(()=>{f.current=!1,h.current=u;for(let w=0;w{const N=m0(w),_=a&&!l?!1:u===v||d.includes(N),T=()=>{if(p.has(N))p.set(N,!0);else return;let k=!0;p.forEach(C=>{C||(k=!1)}),k&&(E==null||E(),y(h.current),a&&(c==null||c()),i&&i())};return o.jsx(uY,{isPresent:_,initial:!f.current||n?void 0:!1,custom:_?void 0:t,presenceAffectsLayout:s,mode:r,onExitComplete:_?void 0:T,children:w},N)})})},Nr=e=>e;let J5=Nr;const fY={useManualTiming:!1};function hY(e){let t=new Set,n=new Set,i=!1,s=!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&&i?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,i){s=!0;return}i=!0,[t,n]=[n,t],t.forEach(l),t.clear(),i=!1,s&&(s=!1,c.process(u))}};return c}const g0=["read","resolveKeyframes","update","preRender","render","postRender"],pY=40;function e6(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=g0.reduce((y,x)=>(y[x]=hY(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,s.delta=i?1e3/60:Math.max(Math.min(y-s.timestamp,pY),1),s.timestamp=y,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(p))},m=()=>{n=!0,i=!0,s.isProcessing||e(p)};return{schedule:g0.reduce((y,x)=>{const E=a[x];return y[x]=(w,N=!1,_=!1)=>(n||m(),E.schedule(w,N,_)),y},{}),cancel:y=>{for(let x=0;xII[e].some(n=>!!t[n])};function mY(e){for(const t in e)df[t]={...df[t],...e[t]}}const gY=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 vy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||gY.has(e)}let n6=e=>!vy(e);function i6(e){e&&(n6=t=>t.startsWith("on")?!vy(t):e(t))}try{i6(require("@emotion/is-prop-valid").default)}catch{}function bY(e,t,n){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||(n6(s)||n===!0&&vy(s)||!t&&!vy(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}function yY({children:e,isValidProp:t,...n}){t&&i6(t),n={...b.useContext(cm),...n},n.isStatic=O1(()=>n.isStatic);const i=b.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(cm.Provider,{value:i,children:e})}function xY(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const L1=b.createContext({});function um(e){return typeof e=="string"||Array.isArray(e)}function D1(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const CT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],IT=["initial",...CT];function P1(e){return D1(e.animate)||IT.some(t=>um(e[t]))}function s6(e){return!!(P1(e)||e.variants)}function EY(e,t){if(P1(e)){const{initial:n,animate:i}=e;return{initial:n===!1||um(n)?n:void 0,animate:um(i)?i:void 0}}return e.inherit!==!1?t:{}}function vY(e){const{initial:t,animate:n}=EY(e,b.useContext(L1));return b.useMemo(()=>({initial:t,animate:n}),[RI(t),RI(n)])}function RI(e){return Array.isArray(e)?e.join(" "):e}const wY=Symbol.for("motionComponentSymbol");function wd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _Y(e,t,n){return b.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):wd(n)&&(n.current=i))},[t])}const RT=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),SY="framerAppearId",r6="data-"+RT(SY),{schedule:jT}=e6(queueMicrotask,!1),a6=b.createContext({});function NY(e,t,n,i,s){var r,a;const{visualElement:l}=b.useContext(L1),c=b.useContext(t6),u=b.useContext(M1),d=b.useContext(cm).reducedMotion,f=b.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=b.useContext(a6);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&TY(f.current,n,s,p);const m=b.useRef(!1);b.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const g=n[r6],v=b.useRef(!!g&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return Z5(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),jT.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),b.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),v.current=!1))}),h}function TY(e,t,n,i){const{layoutId:s,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:o6(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!a||l&&wd(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function o6(e){if(e)return e.options.allowProjection!==!1?e.projection:o6(e.parent)}function kY({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:s}){var r,a;e&&mY(e);function l(u,d){let f;const h={...b.useContext(cm),...u,layoutId:AY(u)},{isStatic:p}=h,m=vY(u),g=i(u,p);if(!p&&AT){CY();const v=IY(h);f=v.MeasureLayout,m.visualElement=NY(s,g,h,t,v.ProjectionNode)}return o.jsxs(L1.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,_Y(g,m.visualElement,d),g,p,m.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(a=(r=s.displayName)!==null&&r!==void 0?r:s.name)!==null&&a!==void 0?a:""})`}`;const c=b.forwardRef(l);return c[wY]=s,c}function AY({layoutId:e}){const t=b.useContext(kT).id;return t&&e!==void 0?t+"-"+e:e}function CY(e,t){b.useContext(t6).strict}function IY(e){const{drag:t,layout:n}=df;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const RY=["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 OT(e){return typeof e!="string"||e.includes("-")?!1:!!(RY.indexOf(e)>-1||/[A-Z]/u.test(e))}function jI(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function MT(e,t,n,i){if(typeof t=="function"){const[s,r]=jI(i);t=t(n!==void 0?n:e.custom,s,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,r]=jI(i);t=t(n!==void 0?n:e.custom,s,r)}return t}const I_=e=>Array.isArray(e),jY=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),OY=e=>I_(e)?e[e.length-1]||0:e,Is=e=>!!(e&&e.getVelocity);function yb(e){const t=Is(e)?e.get():e;return jY(t)?t.toValue():t}function MY({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,s,r){const a={latestValues:LY(i,s,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:i,current:l,...a}),a.onUpdate=l=>n(l)),a}const l6=e=>(t,n)=>{const i=b.useContext(L1),s=b.useContext(M1),r=()=>MY(e,t,i,s);return n?r():O1(r)};function LY(e,t,n,i){const s={},r=i(e,{});for(const h in r)s[h]=yb(r[h]);let{initial:a,animate:l}=e;const c=P1(e),u=s6(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"&&!D1(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),u6=c6("--"),DY=c6("var(--"),LT=e=>DY(e)?PY.test(e.split("/*")[0].trim()):!1,PY=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,d6=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Go=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},dm={...Vf,transform:e=>Go(0,1,e)},b0={...Vf,default:1},Jm=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),gl=Jm("deg"),Za=Jm("%"),bt=Jm("px"),BY=Jm("vh"),UY=Jm("vw"),OI={...Za,parse:e=>Za.parse(e)/100,transform:e=>Za.transform(e*100)},FY={borderWidth:bt,borderTopWidth:bt,borderRightWidth:bt,borderBottomWidth:bt,borderLeftWidth:bt,borderRadius:bt,radius:bt,borderTopLeftRadius:bt,borderTopRightRadius:bt,borderBottomRightRadius:bt,borderBottomLeftRadius:bt,width:bt,maxWidth:bt,height:bt,maxHeight:bt,top:bt,right:bt,bottom:bt,left:bt,padding:bt,paddingTop:bt,paddingRight:bt,paddingBottom:bt,paddingLeft:bt,margin:bt,marginTop:bt,marginRight:bt,marginBottom:bt,marginLeft:bt,backgroundPositionX:bt,backgroundPositionY:bt},$Y={rotate:gl,rotateX:gl,rotateY:gl,rotateZ:gl,scale:b0,scaleX:b0,scaleY:b0,scaleZ:b0,skew:gl,skewX:gl,skewY:gl,distance:bt,translateX:bt,translateY:bt,translateZ:bt,x:bt,y:bt,z:bt,perspective:bt,transformPerspective:bt,opacity:dm,originX:OI,originY:OI,originZ:bt},MI={...Vf,transform:Math.round},DT={...FY,...$Y,zIndex:MI,size:bt,fillOpacity:dm,strokeOpacity:dm,numOctaves:MI},HY={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zY=zf.length;function VY(e,t,n){let i="",s=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),f6=()=>({...UT(),attrs:{}}),FT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function h6(e,{style:t,vars:n},i,s){Object.assign(e.style,t,s&&s.getProjectionStyles(i));for(const r in n)e.style.setProperty(r,n[r])}const p6=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 m6(e,t,n,i){h6(e,t,void 0,i);for(const s in t.attrs)e.setAttribute(p6.has(s)?s:RT(s),t.attrs[s])}const wy={};function WY(e){Object.assign(wy,e)}function g6(e,{layout:t,layoutId:n}){return xu.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!wy[e]||e==="opacity")}function $T(e,t,n){var i;const{style:s}=e,r={};for(const a in s)(Is(s[a])||t.style&&Is(t.style[a])||g6(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(r[a]=s[a]);return r}function b6(e,t,n){const i=$T(e,t,n);for(const s in e)if(Is(e[s])||Is(t[s])){const r=zf.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[r]=e[s]}return i}function XY(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 DI=["x","y","width","height","cx","cy","r"],QY={useVisualState:l6({scrapeMotionValuesFromProps:b6,createRenderState:f6,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:s})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in s)if(xu.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{XY(n,i),Qn.render(()=>{BT(i,s,FT(n.tagName),e.transformTemplate),m6(n,i)})})}})},ZY={useVisualState:l6({scrapeMotionValuesFromProps:$T,createRenderState:UT})};function y6(e,t,n){for(const i in t)!Is(t[i])&&!g6(i,n)&&(e[i]=t[i])}function JY({transformTemplate:e},t){return b.useMemo(()=>{const n=UT();return PT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function eW(e,t){const n=e.style||{},i={};return y6(i,n,e),Object.assign(i,JY(e,t)),i}function tW(e,t){const n={},i=eW(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.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=i,n}function nW(e,t,n,i){const s=b.useMemo(()=>{const r=f6();return BT(r,t,FT(i),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};y6(r,e.style,e),s.style={...r,...s.style}}return s}function iW(e=!1){return(n,i,s,{latestValues:r},a)=>{const c=(OT(n)?nW:tW)(i,r,a,n),u=bY(i,typeof n=="string",e),d=n!==b.Fragment?{...u,...c,ref:s}:{},{children:f}=i,h=b.useMemo(()=>Is(f)?f.get():f,[f]);return b.createElement(n,{...d,children:h})}}function sW(e,t){return function(i,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...OT(i)?QY:ZY,preloadedFeatures:e,useRender:iW(s),createVisualElement:t,Component:i};return kY(a)}}function x6(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i(xb===void 0&&Ja.set(gs.isProcessing||fY.useManualTiming?gs.timestamp:performance.now()),xb),set:e=>{xb=e,queueMicrotask(rW)}};function zT(e,t){e.indexOf(t)===-1&&e.push(t)}function VT(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class GT{constructor(){this.subscriptions=[]}add(t){return zT(this.subscriptions,t),()=>VT(this.subscriptions,t)}notify(t,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,i);else for(let r=0;r!isNaN(parseFloat(e));class oW{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,s=!0)=>{const r=Ja.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&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=Ja.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=aW(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 GT);const i=this.events[t].add(n);return t==="change"?()=>{i(),Qn.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}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=Ja.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>PI)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,PI);return v6(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 fm(e,t){return new oW(e,t)}function lW(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,fm(n))}function cW(e,t){const n=B1(e,t);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const a in r){const l=OY(r[a]);lW(e,a,l)}}function uW(e){return!!(Is(e)&&e.add)}function R_(e,t){const n=e.getValue("willChange");if(uW(n))return n.add(t)}function w6(e){return e.props[r6]}function KT(e){let t;return()=>(t===void 0&&(t=e()),t)}const dW=KT(()=>window.ScrollTimeline!==void 0);class fW{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 i=0;i{if(dW()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{i.forEach((s,r)=>{s&&s(),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 hW extends fW{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Lo=e=>e*1e3,Do=e=>e/1e3;function qT(e){return typeof e=="function"}function BI(e,t){e.timeline=t,e.onfinish=null}const YT=e=>Array.isArray(e)&&typeof e[0]=="number",pW={linearEasing:void 0};function mW(e,t){const n=KT(e);return()=>{var i;return(i=pW[t])!==null&&i!==void 0?i:n()}}const _y=mW(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ff=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},_6=(e,t,n=10)=>{let i="";const s=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${i})`,j_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Jh([0,.65,.55,1]),circOut:Jh([.55,0,1,.45]),backIn:Jh([.31,.01,.66,-.59]),backOut:Jh([.33,1.53,.69,.99])};function N6(e,t){if(e)return typeof e=="function"&&_y()?_6(e,t):YT(e)?Jh(e):Array.isArray(e)?e.map(n=>N6(n,t)||j_.easeOut):j_[e]}const T6=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,gW=1e-7,bW=12;function yW(e,t,n,i,s){let r,a,l=0;do a=t+(n-t)/2,r=T6(a,i,s)-e,r>0?n=a:t=a;while(Math.abs(r)>gW&&++lyW(r,0,1,e,n);return r=>r===0||r===1?r:T6(s(r),t,i)}const k6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,A6=e=>t=>1-e(1-t),C6=eg(.33,1.53,.69,.99),WT=A6(C6),I6=k6(WT),R6=e=>(e*=2)<1?.5*WT(e):.5*(2-Math.pow(2,-10*(e-1))),XT=e=>1-Math.sin(Math.acos(e)),j6=A6(XT),O6=k6(XT),M6=e=>/^0[^.\s]+$/u.test(e);function xW(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||M6(e):!0}const kp=e=>Math.round(e*1e5)/1e5,QT=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function EW(e){return e==null}const vW=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ZT=(e,t)=>n=>!!(typeof n=="string"&&vW.test(n)&&n.startsWith(e)||t&&!EW(n)&&Object.prototype.hasOwnProperty.call(n,t)),L6=(e,t,n)=>i=>{if(typeof i!="string")return i;const[s,r,a,l]=i.match(QT);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},wW=e=>Go(0,255,e),tv={...Vf,transform:e=>Math.round(wW(e))},Oc={test:ZT("rgb","red"),parse:L6("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+tv.transform(e)+", "+tv.transform(t)+", "+tv.transform(n)+", "+kp(dm.transform(i))+")"};function _W(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const O_={test:ZT("#"),parse:_W,transform:Oc.transform},_d={test:ZT("hsl","hue"),parse:L6("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Za.transform(kp(t))+", "+Za.transform(kp(n))+", "+kp(dm.transform(i))+")"},Cs={test:e=>Oc.test(e)||O_.test(e)||_d.test(e),parse:e=>Oc.test(e)?Oc.parse(e):_d.test(e)?_d.parse(e):O_.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Oc.transform(e):_d.transform(e)},SW=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NW(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(QT))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(SW))===null||n===void 0?void 0:n.length)||0)>0}const D6="number",P6="color",TW="var",kW="var(",UI="${}",AW=/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 hm(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const l=t.replace(AW,c=>(Cs.test(c)?(i.color.push(r),s.push(P6),n.push(Cs.parse(c))):c.startsWith(kW)?(i.var.push(r),s.push(TW),n.push(c)):(i.number.push(r),s.push(D6),n.push(parseFloat(c))),++r,UI)).split(UI);return{values:n,split:l,indexes:i,types:s}}function B6(e){return hm(e).values}function U6(e){const{split:t,types:n}=hm(e),i=t.length;return s=>{let r="";for(let a=0;atypeof e=="number"?0:e;function IW(e){const t=B6(e);return U6(e)(t.map(CW))}const Jl={test:NW,parse:B6,createTransformer:U6,getAnimatableNone:IW},RW=new Set(["brightness","contrast","saturate","opacity"]);function jW(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(QT)||[];if(!i)return e;const s=n.replace(i,"");let r=RW.has(t)?1:0;return i!==n&&(r*=100),t+"("+r+s+")"}const OW=/\b([a-z-]*)\(.*?\)/gu,M_={...Jl,getAnimatableNone:e=>{const t=e.match(OW);return t?t.map(jW).join(" "):e}},MW={...DT,color:Cs,backgroundColor:Cs,outlineColor:Cs,fill:Cs,stroke:Cs,borderColor:Cs,borderTopColor:Cs,borderRightColor:Cs,borderBottomColor:Cs,borderLeftColor:Cs,filter:M_,WebkitFilter:M_},JT=e=>MW[e];function F6(e,t){let n=JT(e);return n!==M_&&(n=Jl),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const LW=new Set(["auto","none","0"]);function DW(e,t,n){let i=0,s;for(;ie===Vf||e===bt,$I=(e,t)=>parseFloat(e.split(", ")[t]),HI=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const s=i.match(/^matrix3d\((.+)\)$/u);if(s)return $I(s[1],t);{const r=i.match(/^matrix\((.+)\)$/u);return r?$I(r[1],e):0}},PW=new Set(["x","y","z"]),BW=zf.filter(e=>!PW.has(e));function UW(e){const t=[];return BW.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const hf={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:HI(4,13),y:HI(5,14)};hf.translateX=hf.x;hf.translateY=hf.y;const zc=new Set;let L_=!1,D_=!1;function $6(){if(D_){const e=Array.from(zc).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const s=UW(i);s.length&&(n.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([r,a])=>{var l;(l=i.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}D_=!1,L_=!1,zc.forEach(e=>e.complete()),zc.clear()}function H6(){zc.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(D_=!0)})}function FW(){H6(),$6()}class ek{constructor(t,n,i,s,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=s,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(zc.add(this),L_||(L_=!0,Qn.read(H6),Qn.resolveKeyframes($6))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:s}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),$W=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function HW(e){const t=$W.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${n??i}`,s]}function V6(e,t,n=1){const[i,s]=HW(e);if(!i)return;const r=window.getComputedStyle(t).getPropertyValue(i);if(r){const a=r.trim();return z6(a)?parseFloat(a):a}return LT(s)?V6(s,t,n+1):s}const G6=e=>t=>t.test(e),zW={test:e=>e==="auto",parse:e=>e},K6=[Vf,bt,Za,gl,UY,BY,zW],zI=e=>K6.find(G6(e));class q6 extends ek{constructor(t,n,i,s,r){super(t,n,i,s,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const VI=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Jl.test(e)||e==="0")&&!e.startsWith("url("));function VW(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function U1(e,{repeat:t,repeatType:n="loop"},i){const s=e.filter(KW),r=t&&n!=="loop"&&t%2===1?0:s.length-1;return!r||i===void 0?s[r]:i}const qW=40;class Y6{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ja.now(),this.options={autoplay:t,delay:n,type:i,repeat:s,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>qW?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&FW(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Ja.now(),this.hasAttemptedResolve=!0;const{name:i,type:s,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!GW(t,i,s,r))if(a)this.options.duration=0;else{c&&c(U1(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 P_=2e4;function W6(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t=P_?1/0:t}const mi=(e,t,n)=>e+(t-e)*n;function nv(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 YW({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let s=0,r=0,a=0;if(!t)s=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=nv(c,l,e+1/3),r=nv(c,l,e),a=nv(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:i}}function Sy(e,t){return n=>n>0?t:e}const iv=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},WW=[O_,Oc,_d],XW=e=>WW.find(t=>t.test(e));function GI(e){const t=XW(e);if(!t)return!1;let n=t.parse(e);return t===_d&&(n=YW(n)),n}const KI=(e,t)=>{const n=GI(e),i=GI(t);if(!n||!i)return Sy(e,t);const s={...n};return r=>(s.red=iv(n.red,i.red,r),s.green=iv(n.green,i.green,r),s.blue=iv(n.blue,i.blue,r),s.alpha=mi(n.alpha,i.alpha,r),Oc.transform(s))},QW=(e,t)=>n=>t(e(n)),tg=(...e)=>e.reduce(QW),B_=new Set(["none","hidden"]);function ZW(e,t){return B_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function JW(e,t){return n=>mi(e,t,n)}function tk(e){return typeof e=="number"?JW:typeof e=="string"?LT(e)?Sy:Cs.test(e)?KI:nX:Array.isArray(e)?X6:typeof e=="object"?Cs.test(e)?KI:eX:Sy}function X6(e,t){const n=[...e],i=n.length,s=e.map((r,a)=>tk(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in i)n[r]=i[r](s);return n}}function tX(e,t){var n;const i=[],s={color:0,var:0,number:0};for(let r=0;r{const n=Jl.createTransformer(t),i=hm(e),s=hm(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?B_.has(e)&&!s.values.length||B_.has(t)&&!i.values.length?ZW(e,t):tg(X6(tX(i,s),s.values),n):Sy(e,t)};function Q6(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?mi(e,t,n):tk(e)(e,t)}const iX=5;function Z6(e,t,n){const i=Math.max(t-iX,0);return v6(n-e(i),t-i)}const Si={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},sv=.001;function sX({duration:e=Si.duration,bounce:t=Si.bounce,velocity:n=Si.velocity,mass:i=Si.mass}){let s,r,a=1-t;a=Go(Si.minDamping,Si.maxDamping,a),e=Go(Si.minDuration,Si.maxDuration,Do(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=U_(u,a),m=Math.exp(-f);return sv-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),g=U_(Math.pow(u,2),a);return(-s(u)+sv>0?-1:1)*((h-p)*m)/g}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-sv+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=aX(s,r,l);if(e=Lo(e),isNaN(c))return{stiffness:Si.stiffness,damping:Si.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const rX=12;function aX(e,t,n){let i=n;for(let s=1;se[n]!==void 0)}function cX(e){let t={velocity:Si.velocity,stiffness:Si.stiffness,damping:Si.damping,mass:Si.mass,isResolvedFromDuration:!1,...e};if(!qI(e,lX)&&qI(e,oX))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,r=2*Go(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Si.mass,stiffness:s,damping:r}}else{const n=sX(e);t={...t,...n,mass:Si.mass},t.isResolvedFromDuration=!0}return t}function J6(e=Si.visualDuration,t=Si.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:s}=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}=cX({...n,velocity:-Do(n.velocity||0)}),m=h||0,g=u/(2*Math.sqrt(c*d)),v=a-r,y=Do(Math.sqrt(c/d)),x=Math.abs(v)<5;i||(i=x?Si.restSpeed.granular:Si.restSpeed.default),s||(s=x?Si.restDelta.granular:Si.restDelta.default);let E;if(g<1){const N=U_(y,g);E=_=>{const T=Math.exp(-g*y*_);return a-T*((m+g*y*v)/N*Math.sin(N*_)+v*Math.cos(N*_))}}else if(g===1)E=N=>a-Math.exp(-y*N)*(v+(m+y*v)*N);else{const N=y*Math.sqrt(g*g-1);E=_=>{const T=Math.exp(-g*y*_),k=Math.min(N*_,300);return a-T*((m+g*y*v)*Math.sinh(k)+N*v*Math.cosh(k))/N}}const w={calculatedDuration:p&&f||null,next:N=>{const _=E(N);if(p)l.done=N>=f;else{let T=0;g<1&&(T=N===0?Lo(m):Z6(E,N,_));const k=Math.abs(T)<=i,C=Math.abs(a-_)<=s;l.done=k&&C}return l.value=l.done?a:_,l},toString:()=>{const N=Math.min(W6(w),P_),_=_6(T=>w.next(N*T).value,N,30);return N+"ms "+_}};return w}function YI({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=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)-g*Math.exp(-k/i),E=k=>y+x(k),w=k=>{const C=x(k),I=E(k);h.done=Math.abs(C)<=u,h.value=h.done?y:I};let N,_;const T=k=>{p(h.value)&&(N=k,_=J6({keyframes:[h.value,m(h.value)],velocity:Z6(E,k,h.value),damping:s,stiffness:r,restDelta:u,restSpeed:d}))};return T(0),{calculatedDuration:null,next:k=>{let C=!1;return!_&&N===void 0&&(C=!0,w(k),T(k)),N!==void 0&&k>=N?_.next(k-N):(!C&&w(k),h)}}}const uX=eg(.42,0,1,1),dX=eg(0,0,.58,1),eP=eg(.42,0,.58,1),fX=e=>Array.isArray(e)&&typeof e[0]!="number",hX={linear:Nr,easeIn:uX,easeInOut:eP,easeOut:dX,circIn:XT,circInOut:O6,circOut:j6,backIn:WT,backInOut:I6,backOut:C6,anticipate:R6},WI=e=>{if(YT(e)){J5(e.length===4);const[t,n,i,s]=e;return eg(t,n,i,s)}else if(typeof e=="string")return hX[e];return e};function pX(e,t,n){const i=[],s=n||Q6,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=pX(t,i,s),c=l.length,u=d=>{if(a&&d1)for(;fu(Go(e[0],e[r-1],d)):u}function gX(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=ff(0,t,i);e.push(mi(n,1,s))}}function bX(e){const t=[0];return gX(t,e.length-1),t}function yX(e,t){return e.map(n=>n*t)}function xX(e,t){return e.map(()=>t||eP).splice(0,e.length-1)}function Ny({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const s=fX(i)?i.map(WI):WI(i),r={done:!1,value:t[0]},a=yX(n&&n.length===t.length?n:bX(t),e),l=mX(a,t,{ease:Array.isArray(s)?s:xX(t,s)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const EX=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Qn.update(t,!0),stop:()=>Zl(t),now:()=>gs.isProcessing?gs.timestamp:Ja.now()}},vX={decay:YI,inertia:YI,tween:Ny,keyframes:Ny,spring:J6},wX=e=>e/100;class nk extends Y6{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:i,element:s,keyframes:r}=this.options,a=(s==null?void 0:s.KeyframeResolver)||ek,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,i,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r,velocity:a=0}=this.options,l=qT(n)?n:vX[n]||Ny;let c,u;l!==Ny&&typeof t[0]!="number"&&(c=tg(wX,Q6(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=W6(d));const{calculatedDuration:f}=d,h=f+s,p=h*(i+1)-s;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:i}=this;if(!i){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:s,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:g,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 C=Math.floor(k),I=k%1;!I&&k>=1&&(I=1),I===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(I=1-I,g&&(I-=g/f)):m==="mirror"&&(w=a)),E=Go(0,1,I)*f}const N=x?{done:!1,value:c[0]}:w.next(E);l&&(N.value=l(N.value));let{done:_}=N;!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&&s!==void 0&&(N.value=U1(c,this.options,s)),v&&v(N.value),T&&this.finish(),N}get duration(){const{resolved:t}=this;return t?Do(t.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(t){t=Lo(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=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=EX,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=i??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 _X=new Set(["opacity","clipPath","filter","transform"]);function SX(e,t,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=N6(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const NX=KT(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ty=10,TX=2e4;function kX(e){return qT(e.type)||e.type==="spring"||!S6(e.ease)}function AX(e,t){const n=new nk({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const s=[];let r=0;for(;!i.done&&rthis.onKeyframesResolved(a,l),n,i,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:s,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&_y()&&CX(r)&&(r=tP[r]),kX(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...g}=this.options,v=AX(t,g);t=v.keyframes,t.length===1&&(t[1]=t[0]),i=v.duration,s=v.times,r=v.ease,a="keyframes"}const d=SX(l.owner.current,c,t,{...this.options,duration:i,times:s,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(BI(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(U1(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:s,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Do(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Do(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=Lo(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:i}=n;i.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 Nr;const{animation:i}=n;BI(i,t)}return Nr}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:i,duration:s,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 nk({...p,keyframes:i,duration:s,type:r,ease:a,times:l,isGenerator:!0}),g=Lo(this.time);u.setWithVelocity(m.sample(g-Ty).value,m.sample(g).value,Ty)}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:i,repeatDelay:s,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 NX()&&i&&_X.has(i)&&!c&&!u&&!s&&r!=="mirror"&&a!==0&&l!=="inertia"}}const IX={type:"spring",stiffness:500,damping:25,restSpeed:10},RX=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),jX={type:"keyframes",duration:.8},OX={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MX=(e,{keyframes:t})=>t.length>2?jX:xu.has(e)?e.startsWith("scale")?RX(t[1]):IX:OX;function LX({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const ik=(e,t,n,i={},s,r)=>a=>{const l=HT(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Lo(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:s};LX(l)||(d={...d,...MX(e,d)}),d.duration&&(d.duration=Lo(d.duration)),d.repeatDelay&&(d.repeatDelay=Lo(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=U1(d.keyframes,l);if(h!==void 0)return Qn.update(()=>{d.onUpdate(h),d.onComplete()}),new hW([])}return!r&&XI.supports(d)?new XI(d):new nk(d)};function DX({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function nP(e,t,{delay:n=0,transitionOverride:i,type:s}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;i&&(a=i);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];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&&DX(d,f))continue;const m={delay:n,...HT(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=w6(e);if(y){const x=window.MotionHandoffAnimation(y,f,Qn);x!==null&&(m.startTime=x,g=!0)}}R_(e,f),h.start(ik(f,h,p,e.shouldReduceMotion&&E6.has(f)?{type:!1}:m,e,g));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{Qn.update(()=>{l&&cW(e,l)})}),u}function F_(e,t,n={}){var i;const s=B1(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const a=s?()=>Promise.all(nP(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return PX(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 PX(e,t,n=0,i=0,s=1,r){const a=[],l=(e.variantChildren.size-1)*i,c=s===1?(u=0)=>u*i:(u=0)=>l-u*i;return Array.from(e.variantChildren).sort(BX).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(F_(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function BX(e,t){return e.sortNodePosition(t)}function UX(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const s=t.map(r=>F_(e,r,n));i=Promise.all(s)}else if(typeof t=="string")i=F_(e,t,n);else{const s=typeof t=="function"?B1(e,t,n.custom):t;i=Promise.all(nP(e,s,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const FX=IT.length;function iP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?iP(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:i})=>UX(e,n,i)))}function VX(e){let t=zX(e),n=QI(),i=!0;const s=c=>(u,d)=>{var f;const h=B1(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...g}=h;u={...u,...g,...m}}return u};function r(c){t=c(e)}function a(c){const{props:u}=e,d=iP(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,C=!1;const I=Array.isArray(E)?E:[E];let O=I.reduce(s(y),{});N===!1&&(O={});const{prevResolvedValues:M={}}=x,G={...M,...O},D=j=>{k=!0,h.has(j)&&(C=!0,h.delete(j)),x.needsAnimating[j]=!0;const P=e.getValue(j);P&&(P.liveStyle=!1)};for(const j in G){const P=O[j],$=M[j];if(p.hasOwnProperty(j))continue;let R=!1;I_(P)&&I_($)?R=!x6(P,$):R=P!==$,R?P!=null?D(j):h.add(j):P!==void 0&&h.has(j)?D(j):x.protectedKeys[j]=!0}x.prevProp=E,x.prevResolvedValues=O,x.isActive&&(p={...p,...O}),i&&e.blockInitialAnimation&&(k=!1),k&&(!(_&&T)||C)&&f.push(...I.map(j=>({animation:j,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 g=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,g?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=QI(),i=!0}}}function GX(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!x6(t,e):!1}function bc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function QI(){return{animate:bc(!0),whileInView:bc(),whileHover:bc(),whileTap:bc(),whileDrag:bc(),whileFocus:bc(),exit:bc()}}class ac{constructor(t){this.isMounted=!1,this.node=t}update(){}}class KX extends ac{constructor(t){super(t),t.animationState||(t.animationState=VX(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();D1(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 qX=0;class YX extends ac{constructor(){super(...arguments),this.id=qX++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const WX={animation:{Feature:KX},exit:{Feature:YX}},da={x:!1,y:!1};function sP(){return da.x||da.y}function XX(e){return e==="x"||e==="y"?da[e]?null:(da[e]=!0,()=>{da[e]=!1}):da.x||da.y?null:(da.x=da.y=!0,()=>{da.x=da.y=!1})}const sk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function pm(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function ng(e){return{point:{x:e.pageX,y:e.pageY}}}const QX=e=>t=>sk(t)&&e(t,ng(t));function Ap(e,t,n,i){return pm(e,t,QX(n),i)}const ZI=(e,t)=>Math.abs(e-t);function ZX(e,t){const n=ZI(e.x,t.x),i=ZI(e.y,t.y);return Math.sqrt(n**2+i**2)}class rP{constructor(t,n,{transformPagePoint:i,contextWindow:s,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=av(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=ZX(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:g}=gs;this.history.push({...m,timestamp:g});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=rv(h,this.transformPagePoint),Qn.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=av(f.type==="pointercancel"?this.lastMoveEventInfo:rv(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!sk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=i,this.contextWindow=s||window;const a=ng(t),l=rv(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=gs;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,av(l,this.history)),this.removeListeners=tg(Ap(this.contextWindow,"pointermove",this.handlePointerMove),Ap(this.contextWindow,"pointerup",this.handlePointerUp),Ap(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Zl(this.updatePoint)}}function rv(e,t){return t?{point:t(e.point)}:e}function JI(e,t){return{x:e.x-t.x,y:e.y-t.y}}function av({point:e},t){return{point:e,delta:JI(e,aP(t)),offset:JI(e,JX(t)),velocity:eQ(t,.1)}}function JX(e){return e[0]}function aP(e){return e[e.length-1]}function eQ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const s=aP(e);for(;n>=0&&(i=e[n],!(s.timestamp-i.timestamp>Lo(t)));)n--;if(!i)return{x:0,y:0};const r=Do(s.timestamp-i.timestamp);if(r===0)return{x:0,y:0};const a={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const oP=1e-4,tQ=1-oP,nQ=1+oP,lP=.01,iQ=0-lP,sQ=0+lP;function Cr(e){return e.max-e.min}function rQ(e,t,n){return Math.abs(e-t)<=n}function eR(e,t,n,i=.5){e.origin=i,e.originPoint=mi(t.min,t.max,e.origin),e.scale=Cr(n)/Cr(t),e.translate=mi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=tQ&&e.scale<=nQ||isNaN(e.scale))&&(e.scale=1),(e.translate>=iQ&&e.translate<=sQ||isNaN(e.translate))&&(e.translate=0)}function Cp(e,t,n,i){eR(e.x,t.x,n.x,i?i.originX:void 0),eR(e.y,t.y,n.y,i?i.originY:void 0)}function tR(e,t,n){e.min=n.min+t.min,e.max=e.min+Cr(t)}function aQ(e,t,n){tR(e.x,t.x,n.x),tR(e.y,t.y,n.y)}function nR(e,t,n){e.min=t.min-n.min,e.max=e.min+Cr(t)}function Ip(e,t,n){nR(e.x,t.x,n.x),nR(e.y,t.y,n.y)}function oQ(e,{min:t,max:n},i){return t!==void 0&&en&&(e=i?mi(n,e,i.max):Math.min(e,n)),e}function iR(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 lQ(e,{top:t,left:n,bottom:i,right:s}){return{x:iR(e.x,n,s),y:iR(e.y,t,i)}}function sR(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.mini?n=ff(t.min,t.max-i,e.min):i>s&&(n=ff(e.min,e.max-s,t.min)),Go(0,1,n)}function dQ(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 $_=.35;function fQ(e=$_){return e===!1?e=0:e===!0&&(e=$_),{x:rR(e,"left","right"),y:rR(e,"top","bottom")}}function rR(e,t,n){return{min:aR(e,t),max:aR(e,n)}}function aR(e,t){return typeof e=="number"?e:e[t]||0}const oR=()=>({translate:0,scale:1,origin:0,originPoint:0}),Sd=()=>({x:oR(),y:oR()}),lR=()=>({min:0,max:0}),Ri=()=>({x:lR(),y:lR()});function Mr(e){return[e("x"),e("y")]}function cP({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function hQ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function pQ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function ov(e){return e===void 0||e===1}function H_({scale:e,scaleX:t,scaleY:n}){return!ov(e)||!ov(t)||!ov(n)}function Nc(e){return H_(e)||uP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function uP(e){return cR(e.x)||cR(e.y)}function cR(e){return e&&e!=="0%"}function ky(e,t,n){const i=e-n,s=t*i;return n+s}function uR(e,t,n,i,s){return s!==void 0&&(e=ky(e,s,i)),ky(e,n,i)+t}function z_(e,t=0,n=1,i,s){e.min=uR(e.min,t,n,i,s),e.max=uR(e.max,t,n,i,s)}function dP(e,{x:t,y:n}){z_(e.x,t.translate,t.scale,t.originPoint),z_(e.y,n.translate,n.scale,n.originPoint)}const dR=.999999999999,fR=1.0000000000001;function mQ(e,t,n,i=!1){const s=n.length;if(!s)return;t.x=t.y=1;let r,a;for(let l=0;ldR&&(t.x=1),t.ydR&&(t.y=1)}function Nd(e,t){e.min=e.min+t,e.max=e.max+t}function hR(e,t,n,i,s=.5){const r=mi(e.min,e.max,s);z_(e,t,n,r,i)}function Td(e,t){hR(e.x,t.x,t.scaleX,t.scale,t.originX),hR(e.y,t.y,t.scaleY,t.scale,t.originY)}function fP(e,t){return cP(pQ(e.getBoundingClientRect(),t))}function gQ(e,t,n){const i=fP(e,n),{scroll:s}=t;return s&&(Nd(i.x,s.offset.x),Nd(i.y,s.offset.y)),i}const hP=({current:e})=>e?e.ownerDocument.defaultView:null,bQ=new WeakMap;class yQ{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=Ri(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ng(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XX(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),Mr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(Za.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=Cr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&Qn.postRender(()=>m(d,f)),R_(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(p&&this.currentDirection===null){this.currentDirection=xQ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),g&&g(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Mr(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 rP(t,{onSessionStart:s,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:hP(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:r}=this.getProps();r&&Qn.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:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:s}=this.getProps();if(!i||!y0(t,s,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=oQ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),s=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&&wd(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=lQ(s.layoutBox,n):this.constraints=!1,this.elastic=fQ(i),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Mr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=dQ(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!wd(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=gQ(i,s.root,this.visualElement.getTransformPagePoint());let a=cQ(s.layout.layoutBox,r);if(n){const l=n(hQ(a));this.hasMutatedConstraints=!!l,l&&(a=cP(l))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Mr(d=>{if(!y0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:i?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 i=this.getAxisMotionValue(t);return R_(this.visualElement,t),i.start(ik(t,i,0,n,this.visualElement,!1))}stopAnimation(){Mr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Mr(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()}`,i=this.visualElement.getProps(),s=i[n];return s||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Mr(n=>{const{drag:i}=this.getProps();if(!y0(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[n];r.set(t[n]-mi(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!wd(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Mr(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=uQ({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Mr(a=>{if(!y0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(mi(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;bQ.set(this.visualElement,this);const t=this.visualElement.current,n=Ap(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();wd(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Qn.read(i);const a=pm(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Mr(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:i=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:a=$_,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function y0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function xQ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class EQ extends ac{constructor(t){super(t),this.removeGroupControls=Nr,this.removeListeners=Nr,this.controls=new yQ(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Nr}unmount(){this.removeGroupControls(),this.removeListeners()}}const pR=e=>(t,n)=>{e&&Qn.postRender(()=>e(t,n))};class vQ extends ac{constructor(){super(...arguments),this.removePointerDownListener=Nr}onPointerDown(t){this.session=new rP(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hP(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:pR(t),onStart:pR(n),onMove:i,onEnd:(r,a)=>{delete this.session,s&&Qn.postRender(()=>s(r,a))}}}mount(){this.removePointerDownListener=Ap(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 Eb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function mR(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Rh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(bt.test(e))e=parseFloat(e);else return e;const n=mR(e,t.target.x),i=mR(e,t.target.y);return`${n}% ${i}%`}},wQ={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=Jl.parse(e);if(s.length>5)return i;const r=Jl.createTransformer(e),a=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=l,s[1+a]/=c;const u=mi(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),r(s)}};class _Q extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:r}=t;WY(SQ),r&&(n.group&&n.group.add(r),i&&i.register&&s&&i.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Eb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:s,isPresent:r}=this.props,a=i.projection;return a&&(a.isPresent=r,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||Qn.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),jT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function pP(e){const[t,n]=Q5(),i=b.useContext(kT);return o.jsx(_Q,{...e,layoutGroup:i,switchLayoutGroup:b.useContext(a6),isPresent:t,safeToRemove:n})}const SQ={borderRadius:{...Rh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rh,borderTopRightRadius:Rh,borderBottomLeftRadius:Rh,borderBottomRightRadius:Rh,boxShadow:wQ};function NQ(e,t,n){const i=Is(e)?e:fm(e);return i.start(ik("",i,t,n)),i.animation}function TQ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const kQ=(e,t)=>e.depth-t.depth;class AQ{constructor(){this.children=[],this.isDirty=!1}add(t){zT(this.children,t),this.isDirty=!0}remove(t){VT(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(kQ),this.isDirty=!1,this.children.forEach(t)}}function CQ(e,t){const n=Ja.now(),i=({timestamp:s})=>{const r=s-n;r>=t&&(Zl(i),e(r-t))};return Qn.read(i,!0),()=>Zl(i)}const mP=["TopLeft","TopRight","BottomLeft","BottomRight"],IQ=mP.length,gR=e=>typeof e=="string"?parseFloat(e):e,bR=e=>typeof e=="number"||bt.test(e);function RQ(e,t,n,i,s,r){s?(e.opacity=mi(0,n.opacity!==void 0?n.opacity:1,jQ(i)),e.opacityExit=mi(t.opacity!==void 0?t.opacity:1,0,OQ(i))):r&&(e.opacity=mi(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;ait?1:n(ff(e,t,i))}function xR(e,t){e.min=t.min,e.max=t.max}function Or(e,t){xR(e.x,t.x),xR(e.y,t.y)}function ER(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function vR(e,t,n,i,s){return e-=t,e=ky(e,1/n,i),s!==void 0&&(e=ky(e,1/s,i)),e}function MQ(e,t=0,n=1,i=.5,s,r=e,a=e){if(Za.test(t)&&(t=parseFloat(t),t=mi(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=mi(r.min,r.max,i);e===r&&(l-=t),e.min=vR(e.min,t,n,l,s),e.max=vR(e.max,t,n,l,s)}function wR(e,t,[n,i,s],r,a){MQ(e,t[n],t[i],t[s],t.scale,r,a)}const LQ=["x","scaleX","originX"],DQ=["y","scaleY","originY"];function _R(e,t,n,i){wR(e.x,t,LQ,n?n.x:void 0,i?i.x:void 0),wR(e.y,t,DQ,n?n.y:void 0,i?i.y:void 0)}function SR(e){return e.translate===0&&e.scale===1}function bP(e){return SR(e.x)&&SR(e.y)}function NR(e,t){return e.min===t.min&&e.max===t.max}function PQ(e,t){return NR(e.x,t.x)&&NR(e.y,t.y)}function TR(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yP(e,t){return TR(e.x,t.x)&&TR(e.y,t.y)}function kR(e){return Cr(e.x)/Cr(e.y)}function AR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class BQ{constructor(){this.members=[]}add(t){zT(this.members,t),t.scheduleRender()}remove(t){if(VT(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(s=>t===s);if(n===0)return!1;let i;for(let s=n;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1){i=r;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function UQ(e,t,n){let i="";const s=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||r||a)&&(i=`translate3d(${s}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),p&&(i+=`skewX(${p}deg) `),m&&(i+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(i+=`scale(${l}, ${c})`),i||"none"}const Tc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ep=typeof window<"u"&&window.MotionDebug!==void 0,lv=["","X","Y","Z"],FQ={visibility:"hidden"},CR=1e3;let $Q=0;function cv(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function xP(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=w6(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Qn,!(s||r))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&xP(i)}function EP({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(a={},l=t==null?void 0:t()){this.id=$Q++,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,ep&&(Tc.totalNodes=Tc.resolvedTargetDeltas=Tc.recalculatedProjection=0),this.nodes.forEach(VQ),this.nodes.forEach(WQ),this.nodes.forEach(XQ),this.nodes.forEach(GQ),ep&&window.MotionDebug.record(Tc)},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=CQ(h,250),Eb.hasAnimatedSinceResize&&(Eb.hasAnimatedSinceResize=!1,this.nodes.forEach(RR))})}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 g=this.options.transition||d.getDefaultTransition()||tZ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!yP(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={...HT(g,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||RR(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,Zl(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(QQ),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&&xP(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 N=w/1e3;jR(f.x,a.x,N),jR(f.y,a.y,N),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ip(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),JQ(this.relativeTarget,this.relativeTargetOrigin,h,N),E&&PQ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Ri()),Or(E,this.relativeTarget)),g&&(this.animationValues=d,RQ(d,u,this.latestValues,N,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=N},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&&(Zl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qn.update(()=>{Eb.hasAnimatedSinceResize=!0,this.currentAnimation=NQ(0,CR,{...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(CR),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&&vP(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ri();const f=Cr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Cr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Or(l,c),Td(l,d),Cp(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new BQ),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&&cv("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(IR),this.root.sharedNodes.clear()}}}function HQ(e){e.updateLayout()}function zQ(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:i,measuredBox:s}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Mr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Cr(h);h.min=i[f].min,h.max=h.min+p}):vP(r,n.layoutBox,i)&&Mr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Cr(i[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Sd();Cp(l,i,n.layoutBox);const c=Sd();a?Cp(c,e.applyTransform(s,!0),n.measuredBox):Cp(c,i,n.layoutBox);const u=!bP(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=Ri();Ip(m,n.layoutBox,h.layoutBox);const g=Ri();Ip(g,i,p.layoutBox),yP(m,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function VQ(e){ep&&Tc.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 GQ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function KQ(e){e.clearSnapshot()}function IR(e){e.clearMeasurements()}function qQ(e){e.isLayoutDirty=!1}function YQ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function RR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function WQ(e){e.resolveTargetDelta()}function XQ(e){e.calcProjection()}function QQ(e){e.resetSkewAndRotation()}function ZQ(e){e.removeLeadSnapshot()}function jR(e,t,n){e.translate=mi(t.translate,0,n),e.scale=mi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function OR(e,t,n,i){e.min=mi(t.min,n.min,i),e.max=mi(t.max,n.max,i)}function JQ(e,t,n,i){OR(e.x,t.x,n.x,i),OR(e.y,t.y,n.y,i)}function eZ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const tZ={duration:.45,ease:[.4,0,.1,1]},MR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),LR=MR("applewebkit/")&&!MR("chrome/")?Math.round:Nr;function DR(e){e.min=LR(e.min),e.max=LR(e.max)}function nZ(e){DR(e.x),DR(e.y)}function vP(e,t,n){return e==="position"||e==="preserve-aspect"&&!rQ(kR(t),kR(n),.2)}function iZ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const sZ=EP({attachResizeListener:(e,t)=>pm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),uv={current:void 0},wP=EP({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!uv.current){const e=new sZ({});e.mount(window),e.setOptions({layoutScroll:!0}),uv.current=e}return uv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),rZ={pan:{Feature:vQ},drag:{Feature:EQ,ProjectionNode:wP,MeasureLayout:pP}};function aZ(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const r=(i=void 0)!==null&&i!==void 0?i:s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function _P(e,t){const n=aZ(e),i=new AbortController,s={passive:!0,...t,signal:i.signal};return[n,s,()=>i.abort()]}function PR(e){return t=>{t.pointerType==="touch"||sP()||e(t)}}function oZ(e,t,n={}){const[i,s,r]=_P(e,n),a=PR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=PR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return i.forEach(l=>{l.addEventListener("pointerenter",a,s)}),r}function BR(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,r=i[s];r&&Qn.postRender(()=>r(t,ng(t)))}class lZ extends ac{mount(){const{current:t}=this.node;t&&(this.unmount=oZ(t,n=>(BR(this.node,n,"Start"),i=>BR(this.node,i,"End"))))}unmount(){}}class cZ extends ac{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=tg(pm(this.node.current,"focus",()=>this.onFocus()),pm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const SP=(e,t)=>t?e===t?!0:SP(e,t.parentElement):!1,uZ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dZ(e){return uZ.has(e.tagName)||e.tabIndex!==-1}const tp=new WeakSet;function UR(e){return t=>{t.key==="Enter"&&e(t)}}function dv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const fZ=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=UR(()=>{if(tp.has(n))return;dv(n,"down");const s=UR(()=>{dv(n,"up")}),r=()=>dv(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function FR(e){return sk(e)&&!sP()}function hZ(e,t,n={}){const[i,s,r]=_P(e,n),a=l=>{const c=l.currentTarget;if(!FR(l)||tp.has(c))return;tp.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!FR(p)||!tp.has(c))&&(tp.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||SP(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return i.forEach(l=>{!dZ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),l.addEventListener("focus",u=>fZ(u,s),s)}),r}function $R(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),r=i[s];r&&Qn.postRender(()=>r(t,ng(t)))}class pZ extends ac{mount(){const{current:t}=this.node;t&&(this.unmount=hZ(t,n=>($R(this.node,n,"Start"),(i,{success:s})=>$R(this.node,i,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const V_=new WeakMap,fv=new WeakMap,mZ=e=>{const t=V_.get(e.target);t&&t(e)},gZ=e=>{e.forEach(mZ)};function bZ({root:e,...t}){const n=e||document;fv.has(n)||fv.set(n,{});const i=fv.get(n),s=JSON.stringify(t);return i[s]||(i[s]=new IntersectionObserver(gZ,{root:e,...t})),i[s]}function yZ(e,t,n){const i=bZ(t);return V_.set(e,n),i.observe(e),()=>{V_.delete(e),i.unobserve(e)}}const xZ={some:0,all:1};class EZ extends ac{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:xZ[s]},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 yZ(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(vZ(t,n))&&this.startObserver()}unmount(){}}function vZ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const wZ={inView:{Feature:EZ},tap:{Feature:pZ},focus:{Feature:cZ},hover:{Feature:lZ}},_Z={layout:{ProjectionNode:wP,MeasureLayout:pP}},G_={current:null},NP={current:!1};function SZ(){if(NP.current=!0,!!AT)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>G_.current=e.matches;e.addListener(t),t()}else G_.current=!1}const NZ=[...K6,Cs,Jl],TZ=e=>NZ.find(G6(e)),HR=new WeakMap;function kZ(e,t,n){for(const i in t){const s=t[i],r=n[i];if(Is(s))e.addValue(i,s);else if(Is(r))e.addValue(i,fm(s,{owner:e}));else if(r!==s)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(i);e.addValue(i,fm(a!==void 0?a:s,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const zR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class AZ{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:s,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=ek,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=Ja.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),NP.current||SZ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:G_.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){HR.delete(this.current),this.projection&&this.projection.unmount(),Zl(this.notifyUpdate),Zl(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 i=xu.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Qn.preRender(this.notifyUpdate),i&&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,()=>{s(),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 df){const n=df[t];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(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):Ri()}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 i=0;in.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&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 i=this.values.get(t);return i===void 0&&n!==void 0&&(i=fm(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(z6(s)||M6(s))?s=parseFloat(s):!TZ(s)&&Jl.test(n)&&(s=F6(t,n)),this.setBaseTarget(t,Is(s)?s.get():s)),Is(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let s;if(typeof i=="string"||typeof i=="object"){const a=MT(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(i&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Is(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new GT),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class TP extends AZ{constructor(){super(...arguments),this.KeyframeResolver=q6}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:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Is(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function CZ(e){return window.getComputedStyle(e)}class IZ extends TP{constructor(){super(...arguments),this.type="html",this.renderInstance=h6}readValueFromInstance(t,n){if(xu.has(n)){const i=JT(n);return i&&i.default||0}else{const i=CZ(t),s=(u6(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return fP(t,n)}build(t,n,i){PT(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return $T(t,n,i)}}class RZ extends TP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ri}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(xu.has(n)){const i=JT(n);return i&&i.default||0}return n=p6.has(n)?n:RT(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return b6(t,n,i)}build(t,n,i){BT(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,s){m6(t,n,i,s)}mount(t){this.isSVGTag=FT(t.tagName),super.mount(t)}}const jZ=(e,t)=>OT(e)?new RZ(t):new IZ(t,{allowProjection:e!==b.Fragment}),OZ=sW({...WX,...wZ,...rZ,..._Z},jZ),Wn=xY(OZ);function es(){return es=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?b.useEffect:b.useLayoutEffect;function id(e,t,n){var i=b.useRef(t);i.current=t,b.useEffect(function(){function s(r){i.current(r)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var MZ=["container"];function LZ(e){var t=e.container,n=t===void 0?document.body:t,i=F1(e,MZ);return Ss.createPortal(Mt.createElement("div",es({},i)),n)}function DZ(e){return Mt.createElement("svg",es({width:"44",height:"44",viewBox:"0 0 768 768"},e),Mt.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 PZ(e){return Mt.createElement("svg",es({width:"44",height:"44",viewBox:"0 0 768 768"},e),Mt.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 BZ(e){return Mt.createElement("svg",es({width:"44",height:"44",viewBox:"0 0 768 768"},e),Mt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function UZ(){return b.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function GR(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var s=e.touches[1],r=s.clientX,a=s.clientY;return[(n+r)/2,(i+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var vl=function(e,t,n,i){var s,r=n*t,a=(r-i)/2,l=e;return r<=i?(s=1,l=0):e>0&&a-e<=0?(s=2,l=a):e<0&&a+e<=0&&(s=3,l=-a),[s,l]};function hv(e,t,n,i,s,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=vl(e,r,n,innerWidth)[0],f=vl(t,r,i,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/s*(a-(h+e))-h+(i/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/s*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function Y_(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function pv(e,t,n){var i=Y_(n,innerWidth,innerHeight),s=i[0],r=i[1],a=0,l=s,c=r,u=e/t*r,d=t/e*s;return e=r?l=u:e>=s&&ts/r?c=d:t/e>=3&&!i[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function E0(e,t){var n=t.leading,i=n!==void 0&&n,s=t.maxWait,r=t.wait,a=r===void 0?s||0:r,l=b.useRef(e);l.current=e;var c=b.useRef(0),u=b.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=b.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var g=c.current,v=p-g;if(g===0&&(i&&m(),c.current=p),s!==void 0){if(v>s)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var $Z={T:0,L:0,W:0,H:0,FIT:void 0},AP=function(){var e=b.useRef(!1);return b.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},HZ=["className"];function zZ(e){var t=e.className,n=t===void 0?"":t,i=F1(e,HZ);return Mt.createElement("div",es({className:"PhotoView__Spinner "+n},i),Mt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Mt.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"}),Mt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var VZ=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function GZ(e){var t=e.src,n=e.loaded,i=e.broken,s=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=F1(e,VZ),u=AP();return t&&!i?Mt.createElement(Mt.Fragment,null,Mt.createElement("img",es({className:"PhotoView__Photo"+(s?" "+s:""),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?Mt.createElement("span",{className:"PhotoView__icon"},a):Mt.createElement(zZ,{className:"PhotoView__icon"}))):l?Mt.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var KZ={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 qZ(e){var t=e.item,n=t.src,i=t.render,s=t.width,r=s===void 0?0:s,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,g=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,N=e.onPhotoResize,_=e.isActive,T=e.expose,k=Ay(KZ),C=k[0],I=k[1],O=b.useRef(0),M=AP(),G=C.naturalWidth,D=G===void 0?r:G,F=C.naturalHeight,A=F===void 0?l:F,j=C.width,P=j===void 0?r:j,$=C.height,R=$===void 0?l:$,Y=C.loaded,Z=Y===void 0?!n:Y,B=C.broken,te=C.x,z=C.y,q=C.touched,W=C.stopRaf,K=C.maskTouched,ue=C.rotate,pe=C.scale,_e=C.CX,fe=C.CY,me=C.lastX,Re=C.lastY,ge=C.lastCX,oe=C.lastCY,Te=C.lastScale,ve=C.touchTime,Xe=C.touchLength,De=C.pause,ze=C.reach,Ne=Vc({onScale:function(ye){return Pe(x0(ye))},onRotate:function(ye){ue!==ye&&(T({rotate:ye}),I(es({rotate:ye},pv(D,A,ye))))}});function Pe(ye,Ze,Et){pe!==ye&&(T({scale:ye}),I(es({scale:ye},hv(te,z,P,R,pe,ye,Ze,Et),ye<=1&&{x:0,y:0})))}var Fe=E0(function(ye,Ze,Et){if(Et===void 0&&(Et=0),(q||K)&&_){var sn=Y_(ue,P,R),jn=sn[0],ot=sn[1];if(Et===0&&O.current===0){var mt=Math.abs(ye-_e)<=20,rn=Math.abs(Ze-fe)<=20;if(mt&&rn)return void I({lastCX:ye,lastCY:Ze});O.current=mt?Ze>fe?3:2:1}var fn,At=ye-ge,Wt=Ze-oe;if(Et===0){var Ti=vl(At+me,pe,jn,innerWidth)[0],bi=vl(Wt+Re,pe,ot,innerHeight);fn=function($n,hn,vn,Hn){return hn&&$n===1||Hn==="x"?"x":vn&&$n>1||Hn==="y"?"y":void 0}(O.current,Ti,bi[0],ze),fn!==void 0&&E(fn,ye,Ze,pe)}if(fn==="x"||K)return void I({reach:"x"});var On=x0(pe+(Et-Xe)/100/2*pe,D/P,.2);T({scale:On}),I(es({touchLength:Et,reach:fn,scale:On},hv(te,z,P,R,pe,On,ye,Ze,At,Wt)))}},{maxWait:8});function qe(ye){return!W&&!q&&(M.current&&I(es({},ye,{pause:u})),M.current)}var Q,ae,ie,be,Ue,Ye,yt,lt,ln=(Ue=function(ye){return qe({x:ye})},Ye=function(ye){return qe({y:ye})},yt=function(ye){return M.current&&(T({scale:ye}),I({scale:ye})),!q&&M.current},lt=Vc({X:function(ye){return Ue(ye)},Y:function(ye){return Ye(ye)},S:function(ye){return yt(ye)}}),function(ye,Ze,Et,sn,jn,ot,mt,rn,fn,At,Wt){var Ti=Y_(At,jn,ot),bi=Ti[0],On=Ti[1],$n=vl(ye,rn,bi,innerWidth),hn=$n[0],vn=$n[1],Hn=vl(Ze,rn,On,innerHeight),Bi=Hn[0],Xi=Hn[1],ki=Date.now()-Wt;if(ki>=200||rn!==mt||Math.abs(fn-mt)>1){var Ui=hv(ye,Ze,jn,ot,mt,rn),gn=Ui.x,Ai=Ui.y,zn=hn?vn:gn!==ye?gn:null,Jn=Bi?Xi:Ai!==Ze?Ai:null;return zn!==null&&Rc(ye,zn,lt.X),Jn!==null&&Rc(Ze,Jn,lt.Y),void(rn!==mt&&Rc(mt,rn,lt.S))}var Ci=(ye-Et)/ki,yi=(Ze-sn)/ki,pn=Math.sqrt(Math.pow(Ci,2)+Math.pow(yi,2)),An=!1,Mn=!1;(function(Ln,ce){var Se,Le=Ln,Ee=0,rt=0,it=function(oi){Se||(Se=oi);var Dn=oi-Se,ps=Math.sign(Ln),xi=-.001*ps,wt=Math.sign(-Le)*Math.pow(Le,2)*2e-4,Tt=Le*Dn+(xi+wt)*Math.pow(Dn,2)/2;Ee+=Tt,Se=oi,ps*(Le+=(xi+wt)*Dn)<=0?Pt():ce(Ee)?jt():Pt()};function jt(){rt=requestAnimationFrame(it)}function Pt(){cancelAnimationFrame(rt)}jt()})(pn,function(Ln){var ce=ye+Ln*(Ci/pn),Se=Ze+Ln*(yi/pn),Le=vl(ce,mt,bi,innerWidth),Ee=Le[0],rt=Le[1],it=vl(Se,mt,On,innerHeight),jt=it[0],Pt=it[1];if(Ee&&!An&&(An=!0,hn?Rc(ce,rt,lt.X):KR(rt,ce+(ce-rt),lt.X)),jt&&!Mn&&(Mn=!0,Bi?Rc(Se,Pt,lt.Y):KR(Pt,Se+(Se-Pt),lt.Y)),An&&Mn)return!1;var oi=An||lt.X(rt),Dn=Mn||lt.Y(Pt);return oi&&Dn})}),Dt=(Q=y,ae=function(ye,Ze){ze||Pe(pe!==1?1:Math.max(2,D/P),ye,Ze)},ie=b.useRef(0),be=E0(function(){ie.current=0,Q.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);ie.current+=1,be.apply(void 0,ye),ie.current>=2&&(be.cancel(),ie.current=0,ae.apply(void 0,ye))});function kt(ye,Ze){if(O.current=0,(q||K)&&_){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Et=x0(pe,D/P);if(ln(te,z,me,Re,P,R,pe,Et,Te,ue,ve),w(ye,Ze),_e===ye&&fe===Ze){if(q)return void Dt(ye,Ze);K&&x(ye,Ze)}}}function $t(ye,Ze,Et){Et===void 0&&(Et=0),I({touched:!0,CX:ye,CY:Ze,lastCX:ye,lastCY:Ze,lastX:te,lastY:z,lastScale:pe,touchLength:Et,touchTime:Date.now()})}function Ge(ye){I({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:te,lastY:z})}id(vo?void 0:"mousemove",function(ye){ye.preventDefault(),Fe(ye.clientX,ye.clientY)}),id(vo?void 0:"mouseup",function(ye){kt(ye.clientX,ye.clientY)}),id(vo?"touchmove":void 0,function(ye){ye.preventDefault();var Ze=GR(ye);Fe.apply(void 0,Ze)},{passive:!1}),id(vo?"touchend":void 0,function(ye){var Ze=ye.changedTouches[0];kt(Ze.clientX,Ze.clientY)},{passive:!1}),id("resize",E0(function(){Z&&!q&&(I(pv(D,A,ue)),N())},{maxWait:8})),q_(function(){_&&T(es({scale:pe,rotate:ue},Ne))},[_]);var Kt=function(ye,Ze,Et,sn,jn,ot,mt,rn,fn,At){var Wt=function(gn,Ai,zn,Jn,Ci){var yi=b.useRef(!1),pn=Ay({lead:!0,scale:zn}),An=pn[0],Mn=An.lead,Ln=An.scale,ce=pn[1],Se=E0(function(Le){try{return Ci(!0),ce({lead:!1,scale:Le}),Promise.resolve()}catch(Ee){return Promise.reject(Ee)}},{wait:Jn});return q_(function(){yi.current?(Ci(!1),ce({lead:!0}),Se(zn)):yi.current=!0},[zn]),Mn?[gn*Ln,Ai*Ln,zn/Ln]:[gn*zn,Ai*zn,1]}(ot,mt,rn,fn,At),Ti=Wt[0],bi=Wt[1],On=Wt[2],$n=function(gn,Ai,zn,Jn,Ci){var yi=b.useState($Z),pn=yi[0],An=yi[1],Mn=b.useState(0),Ln=Mn[0],ce=Mn[1],Se=b.useRef(),Le=Vc({OK:function(){return gn&&ce(4)}});function Ee(rt){Ci(!1),ce(rt)}return b.useEffect(function(){if(Se.current||(Se.current=Date.now()),zn){if(function(rt,it){var jt=rt&&rt.current;if(jt&&jt.nodeType===1){var Pt=jt.getBoundingClientRect();it({T:Pt.top,L:Pt.left,W:Pt.width,H:Pt.height,FIT:jt.tagName==="IMG"?getComputedStyle(jt).objectFit:void 0})}}(Ai,An),gn)return Date.now()-Se.current<250?(ce(1),requestAnimationFrame(function(){ce(2),requestAnimationFrame(function(){return Ee(3)})}),void setTimeout(Le.OK,Jn)):void ce(4);Ee(5)}},[gn,zn]),[Ln,pn]}(ye,Ze,Et,fn,At),hn=$n[0],vn=$n[1],Hn=vn.W,Bi=vn.FIT,Xi=innerWidth/2,ki=innerHeight/2,Ui=hn<3||hn>4;return[Ui?Hn?vn.L:Xi:sn+(Xi-ot*rn/2),Ui?Hn?vn.T:ki:jn+(ki-mt*rn/2),Ti,Ui&&Bi?Ti*(vn.H/Hn):bi,hn===0?On:Ui?Hn/(ot*rn)||.01:On,Ui?Bi?1:0:1,hn,Bi]}(u,c,Z,te,z,P,R,pe,d,function(ye){return I({pause:ye})}),nt=Kt[4],at=Kt[6],Qe="transform "+d+"ms "+f,Nt={className:p,onMouseDown:vo?void 0:function(ye){ye.stopPropagation(),ye.button===0&&$t(ye.clientX,ye.clientY,0)},onTouchStart:vo?function(ye){ye.stopPropagation(),$t.apply(void 0,GR(ye))}:void 0,onWheel:function(ye){if(!ze){var Ze=x0(pe-ye.deltaY/100/2,D/P);I({stopRaf:!0}),Pe(Ze,ye.clientX,ye.clientY)}},style:{width:Kt[2]+"px",height:Kt[3]+"px",opacity:Kt[5],objectFit:at===4?void 0:Kt[7],transform:ue?"rotate("+ue+"deg)":void 0,transition:at>2?Qe+", opacity "+d+"ms ease, height "+(at<4?d/2:at>4?d:0)+"ms "+f:void 0}};return Mt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!vo&&_?Ge:void 0,onTouchStart:vo&&_?function(ye){return Ge(ye.touches[0])}:void 0},Mt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+nt+", 0, 0, "+nt+", "+Kt[0]+", "+Kt[1]+")",transition:q||De?void 0:Qe,willChange:_?"transform":void 0}},n?Mt.createElement(GZ,es({src:n,loaded:Z,broken:B},Nt,{onPhotoLoad:function(ye){I(es({},ye,ye.loaded&&pv(ye.naturalWidth||0,ye.naturalHeight||0,ue)))},loadingElement:g,brokenElement:v})):i&&i({attrs:Nt,scale:nt,rotate:ue})))}var qR={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 YZ(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,s=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,g=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,N=e.brokenElement,_=e.images,T=e.index,k=T===void 0?0:T,C=e.onIndexChange,I=e.visible,O=e.onClose,M=e.afterClose,G=e.portalContainer,D=Ay(qR),F=D[0],A=D[1],j=b.useState(0),P=j[0],$=j[1],R=F.x,Y=F.touched,Z=F.pause,B=F.lastCX,te=F.lastCY,z=F.bg,q=z===void 0?u:z,W=F.lastBg,K=F.overlay,ue=F.minimal,pe=F.scale,_e=F.rotate,fe=F.onScale,me=F.onRotate,Re=e.hasOwnProperty("index"),ge=Re?k:P,oe=Re?C:$,Te=b.useRef(ge),ve=_.length,Xe=_[ge],De=typeof n=="boolean"?n:ve>n,ze=function(nt,at){var Qe=b.useReducer(function(Et){return!Et},!1)[1],Nt=b.useRef(0),ye=function(Et){var sn=b.useRef(Et);function jn(ot){sn.current=ot}return b.useMemo(function(){(function(ot){nt?(ot(nt),Nt.current=1):Nt.current=2})(jn)},[Et]),[sn.current,jn]}(nt),Ze=ye[1];return[ye[0],Nt.current,function(){Qe(),Nt.current===2&&(Ze(!1),at&&at()),Nt.current=0}]}(I,M),Ne=ze[0],Pe=ze[1],Fe=ze[2];q_(function(){if(Ne)return A({pause:!0,x:ge*-(innerWidth+Hu)}),void(Te.current=ge);A(qR)},[Ne]);var qe=Vc({close:function(nt){me&&me(0),A({overlay:!0,lastBg:q}),O(nt)},changeIndex:function(nt,at){at===void 0&&(at=!1);var Qe=De?Te.current+(nt-ge):nt,Nt=ve-1,ye=K_(Qe,0,Nt),Ze=De?Qe:ye,Et=innerWidth+Hu;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-Et*Ze,pause:at}),Te.current=Ze,oe&&oe(De?nt<0?Nt:nt>Nt?0:nt:ye)}}),Q=qe.close,ae=qe.changeIndex;function ie(nt){return nt?Q():A({overlay:!K})}function be(){A({x:-(innerWidth+Hu)*ge,lastCX:void 0,lastCY:void 0,pause:!0}),Te.current=ge}function Ue(nt,at,Qe,Nt){nt==="x"?function(ye){if(B!==void 0){var Ze=ye-B,Et=Ze;!De&&(ge===0&&Ze>0||ge===ve-1&&Ze<0)&&(Et=Ze/2),A({touched:!0,lastCX:B,x:-(innerWidth+Hu)*Te.current+Et,pause:!1})}else A({touched:!0,lastCX:ye,x:R,pause:!1})}(at):nt==="y"&&function(ye,Ze){if(te!==void 0){var Et=u===null?null:K_(u,.01,u-Math.abs(ye-te)/100/4);A({touched:!0,lastCY:te,bg:Ze===1?Et:u,minimal:Ze===1})}else A({touched:!0,lastCY:ye,bg:q,minimal:!0})}(Qe,Nt)}function Ye(nt,at){var Qe=nt-(B??nt),Nt=at-(te??at),ye=!1;if(Qe<-40)ae(ge+1);else if(Qe>40)ae(ge-1);else{var Ze=-(innerWidth+Hu)*Te.current;Math.abs(Nt)>100&&ue&&f&&(ye=!0,Q()),A({touched:!1,x:Ze,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||K})}}id("keydown",function(nt){if(I)switch(nt.key){case"ArrowLeft":ae(ge-1,!0);break;case"ArrowRight":ae(ge+1,!0);break;case"Escape":Q()}});var yt=function(nt,at,Qe){return b.useMemo(function(){var Nt=nt.length;return Qe?nt.concat(nt).concat(nt).slice(Nt+at-1,Nt+at+2):nt.slice(Math.max(at-1,0),Math.min(at+2,Nt+1))},[nt,at,Qe])}(_,ge,De);if(!Ne)return null;var lt=K&&!Pe,ln=I?q:W,Dt=fe&&me&&{images:_,index:ge,visible:I,onClose:Q,onIndexChange:ae,overlayVisible:lt,overlay:Xe&&Xe.overlay,scale:pe,rotate:_e,onScale:fe,onRotate:me},kt=i?i(Pe):400,$t=s?s(Pe):VR,Ge=i?i(3):600,Kt=s?s(3):VR;return Mt.createElement(LZ,{className:"PhotoView-Portal"+(lt?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(nt){return nt.stopPropagation()},container:G},I&&Mt.createElement(UZ,null),Mt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Pe===1?" PhotoView-Slider__fadeIn":Pe===2?" PhotoView-Slider__fadeOut":""),style:{background:ln?"rgba(0, 0, 0, "+ln+")":void 0,transitionTimingFunction:$t,transitionDuration:(Y?0:kt)+"ms",animationDuration:kt+"ms"},onAnimationEnd:Fe}),p&&Mt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Mt.createElement("div",{className:"PhotoView-Slider__Counter"},ge+1," / ",ve),Mt.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Dt&&g(Dt),Mt.createElement(DZ,{className:"PhotoView-Slider__toolbarIcon",onClick:Q}))),yt.map(function(nt,at){var Qe=De||ge!==0?Te.current-1+at:ge+at;return Mt.createElement(qZ,{key:De?nt.key+"/"+nt.src+"/"+Qe:nt.key,item:nt,speed:kt,easing:$t,visible:I,onReachMove:Ue,onReachUp:Ye,onPhotoTap:function(){return ie(r)},onMaskTap:function(){return ie(l)},wrapClassName:E,className:x,style:{left:(innerWidth+Hu)*Qe+"px",transform:"translate3d("+R+"px, 0px, 0)",transition:Y||Z?void 0:"transform "+Ge+"ms "+Kt},loadingElement:w,brokenElement:N,onPhotoResize:be,isActive:Te.current===Qe,expose:A})}),!vo&&p&&Mt.createElement(Mt.Fragment,null,(De||ge!==0)&&Mt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ae(ge-1,!0)}},Mt.createElement(PZ,null)),(De||ge+1-1){var y=u.slice();return y.splice(v,1,g),void l({images:y})}l(function(x){return{images:x.images.concat(g)}})},remove:function(g){l(function(v){var y=v.images.filter(function(x){return x.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var v=u.findIndex(function(y){return y.key===g});l({visible:!0,index:v}),i&&i(!0,v,a)}}),p=Vc({close:function(){l({visible:!1}),i&&i(!1,f,a)},changeIndex:function(g){l({index:g}),n&&n(g,a)}}),m=b.useMemo(function(){return es({},a,h)},[a,h]);return Mt.createElement(kP.Provider,{value:m},t,Mt.createElement(YZ,es({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var CP=function(e){var t,n,i=e.src,s=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=b.useContext(kP),h=(t=function(){return f.nextId()},(n=b.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=b.useRef(null);b.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),b.useEffect(function(){return function(){f.remove(h)}},[]);var m=Vc({render:function(v){return s&&s(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),g=b.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return b.useEffect(function(){f.update({key:h,src:i,originRef:p,render:m.render,overlay:r,width:a,height:l})},[i]),d?b.Children.only(b.cloneElement(d,es({},g,{ref:p}))):null};/** + `),()=>{document.head.removeChild(d)}},[t]),o.jsx(vY,{isPresent:t,childRef:i,sizeRef:s,children:b.cloneElement(e,{ref:i})})}const _Y=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:r,mode:a})=>{const l=F1(SY),c=b.useId(),u=b.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;i&&i()},[l,i]),d=b.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return b.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),b.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),a==="popLayout"&&(e=o.jsx(wY,{isPresent:n,children:e})),o.jsx($1.Provider,{value:d,children:e})};function SY(){return new Map}function o6(e=!0){const t=b.useContext($1);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=t,r=b.useId();b.useEffect(()=>{e&&s(r)},[e]);const a=b.useCallback(()=>e&&i&&i(r),[r,i,e]);return!n&&i?[!1,a]:[!0]}const E0=e=>e.key||"";function PI(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const DT=typeof window<"u",l6=DT?b.useLayoutEffect:b.useEffect,Ro=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=o6(a),u=b.useMemo(()=>PI(e),[e]),d=a&&!l?[]:u.map(E0),f=b.useRef(!0),h=b.useRef(u),p=F1(()=>new Map),[m,g]=b.useState(u),[v,y]=b.useState(u);l6(()=>{f.current=!1,h.current=u;for(let w=0;w{const N=E0(w),_=a&&!l?!1:u===v||d.includes(N),T=()=>{if(p.has(N))p.set(N,!0);else return;let k=!0;p.forEach(C=>{C||(k=!1)}),k&&(E==null||E(),y(h.current),a&&(c==null||c()),i&&i())};return o.jsx(_Y,{isPresent:_,initial:!f.current||n?void 0:!1,custom:_?void 0:t,presenceAffectsLayout:s,mode:r,onExitComplete:_?void 0:T,children:w},N)})})},kr=e=>e;let c6=kr;const NY={useManualTiming:!1};function TY(e){let t=new Set,n=new Set,i=!1,s=!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&&i?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,i){s=!0;return}i=!0,[t,n]=[n,t],t.forEach(l),t.clear(),i=!1,s&&(s=!1,c.process(u))}};return c}const v0=["read","resolveKeyframes","update","preRender","render","postRender"],kY=40;function u6(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=v0.reduce((y,x)=>(y[x]=TY(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,s.delta=i?1e3/60:Math.max(Math.min(y-s.timestamp,kY),1),s.timestamp=y,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(p))},m=()=>{n=!0,i=!0,s.isProcessing||e(p)};return{schedule:v0.reduce((y,x)=>{const E=a[x];return y[x]=(w,N=!1,_=!1)=>(n||m(),E.schedule(w,N,_)),y},{}),cancel:y=>{for(let x=0;xBI[e].some(n=>!!t[n])};function AY(e){for(const t in e)hf[t]={...hf[t],...e[t]}}const CY=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 ky(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||CY.has(e)}let f6=e=>!ky(e);function h6(e){e&&(f6=t=>t.startsWith("on")?!ky(t):e(t))}try{h6(require("@emotion/is-prop-valid").default)}catch{}function IY(e,t,n){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||(f6(s)||n===!0&&ky(s)||!t&&!ky(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}function RY({children:e,isValidProp:t,...n}){t&&h6(t),n={...b.useContext(hm),...n},n.isStatic=F1(()=>n.isStatic);const i=b.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(hm.Provider,{value:i,children:e})}function jY(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const H1=b.createContext({});function pm(e){return typeof e=="string"||Array.isArray(e)}function z1(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const PT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],BT=["initial",...PT];function V1(e){return z1(e.animate)||BT.some(t=>pm(e[t]))}function p6(e){return!!(V1(e)||e.variants)}function OY(e,t){if(V1(e)){const{initial:n,animate:i}=e;return{initial:n===!1||pm(n)?n:void 0,animate:pm(i)?i:void 0}}return e.inherit!==!1?t:{}}function MY(e){const{initial:t,animate:n}=OY(e,b.useContext(H1));return b.useMemo(()=>({initial:t,animate:n}),[UI(t),UI(n)])}function UI(e){return Array.isArray(e)?e.join(" "):e}const LY=Symbol.for("motionComponentSymbol");function Sd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function DY(e,t,n){return b.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):Sd(n)&&(n.current=i))},[t])}const UT=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),PY="framerAppearId",m6="data-"+UT(PY),{schedule:FT}=u6(queueMicrotask,!1),g6=b.createContext({});function BY(e,t,n,i,s){var r,a;const{visualElement:l}=b.useContext(H1),c=b.useContext(d6),u=b.useContext($1),d=b.useContext(hm).reducedMotion,f=b.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=b.useContext(g6);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&UY(f.current,n,s,p);const m=b.useRef(!1);b.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const g=n[m6],v=b.useRef(!!g&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return l6(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),FT.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),b.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),v.current=!1))}),h}function UY(e,t,n,i){const{layoutId:s,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:b6(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!a||l&&Sd(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function b6(e){if(e)return e.options.allowProjection!==!1?e.projection:b6(e.parent)}function FY({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:s}){var r,a;e&&AY(e);function l(u,d){let f;const h={...b.useContext(hm),...u,layoutId:$Y(u)},{isStatic:p}=h,m=MY(u),g=i(u,p);if(!p&&DT){HY();const v=zY(h);f=v.MeasureLayout,m.visualElement=BY(s,g,h,t,v.ProjectionNode)}return o.jsxs(H1.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,DY(g,m.visualElement,d),g,p,m.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(a=(r=s.displayName)!==null&&r!==void 0?r:s.name)!==null&&a!==void 0?a:""})`}`;const c=b.forwardRef(l);return c[LY]=s,c}function $Y({layoutId:e}){const t=b.useContext(LT).id;return t&&e!==void 0?t+"-"+e:e}function HY(e,t){b.useContext(d6).strict}function zY(e){const{drag:t,layout:n}=hf;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const VY=["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 $T(e){return typeof e!="string"||e.includes("-")?!1:!!(VY.indexOf(e)>-1||/[A-Z]/u.test(e))}function FI(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function HT(e,t,n,i){if(typeof t=="function"){const[s,r]=FI(i);t=t(n!==void 0?n:e.custom,s,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,r]=FI(i);t=t(n!==void 0?n:e.custom,s,r)}return t}const P_=e=>Array.isArray(e),GY=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),KY=e=>P_(e)?e[e.length-1]||0:e,Os=e=>!!(e&&e.getVelocity);function _b(e){const t=Os(e)?e.get():e;return GY(t)?t.toValue():t}function qY({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,s,r){const a={latestValues:YY(i,s,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:i,current:l,...a}),a.onUpdate=l=>n(l)),a}const y6=e=>(t,n)=>{const i=b.useContext(H1),s=b.useContext($1),r=()=>qY(e,t,i,s);return n?r():F1(r)};function YY(e,t,n,i){const s={},r=i(e,{});for(const h in r)s[h]=_b(r[h]);let{initial:a,animate:l}=e;const c=V1(e),u=p6(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"&&!z1(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),E6=x6("--"),WY=x6("var(--"),zT=e=>WY(e)?XY.test(e.split("/*")[0].trim()):!1,XY=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,v6=(e,t)=>t&&typeof e=="number"?t.transform(e):e,qo=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},mm={...qf,transform:e=>qo(0,1,e)},w0={...qf,default:1},sg=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yl=sg("deg"),Ja=sg("%"),bt=sg("px"),QY=sg("vh"),ZY=sg("vw"),$I={...Ja,parse:e=>Ja.parse(e)/100,transform:e=>Ja.transform(e*100)},JY={borderWidth:bt,borderTopWidth:bt,borderRightWidth:bt,borderBottomWidth:bt,borderLeftWidth:bt,borderRadius:bt,radius:bt,borderTopLeftRadius:bt,borderTopRightRadius:bt,borderBottomRightRadius:bt,borderBottomLeftRadius:bt,width:bt,maxWidth:bt,height:bt,maxHeight:bt,top:bt,right:bt,bottom:bt,left:bt,padding:bt,paddingTop:bt,paddingRight:bt,paddingBottom:bt,paddingLeft:bt,margin:bt,marginTop:bt,marginRight:bt,marginBottom:bt,marginLeft:bt,backgroundPositionX:bt,backgroundPositionY:bt},eW={rotate:yl,rotateX:yl,rotateY:yl,rotateZ:yl,scale:w0,scaleX:w0,scaleY:w0,scaleZ:w0,skew:yl,skewX:yl,skewY:yl,distance:bt,translateX:bt,translateY:bt,translateZ:bt,x:bt,y:bt,z:bt,perspective:bt,transformPerspective:bt,opacity:mm,originX:$I,originY:$I,originZ:bt},HI={...qf,transform:Math.round},VT={...JY,...eW,zIndex:HI,size:bt,fillOpacity:mm,strokeOpacity:mm,numOctaves:HI},tW={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nW=Kf.length;function iW(e,t,n){let i="",s=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),w6=()=>({...qT(),attrs:{}}),YT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function _6(e,{style:t,vars:n},i,s){Object.assign(e.style,t,s&&s.getProjectionStyles(i));for(const r in n)e.style.setProperty(r,n[r])}const S6=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 N6(e,t,n,i){_6(e,t,void 0,i);for(const s in t.attrs)e.setAttribute(S6.has(s)?s:UT(s),t.attrs[s])}const Ay={};function lW(e){Object.assign(Ay,e)}function T6(e,{layout:t,layoutId:n}){return vu.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ay[e]||e==="opacity")}function WT(e,t,n){var i;const{style:s}=e,r={};for(const a in s)(Os(s[a])||t.style&&Os(t.style[a])||T6(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(r[a]=s[a]);return r}function k6(e,t,n){const i=WT(e,t,n);for(const s in e)if(Os(e[s])||Os(t[s])){const r=Kf.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[r]=e[s]}return i}function cW(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 VI=["x","y","width","height","cx","cy","r"],uW={useVisualState:y6({scrapeMotionValuesFromProps:k6,createRenderState:w6,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:s})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in s)if(vu.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{cW(n,i),ti.render(()=>{KT(i,s,YT(n.tagName),e.transformTemplate),N6(n,i)})})}})},dW={useVisualState:y6({scrapeMotionValuesFromProps:WT,createRenderState:qT})};function A6(e,t,n){for(const i in t)!Os(t[i])&&!T6(i,n)&&(e[i]=t[i])}function fW({transformTemplate:e},t){return b.useMemo(()=>{const n=qT();return GT(n,t,e),Object.assign({},n.vars,n.style)},[t])}function hW(e,t){const n=e.style||{},i={};return A6(i,n,e),Object.assign(i,fW(e,t)),i}function pW(e,t){const n={},i=hW(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.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=i,n}function mW(e,t,n,i){const s=b.useMemo(()=>{const r=w6();return KT(r,t,YT(i),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};A6(r,e.style,e),s.style={...r,...s.style}}return s}function gW(e=!1){return(n,i,s,{latestValues:r},a)=>{const c=($T(n)?mW:pW)(i,r,a,n),u=IY(i,typeof n=="string",e),d=n!==b.Fragment?{...u,...c,ref:s}:{},{children:f}=i,h=b.useMemo(()=>Os(f)?f.get():f,[f]);return b.createElement(n,{...d,children:h})}}function bW(e,t){return function(i,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...$T(i)?uW:dW,preloadedFeatures:e,useRender:gW(s),createVisualElement:t,Component:i};return FY(a)}}function C6(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i(Sb===void 0&&eo.set(xs.isProcessing||NY.useManualTiming?xs.timestamp:performance.now()),Sb),set:e=>{Sb=e,queueMicrotask(yW)}};function QT(e,t){e.indexOf(t)===-1&&e.push(t)}function ZT(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class JT{constructor(){this.subscriptions=[]}add(t){return QT(this.subscriptions,t),()=>ZT(this.subscriptions,t)}notify(t,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,i);else for(let r=0;r!isNaN(parseFloat(e));class EW{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,s=!0)=>{const r=eo.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&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=eo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xW(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 JT);const i=this.events[t].add(n);return t==="change"?()=>{i(),ti.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}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=eo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>GI)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,GI);return R6(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 gm(e,t){return new EW(e,t)}function vW(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,gm(n))}function wW(e,t){const n=G1(e,t);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const a in r){const l=KY(r[a]);vW(e,a,l)}}function _W(e){return!!(Os(e)&&e.add)}function B_(e,t){const n=e.getValue("willChange");if(_W(n))return n.add(t)}function j6(e){return e.props[m6]}function ek(e){let t;return()=>(t===void 0&&(t=e()),t)}const SW=ek(()=>window.ScrollTimeline!==void 0);class NW{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 i=0;i{if(SW()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{i.forEach((s,r)=>{s&&s(),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 TW extends NW{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Po=e=>e*1e3,Bo=e=>e/1e3;function tk(e){return typeof e=="function"}function KI(e,t){e.timeline=t,e.onfinish=null}const nk=e=>Array.isArray(e)&&typeof e[0]=="number",kW={linearEasing:void 0};function AW(e,t){const n=ek(e);return()=>{var i;return(i=kW[t])!==null&&i!==void 0?i:n()}}const Cy=AW(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),pf=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},O6=(e,t,n=10)=>{let i="";const s=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${i})`,U_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ip([0,.65,.55,1]),circOut:ip([.55,0,1,.45]),backIn:ip([.31,.01,.66,-.59]),backOut:ip([.33,1.53,.69,.99])};function L6(e,t){if(e)return typeof e=="function"&&Cy()?O6(e,t):nk(e)?ip(e):Array.isArray(e)?e.map(n=>L6(n,t)||U_.easeOut):U_[e]}const D6=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,CW=1e-7,IW=12;function RW(e,t,n,i,s){let r,a,l=0;do a=t+(n-t)/2,r=D6(a,i,s)-e,r>0?n=a:t=a;while(Math.abs(r)>CW&&++lRW(r,0,1,e,n);return r=>r===0||r===1?r:D6(s(r),t,i)}const P6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,B6=e=>t=>1-e(1-t),U6=rg(.33,1.53,.69,.99),ik=B6(U6),F6=P6(ik),$6=e=>(e*=2)<1?.5*ik(e):.5*(2-Math.pow(2,-10*(e-1))),sk=e=>1-Math.sin(Math.acos(e)),H6=B6(sk),z6=P6(sk),V6=e=>/^0[^.\s]+$/u.test(e);function jW(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||V6(e):!0}const Rp=e=>Math.round(e*1e5)/1e5,rk=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function OW(e){return e==null}const MW=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ak=(e,t)=>n=>!!(typeof n=="string"&&MW.test(n)&&n.startsWith(e)||t&&!OW(n)&&Object.prototype.hasOwnProperty.call(n,t)),G6=(e,t,n)=>i=>{if(typeof i!="string")return i;const[s,r,a,l]=i.match(rk);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},LW=e=>qo(0,255,e),lv={...qf,transform:e=>Math.round(LW(e))},Mc={test:ak("rgb","red"),parse:G6("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+lv.transform(e)+", "+lv.transform(t)+", "+lv.transform(n)+", "+Rp(mm.transform(i))+")"};function DW(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const F_={test:ak("#"),parse:DW,transform:Mc.transform},Nd={test:ak("hsl","hue"),parse:G6("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Ja.transform(Rp(t))+", "+Ja.transform(Rp(n))+", "+Rp(mm.transform(i))+")"},js={test:e=>Mc.test(e)||F_.test(e)||Nd.test(e),parse:e=>Mc.test(e)?Mc.parse(e):Nd.test(e)?Nd.parse(e):F_.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Mc.transform(e):Nd.transform(e)},PW=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function BW(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(rk))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(PW))===null||n===void 0?void 0:n.length)||0)>0}const K6="number",q6="color",UW="var",FW="var(",qI="${}",$W=/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 bm(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const l=t.replace($W,c=>(js.test(c)?(i.color.push(r),s.push(q6),n.push(js.parse(c))):c.startsWith(FW)?(i.var.push(r),s.push(UW),n.push(c)):(i.number.push(r),s.push(K6),n.push(parseFloat(c))),++r,qI)).split(qI);return{values:n,split:l,indexes:i,types:s}}function Y6(e){return bm(e).values}function W6(e){const{split:t,types:n}=bm(e),i=t.length;return s=>{let r="";for(let a=0;atypeof e=="number"?0:e;function zW(e){const t=Y6(e);return W6(e)(t.map(HW))}const tc={test:BW,parse:Y6,createTransformer:W6,getAnimatableNone:zW},VW=new Set(["brightness","contrast","saturate","opacity"]);function GW(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(rk)||[];if(!i)return e;const s=n.replace(i,"");let r=VW.has(t)?1:0;return i!==n&&(r*=100),t+"("+r+s+")"}const KW=/\b([a-z-]*)\(.*?\)/gu,$_={...tc,getAnimatableNone:e=>{const t=e.match(KW);return t?t.map(GW).join(" "):e}},qW={...VT,color:js,backgroundColor:js,outlineColor:js,fill:js,stroke:js,borderColor:js,borderTopColor:js,borderRightColor:js,borderBottomColor:js,borderLeftColor:js,filter:$_,WebkitFilter:$_},ok=e=>qW[e];function X6(e,t){let n=ok(e);return n!==$_&&(n=tc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const YW=new Set(["auto","none","0"]);function WW(e,t,n){let i=0,s;for(;ie===qf||e===bt,WI=(e,t)=>parseFloat(e.split(", ")[t]),XI=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const s=i.match(/^matrix3d\((.+)\)$/u);if(s)return WI(s[1],t);{const r=i.match(/^matrix\((.+)\)$/u);return r?WI(r[1],e):0}},XW=new Set(["x","y","z"]),QW=Kf.filter(e=>!XW.has(e));function ZW(e){const t=[];return QW.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const mf={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:XI(4,13),y:XI(5,14)};mf.translateX=mf.x;mf.translateY=mf.y;const Vc=new Set;let H_=!1,z_=!1;function Q6(){if(z_){const e=Array.from(Vc).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const s=ZW(i);s.length&&(n.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([r,a])=>{var l;(l=i.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}z_=!1,H_=!1,Vc.forEach(e=>e.complete()),Vc.clear()}function Z6(){Vc.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(z_=!0)})}function JW(){Z6(),Q6()}class lk{constructor(t,n,i,s,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=s,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Vc.add(this),H_||(H_=!0,ti.read(Z6),ti.resolveKeyframes(Q6))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:s}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),eX=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tX(e){const t=eX.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${n??i}`,s]}function eP(e,t,n=1){const[i,s]=tX(e);if(!i)return;const r=window.getComputedStyle(t).getPropertyValue(i);if(r){const a=r.trim();return J6(a)?parseFloat(a):a}return zT(s)?eP(s,t,n+1):s}const tP=e=>t=>t.test(e),nX={test:e=>e==="auto",parse:e=>e},nP=[qf,bt,Ja,yl,ZY,QY,nX],QI=e=>nP.find(tP(e));class iP extends lk{constructor(t,n,i,s,r){super(t,n,i,s,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const ZI=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(tc.test(e)||e==="0")&&!e.startsWith("url("));function iX(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function K1(e,{repeat:t,repeatType:n="loop"},i){const s=e.filter(rX),r=t&&n!=="loop"&&t%2===1?0:s.length-1;return!r||i===void 0?s[r]:i}const aX=40;class sP{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=eo.now(),this.options={autoplay:t,delay:n,type:i,repeat:s,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>aX?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&JW(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=eo.now(),this.hasAttemptedResolve=!0;const{name:i,type:s,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!sX(t,i,s,r))if(a)this.options.duration=0;else{c&&c(K1(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 V_=2e4;function rP(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t=V_?1/0:t}const xi=(e,t,n)=>e+(t-e)*n;function cv(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 oX({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let s=0,r=0,a=0;if(!t)s=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=cv(c,l,e+1/3),r=cv(c,l,e),a=cv(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:i}}function Iy(e,t){return n=>n>0?t:e}const uv=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},lX=[F_,Mc,Nd],cX=e=>lX.find(t=>t.test(e));function JI(e){const t=cX(e);if(!t)return!1;let n=t.parse(e);return t===Nd&&(n=oX(n)),n}const eR=(e,t)=>{const n=JI(e),i=JI(t);if(!n||!i)return Iy(e,t);const s={...n};return r=>(s.red=uv(n.red,i.red,r),s.green=uv(n.green,i.green,r),s.blue=uv(n.blue,i.blue,r),s.alpha=xi(n.alpha,i.alpha,r),Mc.transform(s))},uX=(e,t)=>n=>t(e(n)),ag=(...e)=>e.reduce(uX),G_=new Set(["none","hidden"]);function dX(e,t){return G_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function fX(e,t){return n=>xi(e,t,n)}function ck(e){return typeof e=="number"?fX:typeof e=="string"?zT(e)?Iy:js.test(e)?eR:mX:Array.isArray(e)?aP:typeof e=="object"?js.test(e)?eR:hX:Iy}function aP(e,t){const n=[...e],i=n.length,s=e.map((r,a)=>ck(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in i)n[r]=i[r](s);return n}}function pX(e,t){var n;const i=[],s={color:0,var:0,number:0};for(let r=0;r{const n=tc.createTransformer(t),i=bm(e),s=bm(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?G_.has(e)&&!s.values.length||G_.has(t)&&!i.values.length?dX(e,t):ag(aP(pX(i,s),s.values),n):Iy(e,t)};function oP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?xi(e,t,n):ck(e)(e,t)}const gX=5;function lP(e,t,n){const i=Math.max(t-gX,0);return R6(n-e(i),t-i)}const ki={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},dv=.001;function bX({duration:e=ki.duration,bounce:t=ki.bounce,velocity:n=ki.velocity,mass:i=ki.mass}){let s,r,a=1-t;a=qo(ki.minDamping,ki.maxDamping,a),e=qo(ki.minDuration,ki.maxDuration,Bo(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=K_(u,a),m=Math.exp(-f);return dv-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),g=K_(Math.pow(u,2),a);return(-s(u)+dv>0?-1:1)*((h-p)*m)/g}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-dv+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=xX(s,r,l);if(e=Po(e),isNaN(c))return{stiffness:ki.stiffness,damping:ki.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const yX=12;function xX(e,t,n){let i=n;for(let s=1;se[n]!==void 0)}function wX(e){let t={velocity:ki.velocity,stiffness:ki.stiffness,damping:ki.damping,mass:ki.mass,isResolvedFromDuration:!1,...e};if(!tR(e,vX)&&tR(e,EX))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,r=2*qo(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:ki.mass,stiffness:s,damping:r}}else{const n=bX(e);t={...t,...n,mass:ki.mass},t.isResolvedFromDuration=!0}return t}function cP(e=ki.visualDuration,t=ki.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:s}=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}=wX({...n,velocity:-Bo(n.velocity||0)}),m=h||0,g=u/(2*Math.sqrt(c*d)),v=a-r,y=Bo(Math.sqrt(c/d)),x=Math.abs(v)<5;i||(i=x?ki.restSpeed.granular:ki.restSpeed.default),s||(s=x?ki.restDelta.granular:ki.restDelta.default);let E;if(g<1){const N=K_(y,g);E=_=>{const T=Math.exp(-g*y*_);return a-T*((m+g*y*v)/N*Math.sin(N*_)+v*Math.cos(N*_))}}else if(g===1)E=N=>a-Math.exp(-y*N)*(v+(m+y*v)*N);else{const N=y*Math.sqrt(g*g-1);E=_=>{const T=Math.exp(-g*y*_),k=Math.min(N*_,300);return a-T*((m+g*y*v)*Math.sinh(k)+N*v*Math.cosh(k))/N}}const w={calculatedDuration:p&&f||null,next:N=>{const _=E(N);if(p)l.done=N>=f;else{let T=0;g<1&&(T=N===0?Po(m):lP(E,N,_));const k=Math.abs(T)<=i,C=Math.abs(a-_)<=s;l.done=k&&C}return l.value=l.done?a:_,l},toString:()=>{const N=Math.min(rP(w),V_),_=O6(T=>w.next(N*T).value,N,30);return N+"ms "+_}};return w}function nR({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=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)-g*Math.exp(-k/i),E=k=>y+x(k),w=k=>{const C=x(k),I=E(k);h.done=Math.abs(C)<=u,h.value=h.done?y:I};let N,_;const T=k=>{p(h.value)&&(N=k,_=cP({keyframes:[h.value,m(h.value)],velocity:lP(E,k,h.value),damping:s,stiffness:r,restDelta:u,restSpeed:d}))};return T(0),{calculatedDuration:null,next:k=>{let C=!1;return!_&&N===void 0&&(C=!0,w(k),T(k)),N!==void 0&&k>=N?_.next(k-N):(!C&&w(k),h)}}}const _X=rg(.42,0,1,1),SX=rg(0,0,.58,1),uP=rg(.42,0,.58,1),NX=e=>Array.isArray(e)&&typeof e[0]!="number",TX={linear:kr,easeIn:_X,easeInOut:uP,easeOut:SX,circIn:sk,circInOut:z6,circOut:H6,backIn:ik,backInOut:F6,backOut:U6,anticipate:$6},iR=e=>{if(nk(e)){c6(e.length===4);const[t,n,i,s]=e;return rg(t,n,i,s)}else if(typeof e=="string")return TX[e];return e};function kX(e,t,n){const i=[],s=n||oP,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=kX(t,i,s),c=l.length,u=d=>{if(a&&d1)for(;fu(qo(e[0],e[r-1],d)):u}function CX(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=pf(0,t,i);e.push(xi(n,1,s))}}function IX(e){const t=[0];return CX(t,e.length-1),t}function RX(e,t){return e.map(n=>n*t)}function jX(e,t){return e.map(()=>t||uP).splice(0,e.length-1)}function Ry({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const s=NX(i)?i.map(iR):iR(i),r={done:!1,value:t[0]},a=RX(n&&n.length===t.length?n:IX(t),e),l=AX(a,t,{ease:Array.isArray(s)?s:jX(t,s)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const OX=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ti.update(t,!0),stop:()=>ec(t),now:()=>xs.isProcessing?xs.timestamp:eo.now()}},MX={decay:nR,inertia:nR,tween:Ry,keyframes:Ry,spring:cP},LX=e=>e/100;class uk extends sP{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:i,element:s,keyframes:r}=this.options,a=(s==null?void 0:s.KeyframeResolver)||lk,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,i,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r,velocity:a=0}=this.options,l=tk(n)?n:MX[n]||Ry;let c,u;l!==Ry&&typeof t[0]!="number"&&(c=ag(LX,oP(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=rP(d));const{calculatedDuration:f}=d,h=f+s,p=h*(i+1)-s;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:i}=this;if(!i){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:s,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:g,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 C=Math.floor(k),I=k%1;!I&&k>=1&&(I=1),I===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(I=1-I,g&&(I-=g/f)):m==="mirror"&&(w=a)),E=qo(0,1,I)*f}const N=x?{done:!1,value:c[0]}:w.next(E);l&&(N.value=l(N.value));let{done:_}=N;!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&&s!==void 0&&(N.value=K1(c,this.options,s)),v&&v(N.value),T&&this.finish(),N}get duration(){const{resolved:t}=this;return t?Bo(t.calculatedDuration):0}get time(){return Bo(this.currentTime)}set time(t){t=Po(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=Bo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=OX,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=i??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 DX=new Set(["opacity","clipPath","filter","transform"]);function PX(e,t,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=L6(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const BX=ek(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),jy=10,UX=2e4;function FX(e){return tk(e.type)||e.type==="spring"||!M6(e.ease)}function $X(e,t){const n=new uk({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const s=[];let r=0;for(;!i.done&&rthis.onKeyframesResolved(a,l),n,i,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:s,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&Cy()&&HX(r)&&(r=dP[r]),FX(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...g}=this.options,v=$X(t,g);t=v.keyframes,t.length===1&&(t[1]=t[0]),i=v.duration,s=v.times,r=v.ease,a="keyframes"}const d=PX(l.owner.current,c,t,{...this.options,duration:i,times:s,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(KI(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(K1(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:s,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Bo(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Bo(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=Po(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:i}=n;i.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 kr;const{animation:i}=n;KI(i,t)}return kr}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:i,duration:s,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 uk({...p,keyframes:i,duration:s,type:r,ease:a,times:l,isGenerator:!0}),g=Po(this.time);u.setWithVelocity(m.sample(g-jy).value,m.sample(g).value,jy)}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:i,repeatDelay:s,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 BX()&&i&&DX.has(i)&&!c&&!u&&!s&&r!=="mirror"&&a!==0&&l!=="inertia"}}const zX={type:"spring",stiffness:500,damping:25,restSpeed:10},VX=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),GX={type:"keyframes",duration:.8},KX={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},qX=(e,{keyframes:t})=>t.length>2?GX:vu.has(e)?e.startsWith("scale")?VX(t[1]):zX:KX;function YX({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const dk=(e,t,n,i={},s,r)=>a=>{const l=XT(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Po(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:s};YX(l)||(d={...d,...qX(e,d)}),d.duration&&(d.duration=Po(d.duration)),d.repeatDelay&&(d.repeatDelay=Po(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=K1(d.keyframes,l);if(h!==void 0)return ti.update(()=>{d.onUpdate(h),d.onComplete()}),new TW([])}return!r&&sR.supports(d)?new sR(d):new uk(d)};function WX({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function fP(e,t,{delay:n=0,transitionOverride:i,type:s}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;i&&(a=i);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];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&&WX(d,f))continue;const m={delay:n,...XT(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=j6(e);if(y){const x=window.MotionHandoffAnimation(y,f,ti);x!==null&&(m.startTime=x,g=!0)}}B_(e,f),h.start(dk(f,h,p,e.shouldReduceMotion&&I6.has(f)?{type:!1}:m,e,g));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{ti.update(()=>{l&&wW(e,l)})}),u}function q_(e,t,n={}){var i;const s=G1(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const a=s?()=>Promise.all(fP(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return XX(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 XX(e,t,n=0,i=0,s=1,r){const a=[],l=(e.variantChildren.size-1)*i,c=s===1?(u=0)=>u*i:(u=0)=>l-u*i;return Array.from(e.variantChildren).sort(QX).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(q_(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function QX(e,t){return e.sortNodePosition(t)}function ZX(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const s=t.map(r=>q_(e,r,n));i=Promise.all(s)}else if(typeof t=="string")i=q_(e,t,n);else{const s=typeof t=="function"?G1(e,t,n.custom):t;i=Promise.all(fP(e,s,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const JX=BT.length;function hP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?hP(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:i})=>ZX(e,n,i)))}function iQ(e){let t=nQ(e),n=rR(),i=!0;const s=c=>(u,d)=>{var f;const h=G1(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...g}=h;u={...u,...g,...m}}return u};function r(c){t=c(e)}function a(c){const{props:u}=e,d=hP(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,C=!1;const I=Array.isArray(E)?E:[E];let O=I.reduce(s(y),{});N===!1&&(O={});const{prevResolvedValues:L={}}=x,G={...L,...O},D=j=>{k=!0,h.has(j)&&(C=!0,h.delete(j)),x.needsAnimating[j]=!0;const P=e.getValue(j);P&&(P.liveStyle=!1)};for(const j in G){const P=O[j],$=L[j];if(p.hasOwnProperty(j))continue;let R=!1;P_(P)&&P_($)?R=!C6(P,$):R=P!==$,R?P!=null?D(j):h.add(j):P!==void 0&&h.has(j)?D(j):x.protectedKeys[j]=!0}x.prevProp=E,x.prevResolvedValues=O,x.isActive&&(p={...p,...O}),i&&e.blockInitialAnimation&&(k=!1),k&&(!(_&&T)||C)&&f.push(...I.map(j=>({animation:j,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 g=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,g?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=rR(),i=!0}}}function sQ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!C6(t,e):!1}function yc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rR(){return{animate:yc(!0),whileInView:yc(),whileHover:yc(),whileTap:yc(),whileDrag:yc(),whileFocus:yc(),exit:yc()}}class lc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class rQ extends lc{constructor(t){super(t),t.animationState||(t.animationState=iQ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();z1(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 aQ=0;class oQ extends lc{constructor(){super(...arguments),this.id=aQ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const lQ={animation:{Feature:rQ},exit:{Feature:oQ}},fa={x:!1,y:!1};function pP(){return fa.x||fa.y}function cQ(e){return e==="x"||e==="y"?fa[e]?null:(fa[e]=!0,()=>{fa[e]=!1}):fa.x||fa.y?null:(fa.x=fa.y=!0,()=>{fa.x=fa.y=!1})}const fk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function ym(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function og(e){return{point:{x:e.pageX,y:e.pageY}}}const uQ=e=>t=>fk(t)&&e(t,og(t));function jp(e,t,n,i){return ym(e,t,uQ(n),i)}const aR=(e,t)=>Math.abs(e-t);function dQ(e,t){const n=aR(e.x,t.x),i=aR(e.y,t.y);return Math.sqrt(n**2+i**2)}class mP{constructor(t,n,{transformPagePoint:i,contextWindow:s,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=dQ(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:g}=xs;this.history.push({...m,timestamp:g});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=fv(h,this.transformPagePoint),ti.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=hv(f.type==="pointercancel"?this.lastMoveEventInfo:fv(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!fk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=i,this.contextWindow=s||window;const a=og(t),l=fv(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=xs;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,hv(l,this.history)),this.removeListeners=ag(jp(this.contextWindow,"pointermove",this.handlePointerMove),jp(this.contextWindow,"pointerup",this.handlePointerUp),jp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ec(this.updatePoint)}}function fv(e,t){return t?{point:t(e.point)}:e}function oR(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hv({point:e},t){return{point:e,delta:oR(e,gP(t)),offset:oR(e,fQ(t)),velocity:hQ(t,.1)}}function fQ(e){return e[0]}function gP(e){return e[e.length-1]}function hQ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const s=gP(e);for(;n>=0&&(i=e[n],!(s.timestamp-i.timestamp>Po(t)));)n--;if(!i)return{x:0,y:0};const r=Bo(s.timestamp-i.timestamp);if(r===0)return{x:0,y:0};const a={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const bP=1e-4,pQ=1-bP,mQ=1+bP,yP=.01,gQ=0-yP,bQ=0+yP;function Rr(e){return e.max-e.min}function yQ(e,t,n){return Math.abs(e-t)<=n}function lR(e,t,n,i=.5){e.origin=i,e.originPoint=xi(t.min,t.max,e.origin),e.scale=Rr(n)/Rr(t),e.translate=xi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=pQ&&e.scale<=mQ||isNaN(e.scale))&&(e.scale=1),(e.translate>=gQ&&e.translate<=bQ||isNaN(e.translate))&&(e.translate=0)}function Op(e,t,n,i){lR(e.x,t.x,n.x,i?i.originX:void 0),lR(e.y,t.y,n.y,i?i.originY:void 0)}function cR(e,t,n){e.min=n.min+t.min,e.max=e.min+Rr(t)}function xQ(e,t,n){cR(e.x,t.x,n.x),cR(e.y,t.y,n.y)}function uR(e,t,n){e.min=t.min-n.min,e.max=e.min+Rr(t)}function Mp(e,t,n){uR(e.x,t.x,n.x),uR(e.y,t.y,n.y)}function EQ(e,{min:t,max:n},i){return t!==void 0&&en&&(e=i?xi(n,e,i.max):Math.min(e,n)),e}function dR(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 vQ(e,{top:t,left:n,bottom:i,right:s}){return{x:dR(e.x,n,s),y:dR(e.y,t,i)}}function fR(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.mini?n=pf(t.min,t.max-i,e.min):i>s&&(n=pf(e.min,e.max-s,t.min)),qo(0,1,n)}function SQ(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 Y_=.35;function NQ(e=Y_){return e===!1?e=0:e===!0&&(e=Y_),{x:hR(e,"left","right"),y:hR(e,"top","bottom")}}function hR(e,t,n){return{min:pR(e,t),max:pR(e,n)}}function pR(e,t){return typeof e=="number"?e:e[t]||0}const mR=()=>({translate:0,scale:1,origin:0,originPoint:0}),Td=()=>({x:mR(),y:mR()}),gR=()=>({min:0,max:0}),Mi=()=>({x:gR(),y:gR()});function Dr(e){return[e("x"),e("y")]}function xP({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function TQ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function kQ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function pv(e){return e===void 0||e===1}function W_({scale:e,scaleX:t,scaleY:n}){return!pv(e)||!pv(t)||!pv(n)}function Tc(e){return W_(e)||EP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function EP(e){return bR(e.x)||bR(e.y)}function bR(e){return e&&e!=="0%"}function Oy(e,t,n){const i=e-n,s=t*i;return n+s}function yR(e,t,n,i,s){return s!==void 0&&(e=Oy(e,s,i)),Oy(e,n,i)+t}function X_(e,t=0,n=1,i,s){e.min=yR(e.min,t,n,i,s),e.max=yR(e.max,t,n,i,s)}function vP(e,{x:t,y:n}){X_(e.x,t.translate,t.scale,t.originPoint),X_(e.y,n.translate,n.scale,n.originPoint)}const xR=.999999999999,ER=1.0000000000001;function AQ(e,t,n,i=!1){const s=n.length;if(!s)return;t.x=t.y=1;let r,a;for(let l=0;lxR&&(t.x=1),t.yxR&&(t.y=1)}function kd(e,t){e.min=e.min+t,e.max=e.max+t}function vR(e,t,n,i,s=.5){const r=xi(e.min,e.max,s);X_(e,t,n,r,i)}function Ad(e,t){vR(e.x,t.x,t.scaleX,t.scale,t.originX),vR(e.y,t.y,t.scaleY,t.scale,t.originY)}function wP(e,t){return xP(kQ(e.getBoundingClientRect(),t))}function CQ(e,t,n){const i=wP(e,n),{scroll:s}=t;return s&&(kd(i.x,s.offset.x),kd(i.y,s.offset.y)),i}const _P=({current:e})=>e?e.ownerDocument.defaultView:null,IQ=new WeakMap;class RQ{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=Mi(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(og(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=cQ(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),Dr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(Ja.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=Rr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&ti.postRender(()=>m(d,f)),B_(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(p&&this.currentDirection===null){this.currentDirection=jQ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),g&&g(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Dr(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 mP(t,{onSessionStart:s,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:_P(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:r}=this.getProps();r&&ti.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:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:s}=this.getProps();if(!i||!_0(t,s,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=EQ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),s=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&&Sd(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=vQ(s.layoutBox,n):this.constraints=!1,this.elastic=NQ(i),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Dr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=SQ(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Sd(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=CQ(i,s.root,this.visualElement.getTransformPagePoint());let a=wQ(s.layout.layoutBox,r);if(n){const l=n(TQ(a));this.hasMutatedConstraints=!!l,l&&(a=xP(l))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Dr(d=>{if(!_0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:i?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 i=this.getAxisMotionValue(t);return B_(this.visualElement,t),i.start(dk(t,i,0,n,this.visualElement,!1))}stopAnimation(){Dr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Dr(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()}`,i=this.visualElement.getProps(),s=i[n];return s||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Dr(n=>{const{drag:i}=this.getProps();if(!_0(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[n];r.set(t[n]-xi(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Sd(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Dr(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=_Q({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Dr(a=>{if(!_0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(xi(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;IQ.set(this.visualElement,this);const t=this.visualElement.current,n=jp(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();Sd(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ti.read(i);const a=ym(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Dr(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:i=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:a=Y_,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function _0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function jQ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class OQ extends lc{constructor(t){super(t),this.removeGroupControls=kr,this.removeListeners=kr,this.controls=new RQ(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kr}unmount(){this.removeGroupControls(),this.removeListeners()}}const wR=e=>(t,n)=>{e&&ti.postRender(()=>e(t,n))};class MQ extends lc{constructor(){super(...arguments),this.removePointerDownListener=kr}onPointerDown(t){this.session=new mP(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:_P(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:wR(t),onStart:wR(n),onMove:i,onEnd:(r,a)=>{delete this.session,s&&ti.postRender(()=>s(r,a))}}}mount(){this.removePointerDownListener=jp(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 Nb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function _R(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Lh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(bt.test(e))e=parseFloat(e);else return e;const n=_R(e,t.target.x),i=_R(e,t.target.y);return`${n}% ${i}%`}},LQ={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=tc.parse(e);if(s.length>5)return i;const r=tc.createTransformer(e),a=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=l,s[1+a]/=c;const u=xi(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),r(s)}};class DQ extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:r}=t;lW(PQ),r&&(n.group&&n.group.add(r),i&&i.register&&s&&i.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Nb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:s,isPresent:r}=this.props,a=i.projection;return a&&(a.isPresent=r,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||ti.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),FT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function SP(e){const[t,n]=o6(),i=b.useContext(LT);return o.jsx(DQ,{...e,layoutGroup:i,switchLayoutGroup:b.useContext(g6),isPresent:t,safeToRemove:n})}const PQ={borderRadius:{...Lh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Lh,borderTopRightRadius:Lh,borderBottomLeftRadius:Lh,borderBottomRightRadius:Lh,boxShadow:LQ};function BQ(e,t,n){const i=Os(e)?e:gm(e);return i.start(dk("",i,t,n)),i.animation}function UQ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const FQ=(e,t)=>e.depth-t.depth;class $Q{constructor(){this.children=[],this.isDirty=!1}add(t){QT(this.children,t),this.isDirty=!0}remove(t){ZT(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(FQ),this.isDirty=!1,this.children.forEach(t)}}function HQ(e,t){const n=eo.now(),i=({timestamp:s})=>{const r=s-n;r>=t&&(ec(i),e(r-t))};return ti.read(i,!0),()=>ec(i)}const NP=["TopLeft","TopRight","BottomLeft","BottomRight"],zQ=NP.length,SR=e=>typeof e=="string"?parseFloat(e):e,NR=e=>typeof e=="number"||bt.test(e);function VQ(e,t,n,i,s,r){s?(e.opacity=xi(0,n.opacity!==void 0?n.opacity:1,GQ(i)),e.opacityExit=xi(t.opacity!==void 0?t.opacity:1,0,KQ(i))):r&&(e.opacity=xi(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;ait?1:n(pf(e,t,i))}function kR(e,t){e.min=t.min,e.max=t.max}function Lr(e,t){kR(e.x,t.x),kR(e.y,t.y)}function AR(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function CR(e,t,n,i,s){return e-=t,e=Oy(e,1/n,i),s!==void 0&&(e=Oy(e,1/s,i)),e}function qQ(e,t=0,n=1,i=.5,s,r=e,a=e){if(Ja.test(t)&&(t=parseFloat(t),t=xi(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=xi(r.min,r.max,i);e===r&&(l-=t),e.min=CR(e.min,t,n,l,s),e.max=CR(e.max,t,n,l,s)}function IR(e,t,[n,i,s],r,a){qQ(e,t[n],t[i],t[s],t.scale,r,a)}const YQ=["x","scaleX","originX"],WQ=["y","scaleY","originY"];function RR(e,t,n,i){IR(e.x,t,YQ,n?n.x:void 0,i?i.x:void 0),IR(e.y,t,WQ,n?n.y:void 0,i?i.y:void 0)}function jR(e){return e.translate===0&&e.scale===1}function kP(e){return jR(e.x)&&jR(e.y)}function OR(e,t){return e.min===t.min&&e.max===t.max}function XQ(e,t){return OR(e.x,t.x)&&OR(e.y,t.y)}function MR(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function AP(e,t){return MR(e.x,t.x)&&MR(e.y,t.y)}function LR(e){return Rr(e.x)/Rr(e.y)}function DR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class QQ{constructor(){this.members=[]}add(t){QT(this.members,t),t.scheduleRender()}remove(t){if(ZT(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(s=>t===s);if(n===0)return!1;let i;for(let s=n;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1){i=r;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function ZQ(e,t,n){let i="";const s=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||r||a)&&(i=`translate3d(${s}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),p&&(i+=`skewX(${p}deg) `),m&&(i+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(i+=`scale(${l}, ${c})`),i||"none"}const kc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sp=typeof window<"u"&&window.MotionDebug!==void 0,mv=["","X","Y","Z"],JQ={visibility:"hidden"},PR=1e3;let eZ=0;function gv(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function CP(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=j6(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ti,!(s||r))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&CP(i)}function IP({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(a={},l=t==null?void 0:t()){this.id=eZ++,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,sp&&(kc.totalNodes=kc.resolvedTargetDeltas=kc.recalculatedProjection=0),this.nodes.forEach(iZ),this.nodes.forEach(lZ),this.nodes.forEach(cZ),this.nodes.forEach(sZ),sp&&window.MotionDebug.record(kc)},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=HQ(h,250),Nb.hasAnimatedSinceResize&&(Nb.hasAnimatedSinceResize=!1,this.nodes.forEach(UR))})}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 g=this.options.transition||d.getDefaultTransition()||pZ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!AP(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={...XT(g,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||UR(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,ec(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(uZ),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&&CP(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 N=w/1e3;FR(f.x,a.x,N),FR(f.y,a.y,N),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Mp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),fZ(this.relativeTarget,this.relativeTargetOrigin,h,N),E&&XQ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Mi()),Lr(E,this.relativeTarget)),g&&(this.animationValues=d,VQ(d,u,this.latestValues,N,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=N},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&&(ec(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ti.update(()=>{Nb.hasAnimatedSinceResize=!0,this.currentAnimation=BQ(0,PR,{...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(PR),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&&RP(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Mi();const f=Rr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Rr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Lr(l,c),Ad(l,d),Op(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new QQ),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(BR),this.root.sharedNodes.clear()}}}function tZ(e){e.updateLayout()}function nZ(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:i,measuredBox:s}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Dr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(h);h.min=i[f].min,h.max=h.min+p}):RP(r,n.layoutBox,i)&&Dr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(i[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Td();Op(l,i,n.layoutBox);const c=Td();a?Op(c,e.applyTransform(s,!0),n.measuredBox):Op(c,i,n.layoutBox);const u=!kP(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=Mi();Mp(m,n.layoutBox,h.layoutBox);const g=Mi();Mp(g,i,p.layoutBox),AP(m,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function iZ(e){sp&&kc.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 sZ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rZ(e){e.clearSnapshot()}function BR(e){e.clearMeasurements()}function aZ(e){e.isLayoutDirty=!1}function oZ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function UR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function lZ(e){e.resolveTargetDelta()}function cZ(e){e.calcProjection()}function uZ(e){e.resetSkewAndRotation()}function dZ(e){e.removeLeadSnapshot()}function FR(e,t,n){e.translate=xi(t.translate,0,n),e.scale=xi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function $R(e,t,n,i){e.min=xi(t.min,n.min,i),e.max=xi(t.max,n.max,i)}function fZ(e,t,n,i){$R(e.x,t.x,n.x,i),$R(e.y,t.y,n.y,i)}function hZ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const pZ={duration:.45,ease:[.4,0,.1,1]},HR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zR=HR("applewebkit/")&&!HR("chrome/")?Math.round:kr;function VR(e){e.min=zR(e.min),e.max=zR(e.max)}function mZ(e){VR(e.x),VR(e.y)}function RP(e,t,n){return e==="position"||e==="preserve-aspect"&&!yQ(LR(t),LR(n),.2)}function gZ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const bZ=IP({attachResizeListener:(e,t)=>ym(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bv={current:void 0},jP=IP({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!bv.current){const e=new bZ({});e.mount(window),e.setOptions({layoutScroll:!0}),bv.current=e}return bv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),yZ={pan:{Feature:MQ},drag:{Feature:OQ,ProjectionNode:jP,MeasureLayout:SP}};function xZ(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const r=(i=void 0)!==null&&i!==void 0?i:s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function OP(e,t){const n=xZ(e),i=new AbortController,s={passive:!0,...t,signal:i.signal};return[n,s,()=>i.abort()]}function GR(e){return t=>{t.pointerType==="touch"||pP()||e(t)}}function EZ(e,t,n={}){const[i,s,r]=OP(e,n),a=GR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=GR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return i.forEach(l=>{l.addEventListener("pointerenter",a,s)}),r}function KR(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,r=i[s];r&&ti.postRender(()=>r(t,og(t)))}class vZ extends lc{mount(){const{current:t}=this.node;t&&(this.unmount=EZ(t,n=>(KR(this.node,n,"Start"),i=>KR(this.node,i,"End"))))}unmount(){}}class wZ extends lc{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=ag(ym(this.node.current,"focus",()=>this.onFocus()),ym(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const MP=(e,t)=>t?e===t?!0:MP(e,t.parentElement):!1,_Z=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function SZ(e){return _Z.has(e.tagName)||e.tabIndex!==-1}const rp=new WeakSet;function qR(e){return t=>{t.key==="Enter"&&e(t)}}function yv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const NZ=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=qR(()=>{if(rp.has(n))return;yv(n,"down");const s=qR(()=>{yv(n,"up")}),r=()=>yv(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function YR(e){return fk(e)&&!pP()}function TZ(e,t,n={}){const[i,s,r]=OP(e,n),a=l=>{const c=l.currentTarget;if(!YR(l)||rp.has(c))return;rp.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!YR(p)||!rp.has(c))&&(rp.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||MP(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return i.forEach(l=>{!SZ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),l.addEventListener("focus",u=>NZ(u,s),s)}),r}function WR(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),r=i[s];r&&ti.postRender(()=>r(t,og(t)))}class kZ extends lc{mount(){const{current:t}=this.node;t&&(this.unmount=TZ(t,n=>(WR(this.node,n,"Start"),(i,{success:s})=>WR(this.node,i,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Q_=new WeakMap,xv=new WeakMap,AZ=e=>{const t=Q_.get(e.target);t&&t(e)},CZ=e=>{e.forEach(AZ)};function IZ({root:e,...t}){const n=e||document;xv.has(n)||xv.set(n,{});const i=xv.get(n),s=JSON.stringify(t);return i[s]||(i[s]=new IntersectionObserver(CZ,{root:e,...t})),i[s]}function RZ(e,t,n){const i=IZ(t);return Q_.set(e,n),i.observe(e),()=>{Q_.delete(e),i.unobserve(e)}}const jZ={some:0,all:1};class OZ extends lc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:jZ[s]},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 RZ(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(MZ(t,n))&&this.startObserver()}unmount(){}}function MZ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const LZ={inView:{Feature:OZ},tap:{Feature:kZ},focus:{Feature:wZ},hover:{Feature:vZ}},DZ={layout:{ProjectionNode:jP,MeasureLayout:SP}},Z_={current:null},LP={current:!1};function PZ(){if(LP.current=!0,!!DT)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Z_.current=e.matches;e.addListener(t),t()}else Z_.current=!1}const BZ=[...nP,js,tc],UZ=e=>BZ.find(tP(e)),XR=new WeakMap;function FZ(e,t,n){for(const i in t){const s=t[i],r=n[i];if(Os(s))e.addValue(i,s);else if(Os(r))e.addValue(i,gm(s,{owner:e}));else if(r!==s)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(i);e.addValue(i,gm(a!==void 0?a:s,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const QR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class $Z{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:s,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=lk,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=eo.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),LP.current||PZ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Z_.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XR.delete(this.current),this.projection&&this.projection.unmount(),ec(this.notifyUpdate),ec(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 i=vu.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&ti.preRender(this.notifyUpdate),i&&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,()=>{s(),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 hf){const n=hf[t];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(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):Mi()}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 i=0;in.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&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 i=this.values.get(t);return i===void 0&&n!==void 0&&(i=gm(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(J6(s)||V6(s))?s=parseFloat(s):!UZ(s)&&tc.test(n)&&(s=X6(t,n)),this.setBaseTarget(t,Os(s)?s.get():s)),Os(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let s;if(typeof i=="string"||typeof i=="object"){const a=HT(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(i&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Os(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new JT),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class DP extends $Z{constructor(){super(...arguments),this.KeyframeResolver=iP}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:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Os(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function HZ(e){return window.getComputedStyle(e)}class zZ extends DP{constructor(){super(...arguments),this.type="html",this.renderInstance=_6}readValueFromInstance(t,n){if(vu.has(n)){const i=ok(n);return i&&i.default||0}else{const i=HZ(t),s=(E6(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return wP(t,n)}build(t,n,i){GT(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return WT(t,n,i)}}class VZ extends DP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mi}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(vu.has(n)){const i=ok(n);return i&&i.default||0}return n=S6.has(n)?n:UT(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return k6(t,n,i)}build(t,n,i){KT(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,s){N6(t,n,i,s)}mount(t){this.isSVGTag=YT(t.tagName),super.mount(t)}}const GZ=(e,t)=>$T(e)?new VZ(t):new zZ(t,{allowProjection:e!==b.Fragment}),KZ=bW({...lQ,...LZ,...yZ,...DZ},GZ),Jn=jY(KZ);function ns(){return ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?b.useEffect:b.useLayoutEffect;function rd(e,t,n){var i=b.useRef(t);i.current=t,b.useEffect(function(){function s(r){i.current(r)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var qZ=["container"];function YZ(e){var t=e.container,n=t===void 0?document.body:t,i=q1(e,qZ);return ks.createPortal(jt.createElement("div",ns({},i)),n)}function WZ(e){return jt.createElement("svg",ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),jt.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 XZ(e){return jt.createElement("svg",ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),jt.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 QZ(e){return jt.createElement("svg",ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),jt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function ZZ(){return b.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function JR(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var s=e.touches[1],r=s.clientX,a=s.clientY;return[(n+r)/2,(i+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var _l=function(e,t,n,i){var s,r=n*t,a=(r-i)/2,l=e;return r<=i?(s=1,l=0):e>0&&a-e<=0?(s=2,l=a):e<0&&a+e<=0&&(s=3,l=-a),[s,l]};function Ev(e,t,n,i,s,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=_l(e,r,n,innerWidth)[0],f=_l(t,r,i,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/s*(a-(h+e))-h+(i/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/s*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function tS(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function vv(e,t,n){var i=tS(n,innerWidth,innerHeight),s=i[0],r=i[1],a=0,l=s,c=r,u=e/t*r,d=t/e*s;return e=r?l=u:e>=s&&ts/r?c=d:t/e>=3&&!i[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function N0(e,t){var n=t.leading,i=n!==void 0&&n,s=t.maxWait,r=t.wait,a=r===void 0?s||0:r,l=b.useRef(e);l.current=e;var c=b.useRef(0),u=b.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=b.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var g=c.current,v=p-g;if(g===0&&(i&&m(),c.current=p),s!==void 0){if(v>s)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var eJ={T:0,L:0,W:0,H:0,FIT:void 0},BP=function(){var e=b.useRef(!1);return b.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},tJ=["className"];function nJ(e){var t=e.className,n=t===void 0?"":t,i=q1(e,tJ);return jt.createElement("div",ns({className:"PhotoView__Spinner "+n},i),jt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},jt.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"}),jt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var iJ=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function sJ(e){var t=e.src,n=e.loaded,i=e.broken,s=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=q1(e,iJ),u=BP();return t&&!i?jt.createElement(jt.Fragment,null,jt.createElement("img",ns({className:"PhotoView__Photo"+(s?" "+s:""),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?jt.createElement("span",{className:"PhotoView__icon"},a):jt.createElement(nJ,{className:"PhotoView__icon"}))):l?jt.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var rJ={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 aJ(e){var t=e.item,n=t.src,i=t.render,s=t.width,r=s===void 0?0:s,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,g=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,N=e.onPhotoResize,_=e.isActive,T=e.expose,k=My(rJ),C=k[0],I=k[1],O=b.useRef(0),L=BP(),G=C.naturalWidth,D=G===void 0?r:G,F=C.naturalHeight,A=F===void 0?l:F,j=C.width,P=j===void 0?r:j,$=C.height,R=$===void 0?l:$,Y=C.loaded,Z=Y===void 0?!n:Y,B=C.broken,te=C.x,K=C.y,z=C.touched,W=C.stopRaf,q=C.maskTouched,ce=C.rotate,me=C.scale,_e=C.CX,de=C.CY,ge=C.lastX,Oe=C.lastY,Ee=C.lastCX,ae=C.lastCY,Ne=C.lastScale,ve=C.touchTime,Qe=C.touchLength,Me=C.pause,ze=C.reach,Se=Gc({onScale:function(ye){return Ue(S0(ye))},onRotate:function(ye){ce!==ye&&(T({rotate:ye}),I(ns({rotate:ye},vv(D,A,ye))))}});function Ue(ye,Xe,St){me!==ye&&(T({scale:ye}),I(ns({scale:ye},Ev(te,K,P,R,me,ye,Xe,St),ye<=1&&{x:0,y:0})))}var Pe=N0(function(ye,Xe,St){if(St===void 0&&(St=0),(z||q)&&_){var Qt=tS(ce,P,R),Rn=Qt[0],Bt=Qt[1];if(St===0&&O.current===0){var Ze=Math.abs(ye-_e)<=20,cn=Math.abs(Xe-de)<=20;if(Ze&&cn)return void I({lastCX:ye,lastCY:Xe});O.current=Ze?Xe>de?3:2:1}var un,Et=ye-Ee,nn=Xe-ae;if(St===0){var Ci=_l(Et+ge,me,Rn,innerWidth)[0],ii=_l(nn+Oe,me,Bt,innerHeight);un=function(Pn,gn,_n,Bn){return gn&&Pn===1||Bn==="x"?"x":_n&&Pn>1||Bn==="y"?"y":void 0}(O.current,Ci,ii[0],ze),un!==void 0&&E(un,ye,Xe,me)}if(un==="x"||q)return void I({reach:"x"});var Dn=S0(me+(St-Qe)/100/2*me,D/P,.2);T({scale:Dn}),I(ns({touchLength:St,reach:un,scale:Dn},Ev(te,K,P,R,me,Dn,ye,Xe,Et,nn)))}},{maxWait:8});function Ke(ye){return!W&&!z&&(L.current&&I(ns({},ye,{pause:u})),L.current)}var Q,oe,ie,be,Le,qe,gt,lt,ln=(Le=function(ye){return Ke({x:ye})},qe=function(ye){return Ke({y:ye})},gt=function(ye){return L.current&&(T({scale:ye}),I({scale:ye})),!z&&L.current},lt=Gc({X:function(ye){return Le(ye)},Y:function(ye){return qe(ye)},S:function(ye){return gt(ye)}}),function(ye,Xe,St,Qt,Rn,Bt,Ze,cn,un,Et,nn){var Ci=tS(Et,Rn,Bt),ii=Ci[0],Dn=Ci[1],Pn=_l(ye,cn,ii,innerWidth),gn=Pn[0],_n=Pn[1],Bn=_l(Xe,cn,Dn,innerHeight),$i=Bn[0],gs=Bn[1],Ii=Date.now()-nn;if(Ii>=200||cn!==Ze||Math.abs(un-Ze)>1){var Ri=Ev(ye,Xe,Rn,Bt,Ze,cn),Un=Ri.x,vi=Ri.y,Sn=gn?_n:Un!==ye?Un:null,si=$i?gs:vi!==Xe?vi:null;return Sn!==null&&jc(ye,Sn,lt.X),si!==null&&jc(Xe,si,lt.Y),void(cn!==Ze&&jc(Ze,cn,lt.S))}var ji=(ye-St)/Ii,Oi=(Xe-Qt)/Ii,bn=Math.sqrt(Math.pow(ji,2)+Math.pow(Oi,2)),jn=!1,Fn=!1;(function($n,yn){var _t,ue=$n,fe=0,De=0,We=function(sn){_t||(_t=sn);var rn=sn-_t,fi=Math.sign($n),Zi=-.001*fi,dn=Math.sign(-ue)*Math.pow(ue,2)*2e-4,Hn=ue*rn+(Zi+dn)*Math.pow(rn,2)/2;fe+=Hn,_t=sn,fi*(ue+=(Zi+dn)*rn)<=0?at():yn(fe)?rt():at()};function rt(){De=requestAnimationFrame(We)}function at(){cancelAnimationFrame(De)}rt()})(bn,function($n){var yn=ye+$n*(ji/bn),_t=Xe+$n*(Oi/bn),ue=_l(yn,Ze,ii,innerWidth),fe=ue[0],De=ue[1],We=_l(_t,Ze,Dn,innerHeight),rt=We[0],at=We[1];if(fe&&!jn&&(jn=!0,gn?jc(yn,De,lt.X):ej(De,yn+(yn-De),lt.X)),rt&&!Fn&&(Fn=!0,$i?jc(_t,at,lt.Y):ej(at,_t+(_t-at),lt.Y)),jn&&Fn)return!1;var sn=jn||lt.X(De),rn=Fn||lt.Y(at);return sn&&rn})}),Mt=(Q=y,oe=function(ye,Xe){ze||Ue(me!==1?1:Math.max(2,D/P),ye,Xe)},ie=b.useRef(0),be=N0(function(){ie.current=0,Q.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);ie.current+=1,be.apply(void 0,ye),ie.current>=2&&(be.cancel(),ie.current=0,oe.apply(void 0,ye))});function kt(ye,Xe){if(O.current=0,(z||q)&&_){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var St=S0(me,D/P);if(ln(te,K,ge,Oe,P,R,me,St,Ne,ce,ve),w(ye,Xe),_e===ye&&de===Xe){if(z)return void Mt(ye,Xe);q&&x(ye,Xe)}}}function Vt(ye,Xe,St){St===void 0&&(St=0),I({touched:!0,CX:ye,CY:Xe,lastCX:ye,lastCY:Xe,lastX:te,lastY:K,lastScale:me,touchLength:St,touchTime:Date.now()})}function He(ye){I({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:te,lastY:K})}rd(_o?void 0:"mousemove",function(ye){ye.preventDefault(),Pe(ye.clientX,ye.clientY)}),rd(_o?void 0:"mouseup",function(ye){kt(ye.clientX,ye.clientY)}),rd(_o?"touchmove":void 0,function(ye){ye.preventDefault();var Xe=JR(ye);Pe.apply(void 0,Xe)},{passive:!1}),rd(_o?"touchend":void 0,function(ye){var Xe=ye.changedTouches[0];kt(Xe.clientX,Xe.clientY)},{passive:!1}),rd("resize",N0(function(){Z&&!z&&(I(vv(D,A,ce)),N())},{maxWait:8})),eS(function(){_&&T(ns({scale:me,rotate:ce},Se))},[_]);var Xt=function(ye,Xe,St,Qt,Rn,Bt,Ze,cn,un,Et){var nn=function(Un,vi,Sn,si,ji){var Oi=b.useRef(!1),bn=My({lead:!0,scale:Sn}),jn=bn[0],Fn=jn.lead,$n=jn.scale,yn=bn[1],_t=N0(function(ue){try{return ji(!0),yn({lead:!1,scale:ue}),Promise.resolve()}catch(fe){return Promise.reject(fe)}},{wait:si});return eS(function(){Oi.current?(ji(!1),yn({lead:!0}),_t(Sn)):Oi.current=!0},[Sn]),Fn?[Un*$n,vi*$n,Sn/$n]:[Un*Sn,vi*Sn,1]}(Bt,Ze,cn,un,Et),Ci=nn[0],ii=nn[1],Dn=nn[2],Pn=function(Un,vi,Sn,si,ji){var Oi=b.useState(eJ),bn=Oi[0],jn=Oi[1],Fn=b.useState(0),$n=Fn[0],yn=Fn[1],_t=b.useRef(),ue=Gc({OK:function(){return Un&&yn(4)}});function fe(De){ji(!1),yn(De)}return b.useEffect(function(){if(_t.current||(_t.current=Date.now()),Sn){if(function(De,We){var rt=De&&De.current;if(rt&&rt.nodeType===1){var at=rt.getBoundingClientRect();We({T:at.top,L:at.left,W:at.width,H:at.height,FIT:rt.tagName==="IMG"?getComputedStyle(rt).objectFit:void 0})}}(vi,jn),Un)return Date.now()-_t.current<250?(yn(1),requestAnimationFrame(function(){yn(2),requestAnimationFrame(function(){return fe(3)})}),void setTimeout(ue.OK,si)):void yn(4);fe(5)}},[Un,Sn]),[$n,bn]}(ye,Xe,St,un,Et),gn=Pn[0],_n=Pn[1],Bn=_n.W,$i=_n.FIT,gs=innerWidth/2,Ii=innerHeight/2,Ri=gn<3||gn>4;return[Ri?Bn?_n.L:gs:Qt+(gs-Bt*cn/2),Ri?Bn?_n.T:Ii:Rn+(Ii-Ze*cn/2),Ci,Ri&&$i?Ci*(_n.H/Bn):ii,gn===0?Dn:Ri?Bn/(Bt*cn)||.01:Dn,Ri?$i?1:0:1,gn,$i]}(u,c,Z,te,K,P,R,me,d,function(ye){return I({pause:ye})}),nt=Xt[4],yt=Xt[6],Je="transform "+d+"ms "+f,ot={className:p,onMouseDown:_o?void 0:function(ye){ye.stopPropagation(),ye.button===0&&Vt(ye.clientX,ye.clientY,0)},onTouchStart:_o?function(ye){ye.stopPropagation(),Vt.apply(void 0,JR(ye))}:void 0,onWheel:function(ye){if(!ze){var Xe=S0(me-ye.deltaY/100/2,D/P);I({stopRaf:!0}),Ue(Xe,ye.clientX,ye.clientY)}},style:{width:Xt[2]+"px",height:Xt[3]+"px",opacity:Xt[5],objectFit:yt===4?void 0:Xt[7],transform:ce?"rotate("+ce+"deg)":void 0,transition:yt>2?Je+", opacity "+d+"ms ease, height "+(yt<4?d/2:yt>4?d:0)+"ms "+f:void 0}};return jt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!_o&&_?He:void 0,onTouchStart:_o&&_?function(ye){return He(ye.touches[0])}:void 0},jt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+nt+", 0, 0, "+nt+", "+Xt[0]+", "+Xt[1]+")",transition:z||Me?void 0:Je,willChange:_?"transform":void 0}},n?jt.createElement(sJ,ns({src:n,loaded:Z,broken:B},ot,{onPhotoLoad:function(ye){I(ns({},ye,ye.loaded&&vv(ye.naturalWidth||0,ye.naturalHeight||0,ce)))},loadingElement:g,brokenElement:v})):i&&i({attrs:ot,scale:nt,rotate:ce})))}var tj={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 oJ(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,s=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,g=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,N=e.brokenElement,_=e.images,T=e.index,k=T===void 0?0:T,C=e.onIndexChange,I=e.visible,O=e.onClose,L=e.afterClose,G=e.portalContainer,D=My(tj),F=D[0],A=D[1],j=b.useState(0),P=j[0],$=j[1],R=F.x,Y=F.touched,Z=F.pause,B=F.lastCX,te=F.lastCY,K=F.bg,z=K===void 0?u:K,W=F.lastBg,q=F.overlay,ce=F.minimal,me=F.scale,_e=F.rotate,de=F.onScale,ge=F.onRotate,Oe=e.hasOwnProperty("index"),Ee=Oe?k:P,ae=Oe?C:$,Ne=b.useRef(Ee),ve=_.length,Qe=_[Ee],Me=typeof n=="boolean"?n:ve>n,ze=function(nt,yt){var Je=b.useReducer(function(St){return!St},!1)[1],ot=b.useRef(0),ye=function(St){var Qt=b.useRef(St);function Rn(Bt){Qt.current=Bt}return b.useMemo(function(){(function(Bt){nt?(Bt(nt),ot.current=1):ot.current=2})(Rn)},[St]),[Qt.current,Rn]}(nt),Xe=ye[1];return[ye[0],ot.current,function(){Je(),ot.current===2&&(Xe(!1),yt&&yt()),ot.current=0}]}(I,L),Se=ze[0],Ue=ze[1],Pe=ze[2];eS(function(){if(Se)return A({pause:!0,x:Ee*-(innerWidth+Vu)}),void(Ne.current=Ee);A(tj)},[Se]);var Ke=Gc({close:function(nt){ge&&ge(0),A({overlay:!0,lastBg:z}),O(nt)},changeIndex:function(nt,yt){yt===void 0&&(yt=!1);var Je=Me?Ne.current+(nt-Ee):nt,ot=ve-1,ye=J_(Je,0,ot),Xe=Me?Je:ye,St=innerWidth+Vu;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-St*Xe,pause:yt}),Ne.current=Xe,ae&&ae(Me?nt<0?ot:nt>ot?0:nt:ye)}}),Q=Ke.close,oe=Ke.changeIndex;function ie(nt){return nt?Q():A({overlay:!q})}function be(){A({x:-(innerWidth+Vu)*Ee,lastCX:void 0,lastCY:void 0,pause:!0}),Ne.current=Ee}function Le(nt,yt,Je,ot){nt==="x"?function(ye){if(B!==void 0){var Xe=ye-B,St=Xe;!Me&&(Ee===0&&Xe>0||Ee===ve-1&&Xe<0)&&(St=Xe/2),A({touched:!0,lastCX:B,x:-(innerWidth+Vu)*Ne.current+St,pause:!1})}else A({touched:!0,lastCX:ye,x:R,pause:!1})}(yt):nt==="y"&&function(ye,Xe){if(te!==void 0){var St=u===null?null:J_(u,.01,u-Math.abs(ye-te)/100/4);A({touched:!0,lastCY:te,bg:Xe===1?St:u,minimal:Xe===1})}else A({touched:!0,lastCY:ye,bg:z,minimal:!0})}(Je,ot)}function qe(nt,yt){var Je=nt-(B??nt),ot=yt-(te??yt),ye=!1;if(Je<-40)oe(Ee+1);else if(Je>40)oe(Ee-1);else{var Xe=-(innerWidth+Vu)*Ne.current;Math.abs(ot)>100&&ce&&f&&(ye=!0,Q()),A({touched:!1,x:Xe,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||q})}}rd("keydown",function(nt){if(I)switch(nt.key){case"ArrowLeft":oe(Ee-1,!0);break;case"ArrowRight":oe(Ee+1,!0);break;case"Escape":Q()}});var gt=function(nt,yt,Je){return b.useMemo(function(){var ot=nt.length;return Je?nt.concat(nt).concat(nt).slice(ot+yt-1,ot+yt+2):nt.slice(Math.max(yt-1,0),Math.min(yt+2,ot+1))},[nt,yt,Je])}(_,Ee,Me);if(!Se)return null;var lt=q&&!Ue,ln=I?z:W,Mt=de&&ge&&{images:_,index:Ee,visible:I,onClose:Q,onIndexChange:oe,overlayVisible:lt,overlay:Qe&&Qe.overlay,scale:me,rotate:_e,onScale:de,onRotate:ge},kt=i?i(Ue):400,Vt=s?s(Ue):ZR,He=i?i(3):600,Xt=s?s(3):ZR;return jt.createElement(YZ,{className:"PhotoView-Portal"+(lt?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(nt){return nt.stopPropagation()},container:G},I&&jt.createElement(ZZ,null),jt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Ue===1?" PhotoView-Slider__fadeIn":Ue===2?" PhotoView-Slider__fadeOut":""),style:{background:ln?"rgba(0, 0, 0, "+ln+")":void 0,transitionTimingFunction:Vt,transitionDuration:(Y?0:kt)+"ms",animationDuration:kt+"ms"},onAnimationEnd:Pe}),p&&jt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},jt.createElement("div",{className:"PhotoView-Slider__Counter"},Ee+1," / ",ve),jt.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Mt&&g(Mt),jt.createElement(WZ,{className:"PhotoView-Slider__toolbarIcon",onClick:Q}))),gt.map(function(nt,yt){var Je=Me||Ee!==0?Ne.current-1+yt:Ee+yt;return jt.createElement(aJ,{key:Me?nt.key+"/"+nt.src+"/"+Je:nt.key,item:nt,speed:kt,easing:Vt,visible:I,onReachMove:Le,onReachUp:qe,onPhotoTap:function(){return ie(r)},onMaskTap:function(){return ie(l)},wrapClassName:E,className:x,style:{left:(innerWidth+Vu)*Je+"px",transform:"translate3d("+R+"px, 0px, 0)",transition:Y||Z?void 0:"transform "+He+"ms "+Xt},loadingElement:w,brokenElement:N,onPhotoResize:be,isActive:Ne.current===Je,expose:A})}),!_o&&p&&jt.createElement(jt.Fragment,null,(Me||Ee!==0)&&jt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return oe(Ee-1,!0)}},jt.createElement(XZ,null)),(Me||Ee+1-1){var y=u.slice();return y.splice(v,1,g),void l({images:y})}l(function(x){return{images:x.images.concat(g)}})},remove:function(g){l(function(v){var y=v.images.filter(function(x){return x.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var v=u.findIndex(function(y){return y.key===g});l({visible:!0,index:v}),i&&i(!0,v,a)}}),p=Gc({close:function(){l({visible:!1}),i&&i(!1,f,a)},changeIndex:function(g){l({index:g}),n&&n(g,a)}}),m=b.useMemo(function(){return ns({},a,h)},[a,h]);return jt.createElement(PP.Provider,{value:m},t,jt.createElement(oJ,ns({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var UP=function(e){var t,n,i=e.src,s=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=b.useContext(PP),h=(t=function(){return f.nextId()},(n=b.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=b.useRef(null);b.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),b.useEffect(function(){return function(){f.remove(h)}},[]);var m=Gc({render:function(v){return s&&s(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),g=b.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return b.useEffect(function(){f.update({key:h,src:i,originRef:p,render:m.render,overlay:r,width:a,height:l})},[i]),d?b.Children.only(b.cloneElement(d,ns({},g,{ref:p}))):null};/** * @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 ZZ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),IP=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** + */const dJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),FP=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** * @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. - */var JZ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var fJ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @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 eJ=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:r,iconNode:a,...l},c)=>b.createElement("svg",{ref:c,...JZ,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:IP("lucide",s),...l},[...a.map(([u,d])=>b.createElement(u,d)),...Array.isArray(r)?r:[r]]));/** + */const hJ=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:r,iconNode:a,...l},c)=>b.createElement("svg",{ref:c,...fJ,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:FP("lucide",s),...l},[...a.map(([u,d])=>b.createElement(u,d)),...Array.isArray(r)?r:[r]]));/** * @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 He=(e,t)=>{const n=b.forwardRef(({className:i,...s},r)=>b.createElement(eJ,{ref:r,iconNode:t,className:IP(`lucide-${ZZ(e)}`,i),...s}));return n.displayName=`${e}`,n};/** + */const $e=(e,t)=>{const n=b.forwardRef(({className:i,...s},r)=>b.createElement(hJ,{ref:r,iconNode:t,className:FP(`lucide-${dJ(e)}`,i),...s}));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 tJ=He("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 pJ=$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"}]]);/** * @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 rk=He("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const hk=$e("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 RP=He("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 $P=$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"}]]);/** * @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 Rp=He("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Lp=$e("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 jP=He("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const HP=$e("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 OP=He("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 zP=$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"}]]);/** * @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 nJ=He("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 mJ=$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"}]]);/** * @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=He("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 su=$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"}]]);/** * @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 iJ=He("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 gJ=$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"}]]);/** * @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 sJ=He("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 bJ=$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"}]]);/** * @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 rJ=He("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 yJ=$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"}]]);/** * @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 ka=He("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const Aa=$e("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 MP=He("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const VP=$e("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 ec=He("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const nc=$e("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 ak=He("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 pk=$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"}]]);/** * @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 aJ=He("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const xJ=$e("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 YR=He("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 nj=$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"}]]);/** * @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 oJ=He("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 EJ=$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"}]]);/** * @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 ok=He("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 mk=$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"}]]);/** * @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 $1=He("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 Y1=$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"}]]);/** * @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 lJ=He("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const vJ=$e("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 cJ=He("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 wJ=$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"}]]);/** * @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=He("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 Tb=$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"}]]);/** * @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 H1=He("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 W1=$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"}]]);/** * @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 uJ=He("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 _J=$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"}]]);/** * @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 mm=He("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 xm=$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"}]]);/** * @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 dJ=He("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const SJ=$e("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @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 LP=He("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 GP=$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"}]]);/** * @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 WR=He("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 ij=$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"}]]);/** * @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 fJ=He("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 NJ=$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"}]]);/** * @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 hJ=He("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 TJ=$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"}]]);/** * @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 lk=He("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 gk=$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"}]]);/** * @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 pJ=He("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 kJ=$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"}]]);/** * @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 DP=He("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 KP=$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"}]]);/** * @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 mJ=He("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 AJ=$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"}]]);/** * @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 gJ=He("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 CJ=$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"}]]);/** * @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 bJ=He("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 IJ=$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"}]]);/** * @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 ck=He("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 bk=$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"}]]);/** * @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 PP=He("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 qP=$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"}]]);/** * @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 yJ=He("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 RJ=$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"}]]);/** * @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 xJ=He("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 jJ=$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"}]]);/** * @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 z1=He("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 X1=$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"}]]);/** * @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 EJ=He("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 OJ=$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"}]]);/** * @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 vJ=He("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 MJ=$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"}]]);/** * @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 uk=He("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 yk=$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"}]]);/** * @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 Eu=He("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 wu=$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"}]]);/** * @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 wJ=He("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 LJ=$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"}]]);/** * @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 BP=He("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 YP=$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"}]]);/** * @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 _J=He("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 DJ=$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"}]]);/** * @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 UP=He("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 WP=$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"}]]);/** * @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 mn=He("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const mn=$e("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 SJ=He("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 PJ=$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"}]]);/** * @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 NJ=He("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 BJ=$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"}]]);/** * @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 Gc=He("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 Kc=$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"}]]);/** * @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 TJ=He("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const UJ=$e("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 FP=He("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 XP=$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"}]]);/** * @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 kJ=He("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 FJ=$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"}]]);/** * @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 AJ=He("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 $J=$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"}]]);/** * @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 CJ=He("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 HJ=$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"}]]);/** * @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 IJ=He("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 zJ=$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"}]]);/** * @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 RJ=He("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 VJ=$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"}]]);/** * @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 jJ=He("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 GJ=$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"}]]);/** * @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 OJ=He("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 KJ=$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"}]]);/** * @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 MJ=He("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 qJ=$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"}]]);/** * @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 LJ=He("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const YJ=$e("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 ws=He("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const Ns=$e("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 DJ=He("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 WJ=$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"}]]);/** * @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 dk=He("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=$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"}]]);/** * @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 PJ=He("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 XJ=$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"}]]);/** * @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 BJ=He("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 QJ=$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"}]]);/** * @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 Cy=He("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const Ly=$e("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 UJ=He("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 ZJ=$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"}]]);/** * @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 FJ=He("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 JJ=$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"}]]);/** * @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 XR=He("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 sj=$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"}]]);/** * @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 iu=He("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 ru=$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"}]]);/** * @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 $J=He("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 eee=$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"}]]);/** * @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 tc=He("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 ic=$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"}]]);/** * @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 HJ=He("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 tee=$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"}]]);/** * @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 zJ=He("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 nee=$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"}]]);/** * @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 VJ=He("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 iee=$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"}]]);/** * @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 GJ=He("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 see=$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"}]]);/** * @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 KJ=He("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 ree=$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"}]]);/** * @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 $P=He("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 QP=$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"}]]);/** * @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 Ns=He("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),QR="veadk_auth_qs";let jh=null;function qJ(){if(jh!==null)return jh;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(QR,t),jh=t):jh=sessionStorage.getItem(QR)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),jh}function Nn(e){const t=qJ();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Gf=3e4,ig=12e4,HP=1e4;function Cn(e,t=Gf){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const Iy="veadk_local_user",Ry="veadk_local_user_tab",YJ=/^[A-Za-z0-9]{1,16}$/;function zP(){try{const e=sessionStorage.getItem(Ry);if(e)return e;const t=localStorage.getItem(Iy);return t&&sessionStorage.setItem(Ry,t),t}catch{try{return localStorage.getItem(Iy)}catch{return null}}}function ZR(e){try{sessionStorage.setItem(Ry,e)}catch{}try{localStorage.setItem(Iy,e)}catch{}}function WJ(){try{sessionStorage.removeItem(Ry)}catch{}try{localStorage.removeItem(Iy)}catch{}}function V1(e){const t=new Headers(e),n=zP();return n&&t.set("X-VeADK-Local-User",n),t}async function VP(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Cn(void 0,HP)})}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 XJ(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function QJ(){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 ZJ(){const[e,t]=await Promise.all([W_(),VP()]);return e.status==="unauthenticated"&&t.length>0}function JJ(){window.location.assign("/oauth2/logout")}async function W_(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Cn(void 0,HP)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),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=zP();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function eee(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function tee(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const X_="veadk:authentication-required";let jp=null,np=null;function nee(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 iee(e){jp||(jp=new Promise(n=>{np=n}),window.dispatchEvent(new Event(X_)));const t=jp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const s=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},r=>{e.removeEventListener("abort",s),i(r)})}):t}function see(){return jp!==null}function ree(){np==null||np(),np=null,jp=null}async function G1(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` -响应:${r}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${s})${a}`)}}const aee=/\brun_sse\s*failed\s*:\s*404\b/i,oee=/session not found/i,lee=/(?:^|[::\s])not found\s*$/i,cee=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,JR="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",ej="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",tj="提示:模型生成的工具参数格式不完整,请重新发送一次。";function v0(e){const t=String(e);return cee.test(t)?t.includes(tj)?t:`${t} + */const As=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rj="veadk_auth_qs";let Dh=null;function aee(){if(Dh!==null)return Dh;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(rj,t),Dh=t):Dh=sessionStorage.getItem(rj)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),Dh}function An(e){const t=aee();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Yf=3e4,lg=12e4,ZP=1e4;function On(e,t=Yf){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const Dy="veadk_local_user",Py="veadk_local_user_tab",oee=/^[A-Za-z0-9]{1,16}$/;function JP(){try{const e=sessionStorage.getItem(Py);if(e)return e;const t=localStorage.getItem(Dy);return t&&sessionStorage.setItem(Py,t),t}catch{try{return localStorage.getItem(Dy)}catch{return null}}}function aj(e){try{sessionStorage.setItem(Py,e)}catch{}try{localStorage.setItem(Dy,e)}catch{}}function lee(){try{sessionStorage.removeItem(Py)}catch{}try{localStorage.removeItem(Dy)}catch{}}function Q1(e){const t=new Headers(e),n=JP();return n&&t.set("X-VeADK-Local-User",n),t}async function eB(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:On(void 0,ZP)})}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 cee(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function uee(){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 dee(){const[e,t]=await Promise.all([nS(),eB()]);return e.status==="unauthenticated"&&t.length>0}function fee(){window.location.assign("/oauth2/logout")}async function nS(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:On(void 0,ZP)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),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=JP();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function hee(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function pee(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const iS="veadk:authentication-required";let Dp=null,ap=null;function mee(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 gee(e){Dp||(Dp=new Promise(n=>{ap=n}),window.dispatchEvent(new Event(iS)));const t=Dp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const s=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},r=>{e.removeEventListener("abort",s),i(r)})}):t}function bee(){return Dp!==null}function yee(){ap==null||ap(),ap=null,Dp=null}async function Z1(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` +响应:${r}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${s})${a}`)}}const xee=/\brun_sse\s*failed\s*:\s*404\b/i,Eee=/session not found/i,vee=/(?:^|[::\s])not found\s*$/i,wee=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,oj="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",lj="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",cj="提示:模型生成的工具参数格式不完整,请重新发送一次。";function T0(e){const t=String(e);return wee.test(t)?t.includes(cj)?t:`${t} -${tj}`:aee.test(t)?oee.test(t)?t.includes(JR)?t:`${t} +${cj}`:xee.test(t)?Eee.test(t)?t.includes(oj)?t:`${t} -${JR}`:lee.test(t)?t.includes(ej)?t:`${t} +${oj}`:vee.test(t)?t.includes(lj)?t:`${t} -${ej}`:t:t}async function*fk(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let i="";try{for(;;){const{done:s,value:r}=await t.read();if(s)break;i+=n.decode(r,{stream:!0});let a=i.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const l=i.slice(0,a.index);i=i.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=i.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const uee=255,dee=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function fee(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let i=0,s="";for(const r of t){if(!dee.test(r))continue;const a=n.encode(r).byteLength;if(i+a>uee)break;s+=r,i+=a}return s.replace(/ +/g," ").trimEnd()}const hk="veadk.messageFeedback.v1";function pk(e,t,n,i){return[e,t,n,i].join(":")}function mk(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(hk)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function hee(e,t,n){if(typeof window>"u")return;const i=mk();i[e]={...i[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(hk,JSON.stringify(i))}function GP(e){if(typeof window>"u")return;const t=pk(e.runtimeId,e.appName,e.userId,e.sessionId),n=mk(),i=n[t];if(i){for(const s of e.eventIds)delete i[`veadk_feedback:${s}`];Object.keys(i).length===0?delete n[t]:n[t]=i,localStorage.setItem(hk,JSON.stringify(n))}}const wb="",gk=new Map;function KP(e,t){gk.set(e,t)}function qP(){gk.clear()}function Yi(e){const t=gk.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 xt(e,t={},n={},i=Gf){const s=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...s?{method:"POST"}:{},headers:V1(t.headers)},a=()=>{const u={...r,signal:Cn(t.signal,i)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),s&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(Nn(`${wb}/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(Nn(`${wb}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(Nn(`${wb}${e}`),u)},l=async u=>{if(nee(u))return!0;if(u.status!==401)return!1;try{return await ZJ()}catch{return!1}};let c=await a();for(;await l(c);)await iee(t.signal),c=await a();return c}function pee(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const i=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return i?`${i}: ${s}`:s}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function Zt(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const i=JSON.parse(n);return pee(i.detail??i.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function YP(){const e=await xt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Kf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Er extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const WP="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",XP="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",mee=["cn-beijing","cn-shanghai"],gee=3e4,K1=5*60*1e3,QP=60*1e3,_b=new Map,kc=new Map,Ac=new Map,pa=new Map;function ZP(e,t){return`${t}:${e}`}function sg(e){const t=e||"cn-beijing";return[t,...mee.filter(n=>n!==t)]}function qf(...e){return e.map(t=>String(t??"")).join("")}function Yf(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function bk(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function JP(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function q1(e,t,n){const i=await xt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await JP(i):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new Kf;if(n!=null&&n.runtimeId&&s==="runtime_private_endpoint_unreachable")throw new Er(WP);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(s))throw new Er(XP);if(n!=null&&n.runtimeId&&i.status===404)throw new Er("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(i.status===401||i.status===403))throw new Er("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Zt(i,"读取 Agent 列表失败"));const r=await i.json();return n!=null&&n.runtimeId&&_b.set(ZP(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+gee}),r}async function jy(e,t){const{app:n,ep:i}=Yi(e),s=await xt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!s.ok){const a=`创建会话失败 (${s.status})`,l=await Zt(s,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await s.json()).id}async function yk(e,t){const{app:n,ep:i}=Yi(e),s=await xt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function Oy(e,t,n){const{app:i,ep:s}=Yi(e),r=await xt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},s);if(!r.ok){const l=await Zt(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(s.runtimeId){const l=pk(s.runtimeId,i,t,n);a.state={...mk()[l]??{},...a.state??{}}}return a}async function eB(e){const{app:t,ep:n}=Yi(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const i=await xt("/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??""})},{},ig);if(!i.ok)throw new Error(await Zt(i,"提交反馈失败"));const s=await i.json(),r=pk(n.runtimeId,t,e.userId,e.sessionId);return hee(r,e.eventId,s),s}async function Y1(e,t={}){const n=qf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=Yf(pa,n,QP);if(!t.force&&i)return i;const s=pa.get(n);if(!t.force&&(s!=null&&s.promise))return s.promise;let r=null;const a=(async()=>{for(const l of sg(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await xt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return bk(pa,n,await u.json());r=new Error(await Zt(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();pa.set(n,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=pa.get(n);(l==null?void 0:l.promise)===a&&pa.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function tB(e){let t=null;for(const n of sg(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),s=await xt(`/web/evaluation/optimizations?${i.toString()}`);if(s.ok)return s.json();t=new Error(await Zt(s,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function nB(e){return Yf(pa,qf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),QP)}function Q_(e){Y1(e).catch(()=>{})}function iB(e){Y1(e,{force:!0}).catch(()=>{})}function sB(e,t){return["good","bad"].map(n=>{const i=e.find(s=>s.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(s=>s.kind===n).length}})}function Sb(e){for(const[t,n]of pa.entries()){const i=n.value;if(!i||i.runtimeId!==e.runtimeId||i.agentName!==e.appName)continue;const s=i.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:""},...s]:s;pa.set(t,{value:{...i,sets:sB(i.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function rB(e){let t=null;for(const n of sg(e.region)){const i=await xt("/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})},{},ig);if(i.ok){const s=await i.json(),r=new Set(e.itemIds);for(const[a,l]of pa.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));pa.set(a,{value:{...c,sets:sB(c.sets,u),items:u},updatedAt:Date.now()})}return s}t=new Error(await Zt(i,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function Z_(e,t,n){const{app:i,ep:s}=Yi(e),r=await xt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function bee(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),s=new Uint8Array(i.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function oB(e,t,n,i,s){const{app:r,ep:a}=Yi(e),l=s==null?"":`?version=${encodeURIComponent(s)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${l}`,u=await xt(c,{},a,ig);if(!u.ok)throw new Error(await Zt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=bee(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??i}}async function lB(e,t,n,i,s){const{blob:r}=await oB(e,t,n,i,s);return URL.createObjectURL(r)}async function yee(e){const t=await xt("/web/media/capabilities");if(!t.ok)throw new Error(await Zt(t,"media capabilities failed"));return t.json()}async function cB(e,t,n,i){const{app:s}=Yi(e),r=new FormData;r.set("app_name",s),r.set("user_id",t),r.set("session_id",n),r.set("file",i);const a=await xt("/web/media",{method:"POST",body:r},{},ig);if(!a.ok)throw new Error(await Zt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function J_(e,t,n){const{app:i}=Yi(e),s=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await xt(s,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Zt(r,"media cleanup failed"))}function uB(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((i,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function Nb(e,t){const n=uB(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await xt(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await Zt(i,"media cleanup failed"))}function dB(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=uB(t);if(!n)return t;const i=`${n}/content`;return Nn(`${wb}${i}`)}async function fB(e,t){const{app:n,ep:i}=Yi(e),s=await xt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const r=s.headers.get("content-type")??"";if(!r.includes("application/json")){const l=r.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${l}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function xk(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 Ek(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function eS(e,t,n){const{app:i,ep:s}=Yi(e),r=await xt(Ek(i,t,n),{},s);if(!r.ok)throw new Error(await Zt(r,"读取会话能力失败"));return xk(await r.json())}async function vk(e){const{ep:t}=Yi(e),n=await xt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Zt(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var r;return((r=s.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function xee(e){const{ep:t}=Yi(e),n=await xt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Zt(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function Eee(e,t,n){const{ep:i}=Yi(e),s=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await xt(r,{},i);if(!a.ok)throw new Error(await Zt(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function hB(e,t,n=1,i=20){const{ep:s}=Yi(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(i)}),a=await xt(`/harness/skills/findskill?${r.toString()}`,{},s);if(!a.ok)throw new Error(await Zt(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function tS(e,t,n,i,s){const{app:r,ep:a}=Yi(e),l=await xt(Ek(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:i.kind,name:i.name,skill_source_id:i.skillSourceId,description:i.description,version:i.version,expected_revision:s})},a);if(!l.ok)throw new Error(await Zt(l,"添加会话能力失败"));return xk(await l.json())}async function pB(e,t,n,i,s){const{app:r,ep:a}=Yi(e),l=`${Ek(r,t,n)}/${encodeURIComponent(i)}?expected_revision=${s}`,c=await xt(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await Zt(c,"移除会话能力失败"));return xk(await c.json())}async function mB(e,t,n=!0){const i=await xt(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const s=await i.json();if(n&&!s.draft)try{const r=await xt(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();s.draft=a.draft}}catch{}return{appName:e,name:s.name??e,description:s.description??"",type:s.type,model:s.model??"",tools:s.tools??[],skillsPreviewSupported:Array.isArray(s.skills),skills:s.skills??[],subAgents:s.subAgents??[],components:s.components??[],searchSources:s.searchSources??[],graph:s.graph,draft:s.draft}}async function wk(e){const{app:t,ep:n}=Yi(e);return mB(t,n,!1)}async function vee(e,t,n){let i=null;for(const s of sg(t)){const r={runtimeId:e,region:s};try{const a=ZP(e,s),l=_b.get(a);l&&l.expiresAt<=Date.now()&&_b.delete(a);const c=_b.get(a),u=n||(c==null?void 0:c.apps[0])||(await q1("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return mB(u,r)}catch(a){if(a instanceof Kf||a instanceof Er&&!a.unsupported)throw a;i=a instanceof Error?a:new Error(String(a))}}throw i??new Error("该 Runtime 未提供可预览的 Agent。")}async function My(e,t,n={},i={}){const s=typeof n=="string"?n:void 0,r=typeof n=="string"?i:n,a=qf(e,t||"cn-beijing",s??""),l=Yf(kc,a,K1);if(!r.force&&l)return l;const c=kc.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=vee(e,t,s).then(d=>bk(kc,a,d));kc.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=kc.get(a);(d==null?void 0:d.promise)===u&&kc.set(a,{value:d.value,updatedAt:d.updatedAt})}}function gB(e,t,n=""){return Yf(kc,qf(e,t||"cn-beijing",n),K1)}function bB(e,t,n=""){My(e,t,n).catch(()=>{})}async function yB(e,t,n,i){const{app:s,ep:r}=Yi(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:i}),l=await xt(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await Zt(l,"Agent 检索失败"));return l.json()}async function xB(e,t){const{app:n}=Yi(e),i=await xt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}async function*gm({appName:e,userId:t,sessionId:n,text:i,attachments:s=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=Yi(e),f=s.flatMap(g=>g.status&&g.status!=="ready"?[]:g.uri?[{fileData:{mimeType:g.mimeType,fileUri:g.uri,displayName:g.name},partMetadata:{veadkMedia:{id:g.id,uri:g.uri,name:g.name,mimeType:g.mimeType,sizeBytes:g.sizeBytes}}}]:g.data?[{inlineData:{mimeType:g.mimeType,data:g.data,displayName:g.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(g=>({functionResponse:{id:g.id,name:g.name,response:g.response}})),...i.trim()?[{text:i}]:[]];if(h&&p.length>0){const g=p[0],v=g.partMetadata;p[0]={...g,partMetadata:{...v,veadkInvocation:h}}}const m=await xt(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 g=await Zt(m,"运行会话失败");throw new Error(v0(`run_sse failed: ${m.status}:${g}`))}for await(const g of fk(m)){const v=g;typeof v.error=="string"&&(v.error=v0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=v0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=v0(v.error_message)),yield v}}async function EB(e){const t=await xt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return i})}const Op=new Map;async function rg(e,t,n,i){var u,d,f;const s=i==null?void 0:i.taskId,r=s?new AbortController:void 0;s&&r&&Op.set(s,r);const a=()=>{s&&Op.get(s)===r&&Op.delete(s)};let l;try{(u=i==null?void 0:i.onStage)==null||u.call(i,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await xt("/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:s,runtimeId:i==null?void 0:i.runtimeId,appName:i==null?void 0:i.appName,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:fee((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs})},{},0),(d=i==null?void 0:i.onStage)==null||d.call(i,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await Zt(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of fk(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=i==null?void 0:i.onStage)==null||f.call(i,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 vB(e){var n;const t=await xt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`取消部署失败 (${t.status})`)}(n=Op.get(e))==null||n.abort(),Op.delete(e)}async function wee(e="cn-beijing"){const t=await xt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const bm={title:"VeADK Studio",logoUrl:""},mv={studio:!1,version:"",branding:bm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function wB(){var e,t;try{const n=await xt("/web/ui-config");if(!n.ok)return mv;const i=await n.json(),s=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:bm.logoUrl;return{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:bm.title,logoUrl:s?Nn(s):""},features:{...mv.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local"}}catch{return mv}}const _B={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function SB(){var n,i,s;const e=await xt("/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.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function NB(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",s=await xt(`/web/studio-update${i}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function TB(e){const t=await xt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},ig);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function W1(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 xt(`/web/runtimes?${t.toString()}`);if(!n.ok){const s=await Zt(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(s===`加载 Runtime 失败 (${n.status})`?r:`${r}:${s}`)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function _k(e,t,n={}){try{const i={runtimeId:e,region:t};return n.retryProbe&&(i.retryProbe=!0),await q1("","",i)}catch(i){if(i instanceof Kf||i instanceof Er)throw i;return null}}async function kB(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const s=await xt("/.well-known/agent-card.json",{},i),r=await JP(s);if(r==="runtime_access_denied")throw new Kf;if(r==="runtime_private_endpoint_unreachable")throw new Er(WP);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new Er(XP);if(s.status===404)return null;if(s.status===401||s.status===403)throw new Er("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Zt(s,"读取 A2A Agent Card 失败"));const a=await s.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 AB(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await xt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await Zt(i,"读取 Runtime API Key 失败"));const s=await i.json();if(typeof s.apiKey!="string"||!s.apiKey)throw new Error("Runtime 未返回可用的 API Key");return s.apiKey}async function CB(e,t){const n=await xt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||`删除失败 (${n.status})`)}}async function IB({runtimeId:e,region:t,signal:n}){const i=new URLSearchParams({runtimeId:e,region:t}),s=await xt(`/web/runtime-update-capability?${i.toString()}`,{signal:n});if(!s.ok)throw new Error(await Zt(s,"检查 Runtime 更新能力失败"));return await s.json()}async function _ee(e,t){let n=null;for(const i of sg(t)){const s=await xt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(s.ok)return s.json();n=new Error(await Zt(s,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function Sk(e,t="cn-beijing",n={}){const i=qf(e,t||"cn-beijing"),s=Yf(Ac,i,K1);if(!n.force&&s)return s;const r=Ac.get(i);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=_ee(e,t).then(l=>bk(Ac,i,l));Ac.set(i,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Ac.get(i);(l==null?void 0:l.promise)===a&&Ac.set(i,{value:l.value,updatedAt:l.updatedAt})}}function RB(e,t="cn-beijing"){return Yf(Ac,qf(e,t||"cn-beijing"),K1)}function jB(e,t="cn-beijing"){Sk(e,t).catch(()=>{})}async function X1(e){const t=await xt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Zt(t,"生成项目失败"));return t.json()}const See=19e4;async function OB(e){const t=await xt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},See);if(!t.ok)throw new Error(await Zt(t,"生成 Agent 配置失败"));return G1(t,"生成 Agent 配置失败")}async function MB(e){const t=await xt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Zt(t,"创建调试运行失败"));return G1(t,"创建调试运行失败")}async function LB(e,t){const n=await xt(`/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 Zt(n,"创建调试会话失败"));return(await G1(n,"创建调试会话失败")).id}async function DB(e,t){const n=await xt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Zt(n,"加载调试调用链路失败"));const i=await G1(n,"加载调试调用链路失败");if(!Array.isArray(i))throw new Error("加载调试调用链路失败:返回格式无效");return i}async function*PB({runId:e,userId:t,sessionId:n,text:i,signal:s}){const r=i.trim()?[{text:i}]:[],a=await xt(`/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:s},{},0);if(!a.ok)throw new Error(await Zt(a,"调试运行失败"));for await(const l of fk(a))yield l}async function sd(e){const t=await xt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Zt(t,"清理调试运行失败"))}const Nee=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:bm,DEFAULT_STUDIO_ACCESS:_B,RuntimeAccessDeniedError:Kf,RuntimeProbeError:Er,addSessionCapability:tS,cancelAgentkitDeployment:vB,clearMessageFeedbackCache:GP,clearRemoteApps:qP,componentSearch:yB,createGeneratedAgentTestRun:MB,createGeneratedAgentTestSession:LB,createSession:jy,deleteAgentFeedbackCases:rB,deleteGeneratedAgentTestRun:sd,deleteMedia:Nb,deleteRuntime:CB,deleteSession:Z_,deleteSessionMedia:J_,deployAgentkitProject:rg,downloadArtifact:aB,fetchRemoteApps:q1,generateAgentDraftFromRequirement:OB,generateAgentProject:X1,getAgentFeedbackCases:Y1,getAgentInfo:wk,getAgentOptimizations:tB,getCachedAgentFeedbackCases:nB,getCachedRuntimeAgentInfo:gB,getCachedRuntimeDetail:RB,getGeneratedAgentTestTrace:DB,getMediaCapabilities:yee,getMyRuntimes:wee,getRuntimeAgentInfo:My,getRuntimeDetail:Sk,getRuntimeUpdateCapability:IB,getRuntimes:W1,getSession:Oy,getSessionCapabilities:eS,getSessionTrace:fB,getStudioAccess:SB,getStudioUpdateStatus:NB,getUiConfig:wB,listApps:YP,listIdentityUserPools:EB,listSessionBuiltinTools:vk,listSessionSkillSpaces:xee,listSessionSkillsInSpace:Eee,listSessions:yk,mediaContentUrl:dB,prefetchAgentFeedbackCases:Q_,prefetchRuntimeAgentInfo:bB,prefetchRuntimeDetail:jB,previewArtifact:lB,probeRuntimeA2a:kB,probeRuntimeApps:_k,refreshAgentFeedbackCases:iB,registerRemoteApp:KP,removeSessionCapability:pB,revealRuntimeApiKey:AB,runGeneratedAgentTestSSE:PB,runSSE:gm,searchSessionPublicSkills:hB,startStudioUpdate:TB,submitMessageFeedback:eB,uploadMedia:cB,upsertCachedAgentFeedbackCase:Sb,webSearch:xB},Symbol.toStringTag,{value:"Module"}));function gv(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const Tee="send_a2ui_json_to_client",kee="validated_a2ui_json",nS="adk_request_credential",nj="transfer_to_agent";function Aee(e){var i,s,r,a;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.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 ya(){return{blocks:[],liveStart:0}}const ij=e=>e.functionCall??e.function_call,iS=e=>e.functionResponse??e.function_response;function Cee(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Iee(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function BB(e){const t=[];for(const[n,i]of e.entries()){const s=i.partMetadata??i.part_metadata,r=s==null?void 0:s.veadkTransport;if((r==null?void 0:r.hidden)===!0)continue;const a=s==null?void 0:s.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=i.inlineData??i.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:Iee(l.data),name:l.displayName??l.display_name});continue}const c=i.fileData??i.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 sS(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 Ree=new Set(["llm","sequential","parallel","loop","a2a"]);function jee(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const s=i,r=Array.isArray(s.skills)?s.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=s.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Ree.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 Oee(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 Mee(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(s=>s.filename===i.filename&&s.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function sj(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function w0(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function pf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let i=e.liveStart;const s=((l=t.content)==null?void 0:l.parts)??[],r=s.some(p=>ij(p)||iS(p));if(t.partial&&!r){for(const p of s){const m=sS(p);typeof m=="string"&&m&&sj(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:i}}n.length=i;for(const p of s){const m=ij(p),g=iS(p),v=BB([p]),y=sS(p);if(typeof y=="string"&&y)sj(n,p.thought?"thinking":"text",y);else if(v.length)w0(n),Oee(n,v);else if(m)if(w0(n),m.name===nj){const x=Cee(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===nS){const x=m.args??{},E=x.authConfig??x.auth_config??x,N=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:N,authUri:Aee(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(g){if(w0(n),g.name===nj)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(g.name===nS)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===g.name){E.done=!0,E.response=g.response;break}}if(g.name===Tee){const x=((d=g.response)==null?void 0:d[kee])??[];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&&Mee(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),w0(n),i=n.length,{blocks:n,liveStart:i}}function Lee(e,t={}){var s,r;const n=[];let i=ya();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=iS(p))==null?void 0:m.name)===nS})){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 g=n[p].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(sS).filter(p=>!!p).join(""),d=BB(c),f=jee(c);if(!u&&!d.length&&!f){i=ya();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}}),i=ya()}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),i=ya()),i=pf(i,a),u.blocks=i.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 Dee(e){var t,n;for(const i of e??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const s=(((n=i.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(s)return s}return"新会话"}const Pee=50,rj=48;function Bee(e){return(e.events??[]).flatMap(t=>{var s,r;const i=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function Uee(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const s=(((n=i.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(s)return s}return"未命名会话"}function Fee(e,t,n){const i=Math.max(0,t-rj),s=Math.min(e.length,t+n+rj);return(i>0?"…":"")+e.slice(i,s).trim()+(s{var c;if((c=l.events)!=null&&c.length)return l;try{return await Oy(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of Bee(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:Uee(l),snippet:Fee(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,Pee)}async function Hee(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await xB(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:i,results:s,error:r}=n;return i?r?{results:[],note:r}:{results:s.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 zee(e,t,n,i){if(!t||!i.trim())return{results:[]};const s=await yB(t,e,i.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const r=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:s.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function Vee(e,t,n){return e==="session"?{results:await $ee(n.userId,n.appId,t)}:e==="web"?Hee(n.appId,t):zee(e,n.appId,n.userId,t)}function UB({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 Gee({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 Kee({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(UB,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function qee(e,t,n){const i=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),r=a=>i?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:i,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:i&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:i&&s.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:i&&s.has("memory"),unavailableLabel:r("长期记忆")}]}function Ly(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 aj(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 Yee({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:s,onOpenSession:r}){var F,A;const[a,l]=b.useState("session"),[c,u]=b.useState(""),[d,f]=b.useState([]),[h,p]=b.useState(),[m,g]=b.useState(!1),[v,y]=b.useState(!1),[x,E]=b.useState(!1),w=b.useRef(0),N=b.useRef(null),_=qee(t,n,i),T=_.find(j=>j.id===a),k=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(j=>j.source==="knowledgebase"||j.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(j=>j.source==="long_term_memory"||j.kind==="memory"):void 0;b.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),g(!1),E(!1)},[t]),b.useEffect(()=>{if(!x)return;function j(P){var $;($=N.current)!=null&&$.contains(P.target)||E(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[x]);async function C(j,P){var Z;const $=j.trim();if(!$||!((Z=_.find(B=>B.id===P))!=null&&Z.ready))return;const R=++w.current;g(!0),y(!0);let Y;try{Y=await Vee(P,$,{userId:e,appId:t})}catch(B){const te=B instanceof Error?B.message:String(B);Y={results:[],note:`搜索失败:${te}`}}R===w.current&&(f(Y.results),p(Y.note),g(!1))}function I(j){w.current+=1,u(j),f([]),p(void 0),y(!1),g(!1)}function O(j){w.current+=1,l(j),E(!1),f([]),p(void 0),y(!1),g(!1)}const M=!!(T!=null&&T.ready),G=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(k==null?void 0:k.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(k==null?void 0:k.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=k!=null&&k.backend?Ly(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:N,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(j=>!j),children:[o.jsx("span",{children:(T==null?void 0:T.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(Gee,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:_.map(j=>{var R,Y;const P=j.id==="knowledge"?(R=n==null?void 0:n.components)==null?void 0:R.find(Z=>Z.source==="knowledgebase"||Z.kind==="knowledgebase"):j.id==="memory"?(Y=n==null?void 0:n.components)==null?void 0:Y.find(Z=>Z.source==="long_term_memory"||Z.kind==="memory"):void 0,$=P?[P.name,P.backend?Ly(P.backend):""].filter(Boolean).join(" · "):j.ready?j.description:j.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===j.id,disabled:!j.ready,onClick:()=>O(j.id),children:[o.jsx("span",{children:j.label}),$&&o.jsx("small",{children:$})]},j.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:j=>I(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),C(c,a))},placeholder:G,disabled:!M,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(mn,{className:"icon spin"}):o.jsx(UB,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:M?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((j,P)=>o.jsx(Wee,{result:j,agentLabel:s,onOpen:r},P)):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?i?"正在读取当前 Agent 的检索能力…":(T==null?void 0:T.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Wee({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(FP,{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?` · ${aj(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(z1,{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(mm,{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(oj,{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?` · ${Ly(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(oj,{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?` · ${Ly(e.sourceType)}`:"",e.ts?` · ${aj(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function oj({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 Kc({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"})]})}const Nk="/assets/volcengine-DM14a-L-.svg",lj="(max-width: 860px)";function Xee(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 Qee(e){let t=2166136261;for(const i of e)t^=i.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 Zee={admin:"管理员",developer:"开发者",user:"普通用户"};function cj({role:e}){const t=Zee[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Jee({version:e,onClose:t}){return b.useEffect(()=>{const n=i=>{i.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),Ss.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(Ns,{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 ete({access:e,userInfo:t,version:n,onLogout:i}){const[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState("");if(!t)return null;const d=eee(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Qee(d||f||h),m=tee(t),g=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${g?" has-image":""}`,style:p,children:[h,g?o.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):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(cj,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&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${g?" has-image":""}`,style:p,children:[h,g?o.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):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(cj,{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(Eu,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),i()},children:[o.jsx(NJ,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(Jee,{version:n,onClose:()=>l(!1)}):null]})}function tte({branding:e,sessions:t,currentSessionId:n,activePage:i,features:s,access:r,streamingSids:a,onNewChat:l,onSearch:c,onQuickCreate:u,onSkillCenter:d,onAddAgent:f,onMyAgents:h,onApplications:p,onPickSession:m,onDeleteSession:g,userInfo:v,version:y,onLogout:x}){const E=O=>(s==null?void 0:s[O])!==!1,[w,N]=b.useState(null),_=b.useRef(typeof window<"u"&&window.matchMedia(lj).matches),[T,k]=b.useState(_.current),C=[...t].sort((O,M)=>(M.lastUpdateTime??0)-(O.lastUpdateTime??0)),I=()=>{_.current=!1,k(O=>!O),N(null)};return b.useEffect(()=>{const O=window.matchMedia(lj),M=G=>{G.matches?k(D=>D||(_.current=!0,!0)):_.current&&(_.current=!1,k(!1))};return O.addEventListener("change",M),()=>O.removeEventListener("change",M)},[]),o.jsxs("aside",{className:`sidebar ${T?"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:l,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||Nk,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:I,"aria-label":T?"展开侧边栏":"收起侧边栏",title:T?"展开侧边栏":"收起侧边栏",children:T?o.jsx(OJ,{className:"icon"}):o.jsx(jJ,{className:"icon"})})]}),E("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:l,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(ws,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:h,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(Kc,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:p,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(Xee,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]}),E("search")&&o.jsx(Kee,{active:i==="search",onClick:c})]}),E("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),E("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:l,"aria-label":"新建会话",title:"新建会话",children:o.jsx(ws,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[C.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),C.map(O=>{const M=Dee(O.events);return o.jsxs("div",{className:`history-item ${O.id===n?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>m(O.id),"aria-current":O.id===n?"page":void 0,title:M,children:[(a==null?void 0:a.has(O.id))&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:M})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>N(G=>G===O.id?null:O.id),children:o.jsx(uJ,{className:"icon"})}),w===O.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>N(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{N(null),g(O.id)},children:[o.jsx(tc,{className:"icon"})," 删除"]})})]})]},O.id)})]})]}),o.jsx(ete,{access:r,userInfo:v,version:y,onLogout:x})]})}function Wi(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function Q1(){for(var e=0,t=arguments.length,n={},i;e=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Tb.prototype=Q1.prototype={constructor:Tb,on:function(e,t){var n=this._,i=ite(e+"",n),s,r=-1,a=i.length;if(arguments.length<2){for(;++r0)for(var n=new Array(s),i=0,s,r;i=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),dj.hasOwnProperty(t)?{space:dj[t],local:e}:e}function rte(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rS&&t.documentElement.namespaceURI===rS?t.createElement(e):t.createElementNS(n,e)}}function ate(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function FB(e){var t=Z1(e);return(t.local?ate:rte)(t)}function ote(){}function Tk(e){return e==null?ote:function(){return this.querySelector(e)}}function lte(e){typeof e!="function"&&(e=Tk(e));for(var t=this._groups,n=t.length,i=new Array(n),s=0;s=E&&(E=x+1);!(N=v[E])&&++E=0;)(a=i[s])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function Ote(e){e||(e=Mte);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,s=new Array(i),r=0;rt?1:e>=t?0:NaN}function Lte(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dte(){return Array.from(this)}function Pte(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Yte:typeof t=="function"?Xte:Wte)(e,t,n??"")):mf(this.node(),e)}function mf(e,t){return e.style.getPropertyValue(t)||GB(e).getComputedStyle(e,null).getPropertyValue(t)}function Zte(e){return function(){delete this[e]}}function Jte(e,t){return function(){this[e]=t}}function ene(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function tne(e,t){return arguments.length>1?this.each((t==null?Zte:typeof t=="function"?ene:Jte)(e,t)):this.node()[e]}function KB(e){return e.trim().split(/^|\s+/)}function kk(e){return e.classList||new qB(e)}function qB(e){this._node=e,this._names=KB(e.getAttribute("class")||"")}qB.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 YB(e,t){for(var n=kk(e),i=-1,s=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function Cne(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,s=t.length,r;n()=>e;function aS(e,{sourceEvent:t,subject:n,target:i,identifier:s,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:i,enumerable:!0,configurable:!0},identifier:{value:s,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}})}aS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Une(e){return!e.ctrlKey&&!e.button}function Fne(){return this.parentNode}function $ne(e,t){return t??{x:e.x,y:e.y}}function Hne(){return navigator.maxTouchPoints||"ontouchstart"in this}function e8(){var e=Une,t=Fne,n=$ne,i=Hne,s={},r=Q1("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(i).on("touchstart.drag",v).on("touchmove.drag",y,Bne).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,N){if(!(d||!e.call(this,w,N))){var _=E(this,t.call(this,w,N),w,N,"mouse");_&&(yr(w.view).on("mousemove.drag",m,ym).on("mouseup.drag",g,ym),ZB(w.view),bv(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}function m(w){if(Vd(w),!u){var N=w.clientX-l,_=w.clientY-c;u=N*N+_*_>f}s.mouse("drag",w)}function g(w){yr(w.view).on("mousemove.drag mouseup.drag",null),JB(w.view,u),Vd(w),s.mouse("end",w)}function v(w,N){if(e.call(this,w,N)){var _=w.changedTouches,T=t.call(this,w,N),k=_.length,C,I;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?S0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?S0(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=Vne.exec(e))?new rr(t[1],t[2],t[3],1):(t=Gne.exec(e))?new rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Kne.exec(e))?S0(t[1],t[2],t[3],t[4]):(t=qne.exec(e))?S0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Yne.exec(e))?yj(t[1],t[2]/100,t[3]/100,1):(t=Wne.exec(e))?yj(t[1],t[2]/100,t[3]/100,t[4]):fj.hasOwnProperty(e)?mj(fj[e]):e==="transparent"?new rr(NaN,NaN,NaN,0):null}function mj(e){return new rr(e>>16&255,e>>8&255,e&255,1)}function S0(e,t,n,i){return i<=0&&(e=t=n=NaN),new rr(e,t,n,i)}function Zne(e){return e instanceof og||(e=su(e)),e?(e=e.rgb(),new rr(e.r,e.g,e.b,e.opacity)):new rr}function oS(e,t,n,i){return arguments.length===1?Zne(e):new rr(e,t,n,i??1)}function rr(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}Ak(rr,oS,t8(og,{brighter(e){return e=e==null?Py:Math.pow(Py,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xm:Math.pow(xm,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rr(qc(this.r),qc(this.g),qc(this.b),By(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:gj,formatHex:gj,formatHex8:Jne,formatRgb:bj,toString:bj}));function gj(){return`#${Mc(this.r)}${Mc(this.g)}${Mc(this.b)}`}function Jne(){return`#${Mc(this.r)}${Mc(this.g)}${Mc(this.b)}${Mc((isNaN(this.opacity)?1:this.opacity)*255)}`}function bj(){const e=By(this.opacity);return`${e===1?"rgb(":"rgba("}${qc(this.r)}, ${qc(this.g)}, ${qc(this.b)}${e===1?")":`, ${e})`}`}function By(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mc(e){return e=qc(e),(e<16?"0":"")+e.toString(16)}function yj(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ba(e,t,n,i)}function n8(e){if(e instanceof ba)return new ba(e.h,e.s,e.l,e.opacity);if(e instanceof og||(e=su(e)),!e)return new ba;if(e instanceof ba)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,s=Math.min(t,n,i),r=Math.max(t,n,i),a=NaN,l=r-s,c=(r+s)/2;return l?(t===r?a=(n-i)/l+(n0&&c<1?0:a,new ba(a,l,c,e.opacity)}function eie(e,t,n,i){return arguments.length===1?n8(e):new ba(e,t,n,i??1)}function ba(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}Ak(ba,eie,t8(og,{brighter(e){return e=e==null?Py:Math.pow(Py,e),new ba(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xm:Math.pow(xm,e),new ba(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,i=n+(n<.5?n:1-n)*t,s=2*n-i;return new rr(yv(e>=240?e-240:e+120,s,i),yv(e,s,i),yv(e<120?e+240:e-120,s,i),this.opacity)},clamp(){return new ba(xj(this.h),N0(this.s),N0(this.l),By(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=By(this.opacity);return`${e===1?"hsl(":"hsla("}${xj(this.h)}, ${N0(this.s)*100}%, ${N0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xj(e){return e=(e||0)%360,e<0?e+360:e}function N0(e){return Math.max(0,Math.min(1,e||0))}function yv(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 Ck=e=>()=>e;function tie(e,t){return function(n){return e+n*t}}function nie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function iie(e){return(e=+e)==1?i8:function(t,n){return n-t?nie(t,n,e):Ck(isNaN(t)?n:t)}}function i8(e,t){var n=t-e;return n?tie(e,n):Ck(isNaN(e)?t:e)}const Uy=function e(t){var n=iie(t);function i(s,r){var a=n((s=oS(s)).r,(r=oS(r)).r),l=n(s.g,r.g),c=n(s.b,r.b),u=i8(s.opacity,r.opacity);return function(d){return s.r=a(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return i.gamma=e,i}(1);function sie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),s;return function(r){for(s=0;sn&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(i=i[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:Ga(i,s)})),n=xv.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,i)-2,x:Ga(u,d)})):d&&f.push(s(f)+"rotate("+d+i)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,i)-2,x:Ga(u,d)}):d&&f.push(s(f)+"skewX("+d+i)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Ga(u,f)},{i:g-2,x:Ga(d,h)})}else(f!==1||h!==1)&&p.push(s(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,g=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--gf}function wj(){ru=($y=vm.now())+J1,gf=ip=0;try{xie()}finally{gf=0,vie(),ru=0}}function Eie(){var e=vm.now(),t=e-$y;t>o8&&(J1-=t,$y=e)}function vie(){for(var e,t=Fy,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Fy=n);sp=e,uS(i)}function uS(e){if(!gf){ip&&(ip=clearTimeout(ip));var t=e-ru;t>24?(e<1/0&&(ip=setTimeout(wj,e-vm.now()-J1)),Oh&&(Oh=clearInterval(Oh))):(Oh||($y=vm.now(),Oh=setInterval(Eie,o8)),gf=1,l8(wj))}}function _j(e,t,n){var i=new Hy;return t=t==null?0:+t,i.restart(s=>{i.stop(),e(s+t)},t,n),i}var wie=Q1("start","end","cancel","interrupt"),_ie=[],u8=0,Sj=1,dS=2,Ab=3,Nj=4,fS=5,Cb=6;function ex(e,t,n,i,s,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Sie(e,n,{name:t,index:i,group:s,on:wie,tween:_ie,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:u8})}function Rk(e,t){var n=Aa(e,t);if(n.state>u8)throw new Error("too late; already scheduled");return n}function so(e,t){var n=Aa(e,t);if(n.state>Ab)throw new Error("too late; already running");return n}function Aa(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Sie(e,t,n){var i=e.__transition,s;i[t]=n,n.timer=c8(r,0,n.time);function r(u){n.state=Sj,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!==Sj)return c();for(d in i)if(p=i[d],p.name===n.name){if(p.state===Ab)return _j(a);p.state===Nj?(p.state=Cb,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[d]):+ddS&&i.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function ese(e,t,n){var i,s,r=Jie(t)?Rk:so;return function(){var a=r(this,e),l=a.on;l!==i&&(s=(i=l).copy()).on(t,n),a.on=s}}function tse(e,t){var n=this._id;return arguments.length<2?Aa(this.node(),n).on.on(e):this.each(ese(n,e,t))}function nse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ise(){return this.on("end.remove",nse(this._id))}function sse(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tk(e));for(var i=this._groups,s=i.length,r=new Array(s),a=0;a()=>e;function Cse(e,{sourceEvent:t,target:n,transform:i,dispatch:s}){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:i,enumerable:!0,configurable:!0},_:{value:s}})}function Io(e,t,n){this.k=e,this.x=t,this.y=n}Io.prototype={constructor:Io,scale:function(e){return e===1?this:new Io(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Io(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 tx=new Io(1,0,0);p8.prototype=Io.prototype;function p8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tx;return e.__zoom}function Ev(e){e.stopImmediatePropagation()}function Mh(e){e.preventDefault(),e.stopImmediatePropagation()}function Ise(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Rse(){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 Tj(){return this.__zoom||tx}function jse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ose(){return navigator.maxTouchPoints||"ontouchstart"in this}function Mse(e,t,n){var i=e.invertX(t[0][0])-n[0][0],s=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(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function m8(){var e=Ise,t=Rse,n=Mse,i=jse,s=Ose,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=kb,u=Q1("start","zoom","end"),d,f,h,p=500,m=150,g=0,v=10;function y(D){D.property("__zoom",Tj).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,F,A,j){var P=D.selection?D.selection():D;P.property("__zoom",Tj),D!==P?N(D,F,A,j):P.interrupt().each(function(){_(this,arguments).event(j).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(D,F,A,j){y.scaleTo(D,function(){var P=this.__zoom.k,$=typeof F=="function"?F.apply(this,arguments):F;return P*$},A,j)},y.scaleTo=function(D,F,A,j){y.transform(D,function(){var P=t.apply(this,arguments),$=this.__zoom,R=A==null?w(P):typeof A=="function"?A.apply(this,arguments):A,Y=$.invert(R),Z=typeof F=="function"?F.apply(this,arguments):F;return n(E(x($,Z),R,Y),P,a)},A,j)},y.translateBy=function(D,F,A,j){y.transform(D,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,j)},y.translateTo=function(D,F,A,j,P){y.transform(D,function(){var $=t.apply(this,arguments),R=this.__zoom,Y=j==null?w($):typeof j=="function"?j.apply(this,arguments):j;return n(tx.translate(Y[0],Y[1]).scale(R.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof A=="function"?-A.apply(this,arguments):-A),$,a)},j,P)};function x(D,F){return F=Math.max(r[0],Math.min(r[1],F)),F===D.k?D:new Io(F,D.x,D.y)}function E(D,F,A){var j=F[0]-A[0]*D.k,P=F[1]-A[1]*D.k;return j===D.x&&P===D.y?D:new Io(D.k,j,P)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function N(D,F,A,j){D.on("start.zoom",function(){_(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(j).end()}).tween("zoom",function(){var P=this,$=arguments,R=_(P,$).event(j),Y=t.apply(P,$),Z=A==null?w(Y):typeof A=="function"?A.apply(P,$):A,B=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),te=P.__zoom,z=typeof F=="function"?F.apply(P,$):F,q=c(te.invert(Z).concat(B/te.k),z.invert(Z).concat(B/z.k));return function(W){if(W===1)W=z;else{var K=q(W),ue=B/K[2];W=new Io(ue,Z[0]-K[0]*ue,Z[1]-K[1]*ue)}R.zoom(null,W)}})}function _(D,F,A){return!A&&D.__zooming||new T(D,F)}function T(D,F){this.that=D,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,F),this.taps=0}T.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,F){return this.mouse&&D!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&D!=="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(D){var F=yr(this.that).datum();u.call(D,this.that,new Cse(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function k(D,...F){if(!e.apply(this,arguments))return;var A=_(this,F).event(D),j=this.__zoom,P=Math.max(r[0],Math.min(r[1],j.k*Math.pow(2,i.apply(this,arguments)))),$=ha(D);if(A.wheel)(A.mouse[0][0]!==$[0]||A.mouse[0][1]!==$[1])&&(A.mouse[1]=j.invert(A.mouse[0]=$)),clearTimeout(A.wheel);else{if(j.k===P)return;A.mouse=[$,j.invert($)],Ib(this),A.start()}Mh(D),A.wheel=setTimeout(R,m),A.zoom("mouse",n(E(x(j,P),A.mouse[0],A.mouse[1]),A.extent,a));function R(){A.wheel=null,A.end()}}function C(D,...F){if(h||!e.apply(this,arguments))return;var A=D.currentTarget,j=_(this,F,!0).event(D),P=yr(D.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",B,!0),$=ha(D,A),R=D.clientX,Y=D.clientY;ZB(D.view),Ev(D),j.mouse=[$,this.__zoom.invert($)],Ib(this),j.start();function Z(te){if(Mh(te),!j.moved){var z=te.clientX-R,q=te.clientY-Y;j.moved=z*z+q*q>g}j.event(te).zoom("mouse",n(E(j.that.__zoom,j.mouse[0]=ha(te,A),j.mouse[1]),j.extent,a))}function B(te){P.on("mousemove.zoom mouseup.zoom",null),JB(te.view,j.moved),Mh(te),j.event(te).end()}}function I(D,...F){if(e.apply(this,arguments)){var A=this.__zoom,j=ha(D.changedTouches?D.changedTouches[0]:D,this),P=A.invert(j),$=A.k*(D.shiftKey?.5:2),R=n(E(x(A,$),j,P),t.apply(this,F),a);Mh(D),l>0?yr(this).transition().duration(l).call(N,R,j,D):yr(this).call(y.transform,R,j,D)}}function O(D,...F){if(e.apply(this,arguments)){var A=D.touches,j=A.length,P=_(this,F,D.changedTouches.length===j).event(D),$,R,Y,Z;for(Ev(D),R=0;R`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:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", 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.`},wm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],g8=["Enter"," ","Escape"],b8={"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 bf;(function(e){e.Strict="strict",e.Loose="loose"})(bf||(bf={}));var Yc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Yc||(Yc={}));var _m;(function(e){e.Partial="partial",e.Full="full"})(_m||(_m={}));const y8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var kl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(kl||(kl={}));var yf;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(yf||(yf={}));var We;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(We||(We={}));const kj={[We.Left]:We.Right,[We.Right]:We.Left,[We.Top]:We.Bottom,[We.Bottom]:We.Top};function x8(e){return e===null?null:e?"valid":"invalid"}const E8=e=>"id"in e&&"source"in e&&"target"in e,Lse=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ok=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),lg=(e,t=[0,0])=>{const{width:n,height:i}=Qo(e),s=e.origin??t,r=n*s[0],a=i*s[1];return{x:e.position.x-r,y:e.position.y-a}},Dse=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,s)=>{const r=typeof s=="string";let a=!t.nodeLookup&&!r?s:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(s):Ok(s)?s:t.nodeLookup.get(s.id));const l=a?zy(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return nx(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ix(n)},cg=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=nx(n,zy(s)),i=!0)}),i?ix(n):{x:0,y:0,width:0,height:0}},Mk=(e,t,[n,i,s]=[0,0,1],r=!1,a=!1)=>{const l={...Wf(t,[n,i,s]),width:t.width/s,height:t.height/s},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,g=Sm(l,Ef(u)),v=(p??0)*(m??0),y=r&&g>0;(!u.internals.handleBounds||y||g>=v||u.dragging)&&c.push(u)}return c},Pse=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function Bse(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&n.set(s.id,s)}),n}async function Use({nodes:e,width:t,height:n,panZoom:i,minZoom:s,maxZoom:r},a){if(e.size===0)return!0;const l=Bse(e,a),c=cg(l),u=Dk(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await i.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 v8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:s,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??i;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",Na.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&ou(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=ou(f)?au(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",Na.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 Fse({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:s}){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(g=>g.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=Pse(a,c);for(const h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const xf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),au=(e={x:0,y:0},t,n)=>({x:xf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:xf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function w8(e,t,n){const{width:i,height:s}=Qo(n),{x:r,y:a}=n.internals.positionAbsolute;return au(e,[[r,a],[r+i,a+s]],t)}const Aj=(e,t,n)=>en?-xf(Math.abs(e-n),1,t)/t:0,Lk=(e,t,n=15,i=40)=>{const s=Aj(e.x,i,t.width-i)*n,r=Aj(e.y,i,t.height-i)*n;return[s,r]},nx=(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)}),hS=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),ix=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),Ef=(e,t=[0,0])=>{var s,r;const{x:n,y:i}=Ok(e)?e.internals.positionAbsolute:lg(e,t);return{x:n,y:i,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},zy=(e,t=[0,0])=>{var s,r;const{x:n,y:i}=Ok(e)?e.internals.positionAbsolute:lg(e,t);return{x:n,y:i,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:i+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},_8=(e,t)=>ix(nx(hS(e),hS(t))),Sm=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},Cj=e=>xa(e.width)&&xa(e.height)&&xa(e.x)&&xa(e.y),xa=e=>!isNaN(e)&&isFinite(e),S8=(e,t)=>(n,i)=>{},ug=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Wf=({x:e,y:t},[n,i,s],r=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-i)/s};return r?ug(l,a):l},vf=({x:e,y:t},[n,i,s])=>({x:e*s+n,y:t*s+i});function zu(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 $se(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=zu(e,n),s=zu(e,t);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof e=="object"){const i=zu(e.top??e.y??0,n),s=zu(e.bottom??e.y??0,n),r=zu(e.left??e.x??0,t),a=zu(e.right??e.x??0,t);return{top:i,right:a,bottom:s,left:r,x:r+a,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hse(e,t,n,i,s,r){const{x:a,y:l}=vf(e,[t,n,i]),{x:c,y:u}=vf({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=s-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const Dk=(e,t,n,i,s,r)=>{const a=$se(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=xf(u,i,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,g=Hse(e,p,m,d,t,n),v={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},Nm=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ou(e){return e!=null&&e!=="parent"}function Qo(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 Pk(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 N8(e,t={width:0,height:0},n,i,s){const r={...e},a=i.get(n);if(a){const l=a.origin||s;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 Ij(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function zse(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),resolve:e,reject:t}}function Vse(e){return{...b8,...e||{}}}function Lp(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:s}){const{x:r,y:a}=Ea(e),l=Wf({x:r-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},i),{x:c,y:u}=n?ug(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Bk=e=>({width:e.offsetWidth,height:e.offsetHeight}),T8=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Gse=["INPUT","SELECT","TEXTAREA"];function k8(e){var i,s;const t=((s=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Gse.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const A8=e=>"clientX"in e,Ea=(e,t)=>{var r,a;const n=A8(e),i=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Rj=(e,t,n,i,s)=>{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:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...Bk(a)}})};function C8({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function A0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function jj({pos:e,x1:t,y1:n,x2:i,y2:s,c:r}){switch(e){case We.Left:return[t-A0(t-i,r),n];case We.Right:return[t+A0(i-t,r),n];case We.Top:return[t,n-A0(n-s,r)];case We.Bottom:return[t,n+A0(s-n,r)]}}function I8({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:i,targetY:s,targetPosition:r=We.Top,curvature:a=.25}){const[l,c]=jj({pos:n,x1:e,y1:t,x2:i,y2:s,c:a}),[u,d]=jj({pos:r,x1:i,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=C8({sourceX:e,sourceY:t,targetX:i,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${i},${s}`,f,h,p,m]}function R8({sourceX:e,sourceY:t,targetX:n,targetY:i}){const s=Math.abs(n-e)/2,r=n0}const Yse=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,Wse=(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)),Xse=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",Na.error006()),t;const i=n.getEdgeId||Yse;let s;return E8(e)?s={...e}:s={...e,id:i(e)},Wse(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function j8({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[s,r,a,l]=R8({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,s,r,a,l]}const Oj={[We.Left]:{x:-1,y:0},[We.Right]:{x:1,y:0},[We.Top]:{x:0,y:-1},[We.Bottom]:{x:0,y:1}},Qse=({source:e,sourcePosition:t=We.Bottom,target:n})=>t===We.Left||t===We.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zse({source:e,sourcePosition:t=We.Bottom,target:n,targetPosition:i=We.Top,center:s,offset:r,stepPosition:a}){const l=Oj[t],c=Oj[i],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=Qse({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],g,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=R8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(g=s.x??u.x+(d.x-u.x)*a,v=s.y??(u.y+d.y)/2):(g=s.x??(u.x+d.x)/2,v=s.y??u.y+(d.y-u.y)*a);const k=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?k:C:m=h==="x"?C:k}else{const k=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?C:k:m=l.y===p?k:C,t===i){const D=Math.abs(e[h]-n[h]);if(D<=r){const F=Math.min(r-1,r-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==i){const D=h==="x"?"y":"x",F=l[h]===c[D],A=u[D]>d[D],j=u[D]=G?(g=(I.x+O.x)/2,v=m[0].y):(g=m[0].x,v=(I.y+O.y)/2)}const N={x:u.x+y.x,y:u.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...N.x!==m[0].x||N.y!==m[0].y?[N]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],g,v,E,w]}function Jse(e,t,n,i){const s=Math.min(Mj(e,t)/2,Mj(t,n)/2,i),{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 pS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function tre(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:s}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||i,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=pS(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 O8=1e3,nre=10,Uk={nodeOrigin:[0,0],nodeExtent:wm,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ire={...Uk,checkEquality:!0};function Fk(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function sre(e,t,n){const i=Fk(Uk,n);for(const s of e.values())if(s.parentId)Hk(s,e,t,i);else{const r=lg(s,i.nodeOrigin),a=ou(s.extent)?s.extent:i.nodeExtent,l=au(r,a,Qo(s));s.internals.positionAbsolute=l}}function rre(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const s of e.handles){const r={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(r):s.type==="target"&&i.push(r)}return{source:n,target:i}}function $k(e){return e==="manual"}function mS(e,t,n,i={}){var d,f;const s=Fk(ire,i),r={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!$k(s.zIndexMode)?O8:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=lg(h,s.nodeOrigin),g=ou(h.extent)?h.extent:s.nodeExtent,v=au(m,g,Qo(h));p={...s.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:rre(h,p),z:M8(h,l,s.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&&Hk(p,t,n,i,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function are(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 Hk(e,t,n,i,s){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Fk(Uk,i),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}are(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*nre),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=r&&!$k(c)?O8:0,{x:h,y:p,z:m}=ore(e,d,a,l,f,c),{positionAbsolute:g}=e.internals,v=h!==g.x||p!==g.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:g,z:m}})}function M8(e,t,n){const i=xa(e.zIndex)?e.zIndex:0;return $k(n)?i:i+(e.selected?t:0)}function ore(e,t,n,i,s,r){const{x:a,y:l}=t.internals.positionAbsolute,c=Qo(e),u=lg(e,n),d=ou(e.extent)?au(u,e.extent,c):u;let f=au({x:a+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=w8(f,c,t));const h=M8(e,s,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function zk(e,t,n,i=[0,0]){var a;const s=[],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)??Ef(c),d=_8(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=Qo(c),h=c.origin??i,p=l.x0||m>0||y||x)&&(s.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(N=>N.id===w.id)||s.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=zk(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function cre({delta:e,panZoom:t,transform:n,translateExtent:i,width:s,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],[s,r]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function Bj(e,t,n,i,s,r){let a=s;const l=i.get(a)||new Map;i.set(a,l.set(n,t)),a=`${s}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),r){a=`${s}-${e}-${r}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function L8(e,t,n){e.clear(),t.clear();for(const i of n){const{source:s,target:r,sourceHandle:a=null,targetHandle:l=null}=i,c={edgeId:i.id,source:s,target:r,sourceHandle:a,targetHandle:l},u=`${s}-${a}--${r}-${l}`,d=`${r}-${l}--${s}-${a}`;Bj("source",c,d,e,s,a),Bj("target",c,u,e,r,l),t.set(i.id,i)}}function D8(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:D8(n,t):!1}function Uj(e,t,n){var s;let i=e;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function ure(e,t,n,i){const s=new Map;for(const[r,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!D8(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&s.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 s}function vv({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,l,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:i})}if(!e)return[s[0],s];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:i}:s[0],s]}function dre({dragItems:e,snapGrid:t,x:n,y:i}){const s=e.values().next().value;if(!s)return null;const r={x:n-s.distance.x,y:i-s.distance.y},a=ug(r,t);return{x:a.x-r.x,y:a.y-r.y}}function fre({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:s}){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,g=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:N,nodeId:_,nodeClickDistance:T=0}){h=yr(w);function k({x:M,y:G}){const{nodeLookup:D,nodeExtent:F,snapGrid:A,snapToGrid:j,nodeOrigin:P,onNodeDrag:$,onSelectionDrag:R,onError:Y,updateNodePositions:Z}=t();r={x:M,y:G};let B=!1;const te=l.size>1,z=te&&F?hS(cg(l)):null,q=te&&j?dre({dragItems:l,snapGrid:A,x:M,y:G}):null;for(const[W,K]of l){if(!D.has(W))continue;let ue={x:M-K.distance.x,y:G-K.distance.y};j&&(ue=q?{x:Math.round(ue.x+q.x),y:Math.round(ue.y+q.y)}:ug(ue,A));let pe=null;if(te&&F&&!K.extent&&z){const{positionAbsolute:me}=K.internals,Re=me.x-z.x+F[0][0],ge=me.x+K.measured.width-z.x2+F[1][0],oe=me.y-z.y+F[0][1],Te=me.y+K.measured.height-z.y2+F[1][1];pe=[[Re,oe],[ge,Te]]}const{position:_e,positionAbsolute:fe}=v8({nodeId:W,nextPosition:ue,nodeLookup:D,nodeExtent:pe||F,nodeOrigin:P,onError:Y});B=B||K.position.x!==_e.x||K.position.y!==_e.y,K.position=_e,K.internals.positionAbsolute=fe}if(m=m||B,!!B&&(Z(l,!0),g&&(i||$||!_&&R))){const[W,K]=vv({nodeId:_,dragItems:l,nodeLookup:D});i==null||i(g,l,W,K),$==null||$(g,W,K),_||R==null||R(g,K)}}async function C(){if(!d)return;const{transform:M,panBy:G,autoPanSpeed:D,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[A,j]=Lk(u,d,D);(A!==0||j!==0)&&(r.x=(r.x??0)-A/M[2],r.y=(r.y??0)-j/M[2],await G({x:A,y:j})&&k(r)),a=requestAnimationFrame(C)}function I(M){var te;const{nodeLookup:G,multiSelectionActive:D,nodesDraggable:F,transform:A,snapGrid:j,snapToGrid:P,selectNodesOnDrag:$,onNodeDragStart:R,onSelectionDragStart:Y,unselectNodesAndEdges:Z}=t();f=!0,(!$||!N)&&!D&&_&&((te=G.get(_))!=null&&te.selected||Z()),N&&$&&_&&(e==null||e(_));const B=Lp(M.sourceEvent,{transform:A,snapGrid:j,snapToGrid:P,containerBounds:d});if(r=B,l=ure(G,F,B,_),l.size>0&&(n||R||!_&&Y)){const[z,q]=vv({nodeId:_,dragItems:l,nodeLookup:G});n==null||n(M.sourceEvent,l,z,q),R==null||R(M.sourceEvent,z,q),_||Y==null||Y(M.sourceEvent,q)}}const O=e8().clickDistance(T).on("start",M=>{const{domNode:G,nodeDragThreshold:D,transform:F,snapGrid:A,snapToGrid:j}=t();d=(G==null?void 0:G.getBoundingClientRect())||null,p=!1,m=!1,g=M.sourceEvent,D===0&&I(M),r=Lp(M.sourceEvent,{transform:F,snapGrid:A,snapToGrid:j,containerBounds:d}),u=Ea(M.sourceEvent,d)}).on("drag",M=>{const{autoPanOnNodeDrag:G,transform:D,snapGrid:F,snapToGrid:A,nodeDragThreshold:j,nodeLookup:P}=t(),$=Lp(M.sourceEvent,{transform:D,snapGrid:F,snapToGrid:A,containerBounds:d});if(g=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||_&&!P.has(_))&&(p=!0),!p){if(!c&&G&&f&&(c=!0,C()),!f){const R=Ea(M.sourceEvent,d),Y=R.x-u.x,Z=R.y-u.y;Math.sqrt(Y*Y+Z*Z)>j&&I(M)}(r.x!==$.xSnapped||r.y!==$.ySnapped)&&l&&f&&(u=Ea(M.sourceEvent,d),k($))}}).on("end",M=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:G,updateNodePositions:D,onNodeDragStop:F,onSelectionDragStop:A}=t();if(m&&(D(l,!1),m=!1),s||F||!_&&A){const[j,P]=vv({nodeId:_,dragItems:l,nodeLookup:G,dragging:!1});s==null||s(M.sourceEvent,l,j,P),F==null||F(M.sourceEvent,j,P),_||A==null||A(M.sourceEvent,P)}}}).filter(M=>{const G=M.target;return!M.button&&(!x||!Uj(G,`.${x}`,w))&&(!E||Uj(G,E,w))});h.call(O)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function hre(e,t,n){const i=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Sm(s,Ef(r))>0&&i.push(r);return i}const pre=250;function mre(e,t,n,i){var l,c;let s=[],r=1/0;const a=hre(e,n,t+pre);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(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:p}=lu(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=i.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function P8(e,t,n,i,s,r=!1){var u,d,f;const a=i.get(e);if(!a)return null;const l=s==="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,...lu(a,c,c.position,!0)}:c}function B8(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function gre(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const U8=()=>!0;function bre(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:s,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:g,onConnectEnd:v,isValidConnection:y=U8,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:N,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){const C=T8(e.target);let I=0,O;const{x:M,y:G}=Ea(e),D=B8(r,k),F=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!F||!D)return;const j=P8(s,D,i,c,t);if(!j)return;let P=Ea(e,F),$=!1,R=null,Y=!1,Z=null;function B(){if(!d||!F)return;const[_e,fe]=Lk(P,F,_);h({x:_e,y:fe}),I=requestAnimationFrame(B)}const te={...j,nodeId:s,type:D,position:j.position},z=c.get(s);let W={inProgress:!0,isValid:null,from:lu(z,te,We.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:z,to:P,toHandle:null,toPosition:kj[te.position],toNode:null,pointer:P};function K(){A=!0,E(W),m==null||m(e,{nodeId:s,handleId:i,handleType:D})}T===0&&K();function ue(_e){if(!A){const{x:Te,y:ve}=Ea(_e),Xe=Te-M,De=ve-G;if(!(Xe*Xe+De*De>T*T))return;K()}if(!N()||!te){pe(_e);return}const fe=w();P=Ea(_e,F),O=mre(Wf(P,fe,!1,[1,1]),n,c,te),$||(B(),$=!0);const me=F8(_e,{handle:O,connectionMode:t,fromNodeId:s,fromHandleId:i,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});Z=me.handleDomNode,R=me.connection,Y=gre(!!O,me.isValid);const Re=c.get(s),ge=Re?lu(Re,te,We.Left,!0):W.from,oe={...W,from:ge,isValid:Y,to:me.toHandle&&Y?vf({x:me.toHandle.x,y:me.toHandle.y},fe):P,toHandle:me.toHandle,toPosition:Y&&me.toHandle?me.toHandle.position:kj[te.position],toNode:me.toHandle?c.get(me.toHandle.nodeId):null,pointer:P};E(oe),W=oe}function pe(_e){if(!("touches"in _e&&_e.touches.length>0)){if(A){(O||Z)&&R&&Y&&(g==null||g(R));const{inProgress:fe,...me}=W,Re={...me,toPosition:W.toHandle?W.toPosition:null};v==null||v(_e,Re),r&&(x==null||x(_e,Re))}p(),cancelAnimationFrame(I),$=!1,Y=!1,R=null,Z=null,C.removeEventListener("mousemove",ue),C.removeEventListener("mouseup",pe),C.removeEventListener("touchmove",ue),C.removeEventListener("touchend",pe)}}C.addEventListener("mousemove",ue),C.addEventListener("mouseup",pe),C.addEventListener("touchmove",ue),C.addEventListener("touchend",pe)}function F8(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:s,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=U8,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}=Ea(e),g=a.elementFromPoint(p,m),v=g!=null&&g.classList.contains(`${l}-flow__handle`)?g:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=B8(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),N=v.classList.contains("connectable"),_=v.classList.contains("connectableend");if(!E||!x)return y;const T={source:f?E:i,sourceHandle:f?w:s,target:f?i:E,targetHandle:f?s:w};y.connection=T;const C=N&&_&&(n===bf.Strict?f&&x==="source"||!f&&x==="target":E!==i||w!==s);y.isValid=C&&u(T),y.toHandle=P8(E,x,w,d,n,!0)}return y}const gS={onPointerDown:bre,isValid:F8};function yre({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const s=yr(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(),N=E.sourceEvent.ctrlKey&&Nm()?10:1,_=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,T=w[2]*Math.pow(2,_*N);t.scaleTo(T)};let g=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(g=[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 N=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],_=[N[0]-g[0],N[1]-g[1]];g=N;const T=i()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},C=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},C,l)},x=m8().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);s.call(x,{})}function a(){s.on("zoom",null)}return{update:r,destroy:a,pointer:ha}}const sx=e=>({x:e.x,y:e.y,zoom:e.k}),wv=({x:e,y:t,zoom:n})=>tx.translate(e,t).scale(n),kd=(e,t)=>e.target.closest(`.${t}`),$8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),xre=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,_v=(e,t=0,n=xre,i=()=>{})=>{const s=typeof t=="number"&&t>0;return s||i(),s?e.transition().duration(t).ease(n).on("end",i):e},H8=e=>{const t=e.ctrlKey&&Nm()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ere({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(kd(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=ha(d),y=H8(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=s===Yc.Vertical?0:d.deltaX*h,m=s===Yc.Horizontal?0:d.deltaY*h;!Nm()&&d.shiftKey&&s!==Yc.Vertical&&(p=d.deltaY*h,m=0),i.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const g=sx(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,g))}}function vre({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,s){const r=i.type==="wheel",a=!t&&r&&!i.ctrlKey,l=kd(i,e);if(i.ctrlKey&&r&&l&&i.preventDefault(),a||l)return null;i.preventDefault(),n.call(this,i,s)}}function wre({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var r,a,l;if((r=i.sourceEvent)!=null&&r.internal)return;const s=sx(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,s))}}function _re({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:s}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&$8(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||i([r.transform.x,r.transform.y,r.transform.k]),s&&!((l=r.sourceEvent)!=null&&l.internal)&&(s==null||s(r.sourceEvent,sx(r.transform)))}}function Sre({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&$8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),s)){const c=sx(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Nre({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:s,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"&&(kd(f,`${u}-flow__node`)||kd(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!s&&!r&&!n||a||d&&!m||kd(f,l)&&m||kd(f,c)&&(!m||s&&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&&!s&&!p&&m||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&g}}function Tre({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:s,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=m8().scaleExtent([t,n]).translateExtent(i),h=yr(e).call(f);x({x:s.x,y:s.y,zoom:xf(s.zoom,t,n)},[[0,0],[d.width,d.height]],i);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(H8);async function g(O,M){return h?new Promise(G=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?Mp:kb).transform(_v(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>G(!0)),O)}):!1}function v({noWheelClassName:O,noPanClassName:M,onPaneContextMenu:G,userSelectionActive:D,panOnScroll:F,panOnDrag:A,panOnScrollMode:j,panOnScrollSpeed:P,preventScrolling:$,zoomOnPinch:R,zoomOnScroll:Y,zoomOnDoubleClick:Z,zoomActivationKeyPressed:B,lib:te,onTransformChange:z,connectionInProgress:q,paneClickDistance:W,selectionOnDrag:K}){D&&!u.isZoomingOrPanning&&y();const ue=F&&!B&&!D;f.clickDistance(K?1/0:!xa(W)||W<0?0:W);const pe=ue?Ere({zoomPanValues:u,noWheelClassName:O,d3Selection:h,d3Zoom:f,panOnScrollMode:j,panOnScrollSpeed:P,zoomOnPinch:R,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):vre({noWheelClassName:O,preventScrolling:$,d3ZoomHandler:p});h.on("wheel.zoom",pe,{passive:!1});const _e=wre({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",_e);const fe=_re({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!G,onPanZoom:r,onTransformChange:z});f.on("zoom",fe);const me=Sre({zoomPanValues:u,panOnDrag:A,panOnScroll:F,onPaneContextMenu:G,onPanZoomEnd:l,onDraggingChange:c});f.on("end",me);const Re=Nre({zoomActivationKeyPressed:B,panOnDrag:A,zoomOnScroll:Y,panOnScroll:F,zoomOnDoubleClick:Z,zoomOnPinch:R,userSelectionActive:D,noPanClassName:M,noWheelClassName:O,lib:te,connectionInProgress:q});f.filter(Re),Z?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(O,M,G){const D=wv(O),F=f==null?void 0:f.constrain()(D,M,G);return F&&await g(F),F}async function E(O,M){const G=wv(O);return await g(G,M),G}function w(O){if(h){const M=wv(O),G=h.property("__zoom");(G.k!==O.zoom||G.x!==O.x||G.y!==O.y)&&(f==null||f.transform(h,M,null,{sync:!0}))}}function N(){const O=h?p8(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function _(O,M){return h?new Promise(G=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?Mp:kb).scaleTo(_v(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>G(!0)),O)}):!1}async function T(O,M){return h?new Promise(G=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?Mp:kb).scaleBy(_v(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>G(!0)),O)}):!1}function k(O){f==null||f.scaleExtent(O)}function C(O){f==null||f.translateExtent(O)}function I(O){const M=!xa(O)||O<0?0:O;f==null||f.clickDistance(M)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:C,syncViewport:w,setClickDistance:I}}var wf;(function(e){e.Line="line",e.Handle="handle"})(wf||(wf={}));function kre({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:s,affectsY:r}){const a=e-t,l=n-i,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function Fj(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:s}}function fl(e,t){return Math.max(0,t-e)}function hl(e,t){return Math.max(0,e-t)}function C0(e,t,n){return Math.max(0,t-e,e-n)}function $j(e,t){return e?!t:t}function Are(e,t,n,i,s,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:g,maxWidth:v,minHeight:y,maxHeight:x}=i,{x:E,y:w,width:N,height:_,aspectRatio:T}=e;let k=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const I=N+(c?-k:k),O=_+(u?-C:C),M=-r[0]*N,G=-r[1]*_;let D=C0(I,g,v),F=C0(O,y,x);if(a){let P=0,$=0;c&&k<0?P=fl(E+k+M,a[0][0]):!c&&k>0&&(P=hl(E+I+M,a[1][0])),u&&C<0?$=fl(w+C+G,a[0][1]):!u&&C>0&&($=hl(w+O+G,a[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(l){let P=0,$=0;c&&k>0?P=hl(E+k,l[0][0]):!c&&k<0&&(P=fl(E+I,l[1][0])),u&&C>0?$=hl(w+C,l[0][1]):!u&&C<0&&($=fl(w+O,l[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(s){if(d){const P=C0(I/T,y,x)*T;if(D=Math.max(D,P),a){let $=0;!c&&!u||c&&!u&&h?$=hl(w+G+I/T,a[1][1])*T:$=fl(w+G+(c?k:-k)/T,a[0][1])*T,D=Math.max(D,$)}if(l){let $=0;!c&&!u||c&&!u&&h?$=fl(w+I/T,l[1][1])*T:$=hl(w+(c?k:-k)/T,l[0][1])*T,D=Math.max(D,$)}}if(f){const P=C0(O*T,g,v)/T;if(F=Math.max(F,P),a){let $=0;!c&&!u||u&&!c&&h?$=hl(E+O*T+M,a[1][0])/T:$=fl(E+(u?C:-C)*T+M,a[0][0])/T,F=Math.max(F,$)}if(l){let $=0;!c&&!u||u&&!c&&h?$=fl(E+O*T,l[1][0])/T:$=hl(E+(u?C:-C)*T,l[0][0])/T,F=Math.max(F,$)}}}C=C+(C<0?F:-F),k=k+(k<0?D:-D),s&&(h?I>O*T?C=($j(c,u)?-k:k)/T:k=($j(c,u)?-C:C)*T:d?(C=k/T,u=c):(k=C*T,c=u));const A=c?E+k:E,j=u?w+C:w;return{width:N+(c?-k:k),height:_+(u?-C:C),x:r[0]*k*(c?-1:1)+A,y:r[1]*C*(u?-1:1)+j}}const z8={width:0,height:0,x:0,y:0},Cre={...z8,pointerX:0,pointerY:0,aspectRatio:1};function Ire(e,t,n){const i=t.position.x+e.position.x,s=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[[i-l,s-c],[i+r-l,s+a-c]]}function Rre({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:s}){const r=yr(e);let a={controlDirection:Fj("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:g,shouldResize:v}){let y={...z8},x={...Cre};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Fj(u)};let E,w=null,N=[],_,T,k,C=!1;const I=e8().on("start",O=>{const{nodeLookup:M,transform:G,snapGrid:D,snapToGrid:F,nodeOrigin:A,paneDomNode:j}=n();if(E=M.get(t),!E)return;w=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:$}=Lp(O.sourceEvent,{transform:G,snapGrid:D,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:P,pointerY:$,aspectRatio:y.width/y.height},_=void 0,T=ou(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(_=M.get(E.parentId)),_&&E.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),N=[],k=void 0;for(const[R,Y]of M)if(Y.parentId===t&&(N.push({id:R,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const Z=Ire(Y,E,Y.origin??A);k?k=[[Math.min(Z[0][0],k[0][0]),Math.min(Z[0][1],k[0][1])],[Math.max(Z[1][0],k[1][0]),Math.max(Z[1][1],k[1][1])]]:k=Z}p==null||p(O,{...y})}).on("drag",O=>{const{transform:M,snapGrid:G,snapToGrid:D,nodeOrigin:F}=n(),A=Lp(O.sourceEvent,{transform:M,snapGrid:G,snapToGrid:D,containerBounds:w}),j=[];if(!E)return;const{x:P,y:$,width:R,height:Y}=y,Z={},B=E.origin??F,{width:te,height:z,x:q,y:W}=Are(x,a.controlDirection,A,a.boundaries,a.keepAspectRatio,B,T,k),K=te!==R,ue=z!==Y,pe=q!==P&&K,_e=W!==$&&ue;if(!pe&&!_e&&!K&&!ue)return;if((pe||_e||B[0]===1||B[1]===1)&&(Z.x=pe?q:y.x,Z.y=_e?W:y.y,y.x=Z.x,y.y=Z.y,N.length>0)){const ge=q-P,oe=W-$;for(const Te of N)Te.position={x:Te.position.x-ge+B[0]*(te-R),y:Te.position.y-oe+B[1]*(z-Y)},j.push(Te)}if((K||ue)&&(Z.width=K&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:y.width,Z.height=ue&&(!a.resizeDirection||a.resizeDirection==="vertical")?z:y.height,y.width=Z.width,y.height=Z.height),_&&E.expandParent){const ge=B[0]*(Z.width??0);Z.x&&Z.x{C&&(g==null||g(O,{...y}),s==null||s({...y}),C=!1)});r.call(I)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var V8={exports:{}},G8={},K8={exports:{}},q8={};/** +${lj}`:t:t}async function*Ek(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let i="";try{for(;;){const{done:s,value:r}=await t.read();if(s)break;i+=n.decode(r,{stream:!0});let a=i.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const l=i.slice(0,a.index);i=i.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=i.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const _ee=255,See=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function Nee(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let i=0,s="";for(const r of t){if(!See.test(r))continue;const a=n.encode(r).byteLength;if(i+a>_ee)break;s+=r,i+=a}return s.replace(/ +/g," ").trimEnd()}const vk="veadk.messageFeedback.v1";function wk(e,t,n,i){return[e,t,n,i].join(":")}function _k(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(vk)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function Tee(e,t,n){if(typeof window>"u")return;const i=_k();i[e]={...i[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(vk,JSON.stringify(i))}function tB(e){if(typeof window>"u")return;const t=wk(e.runtimeId,e.appName,e.userId,e.sessionId),n=_k(),i=n[t];if(i){for(const s of e.eventIds)delete i[`veadk_feedback:${s}`];Object.keys(i).length===0?delete n[t]:n[t]=i,localStorage.setItem(vk,JSON.stringify(n))}}const kb="",Sk=new Map;function nB(e,t){Sk.set(e,t)}function iB(){Sk.clear()}function Xi(e){const t=Sk.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 xt(e,t={},n={},i=Yf){const s=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...s?{method:"POST"}:{},headers:Q1(t.headers)},a=()=>{const u={...r,signal:On(t.signal,i)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),s&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(An(`${kb}/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(An(`${kb}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(An(`${kb}${e}`),u)},l=async u=>{if(mee(u))return!0;if(u.status!==401)return!1;try{return await dee()}catch{return!1}};let c=await a();for(;await l(c);)await gee(t.signal),c=await a();return c}function kee(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const i=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return i?`${i}: ${s}`:s}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Wt(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const i=JSON.parse(n);return kee(i.detail??i.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function sB(){const e=await xt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Wf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class wr extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const rB="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",aB="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",Aee=["cn-beijing","cn-shanghai"],Cee=3e4,J1=5*60*1e3,oB=60*1e3,Ab=new Map,Ac=new Map,Cc=new Map,ma=new Map;function lB(e,t){return`${t}:${e}`}function cg(e){const t=e||"cn-beijing";return[t,...Aee.filter(n=>n!==t)]}function Xf(...e){return e.map(t=>String(t??"")).join("")}function Qf(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function Nk(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function cB(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function ex(e,t,n){const i=await xt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await cB(i):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new Wf;if(n!=null&&n.runtimeId&&s==="runtime_private_endpoint_unreachable")throw new wr(rB);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(s))throw new wr(aB);if(n!=null&&n.runtimeId&&i.status===404)throw new wr("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(i.status===401||i.status===403))throw new wr("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Wt(i,"读取 Agent 列表失败"));const r=await i.json();return n!=null&&n.runtimeId&&Ab.set(lB(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+Cee}),r}async function By(e,t){const{app:n,ep:i}=Xi(e),s=await xt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!s.ok){const a=`创建会话失败 (${s.status})`,l=await Wt(s,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await s.json()).id}async function Tk(e,t){const{app:n,ep:i}=Xi(e),s=await xt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function Uy(e,t,n){const{app:i,ep:s}=Xi(e),r=await xt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},s);if(!r.ok){const l=await Wt(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(s.runtimeId){const l=wk(s.runtimeId,i,t,n);a.state={..._k()[l]??{},...a.state??{}}}return a}async function uB(e){const{app:t,ep:n}=Xi(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const i=await xt("/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??""})},{},lg);if(!i.ok)throw new Error(await Wt(i,"提交反馈失败"));const s=await i.json(),r=wk(n.runtimeId,t,e.userId,e.sessionId);return Tee(r,e.eventId,s),s}async function tx(e,t={}){const n=Xf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=Qf(ma,n,oB);if(!t.force&&i)return i;const s=ma.get(n);if(!t.force&&(s!=null&&s.promise))return s.promise;let r=null;const a=(async()=>{for(const l of cg(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await xt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return Nk(ma,n,await u.json());r=new Error(await Wt(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();ma.set(n,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=ma.get(n);(l==null?void 0:l.promise)===a&&ma.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function dB(e){let t=null;for(const n of cg(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),s=await xt(`/web/evaluation/optimizations?${i.toString()}`);if(s.ok)return s.json();t=new Error(await Wt(s,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function fB(e){return Qf(ma,Xf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),oB)}function sS(e){tx(e).catch(()=>{})}function hB(e){tx(e,{force:!0}).catch(()=>{})}function pB(e,t){return["good","bad"].map(n=>{const i=e.find(s=>s.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(s=>s.kind===n).length}})}function Cb(e){for(const[t,n]of ma.entries()){const i=n.value;if(!i||i.runtimeId!==e.runtimeId||i.agentName!==e.appName)continue;const s=i.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:""},...s]:s;ma.set(t,{value:{...i,sets:pB(i.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function mB(e){let t=null;for(const n of cg(e.region)){const i=await xt("/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})},{},lg);if(i.ok){const s=await i.json(),r=new Set(e.itemIds);for(const[a,l]of ma.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));ma.set(a,{value:{...c,sets:pB(c.sets,u),items:u},updatedAt:Date.now()})}return s}t=new Error(await Wt(i,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function rS(e,t,n){const{app:i,ep:s}=Xi(e),r=await xt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function Iee(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),s=new Uint8Array(i.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function bB(e,t,n,i,s){const{app:r,ep:a}=Xi(e),l=s==null?"":`?version=${encodeURIComponent(s)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${l}`,u=await xt(c,{},a,lg);if(!u.ok)throw new Error(await Wt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=Iee(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??i}}async function yB(e,t,n,i,s){const{blob:r}=await bB(e,t,n,i,s);return URL.createObjectURL(r)}async function Ree(e){const t=await xt("/web/media/capabilities");if(!t.ok)throw new Error(await Wt(t,"media capabilities failed"));return t.json()}async function xB(e,t,n,i){const{app:s}=Xi(e),r=new FormData;r.set("app_name",s),r.set("user_id",t),r.set("session_id",n),r.set("file",i);const a=await xt("/web/media",{method:"POST",body:r},{},lg);if(!a.ok)throw new Error(await Wt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function aS(e,t,n){const{app:i}=Xi(e),s=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await xt(s,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Wt(r,"media cleanup failed"))}function EB(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((i,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function Ib(e,t){const n=EB(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await xt(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await Wt(i,"media cleanup failed"))}function vB(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=EB(t);if(!n)return t;const i=`${n}/content`;return An(`${kb}${i}`)}async function wB(e,t){const{app:n,ep:i}=Xi(e),s=await xt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const r=s.headers.get("content-type")??"";if(!r.includes("application/json")){const l=r.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${l}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function kk(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 Ak(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function oS(e,t,n){const{app:i,ep:s}=Xi(e),r=await xt(Ak(i,t,n),{},s);if(!r.ok)throw new Error(await Wt(r,"读取会话能力失败"));return kk(await r.json())}async function Ck(e){const{ep:t}=Xi(e),n=await xt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Wt(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var r;return((r=s.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function jee(e){const{ep:t}=Xi(e),n=await xt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Wt(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function Oee(e,t,n){const{ep:i}=Xi(e),s=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await xt(r,{},i);if(!a.ok)throw new Error(await Wt(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function _B(e,t,n=1,i=20){const{ep:s}=Xi(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(i)}),a=await xt(`/harness/skills/findskill?${r.toString()}`,{},s);if(!a.ok)throw new Error(await Wt(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function lS(e,t,n,i,s){const{app:r,ep:a}=Xi(e),l=await xt(Ak(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:i.kind,name:i.name,skill_source_id:i.skillSourceId,description:i.description,version:i.version,expected_revision:s})},a);if(!l.ok)throw new Error(await Wt(l,"添加会话能力失败"));return kk(await l.json())}async function SB(e,t,n,i,s){const{app:r,ep:a}=Xi(e),l=`${Ak(r,t,n)}/${encodeURIComponent(i)}?expected_revision=${s}`,c=await xt(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await Wt(c,"移除会话能力失败"));return kk(await c.json())}async function NB(e,t,n=!0){const i=await xt(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const s=await i.json();if(n&&!s.draft)try{const r=await xt(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();s.draft=a.draft}}catch{}return{appName:e,name:s.name??e,description:s.description??"",type:s.type,model:s.model??"",tools:s.tools??[],skillsPreviewSupported:Array.isArray(s.skills),skills:s.skills??[],subAgents:s.subAgents??[],components:s.components??[],searchSources:s.searchSources??[],graph:s.graph,draft:s.draft}}async function Ik(e){const{app:t,ep:n}=Xi(e);return NB(t,n,!1)}async function Mee(e,t,n){let i=null;for(const s of cg(t)){const r={runtimeId:e,region:s};try{const a=lB(e,s),l=Ab.get(a);l&&l.expiresAt<=Date.now()&&Ab.delete(a);const c=Ab.get(a),u=n||(c==null?void 0:c.apps[0])||(await ex("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return NB(u,r)}catch(a){if(a instanceof Wf||a instanceof wr&&!a.unsupported)throw a;i=a instanceof Error?a:new Error(String(a))}}throw i??new Error("该 Runtime 未提供可预览的 Agent。")}async function Fy(e,t,n={},i={}){const s=typeof n=="string"?n:void 0,r=typeof n=="string"?i:n,a=Xf(e,t||"cn-beijing",s??""),l=Qf(Ac,a,J1);if(!r.force&&l)return l;const c=Ac.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=Mee(e,t,s).then(d=>Nk(Ac,a,d));Ac.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Ac.get(a);(d==null?void 0:d.promise)===u&&Ac.set(a,{value:d.value,updatedAt:d.updatedAt})}}function TB(e,t,n=""){return Qf(Ac,Xf(e,t||"cn-beijing",n),J1)}function kB(e,t,n=""){Fy(e,t,n).catch(()=>{})}async function AB(e,t,n,i){const{app:s,ep:r}=Xi(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:i}),l=await xt(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await Wt(l,"Agent 检索失败"));return l.json()}async function CB(e,t){const{app:n}=Xi(e),i=await xt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}async function*Em({appName:e,userId:t,sessionId:n,text:i,attachments:s=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=Xi(e),f=s.flatMap(g=>g.status&&g.status!=="ready"?[]:g.uri?[{fileData:{mimeType:g.mimeType,fileUri:g.uri,displayName:g.name},partMetadata:{veadkMedia:{id:g.id,uri:g.uri,name:g.name,mimeType:g.mimeType,sizeBytes:g.sizeBytes}}}]:g.data?[{inlineData:{mimeType:g.mimeType,data:g.data,displayName:g.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(g=>({functionResponse:{id:g.id,name:g.name,response:g.response}})),...i.trim()?[{text:i}]:[]];if(h&&p.length>0){const g=p[0],v=g.partMetadata;p[0]={...g,partMetadata:{...v,veadkInvocation:h}}}const m=await xt(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 g=await Wt(m,"运行会话失败");throw new Error(T0(`run_sse failed: ${m.status}:${g}`))}for await(const g of Ek(m)){const v=g;typeof v.error=="string"&&(v.error=T0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=T0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=T0(v.error_message)),yield v}}async function IB(e){const t=await xt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return i})}const Pp=new Map;async function ug(e,t,n,i){var u,d,f;const s=i==null?void 0:i.taskId,r=s?new AbortController:void 0;s&&r&&Pp.set(s,r);const a=()=>{s&&Pp.get(s)===r&&Pp.delete(s)};let l;try{(u=i==null?void 0:i.onStage)==null||u.call(i,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await xt("/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:s,runtimeId:i==null?void 0:i.runtimeId,appName:i==null?void 0:i.appName,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:Nee((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs})},{},0),(d=i==null?void 0:i.onStage)==null||d.call(i,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await Wt(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of Ek(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=i==null?void 0:i.onStage)==null||f.call(i,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 RB(e){var n;const t=await xt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`取消部署失败 (${t.status})`)}(n=Pp.get(e))==null||n.abort(),Pp.delete(e)}async function Lee(e="cn-beijing"){const t=await xt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const vm={title:"VeADK Studio",logoUrl:""},Rb={enabled:!1},wv={studio:!1,version:"",branding:vm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:Rb};function Dee(e){if(!e||typeof e!="object")return Rb;const t=e;if(!t.enabled)return Rb;const n=t.apmplus;if(!n||typeof n.aid!="number"||!Number.isFinite(n.aid)||typeof n.token!="string"||!n.token)return Rb;const i=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 i.deployId=="string"?i.deployId:"",userPoolId:typeof i.userPoolId=="string"?i.userPoolId:"",applicationId:typeof i.applicationId=="string"?i.applicationId:"",functionId:typeof i.functionId=="string"?i.functionId:"",region:typeof i.region=="string"?i.region:"",project:typeof i.project=="string"?i.project:"",version:typeof i.version=="string"?i.version:""}}}async function jB(){var e,t;try{const n=await xt("/web/ui-config");if(!n.ok)return wv;const i=await n.json(),s=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:vm.logoUrl;return{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:vm.title,logoUrl:s?An(s):""},features:{...wv.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local",telemetry:Dee(i.telemetry)}}catch{return wv}}const OB={role:"user",telemetry:{userId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function MB(){var n,i,s,r;const e=await xt("/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((i=t.capabilities)==null?void 0:i.createAgents)!="boolean"||typeof((s=t.capabilities)==null?void 0:s.manageAgents)!="boolean"||!["all","mine"].includes((r=t.capabilities)==null?void 0:r.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function LB(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",s=await xt(`/web/studio-update${i}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function DB(e){const t=await xt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},lg);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function nx(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 xt(`/web/runtimes?${t.toString()}`);if(!n.ok){const s=await Wt(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(s===`加载 Runtime 失败 (${n.status})`?r:`${r}:${s}`)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function Rk(e,t,n={}){try{const i={runtimeId:e,region:t};return n.retryProbe&&(i.retryProbe=!0),await ex("","",i)}catch(i){if(i instanceof Wf||i instanceof wr)throw i;return null}}async function PB(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const s=await xt("/.well-known/agent-card.json",{},i),r=await cB(s);if(r==="runtime_access_denied")throw new Wf;if(r==="runtime_private_endpoint_unreachable")throw new wr(rB);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new wr(aB);if(s.status===404)return null;if(s.status===401||s.status===403)throw new wr("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Wt(s,"读取 A2A Agent Card 失败"));const a=await s.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 BB(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await xt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await Wt(i,"读取 Runtime API Key 失败"));const s=await i.json();if(typeof s.apiKey!="string"||!s.apiKey)throw new Error("Runtime 未返回可用的 API Key");return s.apiKey}async function UB(e,t){const n=await xt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||`删除失败 (${n.status})`)}}async function FB({runtimeId:e,region:t,signal:n}){const i=new URLSearchParams({runtimeId:e,region:t}),s=await xt(`/web/runtime-update-capability?${i.toString()}`,{signal:n});if(!s.ok)throw new Error(await Wt(s,"检查 Runtime 更新能力失败"));return await s.json()}async function Pee(e,t){let n=null;for(const i of cg(t)){const s=await xt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(s.ok)return s.json();n=new Error(await Wt(s,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function jk(e,t="cn-beijing",n={}){const i=Xf(e,t||"cn-beijing"),s=Qf(Cc,i,J1);if(!n.force&&s)return s;const r=Cc.get(i);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=Pee(e,t).then(l=>Nk(Cc,i,l));Cc.set(i,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Cc.get(i);(l==null?void 0:l.promise)===a&&Cc.set(i,{value:l.value,updatedAt:l.updatedAt})}}function $B(e,t="cn-beijing"){return Qf(Cc,Xf(e,t||"cn-beijing"),J1)}function HB(e,t="cn-beijing"){jk(e,t).catch(()=>{})}async function ix(e){const t=await xt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Wt(t,"生成项目失败"));return t.json()}const Bee=19e4;async function zB(e){const t=await xt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},Bee);if(!t.ok)throw new Error(await Wt(t,"生成 Agent 配置失败"));return Z1(t,"生成 Agent 配置失败")}async function VB(e){const t=await xt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Wt(t,"创建调试运行失败"));return Z1(t,"创建调试运行失败")}async function GB(e,t){const n=await xt(`/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 Wt(n,"创建调试会话失败"));return(await Z1(n,"创建调试会话失败")).id}async function KB(e,t){const n=await xt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Wt(n,"加载调试调用链路失败"));const i=await Z1(n,"加载调试调用链路失败");if(!Array.isArray(i))throw new Error("加载调试调用链路失败:返回格式无效");return i}async function*qB({runId:e,userId:t,sessionId:n,text:i,signal:s}){const r=i.trim()?[{text:i}]:[],a=await xt(`/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:s},{},0);if(!a.ok)throw new Error(await Wt(a,"调试运行失败"));for await(const l of Ek(a))yield l}async function ad(e){const t=await xt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Wt(t,"清理调试运行失败"))}const Uee=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:vm,DEFAULT_STUDIO_ACCESS:OB,RuntimeAccessDeniedError:Wf,RuntimeProbeError:wr,addSessionCapability:lS,cancelAgentkitDeployment:RB,clearMessageFeedbackCache:tB,clearRemoteApps:iB,componentSearch:AB,createGeneratedAgentTestRun:VB,createGeneratedAgentTestSession:GB,createSession:By,deleteAgentFeedbackCases:mB,deleteGeneratedAgentTestRun:ad,deleteMedia:Ib,deleteRuntime:UB,deleteSession:rS,deleteSessionMedia:aS,deployAgentkitProject:ug,downloadArtifact:gB,fetchRemoteApps:ex,generateAgentDraftFromRequirement:zB,generateAgentProject:ix,getAgentFeedbackCases:tx,getAgentInfo:Ik,getAgentOptimizations:dB,getCachedAgentFeedbackCases:fB,getCachedRuntimeAgentInfo:TB,getCachedRuntimeDetail:$B,getGeneratedAgentTestTrace:KB,getMediaCapabilities:Ree,getMyRuntimes:Lee,getRuntimeAgentInfo:Fy,getRuntimeDetail:jk,getRuntimeUpdateCapability:FB,getRuntimes:nx,getSession:Uy,getSessionCapabilities:oS,getSessionTrace:wB,getStudioAccess:MB,getStudioUpdateStatus:LB,getUiConfig:jB,listApps:sB,listIdentityUserPools:IB,listSessionBuiltinTools:Ck,listSessionSkillSpaces:jee,listSessionSkillsInSpace:Oee,listSessions:Tk,mediaContentUrl:vB,prefetchAgentFeedbackCases:sS,prefetchRuntimeAgentInfo:kB,prefetchRuntimeDetail:HB,previewArtifact:yB,probeRuntimeA2a:PB,probeRuntimeApps:Rk,refreshAgentFeedbackCases:hB,registerRemoteApp:nB,removeSessionCapability:SB,revealRuntimeApiKey:BB,runGeneratedAgentTestSSE:qB,runSSE:Em,searchSessionPublicSkills:_B,startStudioUpdate:DB,submitMessageFeedback:uB,uploadMedia:xB,upsertCachedAgentFeedbackCase:Cb,webSearch:CB},Symbol.toStringTag,{value:"Module"}));function _v(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const Fee="send_a2ui_json_to_client",$ee="validated_a2ui_json",cS="adk_request_credential",uj="transfer_to_agent";function Hee(e){var i,s,r,a;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.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 xa(){return{blocks:[],liveStart:0}}const dj=e=>e.functionCall??e.function_call,uS=e=>e.functionResponse??e.function_response;function zee(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Vee(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function YB(e){const t=[];for(const[n,i]of e.entries()){const s=i.partMetadata??i.part_metadata,r=s==null?void 0:s.veadkTransport;if((r==null?void 0:r.hidden)===!0)continue;const a=s==null?void 0:s.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=i.inlineData??i.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:Vee(l.data),name:l.displayName??l.display_name});continue}const c=i.fileData??i.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 dS(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 Gee=new Set(["llm","sequential","parallel","loop","a2a"]);function Kee(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const s=i,r=Array.isArray(s.skills)?s.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=s.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Gee.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 qee(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 Yee(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(s=>s.filename===i.filename&&s.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function fj(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.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 gf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let i=e.liveStart;const s=((l=t.content)==null?void 0:l.parts)??[],r=s.some(p=>dj(p)||uS(p));if(t.partial&&!r){for(const p of s){const m=dS(p);typeof m=="string"&&m&&fj(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:i}}n.length=i;for(const p of s){const m=dj(p),g=uS(p),v=YB([p]),y=dS(p);if(typeof y=="string"&&y)fj(n,p.thought?"thinking":"text",y);else if(v.length)k0(n),qee(n,v);else if(m)if(k0(n),m.name===uj){const x=zee(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===cS){const x=m.args??{},E=x.authConfig??x.auth_config??x,N=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:N,authUri:Hee(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(g){if(k0(n),g.name===uj)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(g.name===cS)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===g.name){E.done=!0,E.response=g.response;break}}if(g.name===Fee){const x=((d=g.response)==null?void 0:d[$ee])??[];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&&Yee(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),k0(n),i=n.length,{blocks:n,liveStart:i}}function Wee(e,t={}){var s,r;const n=[];let i=xa();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=uS(p))==null?void 0:m.name)===cS})){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 g=n[p].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(dS).filter(p=>!!p).join(""),d=YB(c),f=Kee(c);if(!u&&!d.length&&!f){i=xa();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}}),i=xa()}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),i=xa()),i=gf(i,a),u.blocks=i.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 Xee(e){var t,n;for(const i of e??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const s=(((n=i.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(s)return s}return"新会话"}const Qee=50,hj=48;function Zee(e){return(e.events??[]).flatMap(t=>{var s,r;const i=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function Jee(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const s=(((n=i.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(s)return s}return"未命名会话"}function ete(e,t,n){const i=Math.max(0,t-hj),s=Math.min(e.length,t+n+hj);return(i>0?"…":"")+e.slice(i,s).trim()+(s{var c;if((c=l.events)!=null&&c.length)return l;try{return await Uy(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of Zee(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:Jee(l),snippet:ete(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,Qee)}async function nte(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await CB(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:i,results:s,error:r}=n;return i?r?{results:[],note:r}:{results:s.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 ite(e,t,n,i){if(!t||!i.trim())return{results:[]};const s=await AB(t,e,i.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const r=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:s.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function ste(e,t,n){return e==="session"?{results:await tte(n.userId,n.appId,t)}:e==="web"?nte(n.appId,t):ite(e,n.appId,n.userId,t)}function WB({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 rte({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 ate({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(WB,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function ote(e,t,n){const i=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),r=a=>i?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:i,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:i&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:i&&s.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:i&&s.has("memory"),unavailableLabel:r("长期记忆")}]}function $y(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 pj(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 lte({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:s,onOpenSession:r}){var F,A;const[a,l]=b.useState("session"),[c,u]=b.useState(""),[d,f]=b.useState([]),[h,p]=b.useState(),[m,g]=b.useState(!1),[v,y]=b.useState(!1),[x,E]=b.useState(!1),w=b.useRef(0),N=b.useRef(null),_=ote(t,n,i),T=_.find(j=>j.id===a),k=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(j=>j.source==="knowledgebase"||j.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(j=>j.source==="long_term_memory"||j.kind==="memory"):void 0;b.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),g(!1),E(!1)},[t]),b.useEffect(()=>{if(!x)return;function j(P){var $;($=N.current)!=null&&$.contains(P.target)||E(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[x]);async function C(j,P){var Z;const $=j.trim();if(!$||!((Z=_.find(B=>B.id===P))!=null&&Z.ready))return;const R=++w.current;g(!0),y(!0);let Y;try{Y=await ste(P,$,{userId:e,appId:t})}catch(B){const te=B instanceof Error?B.message:String(B);Y={results:[],note:`搜索失败:${te}`}}R===w.current&&(f(Y.results),p(Y.note),g(!1))}function I(j){w.current+=1,u(j),f([]),p(void 0),y(!1),g(!1)}function O(j){w.current+=1,l(j),E(!1),f([]),p(void 0),y(!1),g(!1)}const L=!!(T!=null&&T.ready),G=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(k==null?void 0:k.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(k==null?void 0:k.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=k!=null&&k.backend?$y(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:N,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(j=>!j),children:[o.jsx("span",{children:(T==null?void 0:T.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(rte,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:_.map(j=>{var R,Y;const P=j.id==="knowledge"?(R=n==null?void 0:n.components)==null?void 0:R.find(Z=>Z.source==="knowledgebase"||Z.kind==="knowledgebase"):j.id==="memory"?(Y=n==null?void 0:n.components)==null?void 0:Y.find(Z=>Z.source==="long_term_memory"||Z.kind==="memory"):void 0,$=P?[P.name,P.backend?$y(P.backend):""].filter(Boolean).join(" · "):j.ready?j.description:j.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===j.id,disabled:!j.ready,onClick:()=>O(j.id),children:[o.jsx("span",{children:j.label}),$&&o.jsx("small",{children:$})]},j.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:j=>I(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),C(c,a))},placeholder:G,disabled:!L,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(mn,{className:"icon spin"}):o.jsx(WB,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:L?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((j,P)=>o.jsx(cte,{result:j,agentLabel:s,onOpen:r},P)):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?i?"正在读取当前 Agent 的检索能力…":(T==null?void 0:T.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function cte({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(XP,{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?` · ${pj(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(X1,{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(xm,{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(mj,{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?` · ${$y(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(mj,{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?` · ${$y(e.sourceType)}`:"",e.ts?` · ${pj(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function mj({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 qc({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"})]})}const Ok="/assets/volcengine-DM14a-L-.svg",gj="(max-width: 860px)";function ute(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 dte(e){let t=2166136261;for(const i of e)t^=i.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 fte={admin:"管理员",developer:"开发者",user:"普通用户"};function bj({role:e}){const t=fte[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function hte({version:e,onClose:t}){return b.useEffect(()=>{const n=i=>{i.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),ks.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(As,{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 pte({access:e,userInfo:t,version:n,onLogout:i}){const[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState("");if(!t)return null;const d=hee(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=dte(d||f||h),m=pee(t),g=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${g?" has-image":""}`,style:p,children:[h,g?o.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):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(bj,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&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${g?" has-image":""}`,style:p,children:[h,g?o.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):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(bj,{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(wu,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),i()},children:[o.jsx(BJ,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(hte,{version:n,onClose:()=>l(!1)}):null]})}function mte({branding:e,sessions:t,currentSessionId:n,activePage:i,features:s,access:r,streamingSids:a,onNewChat:l,onSearch:c,onQuickCreate:u,onSkillCenter:d,onAddAgent:f,onMyAgents:h,onApplications:p,onPickSession:m,onDeleteSession:g,userInfo:v,version:y,onLogout:x}){const E=O=>(s==null?void 0:s[O])!==!1,[w,N]=b.useState(null),_=b.useRef(typeof window<"u"&&window.matchMedia(gj).matches),[T,k]=b.useState(_.current),C=[...t].sort((O,L)=>(L.lastUpdateTime??0)-(O.lastUpdateTime??0)),I=()=>{_.current=!1,k(O=>!O),N(null)};return b.useEffect(()=>{const O=window.matchMedia(gj),L=G=>{G.matches?k(D=>D||(_.current=!0,!0)):_.current&&(_.current=!1,k(!1))};return O.addEventListener("change",L),()=>O.removeEventListener("change",L)},[]),o.jsxs("aside",{className:`sidebar ${T?"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:l,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||Ok,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:I,"aria-label":T?"展开侧边栏":"收起侧边栏",title:T?"展开侧边栏":"收起侧边栏",children:T?o.jsx(KJ,{className:"icon"}):o.jsx(GJ,{className:"icon"})})]}),E("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:l,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(Ns,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:h,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(qc,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:p,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(ute,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]}),E("search")&&o.jsx(ate,{active:i==="search",onClick:c})]}),E("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),E("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:l,"aria-label":"新建会话",title:"新建会话",children:o.jsx(Ns,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[C.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),C.map(O=>{const L=Xee(O.events);return o.jsxs("div",{className:`history-item ${O.id===n?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>m(O.id),"aria-current":O.id===n?"page":void 0,title:L,children:[(a==null?void 0:a.has(O.id))&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:L})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>N(G=>G===O.id?null:O.id),children:o.jsx(_J,{className:"icon"})}),w===O.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>N(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{N(null),g(O.id)},children:[o.jsx(ic,{className:"icon"})," 删除"]})})]})]},O.id)})]})]}),o.jsx(pte,{access:r,userInfo:v,version:y,onLogout:x})]})}function Qi(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function sx(){for(var e=0,t=arguments.length,n={},i;e=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}jb.prototype=sx.prototype={constructor:jb,on:function(e,t){var n=this._,i=bte(e+"",n),s,r=-1,a=i.length;if(arguments.length<2){for(;++r0)for(var n=new Array(s),i=0,s,r;i=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xj.hasOwnProperty(t)?{space:xj[t],local:e}:e}function xte(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===fS&&t.documentElement.namespaceURI===fS?t.createElement(e):t.createElementNS(n,e)}}function Ete(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function XB(e){var t=rx(e);return(t.local?Ete:xte)(t)}function vte(){}function Mk(e){return e==null?vte:function(){return this.querySelector(e)}}function wte(e){typeof e!="function"&&(e=Mk(e));for(var t=this._groups,n=t.length,i=new Array(n),s=0;s=E&&(E=x+1);!(N=v[E])&&++E=0;)(a=i[s])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function qte(e){e||(e=Yte);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,s=new Array(i),r=0;rt?1:e>=t?0:NaN}function Wte(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xte(){return Array.from(this)}function Qte(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?lne:typeof t=="function"?une:cne)(e,t,n??"")):bf(this.node(),e)}function bf(e,t){return e.style.getPropertyValue(t)||t8(e).getComputedStyle(e,null).getPropertyValue(t)}function fne(e){return function(){delete this[e]}}function hne(e,t){return function(){this[e]=t}}function pne(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mne(e,t){return arguments.length>1?this.each((t==null?fne:typeof t=="function"?pne:hne)(e,t)):this.node()[e]}function n8(e){return e.trim().split(/^|\s+/)}function Lk(e){return e.classList||new i8(e)}function i8(e){this._node=e,this._names=n8(e.getAttribute("class")||"")}i8.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 s8(e,t){for(var n=Lk(e),i=-1,s=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function zne(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,s=t.length,r;n()=>e;function hS(e,{sourceEvent:t,subject:n,target:i,identifier:s,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:i,enumerable:!0,configurable:!0},identifier:{value:s,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}})}hS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jne(e){return!e.ctrlKey&&!e.button}function eie(){return this.parentNode}function tie(e,t){return t??{x:e.x,y:e.y}}function nie(){return navigator.maxTouchPoints||"ontouchstart"in this}function u8(){var e=Jne,t=eie,n=tie,i=nie,s={},r=sx("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(i).on("touchstart.drag",v).on("touchmove.drag",y,Zne).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,N){if(!(d||!e.call(this,w,N))){var _=E(this,t.call(this,w,N),w,N,"mouse");_&&(Er(w.view).on("mousemove.drag",m,wm).on("mouseup.drag",g,wm),l8(w.view),Sv(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}function m(w){if(qd(w),!u){var N=w.clientX-l,_=w.clientY-c;u=N*N+_*_>f}s.mouse("drag",w)}function g(w){Er(w.view).on("mousemove.drag mouseup.drag",null),c8(w.view,u),qd(w),s.mouse("end",w)}function v(w,N){if(e.call(this,w,N)){var _=w.changedTouches,T=t.call(this,w,N),k=_.length,C,I;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?C0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?C0(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=sie.exec(e))?new or(t[1],t[2],t[3],1):(t=rie.exec(e))?new or(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=aie.exec(e))?C0(t[1],t[2],t[3],t[4]):(t=oie.exec(e))?C0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lie.exec(e))?Tj(t[1],t[2]/100,t[3]/100,1):(t=cie.exec(e))?Tj(t[1],t[2]/100,t[3]/100,t[4]):Ej.hasOwnProperty(e)?_j(Ej[e]):e==="transparent"?new or(NaN,NaN,NaN,0):null}function _j(e){return new or(e>>16&255,e>>8&255,e&255,1)}function C0(e,t,n,i){return i<=0&&(e=t=n=NaN),new or(e,t,n,i)}function fie(e){return e instanceof fg||(e=au(e)),e?(e=e.rgb(),new or(e.r,e.g,e.b,e.opacity)):new or}function pS(e,t,n,i){return arguments.length===1?fie(e):new or(e,t,n,i??1)}function or(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}Dk(or,pS,d8(fg,{brighter(e){return e=e==null?zy:Math.pow(zy,e),new or(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_m:Math.pow(_m,e),new or(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new or(Yc(this.r),Yc(this.g),Yc(this.b),Vy(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:Sj,formatHex:Sj,formatHex8:hie,formatRgb:Nj,toString:Nj}));function Sj(){return`#${Lc(this.r)}${Lc(this.g)}${Lc(this.b)}`}function hie(){return`#${Lc(this.r)}${Lc(this.g)}${Lc(this.b)}${Lc((isNaN(this.opacity)?1:this.opacity)*255)}`}function Nj(){const e=Vy(this.opacity);return`${e===1?"rgb(":"rgba("}${Yc(this.r)}, ${Yc(this.g)}, ${Yc(this.b)}${e===1?")":`, ${e})`}`}function Vy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Lc(e){return e=Yc(e),(e<16?"0":"")+e.toString(16)}function Tj(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ya(e,t,n,i)}function f8(e){if(e instanceof ya)return new ya(e.h,e.s,e.l,e.opacity);if(e instanceof fg||(e=au(e)),!e)return new ya;if(e instanceof ya)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,s=Math.min(t,n,i),r=Math.max(t,n,i),a=NaN,l=r-s,c=(r+s)/2;return l?(t===r?a=(n-i)/l+(n0&&c<1?0:a,new ya(a,l,c,e.opacity)}function pie(e,t,n,i){return arguments.length===1?f8(e):new ya(e,t,n,i??1)}function ya(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}Dk(ya,pie,d8(fg,{brighter(e){return e=e==null?zy:Math.pow(zy,e),new ya(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_m:Math.pow(_m,e),new ya(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,i=n+(n<.5?n:1-n)*t,s=2*n-i;return new or(Nv(e>=240?e-240:e+120,s,i),Nv(e,s,i),Nv(e<120?e+240:e-120,s,i),this.opacity)},clamp(){return new ya(kj(this.h),I0(this.s),I0(this.l),Vy(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=Vy(this.opacity);return`${e===1?"hsl(":"hsla("}${kj(this.h)}, ${I0(this.s)*100}%, ${I0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function kj(e){return e=(e||0)%360,e<0?e+360:e}function I0(e){return Math.max(0,Math.min(1,e||0))}function Nv(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 Pk=e=>()=>e;function mie(e,t){return function(n){return e+n*t}}function gie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function bie(e){return(e=+e)==1?h8:function(t,n){return n-t?gie(t,n,e):Pk(isNaN(t)?n:t)}}function h8(e,t){var n=t-e;return n?mie(e,n):Pk(isNaN(e)?t:e)}const Gy=function e(t){var n=bie(t);function i(s,r){var a=n((s=pS(s)).r,(r=pS(r)).r),l=n(s.g,r.g),c=n(s.b,r.b),u=h8(s.opacity,r.opacity);return function(d){return s.r=a(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return i.gamma=e,i}(1);function yie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),s;return function(r){for(s=0;sn&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(i=i[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:Ka(i,s)})),n=Tv.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,i)-2,x:Ka(u,d)})):d&&f.push(s(f)+"rotate("+d+i)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,i)-2,x:Ka(u,d)}):d&&f.push(s(f)+"skewX("+d+i)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Ka(u,f)},{i:g-2,x:Ka(d,h)})}else(f!==1||h!==1)&&p.push(s(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,g=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--yf}function Ij(){ou=(qy=Nm.now())+ax,yf=op=0;try{Oie()}finally{yf=0,Lie(),ou=0}}function Mie(){var e=Nm.now(),t=e-qy;t>b8&&(ax-=t,qy=e)}function Lie(){for(var e,t=Ky,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ky=n);lp=e,bS(i)}function bS(e){if(!yf){op&&(op=clearTimeout(op));var t=e-ou;t>24?(e<1/0&&(op=setTimeout(Ij,e-Nm.now()-ax)),Ph&&(Ph=clearInterval(Ph))):(Ph||(qy=Nm.now(),Ph=setInterval(Mie,b8)),yf=1,y8(Ij))}}function Rj(e,t,n){var i=new Yy;return t=t==null?0:+t,i.restart(s=>{i.stop(),e(s+t)},t,n),i}var Die=sx("start","end","cancel","interrupt"),Pie=[],E8=0,jj=1,yS=2,Mb=3,Oj=4,xS=5,Lb=6;function ox(e,t,n,i,s,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Bie(e,n,{name:t,index:i,group:s,on:Die,tween:Pie,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:E8})}function Uk(e,t){var n=Ca(e,t);if(n.state>E8)throw new Error("too late; already scheduled");return n}function ro(e,t){var n=Ca(e,t);if(n.state>Mb)throw new Error("too late; already running");return n}function Ca(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Bie(e,t,n){var i=e.__transition,s;i[t]=n,n.timer=x8(r,0,n.time);function r(u){n.state=jj,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!==jj)return c();for(d in i)if(p=i[d],p.name===n.name){if(p.state===Mb)return Rj(a);p.state===Oj?(p.state=Lb,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[d]):+dyS&&i.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function pse(e,t,n){var i,s,r=hse(t)?Uk:ro;return function(){var a=r(this,e),l=a.on;l!==i&&(s=(i=l).copy()).on(t,n),a.on=s}}function mse(e,t){var n=this._id;return arguments.length<2?Ca(this.node(),n).on.on(e):this.each(pse(n,e,t))}function gse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bse(){return this.on("end.remove",gse(this._id))}function yse(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mk(e));for(var i=this._groups,s=i.length,r=new Array(s),a=0;a()=>e;function zse(e,{sourceEvent:t,target:n,transform:i,dispatch:s}){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:i,enumerable:!0,configurable:!0},_:{value:s}})}function jo(e,t,n){this.k=e,this.x=t,this.y=n}jo.prototype={constructor:jo,scale:function(e){return e===1?this:new jo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jo(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 lx=new jo(1,0,0);S8.prototype=jo.prototype;function S8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lx;return e.__zoom}function kv(e){e.stopImmediatePropagation()}function Bh(e){e.preventDefault(),e.stopImmediatePropagation()}function Vse(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gse(){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 Mj(){return this.__zoom||lx}function Kse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qse(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yse(e,t,n){var i=e.invertX(t[0][0])-n[0][0],s=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(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function N8(){var e=Vse,t=Gse,n=Yse,i=Kse,s=qse,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ob,u=sx("start","zoom","end"),d,f,h,p=500,m=150,g=0,v=10;function y(D){D.property("__zoom",Mj).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,F,A,j){var P=D.selection?D.selection():D;P.property("__zoom",Mj),D!==P?N(D,F,A,j):P.interrupt().each(function(){_(this,arguments).event(j).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(D,F,A,j){y.scaleTo(D,function(){var P=this.__zoom.k,$=typeof F=="function"?F.apply(this,arguments):F;return P*$},A,j)},y.scaleTo=function(D,F,A,j){y.transform(D,function(){var P=t.apply(this,arguments),$=this.__zoom,R=A==null?w(P):typeof A=="function"?A.apply(this,arguments):A,Y=$.invert(R),Z=typeof F=="function"?F.apply(this,arguments):F;return n(E(x($,Z),R,Y),P,a)},A,j)},y.translateBy=function(D,F,A,j){y.transform(D,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,j)},y.translateTo=function(D,F,A,j,P){y.transform(D,function(){var $=t.apply(this,arguments),R=this.__zoom,Y=j==null?w($):typeof j=="function"?j.apply(this,arguments):j;return n(lx.translate(Y[0],Y[1]).scale(R.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof A=="function"?-A.apply(this,arguments):-A),$,a)},j,P)};function x(D,F){return F=Math.max(r[0],Math.min(r[1],F)),F===D.k?D:new jo(F,D.x,D.y)}function E(D,F,A){var j=F[0]-A[0]*D.k,P=F[1]-A[1]*D.k;return j===D.x&&P===D.y?D:new jo(D.k,j,P)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function N(D,F,A,j){D.on("start.zoom",function(){_(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(j).end()}).tween("zoom",function(){var P=this,$=arguments,R=_(P,$).event(j),Y=t.apply(P,$),Z=A==null?w(Y):typeof A=="function"?A.apply(P,$):A,B=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),te=P.__zoom,K=typeof F=="function"?F.apply(P,$):F,z=c(te.invert(Z).concat(B/te.k),K.invert(Z).concat(B/K.k));return function(W){if(W===1)W=K;else{var q=z(W),ce=B/q[2];W=new jo(ce,Z[0]-q[0]*ce,Z[1]-q[1]*ce)}R.zoom(null,W)}})}function _(D,F,A){return!A&&D.__zooming||new T(D,F)}function T(D,F){this.that=D,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,F),this.taps=0}T.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,F){return this.mouse&&D!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&D!=="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(D){var F=Er(this.that).datum();u.call(D,this.that,new zse(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function k(D,...F){if(!e.apply(this,arguments))return;var A=_(this,F).event(D),j=this.__zoom,P=Math.max(r[0],Math.min(r[1],j.k*Math.pow(2,i.apply(this,arguments)))),$=pa(D);if(A.wheel)(A.mouse[0][0]!==$[0]||A.mouse[0][1]!==$[1])&&(A.mouse[1]=j.invert(A.mouse[0]=$)),clearTimeout(A.wheel);else{if(j.k===P)return;A.mouse=[$,j.invert($)],Db(this),A.start()}Bh(D),A.wheel=setTimeout(R,m),A.zoom("mouse",n(E(x(j,P),A.mouse[0],A.mouse[1]),A.extent,a));function R(){A.wheel=null,A.end()}}function C(D,...F){if(h||!e.apply(this,arguments))return;var A=D.currentTarget,j=_(this,F,!0).event(D),P=Er(D.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",B,!0),$=pa(D,A),R=D.clientX,Y=D.clientY;l8(D.view),kv(D),j.mouse=[$,this.__zoom.invert($)],Db(this),j.start();function Z(te){if(Bh(te),!j.moved){var K=te.clientX-R,z=te.clientY-Y;j.moved=K*K+z*z>g}j.event(te).zoom("mouse",n(E(j.that.__zoom,j.mouse[0]=pa(te,A),j.mouse[1]),j.extent,a))}function B(te){P.on("mousemove.zoom mouseup.zoom",null),c8(te.view,j.moved),Bh(te),j.event(te).end()}}function I(D,...F){if(e.apply(this,arguments)){var A=this.__zoom,j=pa(D.changedTouches?D.changedTouches[0]:D,this),P=A.invert(j),$=A.k*(D.shiftKey?.5:2),R=n(E(x(A,$),j,P),t.apply(this,F),a);Bh(D),l>0?Er(this).transition().duration(l).call(N,R,j,D):Er(this).call(y.transform,R,j,D)}}function O(D,...F){if(e.apply(this,arguments)){var A=D.touches,j=A.length,P=_(this,F,D.changedTouches.length===j).event(D),$,R,Y,Z;for(kv(D),R=0;R`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:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", 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.`},Tm=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],T8=["Enter"," ","Escape"],k8={"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 xf;(function(e){e.Strict="strict",e.Loose="loose"})(xf||(xf={}));var Wc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Wc||(Wc={}));var km;(function(e){e.Partial="partial",e.Full="full"})(km||(km={}));const A8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Cl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Cl||(Cl={}));var Ef;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ef||(Ef={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));const Lj={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top};function C8(e){return e===null?null:e?"valid":"invalid"}const I8=e=>"id"in e&&"source"in e&&"target"in e,Wse=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),$k=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hg=(e,t=[0,0])=>{const{width:n,height:i}=Jo(e),s=e.origin??t,r=n*s[0],a=i*s[1];return{x:e.position.x-r,y:e.position.y-a}},Xse=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,s)=>{const r=typeof s=="string";let a=!t.nodeLookup&&!r?s:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(s):$k(s)?s:t.nodeLookup.get(s.id));const l=a?Wy(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cx(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ux(n)},pg=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=cx(n,Wy(s)),i=!0)}),i?ux(n):{x:0,y:0,width:0,height:0}},Hk=(e,t,[n,i,s]=[0,0,1],r=!1,a=!1)=>{const l={...Zf(t,[n,i,s]),width:t.width/s,height:t.height/s},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,g=Am(l,wf(u)),v=(p??0)*(m??0),y=r&&g>0;(!u.internals.handleBounds||y||g>=v||u.dragging)&&c.push(u)}return c},Qse=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function Zse(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&n.set(s.id,s)}),n}async function Jse({nodes:e,width:t,height:n,panZoom:i,minZoom:s,maxZoom:r},a){if(e.size===0)return!0;const l=Zse(e,a),c=pg(l),u=Vk(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await i.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 R8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:s,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??i;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",Ta.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&cu(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=cu(f)?lu(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",Ta.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 ere({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:s}){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(g=>g.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=Qse(a,c);for(const h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const vf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lu=(e={x:0,y:0},t,n)=>({x:vf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:vf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function j8(e,t,n){const{width:i,height:s}=Jo(n),{x:r,y:a}=n.internals.positionAbsolute;return lu(e,[[r,a],[r+i,a+s]],t)}const Dj=(e,t,n)=>en?-vf(Math.abs(e-n),1,t)/t:0,zk=(e,t,n=15,i=40)=>{const s=Dj(e.x,i,t.width-i)*n,r=Dj(e.y,i,t.height-i)*n;return[s,r]},cx=(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)}),ES=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),ux=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),wf=(e,t=[0,0])=>{var s,r;const{x:n,y:i}=$k(e)?e.internals.positionAbsolute:hg(e,t);return{x:n,y:i,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},Wy=(e,t=[0,0])=>{var s,r;const{x:n,y:i}=$k(e)?e.internals.positionAbsolute:hg(e,t);return{x:n,y:i,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:i+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},O8=(e,t)=>ux(cx(ES(e),ES(t))),Am=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},Pj=e=>Ea(e.width)&&Ea(e.height)&&Ea(e.x)&&Ea(e.y),Ea=e=>!isNaN(e)&&isFinite(e),M8=(e,t)=>(n,i)=>{},mg=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Zf=({x:e,y:t},[n,i,s],r=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-i)/s};return r?mg(l,a):l},_f=({x:e,y:t},[n,i,s])=>({x:e*s+n,y:t*s+i});function Gu(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 tre(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=Gu(e,n),s=Gu(e,t);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof e=="object"){const i=Gu(e.top??e.y??0,n),s=Gu(e.bottom??e.y??0,n),r=Gu(e.left??e.x??0,t),a=Gu(e.right??e.x??0,t);return{top:i,right:a,bottom:s,left:r,x:r+a,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function nre(e,t,n,i,s,r){const{x:a,y:l}=_f(e,[t,n,i]),{x:c,y:u}=_f({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=s-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const Vk=(e,t,n,i,s,r)=>{const a=tre(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=vf(u,i,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,g=nre(e,p,m,d,t,n),v={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},Cm=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function cu(e){return e!=null&&e!=="parent"}function Jo(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 Gk(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 L8(e,t={width:0,height:0},n,i,s){const r={...e},a=i.get(n);if(a){const l=a.origin||s;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 Bj(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ire(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),resolve:e,reject:t}}function sre(e){return{...k8,...e||{}}}function Up(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:s}){const{x:r,y:a}=va(e),l=Zf({x:r-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},i),{x:c,y:u}=n?mg(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Kk=e=>({width:e.offsetWidth,height:e.offsetHeight}),D8=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rre=["INPUT","SELECT","TEXTAREA"];function P8(e){var i,s;const t=((s=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:rre.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const B8=e=>"clientX"in e,va=(e,t)=>{var r,a;const n=B8(e),i=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Uj=(e,t,n,i,s)=>{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:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...Kk(a)}})};function U8({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function O0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Fj({pos:e,x1:t,y1:n,x2:i,y2:s,c:r}){switch(e){case Ye.Left:return[t-O0(t-i,r),n];case Ye.Right:return[t+O0(i-t,r),n];case Ye.Top:return[t,n-O0(n-s,r)];case Ye.Bottom:return[t,n+O0(s-n,r)]}}function F8({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:i,targetY:s,targetPosition:r=Ye.Top,curvature:a=.25}){const[l,c]=Fj({pos:n,x1:e,y1:t,x2:i,y2:s,c:a}),[u,d]=Fj({pos:r,x1:i,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=U8({sourceX:e,sourceY:t,targetX:i,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${i},${s}`,f,h,p,m]}function $8({sourceX:e,sourceY:t,targetX:n,targetY:i}){const s=Math.abs(n-e)/2,r=n0}const lre=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,cre=(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)),ure=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",Ta.error006()),t;const i=n.getEdgeId||lre;let s;return I8(e)?s={...e}:s={...e,id:i(e)},cre(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function H8({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[s,r,a,l]=$8({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,s,r,a,l]}const $j={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},dre=({source:e,sourcePosition:t=Ye.Bottom,target:n})=>t===Ye.Left||t===Ye.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fre({source:e,sourcePosition:t=Ye.Bottom,target:n,targetPosition:i=Ye.Top,center:s,offset:r,stepPosition:a}){const l=$j[t],c=$j[i],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=dre({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],g,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=$8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(g=s.x??u.x+(d.x-u.x)*a,v=s.y??(u.y+d.y)/2):(g=s.x??(u.x+d.x)/2,v=s.y??u.y+(d.y-u.y)*a);const k=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?k:C:m=h==="x"?C:k}else{const k=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?C:k:m=l.y===p?k:C,t===i){const D=Math.abs(e[h]-n[h]);if(D<=r){const F=Math.min(r-1,r-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==i){const D=h==="x"?"y":"x",F=l[h]===c[D],A=u[D]>d[D],j=u[D]=G?(g=(I.x+O.x)/2,v=m[0].y):(g=m[0].x,v=(I.y+O.y)/2)}const N={x:u.x+y.x,y:u.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...N.x!==m[0].x||N.y!==m[0].y?[N]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],g,v,E,w]}function hre(e,t,n,i){const s=Math.min(Hj(e,t)/2,Hj(t,n)/2,i),{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 vS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function mre(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:s}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||i,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=vS(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 z8=1e3,gre=10,qk={nodeOrigin:[0,0],nodeExtent:Tm,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},bre={...qk,checkEquality:!0};function Yk(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function yre(e,t,n){const i=Yk(qk,n);for(const s of e.values())if(s.parentId)Xk(s,e,t,i);else{const r=hg(s,i.nodeOrigin),a=cu(s.extent)?s.extent:i.nodeExtent,l=lu(r,a,Jo(s));s.internals.positionAbsolute=l}}function xre(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const s of e.handles){const r={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(r):s.type==="target"&&i.push(r)}return{source:n,target:i}}function Wk(e){return e==="manual"}function wS(e,t,n,i={}){var d,f;const s=Yk(bre,i),r={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Wk(s.zIndexMode)?z8:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=hg(h,s.nodeOrigin),g=cu(h.extent)?h.extent:s.nodeExtent,v=lu(m,g,Jo(h));p={...s.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:xre(h,p),z:V8(h,l,s.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&&Xk(p,t,n,i,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Ere(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 Xk(e,t,n,i,s){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Yk(qk,i),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}Ere(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*gre),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=r&&!Wk(c)?z8:0,{x:h,y:p,z:m}=vre(e,d,a,l,f,c),{positionAbsolute:g}=e.internals,v=h!==g.x||p!==g.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:g,z:m}})}function V8(e,t,n){const i=Ea(e.zIndex)?e.zIndex:0;return Wk(n)?i:i+(e.selected?t:0)}function vre(e,t,n,i,s,r){const{x:a,y:l}=t.internals.positionAbsolute,c=Jo(e),u=hg(e,n),d=cu(e.extent)?lu(u,e.extent,c):u;let f=lu({x:a+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=j8(f,c,t));const h=V8(e,s,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Qk(e,t,n,i=[0,0]){var a;const s=[],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)??wf(c),d=O8(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=Jo(c),h=c.origin??i,p=l.x0||m>0||y||x)&&(s.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(N=>N.id===w.id)||s.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=Qk(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function _re({delta:e,panZoom:t,transform:n,translateExtent:i,width:s,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],[s,r]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function Kj(e,t,n,i,s,r){let a=s;const l=i.get(a)||new Map;i.set(a,l.set(n,t)),a=`${s}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),r){a=`${s}-${e}-${r}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function G8(e,t,n){e.clear(),t.clear();for(const i of n){const{source:s,target:r,sourceHandle:a=null,targetHandle:l=null}=i,c={edgeId:i.id,source:s,target:r,sourceHandle:a,targetHandle:l},u=`${s}-${a}--${r}-${l}`,d=`${r}-${l}--${s}-${a}`;Kj("source",c,d,e,s,a),Kj("target",c,u,e,r,l),t.set(i.id,i)}}function K8(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:K8(n,t):!1}function qj(e,t,n){var s;let i=e;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function Sre(e,t,n,i){const s=new Map;for(const[r,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!K8(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&s.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 s}function Av({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,l,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:i})}if(!e)return[s[0],s];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:i}:s[0],s]}function Nre({dragItems:e,snapGrid:t,x:n,y:i}){const s=e.values().next().value;if(!s)return null;const r={x:n-s.distance.x,y:i-s.distance.y},a=mg(r,t);return{x:a.x-r.x,y:a.y-r.y}}function Tre({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:s}){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,g=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:N,nodeId:_,nodeClickDistance:T=0}){h=Er(w);function k({x:L,y:G}){const{nodeLookup:D,nodeExtent:F,snapGrid:A,snapToGrid:j,nodeOrigin:P,onNodeDrag:$,onSelectionDrag:R,onError:Y,updateNodePositions:Z}=t();r={x:L,y:G};let B=!1;const te=l.size>1,K=te&&F?ES(pg(l)):null,z=te&&j?Nre({dragItems:l,snapGrid:A,x:L,y:G}):null;for(const[W,q]of l){if(!D.has(W))continue;let ce={x:L-q.distance.x,y:G-q.distance.y};j&&(ce=z?{x:Math.round(ce.x+z.x),y:Math.round(ce.y+z.y)}:mg(ce,A));let me=null;if(te&&F&&!q.extent&&K){const{positionAbsolute:ge}=q.internals,Oe=ge.x-K.x+F[0][0],Ee=ge.x+q.measured.width-K.x2+F[1][0],ae=ge.y-K.y+F[0][1],Ne=ge.y+q.measured.height-K.y2+F[1][1];me=[[Oe,ae],[Ee,Ne]]}const{position:_e,positionAbsolute:de}=R8({nodeId:W,nextPosition:ce,nodeLookup:D,nodeExtent:me||F,nodeOrigin:P,onError:Y});B=B||q.position.x!==_e.x||q.position.y!==_e.y,q.position=_e,q.internals.positionAbsolute=de}if(m=m||B,!!B&&(Z(l,!0),g&&(i||$||!_&&R))){const[W,q]=Av({nodeId:_,dragItems:l,nodeLookup:D});i==null||i(g,l,W,q),$==null||$(g,W,q),_||R==null||R(g,q)}}async function C(){if(!d)return;const{transform:L,panBy:G,autoPanSpeed:D,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[A,j]=zk(u,d,D);(A!==0||j!==0)&&(r.x=(r.x??0)-A/L[2],r.y=(r.y??0)-j/L[2],await G({x:A,y:j})&&k(r)),a=requestAnimationFrame(C)}function I(L){var te;const{nodeLookup:G,multiSelectionActive:D,nodesDraggable:F,transform:A,snapGrid:j,snapToGrid:P,selectNodesOnDrag:$,onNodeDragStart:R,onSelectionDragStart:Y,unselectNodesAndEdges:Z}=t();f=!0,(!$||!N)&&!D&&_&&((te=G.get(_))!=null&&te.selected||Z()),N&&$&&_&&(e==null||e(_));const B=Up(L.sourceEvent,{transform:A,snapGrid:j,snapToGrid:P,containerBounds:d});if(r=B,l=Sre(G,F,B,_),l.size>0&&(n||R||!_&&Y)){const[K,z]=Av({nodeId:_,dragItems:l,nodeLookup:G});n==null||n(L.sourceEvent,l,K,z),R==null||R(L.sourceEvent,K,z),_||Y==null||Y(L.sourceEvent,z)}}const O=u8().clickDistance(T).on("start",L=>{const{domNode:G,nodeDragThreshold:D,transform:F,snapGrid:A,snapToGrid:j}=t();d=(G==null?void 0:G.getBoundingClientRect())||null,p=!1,m=!1,g=L.sourceEvent,D===0&&I(L),r=Up(L.sourceEvent,{transform:F,snapGrid:A,snapToGrid:j,containerBounds:d}),u=va(L.sourceEvent,d)}).on("drag",L=>{const{autoPanOnNodeDrag:G,transform:D,snapGrid:F,snapToGrid:A,nodeDragThreshold:j,nodeLookup:P}=t(),$=Up(L.sourceEvent,{transform:D,snapGrid:F,snapToGrid:A,containerBounds:d});if(g=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||_&&!P.has(_))&&(p=!0),!p){if(!c&&G&&f&&(c=!0,C()),!f){const R=va(L.sourceEvent,d),Y=R.x-u.x,Z=R.y-u.y;Math.sqrt(Y*Y+Z*Z)>j&&I(L)}(r.x!==$.xSnapped||r.y!==$.ySnapped)&&l&&f&&(u=va(L.sourceEvent,d),k($))}}).on("end",L=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:G,updateNodePositions:D,onNodeDragStop:F,onSelectionDragStop:A}=t();if(m&&(D(l,!1),m=!1),s||F||!_&&A){const[j,P]=Av({nodeId:_,dragItems:l,nodeLookup:G,dragging:!1});s==null||s(L.sourceEvent,l,j,P),F==null||F(L.sourceEvent,j,P),_||A==null||A(L.sourceEvent,P)}}}).filter(L=>{const G=L.target;return!L.button&&(!x||!qj(G,`.${x}`,w))&&(!E||qj(G,E,w))});h.call(O)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function kre(e,t,n){const i=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Am(s,wf(r))>0&&i.push(r);return i}const Are=250;function Cre(e,t,n,i){var l,c;let s=[],r=1/0;const a=kre(e,n,t+Are);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(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:p}=uu(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=i.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function q8(e,t,n,i,s,r=!1){var u,d,f;const a=i.get(e);if(!a)return null;const l=s==="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,...uu(a,c,c.position,!0)}:c}function Y8(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ire(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const W8=()=>!0;function Rre(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:s,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:g,onConnectEnd:v,isValidConnection:y=W8,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:N,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){const C=D8(e.target);let I=0,O;const{x:L,y:G}=va(e),D=Y8(r,k),F=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!F||!D)return;const j=q8(s,D,i,c,t);if(!j)return;let P=va(e,F),$=!1,R=null,Y=!1,Z=null;function B(){if(!d||!F)return;const[_e,de]=zk(P,F,_);h({x:_e,y:de}),I=requestAnimationFrame(B)}const te={...j,nodeId:s,type:D,position:j.position},K=c.get(s);let W={inProgress:!0,isValid:null,from:uu(K,te,Ye.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:K,to:P,toHandle:null,toPosition:Lj[te.position],toNode:null,pointer:P};function q(){A=!0,E(W),m==null||m(e,{nodeId:s,handleId:i,handleType:D})}T===0&&q();function ce(_e){if(!A){const{x:Ne,y:ve}=va(_e),Qe=Ne-L,Me=ve-G;if(!(Qe*Qe+Me*Me>T*T))return;q()}if(!N()||!te){me(_e);return}const de=w();P=va(_e,F),O=Cre(Zf(P,de,!1,[1,1]),n,c,te),$||(B(),$=!0);const ge=X8(_e,{handle:O,connectionMode:t,fromNodeId:s,fromHandleId:i,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});Z=ge.handleDomNode,R=ge.connection,Y=Ire(!!O,ge.isValid);const Oe=c.get(s),Ee=Oe?uu(Oe,te,Ye.Left,!0):W.from,ae={...W,from:Ee,isValid:Y,to:ge.toHandle&&Y?_f({x:ge.toHandle.x,y:ge.toHandle.y},de):P,toHandle:ge.toHandle,toPosition:Y&&ge.toHandle?ge.toHandle.position:Lj[te.position],toNode:ge.toHandle?c.get(ge.toHandle.nodeId):null,pointer:P};E(ae),W=ae}function me(_e){if(!("touches"in _e&&_e.touches.length>0)){if(A){(O||Z)&&R&&Y&&(g==null||g(R));const{inProgress:de,...ge}=W,Oe={...ge,toPosition:W.toHandle?W.toPosition:null};v==null||v(_e,Oe),r&&(x==null||x(_e,Oe))}p(),cancelAnimationFrame(I),$=!1,Y=!1,R=null,Z=null,C.removeEventListener("mousemove",ce),C.removeEventListener("mouseup",me),C.removeEventListener("touchmove",ce),C.removeEventListener("touchend",me)}}C.addEventListener("mousemove",ce),C.addEventListener("mouseup",me),C.addEventListener("touchmove",ce),C.addEventListener("touchend",me)}function X8(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:s,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=W8,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}=va(e),g=a.elementFromPoint(p,m),v=g!=null&&g.classList.contains(`${l}-flow__handle`)?g:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=Y8(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),N=v.classList.contains("connectable"),_=v.classList.contains("connectableend");if(!E||!x)return y;const T={source:f?E:i,sourceHandle:f?w:s,target:f?i:E,targetHandle:f?s:w};y.connection=T;const C=N&&_&&(n===xf.Strict?f&&x==="source"||!f&&x==="target":E!==i||w!==s);y.isValid=C&&u(T),y.toHandle=q8(E,x,w,d,n,!0)}return y}const _S={onPointerDown:Rre,isValid:X8};function jre({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const s=Er(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(),N=E.sourceEvent.ctrlKey&&Cm()?10:1,_=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,T=w[2]*Math.pow(2,_*N);t.scaleTo(T)};let g=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(g=[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 N=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],_=[N[0]-g[0],N[1]-g[1]];g=N;const T=i()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},C=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},C,l)},x=N8().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);s.call(x,{})}function a(){s.on("zoom",null)}return{update:r,destroy:a,pointer:pa}}const dx=e=>({x:e.x,y:e.y,zoom:e.k}),Cv=({x:e,y:t,zoom:n})=>lx.translate(e,t).scale(n),Cd=(e,t)=>e.target.closest(`.${t}`),Q8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ore=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Iv=(e,t=0,n=Ore,i=()=>{})=>{const s=typeof t=="number"&&t>0;return s||i(),s?e.transition().duration(t).ease(n).on("end",i):e},Z8=e=>{const t=e.ctrlKey&&Cm()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Mre({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Cd(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=pa(d),y=Z8(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=s===Wc.Vertical?0:d.deltaX*h,m=s===Wc.Horizontal?0:d.deltaY*h;!Cm()&&d.shiftKey&&s!==Wc.Vertical&&(p=d.deltaY*h,m=0),i.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const g=dx(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,g))}}function Lre({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,s){const r=i.type==="wheel",a=!t&&r&&!i.ctrlKey,l=Cd(i,e);if(i.ctrlKey&&r&&l&&i.preventDefault(),a||l)return null;i.preventDefault(),n.call(this,i,s)}}function Dre({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var r,a,l;if((r=i.sourceEvent)!=null&&r.internal)return;const s=dx(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,s))}}function Pre({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:s}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&Q8(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||i([r.transform.x,r.transform.y,r.transform.k]),s&&!((l=r.sourceEvent)!=null&&l.internal)&&(s==null||s(r.sourceEvent,dx(r.transform)))}}function Bre({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&Q8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),s)){const c=dx(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Ure({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:s,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"&&(Cd(f,`${u}-flow__node`)||Cd(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!s&&!r&&!n||a||d&&!m||Cd(f,l)&&m||Cd(f,c)&&(!m||s&&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&&!s&&!p&&m||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&g}}function Fre({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:s,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=N8().scaleExtent([t,n]).translateExtent(i),h=Er(e).call(f);x({x:s.x,y:s.y,zoom:vf(s.zoom,t,n)},[[0,0],[d.width,d.height]],i);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(Z8);async function g(O,L){return h?new Promise(G=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Bp:Ob).transform(Iv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>G(!0)),O)}):!1}function v({noWheelClassName:O,noPanClassName:L,onPaneContextMenu:G,userSelectionActive:D,panOnScroll:F,panOnDrag:A,panOnScrollMode:j,panOnScrollSpeed:P,preventScrolling:$,zoomOnPinch:R,zoomOnScroll:Y,zoomOnDoubleClick:Z,zoomActivationKeyPressed:B,lib:te,onTransformChange:K,connectionInProgress:z,paneClickDistance:W,selectionOnDrag:q}){D&&!u.isZoomingOrPanning&&y();const ce=F&&!B&&!D;f.clickDistance(q?1/0:!Ea(W)||W<0?0:W);const me=ce?Mre({zoomPanValues:u,noWheelClassName:O,d3Selection:h,d3Zoom:f,panOnScrollMode:j,panOnScrollSpeed:P,zoomOnPinch:R,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):Lre({noWheelClassName:O,preventScrolling:$,d3ZoomHandler:p});h.on("wheel.zoom",me,{passive:!1});const _e=Dre({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",_e);const de=Pre({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!G,onPanZoom:r,onTransformChange:K});f.on("zoom",de);const ge=Bre({zoomPanValues:u,panOnDrag:A,panOnScroll:F,onPaneContextMenu:G,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ge);const Oe=Ure({zoomActivationKeyPressed:B,panOnDrag:A,zoomOnScroll:Y,panOnScroll:F,zoomOnDoubleClick:Z,zoomOnPinch:R,userSelectionActive:D,noPanClassName:L,noWheelClassName:O,lib:te,connectionInProgress:z});f.filter(Oe),Z?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(O,L,G){const D=Cv(O),F=f==null?void 0:f.constrain()(D,L,G);return F&&await g(F),F}async function E(O,L){const G=Cv(O);return await g(G,L),G}function w(O){if(h){const L=Cv(O),G=h.property("__zoom");(G.k!==O.zoom||G.x!==O.x||G.y!==O.y)&&(f==null||f.transform(h,L,null,{sync:!0}))}}function N(){const O=h?S8(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function _(O,L){return h?new Promise(G=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Bp:Ob).scaleTo(Iv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>G(!0)),O)}):!1}async function T(O,L){return h?new Promise(G=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Bp:Ob).scaleBy(Iv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>G(!0)),O)}):!1}function k(O){f==null||f.scaleExtent(O)}function C(O){f==null||f.translateExtent(O)}function I(O){const L=!Ea(O)||O<0?0:O;f==null||f.clickDistance(L)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:C,syncViewport:w,setClickDistance:I}}var Sf;(function(e){e.Line="line",e.Handle="handle"})(Sf||(Sf={}));function $re({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:s,affectsY:r}){const a=e-t,l=n-i,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function Yj(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:s}}function pl(e,t){return Math.max(0,t-e)}function ml(e,t){return Math.max(0,e-t)}function M0(e,t,n){return Math.max(0,t-e,e-n)}function Wj(e,t){return e?!t:t}function Hre(e,t,n,i,s,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:g,maxWidth:v,minHeight:y,maxHeight:x}=i,{x:E,y:w,width:N,height:_,aspectRatio:T}=e;let k=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const I=N+(c?-k:k),O=_+(u?-C:C),L=-r[0]*N,G=-r[1]*_;let D=M0(I,g,v),F=M0(O,y,x);if(a){let P=0,$=0;c&&k<0?P=pl(E+k+L,a[0][0]):!c&&k>0&&(P=ml(E+I+L,a[1][0])),u&&C<0?$=pl(w+C+G,a[0][1]):!u&&C>0&&($=ml(w+O+G,a[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(l){let P=0,$=0;c&&k>0?P=ml(E+k,l[0][0]):!c&&k<0&&(P=pl(E+I,l[1][0])),u&&C>0?$=ml(w+C,l[0][1]):!u&&C<0&&($=pl(w+O,l[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(s){if(d){const P=M0(I/T,y,x)*T;if(D=Math.max(D,P),a){let $=0;!c&&!u||c&&!u&&h?$=ml(w+G+I/T,a[1][1])*T:$=pl(w+G+(c?k:-k)/T,a[0][1])*T,D=Math.max(D,$)}if(l){let $=0;!c&&!u||c&&!u&&h?$=pl(w+I/T,l[1][1])*T:$=ml(w+(c?k:-k)/T,l[0][1])*T,D=Math.max(D,$)}}if(f){const P=M0(O*T,g,v)/T;if(F=Math.max(F,P),a){let $=0;!c&&!u||u&&!c&&h?$=ml(E+O*T+L,a[1][0])/T:$=pl(E+(u?C:-C)*T+L,a[0][0])/T,F=Math.max(F,$)}if(l){let $=0;!c&&!u||u&&!c&&h?$=pl(E+O*T,l[1][0])/T:$=ml(E+(u?C:-C)*T,l[0][0])/T,F=Math.max(F,$)}}}C=C+(C<0?F:-F),k=k+(k<0?D:-D),s&&(h?I>O*T?C=(Wj(c,u)?-k:k)/T:k=(Wj(c,u)?-C:C)*T:d?(C=k/T,u=c):(k=C*T,c=u));const A=c?E+k:E,j=u?w+C:w;return{width:N+(c?-k:k),height:_+(u?-C:C),x:r[0]*k*(c?-1:1)+A,y:r[1]*C*(u?-1:1)+j}}const J8={width:0,height:0,x:0,y:0},zre={...J8,pointerX:0,pointerY:0,aspectRatio:1};function Vre(e,t,n){const i=t.position.x+e.position.x,s=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[[i-l,s-c],[i+r-l,s+a-c]]}function Gre({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:s}){const r=Er(e);let a={controlDirection:Yj("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:g,shouldResize:v}){let y={...J8},x={...zre};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Yj(u)};let E,w=null,N=[],_,T,k,C=!1;const I=u8().on("start",O=>{const{nodeLookup:L,transform:G,snapGrid:D,snapToGrid:F,nodeOrigin:A,paneDomNode:j}=n();if(E=L.get(t),!E)return;w=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:$}=Up(O.sourceEvent,{transform:G,snapGrid:D,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:P,pointerY:$,aspectRatio:y.width/y.height},_=void 0,T=cu(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(_=L.get(E.parentId)),_&&E.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),N=[],k=void 0;for(const[R,Y]of L)if(Y.parentId===t&&(N.push({id:R,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const Z=Vre(Y,E,Y.origin??A);k?k=[[Math.min(Z[0][0],k[0][0]),Math.min(Z[0][1],k[0][1])],[Math.max(Z[1][0],k[1][0]),Math.max(Z[1][1],k[1][1])]]:k=Z}p==null||p(O,{...y})}).on("drag",O=>{const{transform:L,snapGrid:G,snapToGrid:D,nodeOrigin:F}=n(),A=Up(O.sourceEvent,{transform:L,snapGrid:G,snapToGrid:D,containerBounds:w}),j=[];if(!E)return;const{x:P,y:$,width:R,height:Y}=y,Z={},B=E.origin??F,{width:te,height:K,x:z,y:W}=Hre(x,a.controlDirection,A,a.boundaries,a.keepAspectRatio,B,T,k),q=te!==R,ce=K!==Y,me=z!==P&&q,_e=W!==$&&ce;if(!me&&!_e&&!q&&!ce)return;if((me||_e||B[0]===1||B[1]===1)&&(Z.x=me?z:y.x,Z.y=_e?W:y.y,y.x=Z.x,y.y=Z.y,N.length>0)){const Ee=z-P,ae=W-$;for(const Ne of N)Ne.position={x:Ne.position.x-Ee+B[0]*(te-R),y:Ne.position.y-ae+B[1]*(K-Y)},j.push(Ne)}if((q||ce)&&(Z.width=q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:y.width,Z.height=ce&&(!a.resizeDirection||a.resizeDirection==="vertical")?K:y.height,y.width=Z.width,y.height=Z.height),_&&E.expandParent){const Ee=B[0]*(Z.width??0);Z.x&&Z.x{C&&(g==null||g(O,{...y}),s==null||s({...y}),C=!1)});r.call(I)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var e9={exports:{}},t9={},n9={exports:{}},i9={};/** * @license React * use-sync-external-store-shim.production.js * @@ -513,7 +513,7 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${g?" 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 _f=b;function jre(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ore=typeof Object.is=="function"?Object.is:jre,Mre=_f.useState,Lre=_f.useEffect,Dre=_f.useLayoutEffect,Pre=_f.useDebugValue;function Bre(e,t){var n=t(),i=Mre({inst:{value:n,getSnapshot:t}}),s=i[0].inst,r=i[1];return Dre(function(){s.value=n,s.getSnapshot=t,Sv(s)&&r({inst:s})},[e,n,t]),Lre(function(){return Sv(s)&&r({inst:s}),e(function(){Sv(s)&&r({inst:s})})},[e]),Pre(n),n}function Sv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ore(e,n)}catch{return!0}}function Ure(e,t){return t()}var Fre=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Ure:Bre;q8.useSyncExternalStore=_f.useSyncExternalStore!==void 0?_f.useSyncExternalStore:Fre;K8.exports=q8;var $re=K8.exports;/** + */var Nf=b;function Kre(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qre=typeof Object.is=="function"?Object.is:Kre,Yre=Nf.useState,Wre=Nf.useEffect,Xre=Nf.useLayoutEffect,Qre=Nf.useDebugValue;function Zre(e,t){var n=t(),i=Yre({inst:{value:n,getSnapshot:t}}),s=i[0].inst,r=i[1];return Xre(function(){s.value=n,s.getSnapshot=t,Rv(s)&&r({inst:s})},[e,n,t]),Wre(function(){return Rv(s)&&r({inst:s}),e(function(){Rv(s)&&r({inst:s})})},[e]),Qre(n),n}function Rv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qre(e,n)}catch{return!0}}function Jre(e,t){return t()}var eae=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Jre:Zre;i9.useSyncExternalStore=Nf.useSyncExternalStore!==void 0?Nf.useSyncExternalStore:eae;n9.exports=i9;var tae=n9.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -521,76 +521,76 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${g?" 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 rx=b,Hre=$re;function zre(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vre=typeof Object.is=="function"?Object.is:zre,Gre=Hre.useSyncExternalStore,Kre=rx.useRef,qre=rx.useEffect,Yre=rx.useMemo,Wre=rx.useDebugValue;G8.useSyncExternalStoreWithSelector=function(e,t,n,i,s){var r=Kre(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=Yre(function(){function c(p){if(!u){if(u=!0,d=p,p=i(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,Vre(d,p))return m;var g=i(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}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,i,s]);var l=Gre(e,r[0],r[1]);return qre(function(){a.hasValue=!0,a.value=l},[l]),Wre(l),l};V8.exports=G8;var Xre=V8.exports;const Qre=Of(Xre),Zre={},Hj=e=>{let t;const n=new Set,i=(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))}},s=()=>t,c={setState:i,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Zre?"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(i,s,c);return c},Jre=e=>e?Hj(e):Hj,{useDebugValue:eae}=Mt,{useSyncExternalStoreWithSelector:tae}=Qre,nae=e=>e;function Y8(e,t=nae,n){const i=tae(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return eae(i),i}const zj=(e,t)=>{const n=Jre(e),i=(s,r=t)=>Y8(n,s,r);return Object.assign(i,n),i},iae=(e,t)=>e?zj(e,t):zj;function ri(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[i,s]of e)if(!Object.is(s,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const ax=b.createContext(null),sae=ax.Provider,W8=Na.error001("react");function Yt(e,t){const n=b.useContext(ax);if(n===null)throw new Error(W8);return Y8(n,e,t)}function ai(){const e=b.useContext(ax);if(e===null)throw new Error(W8);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Vj={display:"none"},rae={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},X8="react-flow__node-desc",Q8="react-flow__edge-desc",aae="react-flow__aria-live",oae=e=>e.ariaLiveMessage,lae=e=>e.ariaLabelConfig;function cae({rfId:e}){const t=Yt(oae);return o.jsx("div",{id:`${aae}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rae,children:t})}function uae({rfId:e,disableKeyboardA11y:t}){const n=Yt(lae);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${X8}-${e}`,style:Vj,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${Q8}-${e}`,style:Vj,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(cae,{rfId:e})]})}const ox=b.forwardRef(({position:e="top-left",children:t,className:n,style:i,...s},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Wi(["react-flow__panel",n,...a]),style:i,ref:r,...s,children:t})});ox.displayName="Panel";function dae({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(ox,{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 fae=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},I0=e=>e.id;function hae(e,t){return ri(e.selectedNodes.map(I0),t.selectedNodes.map(I0))&&ri(e.selectedEdges.map(I0),t.selectedEdges.map(I0))}function pae({onSelectionChange:e}){const t=ai(),{selectedNodes:n,selectedEdges:i}=Yt(fae,hae);return b.useEffect(()=>{const s={nodes:n,edges:i};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(r=>r(s))},[n,i,e]),null}const mae=e=>!!e.onSelectionChangeHandlers;function gae({onSelectionChange:e}){const t=Yt(mae);return e||t?o.jsx(pae,{onSelectionChange:e}):null}const Z8=[0,0],bae={x:0,y:0,zoom:1},yae=["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"],Gj=[...yae,"rfId"],xae=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}),Kj={translateExtent:wm,nodeOrigin:Z8,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Eae(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:s,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Yt(xae,ri),u=ai();b.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Kj,l()}),[]);const d=b.useRef(Kj);return b.useEffect(()=>{for(const f of Gj){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?s(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Vse(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Gj.map(f=>e[f])),null}function qj(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function vae(e){var i;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const s=qj(),r=()=>n(s!=null&&s.matches?"dark":"light");return r(),s==null||s.addEventListener("change",r),()=>{s==null||s.removeEventListener("change",r)}},[e]),t!==null?t:(i=qj())!=null&&i.matches?"dark":"light"}const Yj=typeof document<"u"?document:null;function Tm(e=null,t={target:Yj,actInsideInputWithModifier:!0}){const[n,i]=b.useState(!1),s=b.useRef(!1),r=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var fx=b,nae=tae;function iae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sae=typeof Object.is=="function"?Object.is:iae,rae=nae.useSyncExternalStore,aae=fx.useRef,oae=fx.useEffect,lae=fx.useMemo,cae=fx.useDebugValue;t9.useSyncExternalStoreWithSelector=function(e,t,n,i,s){var r=aae(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=lae(function(){function c(p){if(!u){if(u=!0,d=p,p=i(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,sae(d,p))return m;var g=i(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}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,i,s]);var l=rae(e,r[0],r[1]);return oae(function(){a.hasValue=!0,a.value=l},[l]),cae(l),l};e9.exports=t9;var uae=e9.exports;const dae=Df(uae),fae={},Xj=e=>{let t;const n=new Set,i=(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))}},s=()=>t,c={setState:i,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(fae?"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(i,s,c);return c},hae=e=>e?Xj(e):Xj,{useDebugValue:pae}=jt,{useSyncExternalStoreWithSelector:mae}=dae,gae=e=>e;function s9(e,t=gae,n){const i=mae(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pae(i),i}const Qj=(e,t)=>{const n=hae(e),i=(s,r=t)=>s9(n,s,r);return Object.assign(i,n),i},bae=(e,t)=>e?Qj(e,t):Qj;function ui(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[i,s]of e)if(!Object.is(s,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const hx=b.createContext(null),yae=hx.Provider,r9=Ta.error001("react");function Kt(e,t){const n=b.useContext(hx);if(n===null)throw new Error(r9);return s9(n,e,t)}function di(){const e=b.useContext(hx);if(e===null)throw new Error(r9);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Zj={display:"none"},xae={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},a9="react-flow__node-desc",o9="react-flow__edge-desc",Eae="react-flow__aria-live",vae=e=>e.ariaLiveMessage,wae=e=>e.ariaLabelConfig;function _ae({rfId:e}){const t=Kt(vae);return o.jsx("div",{id:`${Eae}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xae,children:t})}function Sae({rfId:e,disableKeyboardA11y:t}){const n=Kt(wae);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${a9}-${e}`,style:Zj,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${o9}-${e}`,style:Zj,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(_ae,{rfId:e})]})}const px=b.forwardRef(({position:e="top-left",children:t,className:n,style:i,...s},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Qi(["react-flow__panel",n,...a]),style:i,ref:r,...s,children:t})});px.displayName="Panel";function Nae({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(px,{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 Tae=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},L0=e=>e.id;function kae(e,t){return ui(e.selectedNodes.map(L0),t.selectedNodes.map(L0))&&ui(e.selectedEdges.map(L0),t.selectedEdges.map(L0))}function Aae({onSelectionChange:e}){const t=di(),{selectedNodes:n,selectedEdges:i}=Kt(Tae,kae);return b.useEffect(()=>{const s={nodes:n,edges:i};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(r=>r(s))},[n,i,e]),null}const Cae=e=>!!e.onSelectionChangeHandlers;function Iae({onSelectionChange:e}){const t=Kt(Cae);return e||t?o.jsx(Aae,{onSelectionChange:e}):null}const l9=[0,0],Rae={x:0,y:0,zoom:1},jae=["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"],Jj=[...jae,"rfId"],Oae=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}),eO={translateExtent:Tm,nodeOrigin:l9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Mae(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:s,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Kt(Oae,ui),u=di();b.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=eO,l()}),[]);const d=b.useRef(eO);return b.useEffect(()=>{for(const f of Jj){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?s(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:sre(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Jj.map(f=>e[f])),null}function tO(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Lae(e){var i;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const s=tO(),r=()=>n(s!=null&&s.matches?"dark":"light");return r(),s==null||s.addEventListener("change",r),()=>{s==null||s.removeEventListener("change",r)}},[e]),t!==null?t:(i=tO())!=null&&i.matches?"dark":"light"}const nO=typeof document<"u"?document:null;function Im(e=null,t={target:nO,actInsideInputWithModifier:!0}){const[n,i]=b.useState(!1),s=b.useRef(!1),r=b.useRef(new Set([])),[a,l]=b.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 b.useEffect(()=>{const c=(t==null?void 0:t.target)??Yj,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&k8(p))return!1;const g=Xj(p.code,l);if(r.current.add(p[g]),Wj(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&&(s.current||!E)&&p.preventDefault(),i(!0)}},f=p=>{const m=Xj(p.code,l);Wj(a,r.current,!0)?(i(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),s.current=!1},h=()=>{r.current.clear(),i(!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,i]),n}function Wj(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(s=>t.has(s)))}function Xj(e,t){return t.includes(e)?"code":"key"}const wae=()=>{const e=ai();return b.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:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,s,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??s,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:s,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=Dk(t,i,s,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:i,snapGrid:s,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??s,f=n.snapToGrid??r;return Wf(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:s,y:r}=i.getBoundingClientRect(),a=vf(t,n);return{x:a.x+s,y:a.y+r}}}),[])};function J8(e,t){const n=[],i=new Map,s=[];for(const r of e)if(r.type==="add"){s.push(r);continue}else if(r.type==="remove"||r.type==="replace")i.set(r.id,[r]);else{const a=i.get(r.id);a?a.push(r):i.set(r.id,[r])}for(const r of t){const a=i.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)_ae(c,l);n.push(l)}return s.length&&s.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function _ae(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 e9(e,t){return J8(e,t)}function t9(e,t){return J8(e,t)}function Cc(e,t){return{id:e,type:"select",selected:t}}function Ad(e,t=new Set,n=!1){const i=[];for(const[s,r]of e){const a=t.has(s);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),i.push(Cc(r.id,a)))}return i}function Qj({items:e=[],lookup:t}){var s;const n=[],i=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.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)i.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function Zj(e){return{id:e.id,type:"remove"}}const Sae=S8();function n9(e,t,n={}){return Xse(e,t,{...n,onError:n.onError??Sae})}const Jj=e=>Lse(e),Nae=e=>E8(e);function i9(e){return b.forwardRef(e)}const Tae=typeof window<"u"?b.useLayoutEffect:b.useEffect;function eO(e){const[t,n]=b.useState(BigInt(0)),[i]=b.useState(()=>kae(()=>n(s=>s+BigInt(1))));return Tae(()=>{const s=i.get();s.length&&(e(s),i.reset())},[t]),i}function kae(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const s9=b.createContext(null);function Aae({children:e}){const t=ai(),n=b.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let g=c;for(const y of l)g=typeof y=="function"?y(g):y;let v=Qj({items:g,lookup:h});for(const y of m.values())v=y(v);d&&u(g),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),i=eO(n),s=b.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(Qj({items:p,lookup:h}))},[]),r=eO(s),a=b.useMemo(()=>({nodeQueue:i,edgeQueue:r}),[]);return o.jsx(s9.Provider,{value:a,children:e})}function Cae(){const e=b.useContext(s9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Iae=e=>!!e.panZoom;function lx(){const e=wae(),t=ai(),n=Cae(),i=Yt(Iae),s=b.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=Jj(f)?f:h.get(f.id),g=m.parentId?N8(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:g,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return Ef(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(g=>{if(g.id===f){const v=typeof h=="function"?h(g):h;return p.replace&&Jj(v)?v:{...g,...v}}return g}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(g=>{if(g.id===f){const v=typeof h=="function"?h(g):h;return p.replace&&Nae(v)?v:{...g,...v}}return g}))};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,g,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:g,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:g,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:N,edges:_}=await Fse({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),T=_.length>0,k=N.length>0;if(T){const C=_.map(Zj);v==null||v(_),x(C)}if(k){const C=N.map(Zj);g==null||g(N),y(C)}return(k||T)&&(E==null||E({nodes:N,edges:_})),{deletedNodes:N,deletedEdges:_}},getIntersectingNodes:(f,h=!0,p)=>{const m=Cj(f),g=m?f:c(f),v=p!==void 0;return g?(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=Ef(v?y:x),w=Sm(E,g);return h&&w>0||w>=E.width*E.height||w>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=Cj(f)?f:c(f);if(!g)return!1;const v=Sm(g,h);return p&&v>0||v>=h.width*h.height||v>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Dse(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??zse();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...s,...e,viewportInitialized:i}),[i])}const tO=e=>e.selected,Rae=typeof window<"u"?window:void 0;function jae({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ai(),{deleteElements:i}=lx(),s=Tm(e,{actInsideInputWithModifier:!1}),r=Tm(t,{target:Rae});b.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();i({nodes:l.filter(tO),edges:a.filter(tO)}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function Oae(e){const t=ai();b.useEffect(()=>{const n=()=>{var s,r,a,l;if(!e.current||!(((r=(s=e.current).checkVisibility)==null?void 0:r.call(s))??!0))return!1;const i=Bk(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Na.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const cx={position:"absolute",width:"100%",height:"100%",top:0,left:0},Mae=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Lae({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:r=Yc.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:g,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const N=ai(),_=b.useRef(null),{userSelectionActive:T,lib:k,connectionInProgress:C}=Yt(Mae,ri),I=Tm(h),O=b.useRef();Oae(_);const M=b.useCallback(G=>{y==null||y({x:G[0],y:G[1],zoom:G[2]}),x||N.setState({transform:G})},[y,x]);return b.useEffect(()=>{if(_.current){O.current=Tre({domNode:_.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>N.setState(j=>j.paneDragging===A?j:{paneDragging:A}),onPanZoomStart:(A,j)=>{const{onViewportChangeStart:P,onMoveStart:$}=N.getState();$==null||$(A,j),P==null||P(j)},onPanZoom:(A,j)=>{const{onViewportChange:P,onMove:$}=N.getState();$==null||$(A,j),P==null||P(j)},onPanZoomEnd:(A,j)=>{const{onViewportChangeEnd:P,onMoveEnd:$}=N.getState();$==null||$(A,j),P==null||P(j)}});const{x:G,y:D,zoom:F}=O.current.getViewport();return N.setState({panZoom:O.current,transform:[G,D,F],domNode:_.current.closest(".react-flow")}),()=>{var A;(A=O.current)==null||A.destroy()}}},[]),b.useEffect(()=>{var G;(G=O.current)==null||G.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:v,userSelectionActive:T,noWheelClassName:g,lib:k,onTransformChange:M,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,i,s,r,a,l,I,p,v,T,g,k,M,C,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:_,style:cx,children:m})}const Dae=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Pae(){const{userSelectionActive:e,userSelectionRect:t}=Yt(Dae,ri);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 Nv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Bae=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Uae({isSelecting:e,selectionKeyPressed:t,selectionMode:n=_m.Full,panOnDrag:i,autoPanOnSelection:s,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:g}){const v=b.useRef(0),y=ai(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:N,panBy:_,autoPanSpeed:T}=Yt(Bae,ri),k=E&&(e||x),C=b.useRef(null),I=b.useRef(),O=b.useRef(new Set),M=b.useRef(new Set),G=b.useRef(!1),D=b.useRef({x:0,y:0}),F=b.useRef(!1),A=K=>{if(G.current||N){G.current=!1;return}u==null||u(K),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},j=K=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){K.preventDefault();return}d==null||d(K)},P=f?K=>f(K):void 0,$=K=>{G.current&&(K.stopPropagation(),G.current=!1)},R=K=>{var Te,ve;const{domNode:ue,transform:pe}=y.getState();if(I.current=ue==null?void 0:ue.getBoundingClientRect(),!I.current)return;const _e=K.target===C.current;if(!_e&&!!K.target.closest(".nokey")||!e||!(a&&_e||t)||K.button!==0||!K.isPrimary)return;(ve=(Te=K.target)==null?void 0:Te.setPointerCapture)==null||ve.call(Te,K.pointerId),G.current=!1;const{x:Re,y:ge}=Ea(K.nativeEvent,I.current),oe=Wf({x:Re,y:ge},pe);y.setState({userSelectionRect:{width:0,height:0,startX:oe.x,startY:oe.y,x:Re,y:ge}}),_e||(K.stopPropagation(),K.preventDefault())};function Y(K,ue){const{userSelectionRect:pe}=y.getState();if(!pe)return;const{transform:_e,nodeLookup:fe,edgeLookup:me,connectionLookup:Re,triggerNodeChanges:ge,triggerEdgeChanges:oe,defaultEdgeOptions:Te}=y.getState(),ve={x:pe.startX,y:pe.startY},{x:Xe,y:De}=vf(ve,_e),ze={startX:ve.x,startY:ve.y,x:Kqe.id)),M.current=new Set;const Fe=(Te==null?void 0:Te.selectable)??!0;for(const qe of O.current){const Q=Re.get(qe);if(Q)for(const{edgeId:ae}of Q.values()){const ie=me.get(ae);ie&&(ie.selectable??Fe)&&M.current.add(ae)}}if(!Ij(Ne,O.current)){const qe=Ad(fe,O.current,!0);ge(qe)}if(!Ij(Pe,M.current)){const qe=Ad(me,M.current);oe(qe)}y.setState({userSelectionRect:ze,userSelectionActive:!0,nodesSelectionActive:!1})}function Z(){if(!s||!I.current)return;const[K,ue]=Lk(D.current,I.current,T);_({x:K,y:ue}).then(pe=>{if(!G.current||!pe){v.current=requestAnimationFrame(Z);return}const{x:_e,y:fe}=D.current;Y(_e,fe),v.current=requestAnimationFrame(Z)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};b.useEffect(()=>()=>B(),[]);const te=K=>{const{userSelectionRect:ue,transform:pe,resetSelectedElements:_e}=y.getState();if(!I.current||!ue)return;const{x:fe,y:me}=Ea(K.nativeEvent,I.current);D.current={x:fe,y:me};const Re=vf({x:ue.startX,y:ue.startY},pe);if(!G.current){const ge=t?0:r;if(Math.hypot(fe-Re.x,me-Re.y)<=ge)return;_e(),l==null||l(K)}G.current=!0,F.current||(Z(),F.current=!0),Y(fe,me)},z=K=>{var ue,pe;K.button===0&&((pe=(ue=K.target)==null?void 0:ue.releasePointerCapture)==null||pe.call(ue,K.pointerId),!x&&K.target===C.current&&y.getState().userSelectionRect&&(A==null||A(K)),y.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(c==null||c(K),y.setState({nodesSelectionActive:O.current.size>0})),B())},q=K=>{var ue,pe;(pe=(ue=K.target)==null?void 0:ue.releasePointerCapture)==null||pe.call(ue,K.pointerId),B()},W=i===!0||Array.isArray(i)&&i.includes(0);return o.jsxs("div",{className:Wi(["react-flow__pane",{draggable:W,dragging:w,selection:e}]),onClick:k?void 0:Nv(A,C),onContextMenu:Nv(j,C),onWheel:Nv(P,C),onPointerEnter:k?void 0:h,onPointerMove:k?te:p,onPointerUp:k?z:void 0,onPointerCancel:k?q:void 0,onPointerDownCapture:k?R:void 0,onClickCapture:k?$:void 0,onPointerLeave:m,ref:C,style:cx,children:[g,o.jsx(Pae,{})]})}function bS({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Na.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):s([e])}function r9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:s,isSelectable:r,nodeClickDistance:a}){const l=ai(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=fre({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{bS({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),b.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:r,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,r,e,s,a]),c}const Fae=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function a9(){const e=ai();return b.useCallback(n=>{const{nodeExtent:i,snapToGrid:s,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Fae(a),p=s?r[0]:5,m=s?r[1]:5,g=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+g,y:y.internals.positionAbsolute.y+v};s&&(x=ug(x,r));const{position:E,positionAbsolute:w}=v8({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const Vk=b.createContext(null),$ae=Vk.Provider;Vk.Consumer;const o9=()=>b.useContext(Vk),Hae=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zae=(e,t,n)=>i=>{const{connectionClickStartHandle:s,connectionMode:r,connection:a}=i,{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:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:r===bf.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:!!s,valid:d&&u}};function Vae({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,A;const m=a||null,g=e==="target",v=ai(),y=o9(),{connectOnClick:x,noPanClassName:E,rfId:w}=Yt(Hae,ri),{connectingFrom:N,connectingTo:_,clickConnecting:T,isPossibleEndHandle:k,connectionInProcess:C,clickConnectionInProcess:I,valid:O}=Yt(zae(y,m,e),ri);y||(A=(F=v.getState()).onError)==null||A.call(F,"010",Na.error010());const M=j=>{const{defaultEdgeOptions:P,onConnect:$,hasDefaultEdges:R}=v.getState(),Y={...P,...j};if(R){const{edges:Z,setEdges:B,onError:te}=v.getState();B(n9(Y,Z,{onError:te}))}$==null||$(Y),l==null||l(Y)},G=j=>{if(!y)return;const P=A8(j.nativeEvent);if(s&&(P&&j.button===0||!P)){const $=v.getState();gS.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:g,handleId:m,nodeId:y,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...R)=>{var Y,Z;return(Z=(Y=v.getState()).onConnectEnd)==null?void 0:Z.call(Y,...R)},updateConnection:$.updateConnection,onConnect:M,isValidConnection:n||((...R)=>{var Y,Z;return((Z=(Y=v.getState()).isValidConnection)==null?void 0:Z.call(Y,...R))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}P?d==null||d(j):f==null||f(j)},D=j=>{const{onClickConnectStart:P,onClickConnectEnd:$,connectionClickStartHandle:R,connectionMode:Y,isValidConnection:Z,lib:B,rfId:te,nodeLookup:z,connection:q}=v.getState();if(!y||!R&&!s)return;if(!R){P==null||P(j.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const W=T8(j.target),K=n||Z,{connection:ue,isValid:pe}=gS.isValid(j.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:Y,fromNodeId:R.nodeId,fromHandleId:R.id||null,fromType:R.type,isValidConnection:K,flowId:te,doc:W,lib:B,nodeLookup:z});pe&&ue&&M(ue);const _e=structuredClone(q);delete _e.inProgress,_e.toPosition=_e.toHandle?_e.toHandle.position:null,$==null||$(j,_e),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:Wi(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!g,target:g,connectable:i,connectablestart:s,connectableend:r,clickconnecting:T,connectingfrom:N,connectingto:_,valid:O,connectionindicator:i&&(!C||k)&&(C||I?r:s)}]),onMouseDown:G,onTouchStart:G,onClick:x?D:void 0,ref:p,...h,children:c})}const Rs=b.memo(i9(Vae));function Gae({data:e,isConnectable:t,sourcePosition:n=We.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Rs,{type:"source",position:n,isConnectable:t})]})}function Kae({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:i=We.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Rs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Rs,{type:"source",position:i,isConnectable:t})]})}function qae(){return null}function Yae({data:e,isConnectable:t,targetPosition:n=We.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Rs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Gy={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},nO={input:Gae,default:Kae,output:Yae,group:qae};function Wae(e){var t,n,i,s;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??((i=e.style)==null?void 0:i.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Xae=e=>{const{width:t,height:n,x:i,y:s}=cg(e.nodeLookup,{filter:r=>!!r.selected});return{width:xa(t)?t:null,height:xa(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${s}px)`}};function Qae({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=ai(),{width:s,height:r,transformString:a,userSelectionActive:l}=Yt(Xae,ri),c=a9(),u=b.useRef(null);b.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&r!==null;if(r9({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=i.getState().nodes.filter(g=>g.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Gy,p.key)&&(p.preventDefault(),c({direction:Gy[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Wi(["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:s,height:r}})})}const iO=typeof window<"u"?window:void 0,Zae=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function l9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:g,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:k,autoPanOnSelection:C,defaultViewport:I,translateExtent:O,minZoom:M,maxZoom:G,preventScrolling:D,onSelectionContextMenu:F,noWheelClassName:A,noPanClassName:j,disableKeyboardA11y:P,onViewportChange:$,isControlledViewport:R}){const{nodesSelectionActive:Y,userSelectionActive:Z}=Yt(Zae,ri),B=Tm(u,{target:iO}),te=Tm(g,{target:iO}),z=te||k,q=te||w,W=d&&z!==!0,K=B||Z||W;return jae({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(Lae,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:q,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:!B&&z,defaultViewport:I,translateExtent:O,minZoom:M,maxZoom:G,zoomActivationKeyCode:v,preventScrolling:D,noWheelClassName:A,noPanClassName:j,onViewportChange:$,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:W,children:o.jsxs(Uae,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:z,autoPanOnSelection:C,isSelecting:!!K,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:W,children:[e,Y&&o.jsx(Qae,{onSelectionContextMenu:F,noPanClassName:j,disableKeyboardA11y:P})]})})}l9.displayName="FlowRenderer";const Jae=b.memo(l9),eoe=e=>t=>e?Mk(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 toe(e){return Yt(b.useCallback(eoe(e),[e]),ri)}const noe=e=>e.updateNodeInternals;function ioe(){const e=Yt(noe),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(s=>{const r=s.target.getAttribute("data-id");i.set(r,{id:r,nodeElement:s.target,force:!0})}),e(i)}));return b.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function soe({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const s=ai(),r=b.useRef(null),a=b.useRef(null),l=b.useRef(e.sourcePosition),c=b.useRef(e.targetPosition),u=b.useRef(t),d=n&&!!e.internals.handleBounds;return b.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(r.current),a.current=r.current)},[d,e.hidden]),b.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.current=null)},[]),b.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,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function roe({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:s,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:g,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:N}=Yt(K=>{const ue=K.nodeLookup.get(e),pe=K.parentLookup.has(e);return{node:ue,internals:ue.internals,isParent:pe}},ri);let _=E.type||"default",T=(v==null?void 0:v[_])||nO[_];T===void 0&&(x==null||x("003",Na.error003(_)),_="default",T=(v==null?void 0:v.default)||nO.default);const k=!!(E.draggable||l&&typeof E.draggable>"u"),C=!!(E.selectable||c&&typeof E.selectable>"u"),I=!!(E.connectable||u&&typeof E.connectable>"u"),O=!!(E.focusable||d&&typeof E.focusable>"u"),M=ai(),G=Pk(E),D=soe({node:E,nodeType:_,hasDimensions:G,resizeObserver:f}),F=r9({nodeRef:D,disabled:E.hidden||!k,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),A=a9();if(E.hidden)return null;const j=Qo(E),P=Wae(E),$=C||k||t||n||i||s,R=n?K=>n(K,{...w.userNode}):void 0,Y=i?K=>i(K,{...w.userNode}):void 0,Z=s?K=>s(K,{...w.userNode}):void 0,B=r?K=>r(K,{...w.userNode}):void 0,te=a?K=>a(K,{...w.userNode}):void 0,z=K=>{const{selectNodesOnDrag:ue,nodeDragThreshold:pe}=M.getState();C&&(!ue||!k||pe>0)&&bS({id:e,store:M,nodeRef:D}),t&&t(K,{...w.userNode})},q=K=>{if(!(k8(K.nativeEvent)||m)){if(g8.includes(K.key)&&C){const ue=K.key==="Escape";bS({id:e,store:M,unselect:ue,nodeRef:D})}else if(k&&E.selected&&Object.prototype.hasOwnProperty.call(Gy,K.key)){K.preventDefault();const{ariaLabelConfig:ue}=M.getState();M.setState({ariaLiveMessage:ue["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),A({direction:Gy[K.key],factor:K.shiftKey?4:1})}}},W=()=>{var Re;if(m||!((Re=D.current)!=null&&Re.matches(":focus-visible")))return;const{transform:K,width:ue,height:pe,autoPanOnNodeFocus:_e,setCenter:fe}=M.getState();if(!_e)return;Mk(new Map([[e,E]]),{x:0,y:0,width:ue,height:pe},K,!0).length>0||fe(E.position.x+j.width/2,E.position.y+j.height/2,{zoom:K[2]})};return o.jsx("div",{className:Wi(["react-flow__node",`react-flow__node-${_}`,{[p]:k},E.className,{selected:E.selected,selectable:C,parent:N,draggable:k,dragging:F}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:G?"visible":"hidden",...E.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:Y,onMouseLeave:Z,onContextMenu:B,onClick:z,onDoubleClick:te,onKeyDown:O?q:void 0,tabIndex:O?0:void 0,onFocus:O?W:void 0,role:E.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${X8}-${g}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx($ae,{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:C,draggable:k,deletable:E.deletable??!0,isConnectable:I,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...j})})})}var aoe=b.memo(roe);const ooe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function c9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,onError:r}=Yt(ooe,ri),a=toe(e.onlyRenderVisibleElements),l=ioe();return o.jsx("div",{className:"react-flow__nodes",style:cx,children:a.map(c=>o.jsx(aoe,{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:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}c9.displayName="NodeRenderer";const loe=b.memo(c9);function coe(e){return Yt(b.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const i=[];if(n.width&&n.height)for(const s of n.edges){const r=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);r&&a&&qse({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(s.id)}return i},[e]),ri)}const uoe=({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"})},doe=({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"})},sO={[yf.Arrow]:uoe,[yf.ArrowClosed]:doe};function foe(e){const t=ai();return b.useMemo(()=>{var s,r;return Object.prototype.hasOwnProperty.call(sO,e)?sO[e]:((r=(s=t.getState()).onError)==null||r.call(s,"009",Na.error009(e)),null)},[e])}const hoe=({id:e,type:t,color:n,width:i=12.5,height:s=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=foe(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},u9=({defaultColor:e,rfId:t})=>{const n=Yt(r=>r.edges),i=Yt(r=>r.defaultEdgeOptions),s=b.useMemo(()=>tre(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return s.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:s.map(r=>o.jsx(hoe,{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};u9.displayName="MarkerDefinitions";var poe=b.memo(u9);function d9({x:e,y:t,label:n,labelStyle:i,labelShowBg:s=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=Wi(["react-flow__edge-textwrapper",u]),m=b.useRef(null);return b.useEffect(()=>{if(m.current){const g=m.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.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:[s&&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:i,children:n}),c]}):null}d9.displayName="EdgeText";const moe=b.memo(d9);function dg({path:e,labelX:t,labelY:n,label:i,labelStyle:s,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:Wi(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&xa(t)&&xa(n)?o.jsx(moe,{x:t,y:n,label:i,labelStyle:s,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function rO({pos:e,x1:t,y1:n,x2:i,y2:s}){return e===We.Left||e===We.Right?[.5*(t+i),n]:[t,.5*(n+s)]}function f9({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:i,targetY:s,targetPosition:r=We.Top}){const[a,l]=rO({pos:n,x1:e,y1:t,x2:i,y2:s}),[c,u]=rO({pos:r,x1:i,y1:s,x2:e,y2:t}),[d,f,h,p]=C8({sourceX:e,sourceY:t,targetX:i,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${i},${s}`,d,f,h,p]}function h9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:y})=>{const[x,E,w]=f9({sourceX:n,sourceY:i,sourcePosition:a,targetX:s,targetY:r,targetPosition:l}),N=e.isInternal?void 0:t;return o.jsx(dg,{id:N,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:y})})}const goe=h9({isInternal:!1}),p9=h9({isInternal:!0});goe.displayName="SimpleBezierEdge";p9.displayName="SimpleBezierEdgeInternal";function m9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=We.Bottom,targetPosition:m=We.Top,markerEnd:g,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,N]=Vy({sourceX:n,sourceY:i,sourcePosition:p,targetX:s,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(dg,{id:_,path:E,labelX:w,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:v,interactionWidth:x})})}const g9=m9({isInternal:!1}),b9=m9({isInternal:!0});g9.displayName="SmoothStepEdge";b9.displayName="SmoothStepEdgeInternal";function y9(e){return b.memo(({id:t,...n})=>{var s;const i=e.isInternal?void 0:t;return o.jsx(g9,{...n,id:i,pathOptions:b.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const boe=y9({isInternal:!1}),x9=y9({isInternal:!0});boe.displayName="StepEdge";x9.displayName="StepEdgeInternal";function E9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})=>{const[v,y,x]=j8({sourceX:n,sourceY:i,targetX:s,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(dg,{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:g})})}const yoe=E9({isInternal:!1}),v9=E9({isInternal:!0});yoe.displayName="StraightEdge";v9.displayName="StraightEdgeInternal";function w9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,sourcePosition:a=We.Bottom,targetPosition:l=We.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,N]=I8({sourceX:n,sourceY:i,sourcePosition:a,targetX:s,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),_=e.isInternal?void 0:t;return o.jsx(dg,{id:_,path:E,labelX:w,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:x})})}const xoe=w9({isInternal:!1}),_9=w9({isInternal:!0});xoe.displayName="BezierEdge";_9.displayName="BezierEdgeInternal";const aO={default:_9,straight:v9,step:x9,smoothstep:b9,simplebezier:p9},oO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Eoe=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,voe=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,lO="react-flow__edgeupdater";function cO({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:s,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:s,onMouseEnter:r,onMouseOut:a,className:Wi([lO,`${lO}-${l}`]),cx:Eoe(t,i,e),cy:voe(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function woe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:s,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=ai(),g=(w,N)=>{if(w.button!==0)return;const{autoPanOnConnect:_,domNode:T,connectionMode:k,connectionRadius:C,lib:I,onConnectStart:O,cancelConnection:M,nodeLookup:G,rfId:D,panBy:F,updateConnection:A}=m.getState(),j=N.type==="target",P=(Y,Z)=>{h(!1),f==null||f(Y,n,N.type,Z)},$=Y=>u==null?void 0:u(n,Y),R=(Y,Z)=>{h(!0),d==null||d(w,n,N.type),O==null||O(Y,Z)};gS.onPointerDown(w.nativeEvent,{autoPanOnConnect:_,connectionMode:k,connectionRadius:C,domNode:T,handleId:N.id,nodeId:N.nodeId,nodeLookup:G,isTarget:j,edgeUpdaterType:N.type,lib:I,flowId:D,cancelConnection:M,panBy:F,isValidConnection:(...Y)=>{var Z,B;return((B=(Z=m.getState()).isValidConnection)==null?void 0:B.call(Z,...Y))??!0},onConnect:$,onConnectStart:R,onConnectEnd:(...Y)=>{var Z,B;return(B=(Z=m.getState()).onConnectEnd)==null?void 0:B.call(Z,...Y)},onReconnectEnd:P,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>g(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>g(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(cO,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(cO,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function _oe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:s,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:g,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=Yt(fe=>fe.edgeLookup.get(e));const w=Yt(fe=>fe.defaultEdgeOptions);E=w?{...w,...E}:E;let N=E.type||"default",_=(g==null?void 0:g[N])||aO[N];_===void 0&&(y==null||y("011",Na.error011(N)),N="default",_=(g==null?void 0:g.default)||aO.default);const T=!!(E.focusable||t&&typeof E.focusable>"u"),k=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),C=!!(E.selectable||i&&typeof E.selectable>"u"),I=b.useRef(null),[O,M]=b.useState(!1),[G,D]=b.useState(!1),F=ai(),{zIndex:A,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z}=Yt(b.useCallback(fe=>{const me=fe.nodeLookup.get(E.source),Re=fe.nodeLookup.get(E.target);if(!me||!Re)return{zIndex:E.zIndex,...oO};const ge=ere({id:e,sourceNode:me,targetNode:Re,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:fe.connectionMode,onError:y});return{zIndex:Kse({selected:E.selected,zIndex:E.zIndex,sourceNode:me,targetNode:Re,elevateOnSelect:fe.elevateEdgesOnSelect,zIndexMode:fe.zIndexMode}),...ge||oO}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),ri),B=b.useMemo(()=>E.markerStart?`url('#${pS(E.markerStart,m)}')`:void 0,[E.markerStart,m]),te=b.useMemo(()=>E.markerEnd?`url('#${pS(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||j===null||P===null||$===null||R===null)return null;const z=fe=>{var oe;const{addSelectedEdges:me,unselectNodesAndEdges:Re,multiSelectionActive:ge}=F.getState();C&&(F.setState({nodesSelectionActive:!1}),E.selected&&ge?(Re({nodes:[],edges:[E]}),(oe=I.current)==null||oe.blur()):me([e])),s&&s(fe,E)},q=r?fe=>{r(fe,{...E})}:void 0,W=a?fe=>{a(fe,{...E})}:void 0,K=l?fe=>{l(fe,{...E})}:void 0,ue=c?fe=>{c(fe,{...E})}:void 0,pe=u?fe=>{u(fe,{...E})}:void 0,_e=fe=>{var me;if(!x&&g8.includes(fe.key)&&C){const{unselectNodesAndEdges:Re,addSelectedEdges:ge}=F.getState();fe.key==="Escape"?((me=I.current)==null||me.blur(),Re({edges:[E]})):ge([e])}};return o.jsx("svg",{style:{zIndex:A},children:o.jsxs("g",{className:Wi(["react-flow__edge",`react-flow__edge-${N}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!C&&!s,updating:O,selectable:C}]),onClick:z,onDoubleClick:q,onContextMenu:W,onMouseEnter:K,onMouseMove:ue,onMouseLeave:pe,onKeyDown:T?_e: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?`${Q8}-${m}`:void 0,ref:I,...E.domAttributes,children:[!G&&o.jsx(_,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:C,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:B,markerEnd:te,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),k&&o.jsx(woe,{edge:E,isReconnectable:k,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z,setUpdateHover:M,setReconnecting:D})]})})}var Soe=b.memo(_oe);const Noe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function S9({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:s,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:g}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=Yt(Noe,ri),w=coe(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(poe,{defaultColor:e,rfId:n}),w.map(N=>o.jsx(Soe,{id:N,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:s,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:i,disableKeyboardA11y:g},N))]})}S9.displayName="EdgeRenderer";const Toe=b.memo(S9),koe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Aoe({children:e}){const t=Yt(koe);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Coe(e){const t=lx(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Ioe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Roe(e){const t=Yt(Ioe),n=ai();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function joe(e){return e.connection.inProgress?{...e.connection,to:Wf(e.connection.to,e.transform)}:{...e.connection}}function Ooe(e){return joe}function Moe(e){const t=Ooe();return Yt(t,ri)}const Loe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Doe({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:s,width:r,height:a,isValid:l,inProgress:c}=Yt(Loe,ri);return!(r&&s&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Wi(["react-flow__connection",x8(l)]),children:o.jsx(N9,{style:t,type:n,CustomComponent:i,isValid:l})})})}const N9=({style:e,type:t=kl.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:s,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Moe();if(!s)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:x8(i),toNode:d,toHandle:f,pointer:p});let m="";const g={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case kl.Bezier:[m]=I8(g);break;case kl.SimpleBezier:[m]=f9(g);break;case kl.Step:[m]=Vy({...g,borderRadius:0});break;case kl.SmoothStep:[m]=Vy(g);break;default:[m]=j8(g)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};N9.displayName="ConnectionLine";const Poe={};function uO(e=Poe){b.useRef(e),ai(),b.useEffect(()=>{},[e])}function Boe(){ai(),b.useRef(!1),b.useEffect(()=>{},[])}function T9({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:g,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:T,deleteKeyCode:k,onlyRenderVisibleElements:C,elementsSelectable:I,defaultViewport:O,translateExtent:M,minZoom:G,maxZoom:D,preventScrolling:F,defaultMarkerColor:A,zoomOnScroll:j,zoomOnPinch:P,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,zoomOnDoubleClick:Z,panOnDrag:B,autoPanOnSelection:te,onPaneClick:z,onPaneMouseEnter:q,onPaneMouseMove:W,onPaneMouseLeave:K,onPaneScroll:ue,onPaneContextMenu:pe,paneClickDistance:_e,nodeClickDistance:fe,onEdgeContextMenu:me,onEdgeMouseEnter:Re,onEdgeMouseMove:ge,onEdgeMouseLeave:oe,reconnectRadius:Te,onReconnect:ve,onReconnectStart:Xe,onReconnectEnd:De,noDragClassName:ze,noWheelClassName:Ne,noPanClassName:Pe,disableKeyboardA11y:Fe,nodeExtent:qe,rfId:Q,viewport:ae,onViewportChange:ie}){return uO(e),uO(t),Boe(),Coe(n),Roe(ae),o.jsx(Jae,{onPaneClick:z,onPaneMouseEnter:q,onPaneMouseMove:W,onPaneMouseLeave:K,onPaneContextMenu:pe,onPaneScroll:ue,paneClickDistance:_e,deleteKeyCode:k,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:T,elementsSelectable:I,zoomOnScroll:j,zoomOnPinch:P,zoomOnDoubleClick:Z,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,panOnDrag:B,autoPanOnSelection:te,defaultViewport:O,translateExtent:M,minZoom:G,maxZoom:D,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:ze,noWheelClassName:Ne,noPanClassName:Pe,disableKeyboardA11y:Fe,onViewportChange:ie,isControlledViewport:!!ae,children:o.jsxs(Aoe,{children:[o.jsx(Toe,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:ve,onReconnectStart:Xe,onReconnectEnd:De,onlyRenderVisibleElements:C,onEdgeContextMenu:me,onEdgeMouseEnter:Re,onEdgeMouseMove:ge,onEdgeMouseLeave:oe,reconnectRadius:Te,defaultMarkerColor:A,noPanClassName:Pe,disableKeyboardA11y:Fe,rfId:Q}),o.jsx(Doe,{style:g,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(loe,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:fe,onlyRenderVisibleElements:C,noPanClassName:Pe,noDragClassName:ze,disableKeyboardA11y:Fe,nodeExtent:qe,rfId:Q}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}T9.displayName="GraphView";const Uoe=b.memo(T9),Foe=S8(),dO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,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,g=new Map,v=new Map,y=i??t??[],x=n??e??[],E=d??[0,0],w=f??wm;L8(g,v,y);const{nodesInitialized:N}=mS(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let _=[0,0,1];if(a&&s&&r){const T=cg(p,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:k,y:C,zoom:I}=Dk(T,s,r,c,u,(l==null?void 0:l.padding)??.1);_=[k,C,I]}return{rfId:"1",width:s??0,height:r??0,transform:_,nodes:x,nodesInitialized:N,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:wm,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bf.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:{...y8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Foe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:b8,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},$oe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>iae((p,m)=>{async function g(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:N,minZoom:_,maxZoom:T}=m();y&&(await Use({nodes:v,width:w,height:N,panZoom:y,minZoom:_,maxZoom:T},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...dO({nodes:e,edges:t,width:s,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:N,zIndexMode:_,nodesSelectionActive:T}=m(),{nodesInitialized:k,hasSelectedNodes:C}=mS(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:_}),I=T&&C;N&&k?(g(),p({nodes:v,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:v,nodesInitialized:k,nodesSelectionActive:I})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();L8(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:N,nodeExtent:_,debug:T,fitViewQueued:k,zIndexMode:C}=m(),{changes:I,updatedInternals:O}=lre(v,x,E,w,N,_,C);O&&(sre(x,E,{nodeOrigin:N,nodeExtent:_,zIndexMode:C}),k?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(T&&console.log("React Flow: trigger node changes",I),y==null||y(I)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:N,connection:_,updateConnection:T,onNodesChangeMiddlewareMap:k}=m();for(const[C,I]of v){const O=w.get(C),M=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(I!=null&&I.position)),G={id:C,type:"position",position:M?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:y};if(O&&_.inProgress&&_.fromNode.id===O.id){const D=lu(O,_.fromHandle,We.Left,!0);T({..._,from:D})}M&&O.parentId&&x.push({id:C,parentId:O.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),E.push(G)}if(x.length>0){const{parentLookup:C,nodeOrigin:I}=m(),O=zk(x,w,C,I);E.push(...O)}for(const C of k.values())E=C(E);N(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:N}=m();if(v!=null&&v.length){if(w){const _=e9(v,E);x(_)}N&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:N}=m();if(v!=null&&v.length){if(w){const _=t9(v,E);x(_)}N&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:N}=m();if(y){const _=v.map(T=>Cc(T,!0));w(_);return}w(Ad(E,new Set([...v]),!0)),N(Ad(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:N}=m();if(y){const _=v.map(T=>Cc(T,!0));N(_);return}N(Ad(x,new Set([...v]))),w(Ad(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:_}=m(),T=v||E,k=y||x,C=[];for(const O of T){if(!O.selected)continue;const M=w.get(O.id);M&&(M.selected=!1),C.push(Cc(O.id,!1))}const I=[];for(const O of k)O.selected&&I.push(Cc(O.id,!1));N(C),_(I)},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 N=y.reduce((T,k)=>k.selected?[...T,Cc(k.id,!1)]:T,[]),_=v.reduce((T,k)=>k.selected?[...T,Cc(k.id,!1)]:T,[]);x(N),E(_)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:N,nodeExtent:_,zIndexMode:T}=m();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(mS(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:T}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:N}=m();return cre({delta:v,panZoom:w,transform:y,translateExtent:N,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:N,panZoom:_}=m();if(!_)return!1;const T=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:N;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:{...y8}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...dO()})}},Object.is);function Gk({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:s,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=b.useState(()=>$oe({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(sae,{value:m,children:o.jsx(Aae,{children:p})})}function Hoe({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(ax)?o.jsx(o.Fragment,{children:e}):o.jsx(Gk,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:s,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const zoe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Voe({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:s,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:C,onNodesDelete:I,onEdgesDelete:O,onDelete:M,onSelectionChange:G,onSelectionDragStart:D,onSelectionDrag:F,onSelectionDragStop:A,onSelectionContextMenu:j,onSelectionStart:P,onSelectionEnd:$,onBeforeDelete:R,connectionMode:Y,connectionLineType:Z=kl.Bezier,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:z,deleteKeyCode:q="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:K=!1,selectionMode:ue=_m.Full,panActivationKeyCode:pe="Space",multiSelectionKeyCode:_e=Nm()?"Meta":"Control",zoomActivationKeyCode:fe=Nm()?"Meta":"Control",snapToGrid:me,snapGrid:Re,onlyRenderVisibleElements:ge=!1,selectNodesOnDrag:oe,nodesDraggable:Te,autoPanOnNodeFocus:ve,nodesConnectable:Xe,nodesFocusable:De,nodeOrigin:ze=Z8,edgesFocusable:Ne,edgesReconnectable:Pe,elementsSelectable:Fe=!0,defaultViewport:qe=bae,minZoom:Q=.5,maxZoom:ae=2,translateExtent:ie=wm,preventScrolling:be=!0,nodeExtent:Ue,defaultMarkerColor:Ye="#b1b1b7",zoomOnScroll:yt=!0,zoomOnPinch:lt=!0,panOnScroll:ln=!1,panOnScrollSpeed:Dt=.5,panOnScrollMode:kt=Yc.Free,zoomOnDoubleClick:$t=!0,panOnDrag:Ge=!0,onPaneClick:Kt,onPaneMouseEnter:nt,onPaneMouseMove:at,onPaneMouseLeave:Qe,onPaneScroll:Nt,onPaneContextMenu:ye,paneClickDistance:Ze=1,nodeClickDistance:Et=0,children:sn,onReconnect:jn,onReconnectStart:ot,onReconnectEnd:mt,onEdgeContextMenu:rn,onEdgeDoubleClick:fn,onEdgeMouseEnter:At,onEdgeMouseMove:Wt,onEdgeMouseLeave:Ti,reconnectRadius:bi=10,onNodesChange:On,onEdgesChange:$n,noDragClassName:hn="nodrag",noWheelClassName:vn="nowheel",noPanClassName:Hn="nopan",fitView:Bi,fitViewOptions:Xi,connectOnClick:ki,attributionPosition:Ui,proOptions:gn,defaultEdgeOptions:Ai,elevateNodesOnSelect:zn=!0,elevateEdgesOnSelect:Jn=!1,disableKeyboardA11y:Ci=!1,autoPanOnConnect:yi,autoPanOnNodeDrag:pn,autoPanOnSelection:An=!0,autoPanSpeed:Mn,connectionRadius:Ln,isValidConnection:ce,onError:Se,style:Le,id:Ee,nodeDragThreshold:rt,connectionDragThreshold:it,viewport:jt,onViewportChange:Pt,width:oi,height:Dn,colorMode:ps="light",debug:xi,onScroll:wt,ariaLabelConfig:Tt,zIndexMode:Ii="basic",...Vn},Ds){const ta=Ee||"1",oo=vae(ps),is=b.useCallback(Ps=>{Ps.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),wt==null||wt(Ps)},[wt]);return o.jsx("div",{"data-testid":"rf__wrapper",...Vn,onScroll:is,style:{...Le,...zoe},ref:Ds,className:Wi(["react-flow",s,oo]),id:Ee,role:"application",children:o.jsxs(Hoe,{nodes:e,edges:t,width:oi,height:Dn,fitView:Bi,fitViewOptions:Xi,minZoom:Q,maxZoom:ae,nodeOrigin:ze,nodeExtent:Ue,zIndexMode:Ii,children:[o.jsx(Eae,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:Te,autoPanOnNodeFocus:ve,nodesConnectable:Xe,nodesFocusable:De,edgesFocusable:Ne,edgesReconnectable:Pe,elementsSelectable:Fe,elevateNodesOnSelect:zn,elevateEdgesOnSelect:Jn,minZoom:Q,maxZoom:ae,nodeExtent:Ue,onNodesChange:On,onEdgesChange:$n,snapToGrid:me,snapGrid:Re,connectionMode:Y,translateExtent:ie,connectOnClick:ki,defaultEdgeOptions:Ai,fitView:Bi,fitViewOptions:Xi,onNodesDelete:I,onEdgesDelete:O,onDelete:M,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:C,onSelectionDrag:F,onSelectionDragStart:D,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Hn,nodeOrigin:ze,rfId:ta,autoPanOnConnect:yi,autoPanOnNodeDrag:pn,autoPanSpeed:Mn,onError:Se,connectionRadius:Ln,isValidConnection:ce,selectNodesOnDrag:oe,nodeDragThreshold:rt,connectionDragThreshold:it,onBeforeDelete:R,debug:xi,ariaLabelConfig:Tt,zIndexMode:Ii}),o.jsx(Uoe,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,nodeTypes:r,edgeTypes:a,connectionLineType:Z,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:z,selectionKeyCode:W,selectionOnDrag:K,selectionMode:ue,deleteKeyCode:q,multiSelectionKeyCode:_e,panActivationKeyCode:pe,zoomActivationKeyCode:fe,onlyRenderVisibleElements:ge,defaultViewport:qe,translateExtent:ie,minZoom:Q,maxZoom:ae,preventScrolling:be,zoomOnScroll:yt,zoomOnPinch:lt,zoomOnDoubleClick:$t,panOnScroll:ln,panOnScrollSpeed:Dt,panOnScrollMode:kt,panOnDrag:Ge,autoPanOnSelection:An,onPaneClick:Kt,onPaneMouseEnter:nt,onPaneMouseMove:at,onPaneMouseLeave:Qe,onPaneScroll:Nt,onPaneContextMenu:ye,paneClickDistance:Ze,nodeClickDistance:Et,onSelectionContextMenu:j,onSelectionStart:P,onSelectionEnd:$,onReconnect:jn,onReconnectStart:ot,onReconnectEnd:mt,onEdgeContextMenu:rn,onEdgeDoubleClick:fn,onEdgeMouseEnter:At,onEdgeMouseMove:Wt,onEdgeMouseLeave:Ti,reconnectRadius:bi,defaultMarkerColor:Ye,noDragClassName:hn,noWheelClassName:vn,noPanClassName:Hn,rfId:ta,disableKeyboardA11y:Ci,nodeExtent:Ue,viewport:jt,onViewportChange:Pt}),o.jsx(gae,{onSelectionChange:G}),sn,o.jsx(dae,{proOptions:gn,position:Ui}),o.jsx(uae,{rfId:ta,disableKeyboardA11y:Ci})]})})}var k9=i9(Voe);const Goe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Koe({children:e}){const t=Yt(Goe);return t?Ss.createPortal(e,t):null}function A9(e){const[t,n]=b.useState(e),i=b.useCallback(s=>n(r=>e9(s,r)),[]);return[t,n,i]}function C9(e){const[t,n]=b.useState(e),i=b.useCallback(s=>n(r=>t9(s,r)),[]);return[t,n,i]}const qoe=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||!Pk(n.userNode))return!1;return!0};function Yoe(e={includeHiddenNodes:!1}){return Yt(qoe(e))}function Woe({dimensions:e,lineWidth:t,variant:n,className:i}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Wi(["react-flow__background-pattern",n,i])})}function Xoe({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Wi(["react-flow__background-pattern","dots",t])})}var Gl;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Gl||(Gl={}));const Qoe={[Gl.Dots]:1,[Gl.Lines]:1,[Gl.Cross]:6},Zoe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function I9({id:e,variant:t=Gl.Dots,gap:n=20,size:i,lineWidth:s=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=Yt(Zoe,ri),m=i||Qoe[t],g=t===Gl.Dots,v=t===Gl.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],N=v?[E,E]:x,_=[w[0]*h[2]||1+N[0]/2,w[1]*h[2]||1+N[1]/2],T=`${p}${e||""}`;return o.jsxs("svg",{className:Wi(["react-flow__background",u]),style:{...c,...cx,"--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:g?o.jsx(Xoe,{radius:E/2,className:d}):o.jsx(Woe,{dimensions:N,lineWidth:s,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}I9.displayName="Background";const R9=b.memo(I9);function Joe(){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 ele(){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 tle(){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 nle(){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 ile(){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 R0({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Wi(["react-flow__controls-button",t]),...n,children:e})}const sle=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function j9({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=ai(),{isInteractive:g,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=Yt(sle,ri),{zoomIn:E,zoomOut:w,fitView:N}=lx(),_=()=>{E(),r==null||r()},T=()=>{w(),a==null||a()},k=()=>{N(s),l==null||l()},C=()=>{m.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},I=h==="horizontal"?"horizontal":"vertical";return o.jsxs(ox,{className:Wi(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(R0,{onClick:_,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(Joe,{})}),o.jsx(R0,{onClick:T,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(ele,{})})]}),n&&o.jsx(R0,{className:"react-flow__controls-fitview",onClick:k,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(tle,{})}),i&&o.jsx(R0,{className:"react-flow__controls-interactive",onClick:C,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:g?o.jsx(ile,{}):o.jsx(nle,{})}),d]})}j9.displayName="Controls";const O9=b.memo(j9);function rle({id:e,x:t,y:n,width:i,height:s,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:g}=r||{},v=a||m||g;return o.jsx("rect",{className:Wi(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:s,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const ale=b.memo(rle),ole=e=>e.nodes.map(t=>t.id),Tv=e=>e instanceof Function?e:()=>e;function lle({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:r=ale,onClick:a}){const l=Yt(ole,ri),c=Tv(t),u=Tv(e),d=Tv(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(ule,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function cle({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Yt(m=>{const g=m.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const v=g.internals.userNode,{x:y,y:x}=g.internals.positionAbsolute,{width:E,height:w}=Qo(v);return{node:v,x:y,y:x,width:E,height:w}},ri);return!u||u.hidden||!Pk(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const ule=b.memo(cle);var dle=b.memo(lle);const fle=200,hle=150,ple=e=>!e.hidden,mle=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?_8(cg(e.nodeLookup,{filter:ple}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},gle="react-flow__minimap-desc";function M9({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:g=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const N=ai(),_=b.useRef(null),{boundingRect:T,viewBB:k,rfId:C,panZoom:I,translateExtent:O,flowWidth:M,flowHeight:G,ariaLabelConfig:D}=Yt(mle,ri),F=(e==null?void 0:e.width)??fle,A=(e==null?void 0:e.height)??hle,j=T.width/F,P=T.height/A,$=Math.max(j,P),R=$*F,Y=$*A,Z=w*$,B=T.x-(R-T.width)/2-Z,te=T.y-(Y-T.height)/2-Z,z=R+Z*2,q=Y+Z*2,W=`${gle}-${C}`,K=b.useRef(0),ue=b.useRef();K.current=$,b.useEffect(()=>{if(_.current&&I)return ue.current=yre({domNode:_.current,panZoom:I,getTransform:()=>N.getState().transform,getViewScale:()=>K.current}),()=>{var me;(me=ue.current)==null||me.destroy()}},[I]),b.useEffect(()=>{var me;(me=ue.current)==null||me.update({translateExtent:O,width:M,height:G,inversePan:x,pannable:g,zoomStep:E,zoomable:v})},[g,v,x,E,O,M,G]);const pe=p?me=>{var oe;const[Re,ge]=((oe=ue.current)==null?void 0:oe.pointer(me))||[0,0];p(me,{x:Re,y:ge})}:void 0,_e=m?b.useCallback((me,Re)=>{const ge=N.getState().nodeLookup.get(Re).internals.userNode;m(me,ge)},[]):void 0,fe=y??D["minimap.ariaLabel"];return o.jsx(ox,{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 i=="string"?i: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:Wi(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:A,viewBox:`${B} ${te} ${z} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:_,onClick:pe,children:[fe&&o.jsx("title",{id:W,children:fe}),o.jsx(dle,{onClick:_e,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-Z},${te-Z}h${z+Z*2}v${q+Z*2}h${-z-Z*2}z - M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}M9.displayName="MiniMap";const ble=b.memo(M9),yle=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,xle={[wf.Line]:"right",[wf.Handle]:"bottom-right"};function Ele({nodeId:e,position:t,variant:n=wf.Handle,className:i,style:s=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:g,onResize:v,onResizeEnd:y}){const x=o9(),E=typeof e=="string"?e:x,w=ai(),N=b.useRef(null),_=n===wf.Handle,T=Yt(b.useCallback(yle(_&&p),[_,p]),ri),k=b.useRef(null),C=t??xle[n];b.useEffect(()=>{if(!(!N.current||!E))return k.current||(k.current=Rre({domNode:N.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:O,transform:M,snapGrid:G,snapToGrid:D,nodeOrigin:F,domNode:A}=w.getState();return{nodeLookup:O,transform:M,snapGrid:G,snapToGrid:D,nodeOrigin:F,paneDomNode:A}},onChange:(O,M)=>{const{triggerNodeChanges:G,nodeLookup:D,parentLookup:F,nodeOrigin:A}=w.getState(),j=[],P={x:O.x,y:O.y},$=D.get(E);if($&&$.expandParent&&$.parentId){const R=$.origin??A,Y=O.width??$.measured.width??0,Z=O.height??$.measured.height??0,B={id:$.id,parentId:$.parentId,rect:{width:Y,height:Z,...N8({x:O.x??$.position.x,y:O.y??$.position.y},{width:Y,height:Z},$.parentId,D,R)}},te=zk([B],D,F,A);j.push(...te),P.x=O.x?Math.max(R[0]*Y,O.x):void 0,P.y=O.y?Math.max(R[1]*Z,O.y):void 0}if(P.x!==void 0&&P.y!==void 0){const R={id:E,type:"position",position:{...P}};j.push(R)}if(O.width!==void 0&&O.height!==void 0){const Y={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};j.push(Y)}for(const R of M){const Y={...R,type:"position"};j.push(Y)}G(j)},onEnd:({width:O,height:M})=>{const G={id:E,type:"dimensions",resizing:!1,dimensions:{width:O,height:M}};w.getState().triggerNodeChanges([G])}})),k.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var O;(O=k.current)==null||O.destroy()}},[C,l,c,u,d,f,g,v,y,m]);const I=C.split("-");return o.jsx("div",{className:Wi(["react-flow__resize-control","nodrag",...I,n,i]),ref:N,style:{...s,scale:T,...a&&{[_?"backgroundColor":"borderColor"]:a}},children:r})}b.memo(Ele);var L9=Object.defineProperty,vle=(e,t,n)=>t in e?L9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wle=(e,t)=>{for(var n in t)L9(e,n,{get:t[n],enumerable:!0})},_le=(e,t,n)=>vle(e,t+"",n),D9={};wle(D9,{Graph:()=>Jr,alg:()=>Kk,json:()=>B9,version:()=>Tle});var Sle=Object.defineProperty,P9=(e,t)=>{for(var n in t)Sle(e,n,{get:t[n],enumerable:!0})},Jr=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(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),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=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),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 i=n;i!==void 0;i=this.parent(i))if(i===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 i=new Set(n);for(let s of this.successors(t))i.add(s);return Array.from(i.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 i={},s=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(i[r]=a??void 0,a??void 0):a in i?i[a]:s(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,s(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((i,s)=>(n!==void 0?this.setEdge(i,s,n):this.setEdge(i,s),s)),this}setEdge(t,n,i,s){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=s,arguments.length>2&&(c=i,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=rp(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=Nle(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,fO(this._preds[a],r),fO(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,i){let s=arguments.length===1?kv(this._isDirected,t):rp(this._isDirected,t,n,i);return this._edgeLabels[s]}edgeAsObj(t,n,i){let s=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof s!="object"?{label:s}:s}hasEdge(t,n,i){return(arguments.length===1?kv(this._isDirected,t):rp(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let s=arguments.length===1?kv(this._isDirected,t):rp(this._isDirected,t,n,i),r=this._edgeObjs[s];if(r){let a=r.v,l=r.w;delete this._edgeLabels[s],delete this._edgeObjs[s],hO(this._preds[l],a),hO(this._sucs[a],l),delete this._in[l][s],delete this._out[a][s],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,i){if(!t)return;let s=Object.values(t);return i?s.filter(r=>r.v===n&&r.w===i||r.v===i&&r.w===n):s}};function fO(e,t){e[t]?e[t]++:e[t]=1}function hO(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function rp(e,t,n,i){let s=""+t,r=""+n;if(!e&&s>r){let a=s;s=r,r=a}return s+""+r+""+(i===void 0?"\0":i)}function Nle(e,t,n,i){let s=""+t,r=""+n;if(!e&&s>r){let l=s;s=r,r=l}let a={v:s,w:r};return i&&(a.name=i),a}function kv(e,t){return rp(e,t.v,t.w,t.name)}var Tle="4.0.1",B9={};P9(B9,{read:()=>Ile,write:()=>kle});function kle(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Ale(e),edges:Cle(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Ale(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),i!==void 0&&(s.parent=i),s})}function Cle(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function Ile(e){let t=new Jr(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 Kk={};P9(Kk,{CycleException:()=>qy,bellmanFord:()=>U9,components:()=>Ole,dijkstra:()=>Ky,dijkstraAll:()=>Dle,findCycles:()=>Ple,floydWarshall:()=>Ule,isAcyclic:()=>$le,postorder:()=>zle,preorder:()=>Vle,prim:()=>Gle,shortestPaths:()=>Kle,tarjan:()=>$9,topsort:()=>H9});var Rle=()=>1;function U9(e,t,n,i){return jle(e,String(t),n||Rle,i||function(s){return e.outEdges(s)})}function jle(e,t,n,i){let s={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);s[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,i=String(e);if(!(i in n)){let s=this._arr,r=s.length;return n[i]=r,s.push({key:i,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 i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,s=e;n>1,!(t[i].priority1;function Ky(e,t,n,i){let s=function(r){return e.outEdges(r)};return Lle(e,String(t),n||Mle,i||s)}function Lle(e,t,n,i){let s={},r=new F9,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=s[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=s[a],l.distance!==Number.POSITIVE_INFINITY);)i(a).forEach(c);return s}function Dle(e,t,n){return e.nodes().reduce(function(i,s){return i[s]=Ky(e,s,t,n),i},{})}function $9(e){let t=0,n=[],i={},s=[];function r(a){let l=i[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in i?i[c].onStack&&(l.lowlink=Math.min(l.lowlink,i[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,i[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in i||r(a)}),s}function Ple(e){return $9(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Ble=()=>1;function Ule(e,t,n){return Fle(e,t||Ble,n||function(i){return e.outEdges(i)})}function Fle(e,t,n){let i={},s=e.nodes();return s.forEach(function(r){i[r]={},i[r][r]={distance:0,predecessor:""},s.forEach(function(a){r!==a&&(i[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);i[r][l]={distance:c,predecessor:r}})}),s.forEach(function(r){let a=i[r];s.forEach(function(l){let c=i[l];s.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);s=z9(e,l,n==="post",a,r,i,s)}),s}function z9(e,t,n,i,s,r,a){return t in i||(i[t]=!0,n||(a=r(a,t)),s(t).forEach(function(l){a=z9(e,l,n,i,s,r,a)}),n&&(a=r(a,t))),a}function V9(e,t,n){return Hle(e,t,n,function(i,s){return i.push(s),i},[])}function zle(e,t){return V9(e,t,"post")}function Vle(e,t){return V9(e,t,"pre")}function Gle(e,t){let n=new Jr,i={},s=new F9,r;function a(c){let u=c.v===r?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=s.removeMin(),r in i)n.setEdge(r,i[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function Kle(e,t,n,i){return qle(e,t,n,i??(s=>{let r=e.outEdges(s);return r??[]}))}function qle(e,t,n,i){if(n===void 0)return Ky(e,t,n,i);let s=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+s.weight,minlen:Math.max(i.minlen,s.minlen)})}),t}function G9(e){let t=new Jr({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 pO(e,t){let n=e.x,i=e.y,s=t.x-n,r=t.y-i,a=e.width/2,l=e.height/2;if(!s&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(s)*l?(r<0&&(l=-l),c=l*s/r,u=l):(s<0&&(a=-a),c=a,u=a*r/s),{x:n+c,y:i+u}}function fg(e){let t=km(q9(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),s=i.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][i.order]=n)}),t}function Wle(e){let t=e.nodes().map(i=>{let s=e.node(i).rank;return s===void 0?Number.MAX_VALUE:s}),n=Xa(Math.min,t);e.nodes().forEach(i=>{let s=e.node(i);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function Xle(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Xa(Math.min,t),i=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;i[l]||(i[l]=[]),i[l].push(a)});let s=0,r=e.graph().nodeRankFactor;Array.from(i).forEach((a,l)=>{a===void 0&&l%r!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function mO(e,t,n,i){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=i),Xf(e,"border",s,t)}function Qle(e,t=K9){let n=[];for(let i=0;iK9){let n=Qle(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function q9(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return Xa(Math.max,t)}function Zle(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function Y9(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function W9(e,t){return t()}var Jle=0;function qk(e){let t=++Jle;return e+(""+t)}function km(e,t,n=1){t==null&&(t=e,e=0);let i=r=>rti[t]:n=t,Object.entries(e).reduce((i,[s,r])=>(i[s]=n(r,s),i),{})}function ece(e,t){return e.reduce((n,i,s)=>(n[i]=t[s],n),{})}var dx="\0",tce="3.0.0",nce=class{constructor(){_le(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return gO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&gO(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,ice)),n=n._prev;return"["+e.join(", ")+"]"}};function gO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ice(e,t){if(e!=="_next"&&e!=="_prev")return t}var sce=nce,rce=()=>1;function ace(e,t){if(e.nodeCount()<=1)return[];let n=lce(e,t||rce);return oce(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function oce(e,t,n){var i;let s=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Av(e,t,n,l);for(;l=r.dequeue();)Av(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(i=t[c])==null?void 0:i.dequeue(),l){s=s.concat(Av(e,t,n,l,!0)||[]);break}}}return s}function Av(e,t,n,i,s){let r=[],a=s?r:void 0;return(e.inEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);s&&r.push({v:l.v,w:l.w}),u.out-=c,yS(t,n,u)}),(e.outEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,yS(t,n,d)}),e.removeNode(i.v),a}function lce(e,t){let n=new Jr,i=0,s=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);s=Math.max(s,f.out+=u),i=Math.max(i,h.in+=u)});let r=cce(s+i+3).map(()=>new sce),a=i+1;return n.nodes().forEach(l=>{yS(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function yS(e,t,n){var i,s,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(i=e[0])==null||i.enqueue(n)}function cce(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,qk("rev"))});function t(n){return i=>n.edge(i).weight}}function dce(e){let t=[],n={},i={};function s(r){Object.hasOwn(i,r)||(i[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[r])}return e.nodes().forEach(s),t}function fce(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function hce(e){e.graph().dummyChains=[],e.edges().forEach(t=>pce(e,t))}function pce(e,t){let n=t.v,i=e.node(n).rank,s=t.w,r=e.node(s).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i{let n=e.node(t),i=n.edgeLabel,s;for(e.setEdge(n.edgeObj,i);n.dummy;)s=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=s,n=e.node(t)})}function Yk(e){let t={};function n(i){let s=e.node(i);if(Object.hasOwn(t,i))return s.rank;t[i]=!0;let r=e.outEdges(i),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=Xa(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),s.rank=l}e.sources().forEach(n)}function Sf(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var X9=gce;function gce(e){let t=new Jr({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],s=e.nodeCount();t.setNode(i,{});let r,a;for(;bce(t,e){let a=r.v,l=i===a?r.w:a;!e.hasNode(l)&&!Sf(t,r)&&(e.setNode(l,{}),e.setEdge(i,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function yce(e,t){return t.edges().reduce((n,i)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(s=Sf(t,i)),st.node(i).rank+=n)}var{preorder:Ece,postorder:vce}=Kk,wce=vu;vu.initLowLimValues=Xk;vu.initCutValues=Wk;vu.calcCutValue=Q9;vu.leaveEdge=J9;vu.enterEdge=eU;vu.exchangeEdges=tU;function vu(e){e=Yle(e),Yk(e);let t=X9(e);Xk(t),Wk(t,e);let n,i;for(;n=J9(t);)i=eU(t,e,n),tU(t,e,n,i)}function Wk(e,t){let n=vce(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>_ce(e,t,i))}function _ce(e,t,n){let i=e.node(n).parent,s=e.edge(n,i);s.cutvalue=Q9(e,t,n)}function Q9(e,t,n){let i=e.node(n).parent,s=!0,r=t.edge(n,i),a=0;r||(s=!1,r=t.edge(i,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!==i){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,Nce(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function Xk(e,t){arguments.length<2&&(t=e.nodes()[0]),Z9(e,{},1,t)}function Z9(e,t,n,i,s){let r=n,a=e.node(i);t[i]=!0;let l=e.neighbors(i);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=Z9(e,t,n,c,i))}),a.low=r,a.lim=n++,s?a.parent=s:delete a.parent,n}function J9(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function eU(e,t,n){let i=n.v,s=n.w;t.hasEdge(i,s)||(i=n.w,s=n.v);let r=e.node(i),a=e.node(s),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===bO(e,e.node(u.v),l)&&c!==bO(e,e.node(u.w),l)).reduce((u,d)=>Sf(t,d)!e.node(s).parent);if(!n)return;let i=Ece(e,[n]);i=i.slice(1),i.forEach(s=>{let r=e.node(s).parent,a=t.edge(s,r),l=!1;a||(a=t.edge(r,s),l=!0),t.node(s).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function Nce(e,t,n){return e.hasEdge(t,n)}function bO(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Tce=kce;function kce(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":yO(e);break;case"tight-tree":Cce(e);break;case"longest-path":Ace(e);break;case"none":break;default:yO(e)}}var Ace=Yk;function Cce(e){Yk(e),X9(e)}function yO(e){wce(e)}var Ice=Rce;function Rce(e){let t=Oce(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),s=i.edgeObj,r=jce(e,t,s.v,s.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(i=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=i;for(;(d=e.parent(d))!==u;)r.push(d);return{path:s.concat(r.reverse()),lca:u}}function Oce(e){let t={},n=0;function i(s){let r=n;e.children(s).forEach(i),t[s]={low:r,lim:n++}}return e.children(dx).forEach(i),t}function Mce(e){let t=Xf(e,"root",{},"_root"),n=Lce(e),i=Object.values(n),s=Xa(Math.max,i)-1,r=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=Dce(e)+1;e.children(dx).forEach(l=>nU(e,t,r,a,s,n,l)),e.graph().nodeRankFactor=r}function nU(e,t,n,i,s,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=mO(e,"_bt"),d=mO(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;nU(e,t,n,i,s,r,h);let m=e.node(h),g=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?i:2*i,x=g!==v?1:s-((p=r[a])!=null?p:0)+1;e.setEdge(u,g,{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:s+((l=r[a])!=null?l:0)})}function Lce(e){let t={};function n(i,s){let r=e.children(i);r&&r.length&&r.forEach(a=>n(a,s+1)),t[i]=s}return e.children(dx).forEach(i=>n(i,1)),t}function Dce(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Pce(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Bce=Uce;function Uce(e){function t(n){let i=e.children(n),s=e.node(n);if(i.length&&i.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let r=s.minRank,a=s.maxRank+1;rEO(e.node(t))),e.edges().forEach(t=>EO(e.edge(t)))}function EO(e){let t=e.width;e.width=e.height,e.height=t}function Hce(e){e.nodes().forEach(t=>Cv(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(Cv),Object.hasOwn(i,"y")&&Cv(i)})}function Cv(e){e.y=-e.y}function zce(e){e.nodes().forEach(t=>Iv(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(Iv),Object.hasOwn(i,"x")&&Iv(i)})}function Iv(e){let t=e.x;e.x=e.y,e.y=t}function Vce(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),i=n.map(l=>e.node(l).rank),s=Xa(Math.max,i),r=km(s+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 Gce(e,t){let n=0;for(let i=1;id)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:i[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 qce(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let s=i.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:s.sum/s.weight,weight:s.weight}}})}function Yce(e,t){let n={};e.forEach((s,r)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i:r};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let r=n[s.v],a=n[s.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let i=Object.values(n).filter(s=>!s.indegree);return Wce(i)}function Wce(e){let t=[];function n(s){return r=>{r.merged||(r.barycenter===void 0||s.barycenter===void 0||r.barycenter>=s.barycenter)&&Xce(s,r)}}function i(s){return r=>{r.in.push(s),--r.indegree===0&&e.push(r)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(i(s))}return t.filter(s=>!s.merged).map(s=>Yy(s,["vs","i","barycenter","weight"]))}function Xce(e,t){let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}function Qce(e,t){let n=Zle(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;i.sort(Zce(!!t)),c=vO(r,s,c),i.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=vO(r,s,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function vO(e,t,n){let i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),e.push(i.vs),n++;return n}function Zce(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function sU(e,t,n,i){let s=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==l));let u=qce(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=sU(e,h.v,n,i);c[h.v]=p,Object.hasOwn(p,"barycenter")&&eue(h,p)}});let d=Yce(u,n);Jce(d,c);let f=Qce(d,i);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),g=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function Jce(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function eue(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 tue(e,t,n,i){i||(i=e.nodes());let s=nue(e),r=new Jr({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return i.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||s);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 nue(e){let t;for(;e.hasNode(t=qk("_root")););return t}function iue(e,t,n){let i={},s;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=i[l],i[l]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function rU(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,rU);return}let n=q9(e),i=wO(e,km(1,n+1),"inEdges"),s=wO(e,km(n-1,-1,-1),"outEdges"),r=Vce(e);if(_O(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){sue(u%2?i:s,u%4>=2,c),r=fg(e);let f=Gce(e,r);f{i.has(r)||i.set(r,[]),i.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&s(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&s(l,r)}return t.map(function(r){return tue(e,r,n,i.get(r)||[])})}function sue(e,t,n){let i=new Jr;e.forEach(function(s){n.forEach(l=>i.setEdge(l.left,l.right));let r=s.graph().root,a=sU(s,r,i,t);a.vs.forEach((l,c)=>s.node(l).order=c),iue(s,i,a.vs)})}function _O(e,t){Object.values(t).forEach(n=>n.forEach((i,s)=>e.node(i).order=s))}function rue(e,t){let n={};function i(s,r){let a=0,l=0,c=s.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=oue(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let g=e.predecessors(m);g&&g.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)&&aU(n,p,f)})}})}function s(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,i(a,u,f,l,c),u=f,l=c}}i(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(s),n}function oue(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function aU(e,t,n){if(t>n){let s=t;t=n,n=s}let i=e[t];i||(e[t]=i={}),i[n]=!0}function lue(e,t,n){if(t>n){let s=t;t=n,n=s}let i=e[t];return i!==void 0&&Object.hasOwn(i,n)}function cue(e,t,n,i){let s={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{s[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=i(u);if(d&&d.length){let f=d.sort((p,m)=>{let g=a[p],v=a[m];return(g!==void 0?g: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 g=f[p];if(g===void 0)continue;let v=a[g];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(g,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=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);g!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(i).forEach(p=>{var m;let g=n[p];g!==void 0&&(r[p]=(m=r[g])!=null?m:0)}),r}function due(e,t,n,i){let s=new Jr,r=e.graph(),a=gue(r.nodesep,r.edgesep,i);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function fue(e,t){return Object.values(t).reduce((n,i)=>{let s=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([l,c])=>{let u=bue(e,l)/2;s=Math.max(c+u,s),r=Math.min(c-u,r)});let a=s-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=i-Xa(Math.min,u);a!=="l"&&(d=s-Xa(Math.max,u)),d&&(e[l]=ux(c,f=>f+d))})})}function pue(e,t=void 0){let n=e.ul;return n?ux(n,(i,s)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let l=Object.values(e).map(c=>{let u=c[s];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 mue(e){let t=fg(e),n=Object.assign(rue(e,t),aue(e,t)),i={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=cue(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=uue(e,s,c.root,c.align,l==="r");l==="r"&&(u=ux(u,d=>-d)),i[a+l]=u})});let r=fue(e,i);return hue(i,r),pue(i,e.graph().align)}function gue(e,t,n){return(i,s,r)=>{let a=i.node(s),l=i.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 bue(e,t){return e.node(t).width}function yue(e){e=G9(e),xue(e),Object.entries(mue(e)).forEach(([t,n])=>e.node(t).x=n)}function xue(e){let t=fg(e),n=e.graph(),i=n.ranksep,s=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);s==="top"?u.y=r+u.height/2:s==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+i})}function Eue(e,t={}){let n=t.debugTiming?Y9:W9;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>Iue(e));return n(" runLayout",()=>vue(i,n,t)),n(" updateInputGraph",()=>wue(e,i)),i})}function vue(e,t,n){t(" makeSpaceForEdgeLabels",()=>Rue(e)),t(" removeSelfEdges",()=>Fue(e)),t(" acyclic",()=>uce(e)),t(" nestingGraph.run",()=>Mce(e)),t(" rank",()=>Tce(G9(e))),t(" injectEdgeLabelProxies",()=>jue(e)),t(" removeEmptyRanks",()=>Xle(e)),t(" nestingGraph.cleanup",()=>Pce(e)),t(" normalizeRanks",()=>Wle(e)),t(" assignRankMinMax",()=>Oue(e)),t(" removeEdgeLabelProxies",()=>Mue(e)),t(" normalize.run",()=>hce(e)),t(" parentDummyChains",()=>Ice(e)),t(" addBorderSegments",()=>Bce(e)),t(" order",()=>rU(e,n)),t(" insertSelfEdges",()=>$ue(e)),t(" adjustCoordinateSystem",()=>Fce(e)),t(" position",()=>yue(e)),t(" positionSelfEdges",()=>Hue(e)),t(" removeBorderNodes",()=>Uue(e)),t(" normalize.undo",()=>mce(e)),t(" fixupEdgeLabelCoords",()=>Pue(e)),t(" undoCoordinateSystem",()=>$ce(e)),t(" translateGraph",()=>Lue(e)),t(" assignNodeIntersects",()=>Due(e)),t(" reversePoints",()=>Bue(e)),t(" acyclic.undo",()=>fce(e))}function wue(e,t){e.nodes().forEach(n=>{let i=e.node(n),s=t.node(n);i&&(i.x=s.x,i.y=s.y,i.order=s.order,i.rank=s.rank,t.children(n).length&&(i.width=s.width,i.height=s.height))}),e.edges().forEach(n=>{let i=e.edge(n),s=t.edge(n);i.points=s.points,Object.hasOwn(s,"x")&&(i.x=s.x,i.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var _ue=["nodesep","edgesep","ranksep","marginx","marginy"],Sue={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Nue=["acyclicer","ranker","rankdir","align","rankalign"],Tue=["width","height","rank"],SO={width:0,height:0},kue=["minlen","weight","width","height","labeloffset"],Aue={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Cue=["labelpos"];function Iue(e){let t=new Jr({multigraph:!0,compound:!0}),n=jv(e.graph());return t.setGraph(Object.assign({},Sue,Rv(n,_ue),Yy(n,Nue))),e.nodes().forEach(i=>{let s=jv(e.node(i)),r=Rv(s,Tue);Object.keys(SO).forEach(l=>{r[l]===void 0&&(r[l]=SO[l])}),t.setNode(i,r);let a=e.parent(i);a!==void 0&&t.setParent(i,a)}),e.edges().forEach(i=>{let s=jv(e.edge(i));t.setEdge(i,Object.assign({},Aue,Rv(s,kue),Yy(s,Cue)))}),t}function Rue(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let i=e.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function jue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let i=e.node(t.v),s={rank:(e.node(t.w).rank-i.rank)/2+i.rank,e:t};Xf(e,"edge-proxy",s,"_ep")}})}function Oue(e){let t=0;e.nodes().forEach(n=>{let i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Math.max(t,i.maxRank))}),e.graph().maxRank=t}function Mue(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let i=n;e.edge(i.e).labelRank=n.rank,e.removeNode(t)}})}function Lue(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=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),i=Math.min(i,f-p/2),s=Math.max(s,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,i-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=i}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=i}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=i)}),r.width=n-t+a,r.height=s-i+l}function Due(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),s=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=s,a=i),n.points.unshift(pO(i,r)),n.points.push(pO(s,a))})}function Pue(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 Bue(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Uue(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),i=e.node(n.borderTop),s=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(s.y-i.y),n.x=r.x+n.width/2,n.y=i.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Fue(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 $ue(e){fg(e).forEach(t=>{let n=0;t.forEach((i,s)=>{let r=e.node(i);r.order=s+n,(r.selfEdges||[]).forEach(a=>{Xf(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function Hue(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let i=n,s=e.node(i.e.v),r=s.x+s.width/2,a=s.y,l=n.x-r,c=s.height/2;e.setEdge(i.e,i.label),e.removeNode(t),i.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}],i.label.x=n.x,i.label.y=n.y}})}function Rv(e,t){return ux(Yy(e,t),Number)}function jv(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function zue(e){let t=fg(e),n=new Jr({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+e.node(i).rank)}),e.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),t.forEach((i,s)=>{let r="layer"+s;n.setNode(r,{rank:"same"}),i.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var Vue={graphlib:D9,version:tce,layout:Eue,debug:zue,util:{time:Y9,notime:W9}},NO=Vue;/*! For license information please see dagre.esm.js.LEGAL.txt */const ap={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:nu},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:UP},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:RP},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:dk},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:z1}},xS=220,ES=88,TO=96,kO=34,Dp=64,Ov=310,Cd=24,oU=56,vS=40,AO=40,Gue=18,Kue=58,que=!1,Yue=e=>e==="sequential"||e==="parallel"||e==="loop";function wS(e,t){const n=e.agentType??"llm";return Yue(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function _S(e,t=[],n="horizontal",i=!1){const s=e.agentType??"llm";if(!wS(e,t))return{width:xS,height:ES};if(i&&e.subAgents.length===0)return{width:Ov,height:Dp};const r=e.subAgents.map((f,h)=>_S(f,[...t,h],n,i)),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&&s!=="parallel"?oU:Cd,u=n==="horizontal"?s!=="parallel":s==="parallel",d=r.length?s==="parallel"?Gue+AO:s==="loop"?Kue:0:AO;return u?{width:Math.max(Ov,r.reduce((f,h)=>f+h.width,0)+vS*Math.max(0,r.length-1)+c*2),height:Dp+Cd+l+d+Cd}:{width:Math.max(Ov,a+Cd*2),height:Dp+c+r.reduce((f,h)=>f+h.height,0)+vS*Math.max(0,r.length-1)+d+c}}function Lh(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Wue(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function CO(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Dh(e,t,n,i){const s=(i==null?void 0:i.tone)==="sequential"?"hsl(213 40% 40%)":(i==null?void 0:i.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${i!=null&&i.loop?"-loop":""}`,source:e,target:t,sourceHandle:i!=null&&i.loop?"loop-source":void 0,targetHandle:i!=null&&i.loop?"loop-target":void 0,label:n,type:"insertStep",data:i?{insert:i.insert,loop:i.loop,tone:i.tone}:void 0,animated:i==null?void 0:i.loop,markerEnd:{type:yf.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function IO(e,t,n=!1){const i=[{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}],s=[];function r(d,f,h,p,m){const g=d.agentType??"llm",v=Lh(f);return wS(d,f)?(a(d,f,h,p,m),v):(i.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:g==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:g,description:d.description.trim()||ap[g].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const g=d.agentType??"sequential",v=Lh(f),y=_S(d,f,t,n);i.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":ap[g].label),pattern:g,description:d.description.trim()||ap[g].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)=>_S(T,[...f,k],t,n)),E=x.length&&g!=="parallel"?oU:Cd,w=t==="horizontal"?g!=="parallel":g==="parallel";let N=E;const _=d.subAgents.map((T,k)=>{const C=x[k],I=w?{x:N,y:Dp+Cd}:{x:(y.width-C.width)/2,y:Dp+N};return N+=(w?C.width:C.height)+vS,r(T,[...f,k],v,I,g)});if(g==="sequential"||g==="loop"){for(let T=0;T<_.length-1;T+=1)s.push(Dh(_[T],_[T+1],"然后",{tone:g,insert:{parentPath:f,index:T+1}}));g==="loop"&&_.length>1&&s.push(Dh(_[_.length-1],_[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=Lh(f);if(wS(d,f))return a(d,f),[p];if(i.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()||ap[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((g,v)=>{const y=[...f,v],x=Lh(y);s.push(Dh(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(g,y))}),m},c=Lh([]),u=l(e,[]);return s.push(Dh("terminal-input",c)),u.forEach(d=>s.push(Dh(d,"terminal-output"))),Xue(i,s,t)}function Xue(e,t,n){const i=new NO.graphlib.Graph().setDefaultEdgeLabel(()=>({}));i.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=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";i.setNode(r.id,{width:a?TO:r.data.layoutWidth??xS,height:a?kO:r.data.layoutHeight??ES})}),t.filter(r=>s.has(r.source)&&s.has(r.target)).forEach(r=>i.setEdge(r.source,r.target)),NO.layout(i),{nodes:e.map(r=>{if(r.parentId)return r;const a=i.node(r.id),l=r.data.kind==="terminal",c=l?TO:r.data.layoutWidth??xS,u=l?kO:r.data.layoutHeight??ES;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const fx=b.createContext(null),hx=b.createContext("horizontal");function Que({id:e,sourceX:t,sourceY:n,targetX:i,targetY:s,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=b.useContext(fx),[h,p]=b.useState(!1),[m,g,v]=Vy({sourceX:t,sourceY:n,targetX:i,targetY:s,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(dg,{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(Koe,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}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(ws,{})})]})})]})}function Zue({data:e,selected:t}){const n=b.useContext(fx),i=b.useContext(hx),s=i==="vertical"?We.Top:We.Left,r=i==="vertical"?We.Bottom:We.Right,a=i==="vertical"?We.Right:We.Bottom,l=e.pattern??"llm",c=ap[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(Rs,{type:"target",position:s,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(tc,{})}),o.jsx(Rs,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Rs,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Rs,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Jue({data:e,selected:t}){const n=b.useContext(fx),i=b.useContext(hx),s=i==="vertical"?We.Top:We.Left,r=i==="vertical"?We.Bottom:We.Right,a=i==="vertical"?We.Right:We.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(Rs,{type:"target",position:s,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(ws,{})}),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(ws,{})})]}),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(ws,{}),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(ws,{}),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(tc,{})}),o.jsx(Rs,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Rs,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Rs,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function ede({data:e}){const t=b.useContext(hx);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Rs,{type:"target",position:t==="vertical"?We.Top:We.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Rs,{type:"source",position:t==="vertical"?We.Bottom:We.Right,className:"abc-handle"})]})}const tde={agent:Zue,group:Jue,terminal:ede},nde={insertStep:Que};function ide({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:s,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=b.useMemo(()=>IO(e,c,a),[]),[d,f,h]=A9(u.nodes),[p,m,g]=C9(u.edges),v=Yoe(),y=b.useRef(`${c}:${a?"readonly":"editable"}:${CO(e)}`),x=b.useRef(null),{fitView:E}=lx(),w=b.useMemo(()=>IO(e,c,a),[c,e,a]),[N,_]=b.useState(()=>window.matchMedia("(max-width: 860px)").matches),T=b.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:N?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[N,a]),k=b.useCallback((I=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const O=x.current;if(O&&(O.clientWidth===0||O.clientHeight===0)&&I<8){k(I+1);return}E(T)})})},[T,E]);b.useEffect(()=>{const I=window.matchMedia("(max-width: 860px)"),O=M=>_(M.matches);return I.addEventListener("change",O),()=>I.removeEventListener("change",O)},[]),b.useEffect(()=>{const I=`${c}:${a?"readonly":"editable"}:${CO(e)}`,O=I!==y.current;y.current=I,m(w.edges),f(M=>{const G=new Map(M.map(D=>[D.id,D]));return w.nodes.map(D=>{const F=G.get(D.id);return{...D,measured:!O&&F&&F.type===D.type?F.measured:void 0,position:!O&&F?F.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&Wue(D.data.path,t)}})}),O&&k()},[w,e,k,t,m,f]),b.useEffect(()=>{k()},[N,k]),b.useEffect(()=>{v&&k()},[w,k,v]),b.useEffect(()=>{if(!a||!x.current)return;const I=new ResizeObserver(()=>k());return I.observe(x.current),k(),()=>I.disconnect()},[k,a]);const C=b.useMemo(()=>a?null:{onAdd:i,onInsert:s,onDelete:r},[i,r,s,a]);return o.jsx(hx.Provider,{value:c,children:o.jsx(fx.Provider,{value:C,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(k9,{nodes:d,edges:p,nodeTypes:tde,edgeTypes:nde,onNodesChange:h,onEdgesChange:g,onNodeClick:(I,O)=>{!a&&O.data.kind==="agent"&&O.data.path&&n(O.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(R9,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(O9,{showInteractive:!1}),que]})})})})})}function Am(e){return o.jsx(Gk,{children:o.jsx(ide,{...e})})}const sde="https://ark.cn-beijing.volces.com/api/v3/",Rb=[{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:sde}],Nf=[],RO={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},rde={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},ade="https://api.vikingdb.cn-beijing.volces.com/openviking",ode=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return b.useEffect(()=>{const c=(t==null?void 0:t.target)??nO,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&P8(p))return!1;const g=sO(p.code,l);if(r.current.add(p[g]),iO(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&&(s.current||!E)&&p.preventDefault(),i(!0)}},f=p=>{const m=sO(p.code,l);iO(a,r.current,!0)?(i(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),s.current=!1},h=()=>{r.current.clear(),i(!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,i]),n}function iO(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(s=>t.has(s)))}function sO(e,t){return t.includes(e)?"code":"key"}const Dae=()=>{const e=di();return b.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:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,s,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??s,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:s,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=Vk(t,i,s,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:i,snapGrid:s,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??s,f=n.snapToGrid??r;return Zf(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:s,y:r}=i.getBoundingClientRect(),a=_f(t,n);return{x:a.x+s,y:a.y+r}}}),[])};function c9(e,t){const n=[],i=new Map,s=[];for(const r of e)if(r.type==="add"){s.push(r);continue}else if(r.type==="remove"||r.type==="replace")i.set(r.id,[r]);else{const a=i.get(r.id);a?a.push(r):i.set(r.id,[r])}for(const r of t){const a=i.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)Pae(c,l);n.push(l)}return s.length&&s.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function Pae(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 u9(e,t){return c9(e,t)}function d9(e,t){return c9(e,t)}function Ic(e,t){return{id:e,type:"select",selected:t}}function Id(e,t=new Set,n=!1){const i=[];for(const[s,r]of e){const a=t.has(s);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),i.push(Ic(r.id,a)))}return i}function rO({items:e=[],lookup:t}){var s;const n=[],i=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.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)i.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function aO(e){return{id:e.id,type:"remove"}}const Bae=M8();function f9(e,t,n={}){return ure(e,t,{...n,onError:n.onError??Bae})}const oO=e=>Wse(e),Uae=e=>I8(e);function h9(e){return b.forwardRef(e)}const Fae=typeof window<"u"?b.useLayoutEffect:b.useEffect;function lO(e){const[t,n]=b.useState(BigInt(0)),[i]=b.useState(()=>$ae(()=>n(s=>s+BigInt(1))));return Fae(()=>{const s=i.get();s.length&&(e(s),i.reset())},[t]),i}function $ae(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const p9=b.createContext(null);function Hae({children:e}){const t=di(),n=b.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let g=c;for(const y of l)g=typeof y=="function"?y(g):y;let v=rO({items:g,lookup:h});for(const y of m.values())v=y(v);d&&u(g),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),i=lO(n),s=b.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(rO({items:p,lookup:h}))},[]),r=lO(s),a=b.useMemo(()=>({nodeQueue:i,edgeQueue:r}),[]);return o.jsx(p9.Provider,{value:a,children:e})}function zae(){const e=b.useContext(p9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Vae=e=>!!e.panZoom;function mx(){const e=Dae(),t=di(),n=zae(),i=Kt(Vae),s=b.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=oO(f)?f:h.get(f.id),g=m.parentId?L8(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:g,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return wf(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(g=>{if(g.id===f){const v=typeof h=="function"?h(g):h;return p.replace&&oO(v)?v:{...g,...v}}return g}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(g=>{if(g.id===f){const v=typeof h=="function"?h(g):h;return p.replace&&Uae(v)?v:{...g,...v}}return g}))};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,g,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:g,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:g,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:N,edges:_}=await ere({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),T=_.length>0,k=N.length>0;if(T){const C=_.map(aO);v==null||v(_),x(C)}if(k){const C=N.map(aO);g==null||g(N),y(C)}return(k||T)&&(E==null||E({nodes:N,edges:_})),{deletedNodes:N,deletedEdges:_}},getIntersectingNodes:(f,h=!0,p)=>{const m=Pj(f),g=m?f:c(f),v=p!==void 0;return g?(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=wf(v?y:x),w=Am(E,g);return h&&w>0||w>=E.width*E.height||w>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=Pj(f)?f:c(f);if(!g)return!1;const v=Am(g,h);return p&&v>0||v>=h.width*h.height||v>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Xse(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??ire();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...s,...e,viewportInitialized:i}),[i])}const cO=e=>e.selected,Gae=typeof window<"u"?window:void 0;function Kae({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=di(),{deleteElements:i}=mx(),s=Im(e,{actInsideInputWithModifier:!1}),r=Im(t,{target:Gae});b.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();i({nodes:l.filter(cO),edges:a.filter(cO)}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function qae(e){const t=di();b.useEffect(()=>{const n=()=>{var s,r,a,l;if(!e.current||!(((r=(s=e.current).checkVisibility)==null?void 0:r.call(s))??!0))return!1;const i=Kk(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Ta.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const gx={position:"absolute",width:"100%",height:"100%",top:0,left:0},Yae=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Wae({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:r=Wc.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:g,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const N=di(),_=b.useRef(null),{userSelectionActive:T,lib:k,connectionInProgress:C}=Kt(Yae,ui),I=Im(h),O=b.useRef();qae(_);const L=b.useCallback(G=>{y==null||y({x:G[0],y:G[1],zoom:G[2]}),x||N.setState({transform:G})},[y,x]);return b.useEffect(()=>{if(_.current){O.current=Fre({domNode:_.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>N.setState(j=>j.paneDragging===A?j:{paneDragging:A}),onPanZoomStart:(A,j)=>{const{onViewportChangeStart:P,onMoveStart:$}=N.getState();$==null||$(A,j),P==null||P(j)},onPanZoom:(A,j)=>{const{onViewportChange:P,onMove:$}=N.getState();$==null||$(A,j),P==null||P(j)},onPanZoomEnd:(A,j)=>{const{onViewportChangeEnd:P,onMoveEnd:$}=N.getState();$==null||$(A,j),P==null||P(j)}});const{x:G,y:D,zoom:F}=O.current.getViewport();return N.setState({panZoom:O.current,transform:[G,D,F],domNode:_.current.closest(".react-flow")}),()=>{var A;(A=O.current)==null||A.destroy()}}},[]),b.useEffect(()=>{var G;(G=O.current)==null||G.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:v,userSelectionActive:T,noWheelClassName:g,lib:k,onTransformChange:L,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,i,s,r,a,l,I,p,v,T,g,k,L,C,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:_,style:gx,children:m})}const Xae=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qae(){const{userSelectionActive:e,userSelectionRect:t}=Kt(Xae,ui);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 jv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Zae=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Jae({isSelecting:e,selectionKeyPressed:t,selectionMode:n=km.Full,panOnDrag:i,autoPanOnSelection:s,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:g}){const v=b.useRef(0),y=di(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:N,panBy:_,autoPanSpeed:T}=Kt(Zae,ui),k=E&&(e||x),C=b.useRef(null),I=b.useRef(),O=b.useRef(new Set),L=b.useRef(new Set),G=b.useRef(!1),D=b.useRef({x:0,y:0}),F=b.useRef(!1),A=q=>{if(G.current||N){G.current=!1;return}u==null||u(q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},j=q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){q.preventDefault();return}d==null||d(q)},P=f?q=>f(q):void 0,$=q=>{G.current&&(q.stopPropagation(),G.current=!1)},R=q=>{var Ne,ve;const{domNode:ce,transform:me}=y.getState();if(I.current=ce==null?void 0:ce.getBoundingClientRect(),!I.current)return;const _e=q.target===C.current;if(!_e&&!!q.target.closest(".nokey")||!e||!(a&&_e||t)||q.button!==0||!q.isPrimary)return;(ve=(Ne=q.target)==null?void 0:Ne.setPointerCapture)==null||ve.call(Ne,q.pointerId),G.current=!1;const{x:Oe,y:Ee}=va(q.nativeEvent,I.current),ae=Zf({x:Oe,y:Ee},me);y.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:Oe,y:Ee}}),_e||(q.stopPropagation(),q.preventDefault())};function Y(q,ce){const{userSelectionRect:me}=y.getState();if(!me)return;const{transform:_e,nodeLookup:de,edgeLookup:ge,connectionLookup:Oe,triggerNodeChanges:Ee,triggerEdgeChanges:ae,defaultEdgeOptions:Ne}=y.getState(),ve={x:me.startX,y:me.startY},{x:Qe,y:Me}=_f(ve,_e),ze={startX:ve.x,startY:ve.y,x:qKe.id)),L.current=new Set;const Pe=(Ne==null?void 0:Ne.selectable)??!0;for(const Ke of O.current){const Q=Oe.get(Ke);if(Q)for(const{edgeId:oe}of Q.values()){const ie=ge.get(oe);ie&&(ie.selectable??Pe)&&L.current.add(oe)}}if(!Bj(Se,O.current)){const Ke=Id(de,O.current,!0);Ee(Ke)}if(!Bj(Ue,L.current)){const Ke=Id(ge,L.current);ae(Ke)}y.setState({userSelectionRect:ze,userSelectionActive:!0,nodesSelectionActive:!1})}function Z(){if(!s||!I.current)return;const[q,ce]=zk(D.current,I.current,T);_({x:q,y:ce}).then(me=>{if(!G.current||!me){v.current=requestAnimationFrame(Z);return}const{x:_e,y:de}=D.current;Y(_e,de),v.current=requestAnimationFrame(Z)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};b.useEffect(()=>()=>B(),[]);const te=q=>{const{userSelectionRect:ce,transform:me,resetSelectedElements:_e}=y.getState();if(!I.current||!ce)return;const{x:de,y:ge}=va(q.nativeEvent,I.current);D.current={x:de,y:ge};const Oe=_f({x:ce.startX,y:ce.startY},me);if(!G.current){const Ee=t?0:r;if(Math.hypot(de-Oe.x,ge-Oe.y)<=Ee)return;_e(),l==null||l(q)}G.current=!0,F.current||(Z(),F.current=!0),Y(de,ge)},K=q=>{var ce,me;q.button===0&&((me=(ce=q.target)==null?void 0:ce.releasePointerCapture)==null||me.call(ce,q.pointerId),!x&&q.target===C.current&&y.getState().userSelectionRect&&(A==null||A(q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(c==null||c(q),y.setState({nodesSelectionActive:O.current.size>0})),B())},z=q=>{var ce,me;(me=(ce=q.target)==null?void 0:ce.releasePointerCapture)==null||me.call(ce,q.pointerId),B()},W=i===!0||Array.isArray(i)&&i.includes(0);return o.jsxs("div",{className:Qi(["react-flow__pane",{draggable:W,dragging:w,selection:e}]),onClick:k?void 0:jv(A,C),onContextMenu:jv(j,C),onWheel:jv(P,C),onPointerEnter:k?void 0:h,onPointerMove:k?te:p,onPointerUp:k?K:void 0,onPointerCancel:k?z:void 0,onPointerDownCapture:k?R:void 0,onClickCapture:k?$:void 0,onPointerLeave:m,ref:C,style:gx,children:[g,o.jsx(Qae,{})]})}function SS({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Ta.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):s([e])}function m9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:s,isSelectable:r,nodeClickDistance:a}){const l=di(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=Tre({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{SS({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),b.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:r,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,r,e,s,a]),c}const eoe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function g9(){const e=di();return b.useCallback(n=>{const{nodeExtent:i,snapToGrid:s,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=eoe(a),p=s?r[0]:5,m=s?r[1]:5,g=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+g,y:y.internals.positionAbsolute.y+v};s&&(x=mg(x,r));const{position:E,positionAbsolute:w}=R8({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const Zk=b.createContext(null),toe=Zk.Provider;Zk.Consumer;const b9=()=>b.useContext(Zk),noe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ioe=(e,t,n)=>i=>{const{connectionClickStartHandle:s,connectionMode:r,connection:a}=i,{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:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:r===xf.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:!!s,valid:d&&u}};function soe({type:e="source",position:t=Ye.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,A;const m=a||null,g=e==="target",v=di(),y=b9(),{connectOnClick:x,noPanClassName:E,rfId:w}=Kt(noe,ui),{connectingFrom:N,connectingTo:_,clickConnecting:T,isPossibleEndHandle:k,connectionInProcess:C,clickConnectionInProcess:I,valid:O}=Kt(ioe(y,m,e),ui);y||(A=(F=v.getState()).onError)==null||A.call(F,"010",Ta.error010());const L=j=>{const{defaultEdgeOptions:P,onConnect:$,hasDefaultEdges:R}=v.getState(),Y={...P,...j};if(R){const{edges:Z,setEdges:B,onError:te}=v.getState();B(f9(Y,Z,{onError:te}))}$==null||$(Y),l==null||l(Y)},G=j=>{if(!y)return;const P=B8(j.nativeEvent);if(s&&(P&&j.button===0||!P)){const $=v.getState();_S.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:g,handleId:m,nodeId:y,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...R)=>{var Y,Z;return(Z=(Y=v.getState()).onConnectEnd)==null?void 0:Z.call(Y,...R)},updateConnection:$.updateConnection,onConnect:L,isValidConnection:n||((...R)=>{var Y,Z;return((Z=(Y=v.getState()).isValidConnection)==null?void 0:Z.call(Y,...R))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}P?d==null||d(j):f==null||f(j)},D=j=>{const{onClickConnectStart:P,onClickConnectEnd:$,connectionClickStartHandle:R,connectionMode:Y,isValidConnection:Z,lib:B,rfId:te,nodeLookup:K,connection:z}=v.getState();if(!y||!R&&!s)return;if(!R){P==null||P(j.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const W=D8(j.target),q=n||Z,{connection:ce,isValid:me}=_S.isValid(j.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:Y,fromNodeId:R.nodeId,fromHandleId:R.id||null,fromType:R.type,isValidConnection:q,flowId:te,doc:W,lib:B,nodeLookup:K});me&&ce&&L(ce);const _e=structuredClone(z);delete _e.inProgress,_e.toPosition=_e.toHandle?_e.toHandle.position:null,$==null||$(j,_e),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:Qi(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!g,target:g,connectable:i,connectablestart:s,connectableend:r,clickconnecting:T,connectingfrom:N,connectingto:_,valid:O,connectionindicator:i&&(!C||k)&&(C||I?r:s)}]),onMouseDown:G,onTouchStart:G,onClick:x?D:void 0,ref:p,...h,children:c})}const Ms=b.memo(h9(soe));function roe({data:e,isConnectable:t,sourcePosition:n=Ye.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Ms,{type:"source",position:n,isConnectable:t})]})}function aoe({data:e,isConnectable:t,targetPosition:n=Ye.Top,sourcePosition:i=Ye.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Ms,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Ms,{type:"source",position:i,isConnectable:t})]})}function ooe(){return null}function loe({data:e,isConnectable:t,targetPosition:n=Ye.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Ms,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Qy={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},uO={input:roe,default:aoe,output:loe,group:ooe};function coe(e){var t,n,i,s;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??((i=e.style)==null?void 0:i.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const uoe=e=>{const{width:t,height:n,x:i,y:s}=pg(e.nodeLookup,{filter:r=>!!r.selected});return{width:Ea(t)?t:null,height:Ea(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${s}px)`}};function doe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=di(),{width:s,height:r,transformString:a,userSelectionActive:l}=Kt(uoe,ui),c=g9(),u=b.useRef(null);b.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&r!==null;if(m9({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=i.getState().nodes.filter(g=>g.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Qy,p.key)&&(p.preventDefault(),c({direction:Qy[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Qi(["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:s,height:r}})})}const dO=typeof window<"u"?window:void 0,foe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function y9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:g,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:k,autoPanOnSelection:C,defaultViewport:I,translateExtent:O,minZoom:L,maxZoom:G,preventScrolling:D,onSelectionContextMenu:F,noWheelClassName:A,noPanClassName:j,disableKeyboardA11y:P,onViewportChange:$,isControlledViewport:R}){const{nodesSelectionActive:Y,userSelectionActive:Z}=Kt(foe,ui),B=Im(u,{target:dO}),te=Im(g,{target:dO}),K=te||k,z=te||w,W=d&&K!==!0,q=B||Z||W;return Kae({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(Wae,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:z,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:T,panOnDrag:!B&&K,defaultViewport:I,translateExtent:O,minZoom:L,maxZoom:G,zoomActivationKeyCode:v,preventScrolling:D,noWheelClassName:A,noPanClassName:j,onViewportChange:$,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:W,children:o.jsxs(Jae,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:K,autoPanOnSelection:C,isSelecting:!!q,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:W,children:[e,Y&&o.jsx(doe,{onSelectionContextMenu:F,noPanClassName:j,disableKeyboardA11y:P})]})})}y9.displayName="FlowRenderer";const hoe=b.memo(y9),poe=e=>t=>e?Hk(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 moe(e){return Kt(b.useCallback(poe(e),[e]),ui)}const goe=e=>e.updateNodeInternals;function boe(){const e=Kt(goe),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(s=>{const r=s.target.getAttribute("data-id");i.set(r,{id:r,nodeElement:s.target,force:!0})}),e(i)}));return b.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function yoe({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const s=di(),r=b.useRef(null),a=b.useRef(null),l=b.useRef(e.sourcePosition),c=b.useRef(e.targetPosition),u=b.useRef(t),d=n&&!!e.internals.handleBounds;return b.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(r.current),a.current=r.current)},[d,e.hidden]),b.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.current=null)},[]),b.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,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function xoe({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:s,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:g,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:N}=Kt(q=>{const ce=q.nodeLookup.get(e),me=q.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:me}},ui);let _=E.type||"default",T=(v==null?void 0:v[_])||uO[_];T===void 0&&(x==null||x("003",Ta.error003(_)),_="default",T=(v==null?void 0:v.default)||uO.default);const k=!!(E.draggable||l&&typeof E.draggable>"u"),C=!!(E.selectable||c&&typeof E.selectable>"u"),I=!!(E.connectable||u&&typeof E.connectable>"u"),O=!!(E.focusable||d&&typeof E.focusable>"u"),L=di(),G=Gk(E),D=yoe({node:E,nodeType:_,hasDimensions:G,resizeObserver:f}),F=m9({nodeRef:D,disabled:E.hidden||!k,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),A=g9();if(E.hidden)return null;const j=Jo(E),P=coe(E),$=C||k||t||n||i||s,R=n?q=>n(q,{...w.userNode}):void 0,Y=i?q=>i(q,{...w.userNode}):void 0,Z=s?q=>s(q,{...w.userNode}):void 0,B=r?q=>r(q,{...w.userNode}):void 0,te=a?q=>a(q,{...w.userNode}):void 0,K=q=>{const{selectNodesOnDrag:ce,nodeDragThreshold:me}=L.getState();C&&(!ce||!k||me>0)&&SS({id:e,store:L,nodeRef:D}),t&&t(q,{...w.userNode})},z=q=>{if(!(P8(q.nativeEvent)||m)){if(T8.includes(q.key)&&C){const ce=q.key==="Escape";SS({id:e,store:L,unselect:ce,nodeRef:D})}else if(k&&E.selected&&Object.prototype.hasOwnProperty.call(Qy,q.key)){q.preventDefault();const{ariaLabelConfig:ce}=L.getState();L.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:q.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),A({direction:Qy[q.key],factor:q.shiftKey?4:1})}}},W=()=>{var Oe;if(m||!((Oe=D.current)!=null&&Oe.matches(":focus-visible")))return;const{transform:q,width:ce,height:me,autoPanOnNodeFocus:_e,setCenter:de}=L.getState();if(!_e)return;Hk(new Map([[e,E]]),{x:0,y:0,width:ce,height:me},q,!0).length>0||de(E.position.x+j.width/2,E.position.y+j.height/2,{zoom:q[2]})};return o.jsx("div",{className:Qi(["react-flow__node",`react-flow__node-${_}`,{[p]:k},E.className,{selected:E.selected,selectable:C,parent:N,draggable:k,dragging:F}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:G?"visible":"hidden",...E.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:Y,onMouseLeave:Z,onContextMenu:B,onClick:K,onDoubleClick:te,onKeyDown:O?z:void 0,tabIndex:O?0:void 0,onFocus:O?W:void 0,role:E.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${a9}-${g}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(toe,{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:C,draggable:k,deletable:E.deletable??!0,isConnectable:I,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...j})})})}var Eoe=b.memo(xoe);const voe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function x9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,onError:r}=Kt(voe,ui),a=moe(e.onlyRenderVisibleElements),l=boe();return o.jsx("div",{className:"react-flow__nodes",style:gx,children:a.map(c=>o.jsx(Eoe,{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:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}x9.displayName="NodeRenderer";const woe=b.memo(x9);function _oe(e){return Kt(b.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const i=[];if(n.width&&n.height)for(const s of n.edges){const r=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);r&&a&&ore({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(s.id)}return i},[e]),ui)}const Soe=({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"})},Noe=({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"})},fO={[Ef.Arrow]:Soe,[Ef.ArrowClosed]:Noe};function Toe(e){const t=di();return b.useMemo(()=>{var s,r;return Object.prototype.hasOwnProperty.call(fO,e)?fO[e]:((r=(s=t.getState()).onError)==null||r.call(s,"009",Ta.error009(e)),null)},[e])}const koe=({id:e,type:t,color:n,width:i=12.5,height:s=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=Toe(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},E9=({defaultColor:e,rfId:t})=>{const n=Kt(r=>r.edges),i=Kt(r=>r.defaultEdgeOptions),s=b.useMemo(()=>mre(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return s.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:s.map(r=>o.jsx(koe,{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};E9.displayName="MarkerDefinitions";var Aoe=b.memo(E9);function v9({x:e,y:t,label:n,labelStyle:i,labelShowBg:s=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=Qi(["react-flow__edge-textwrapper",u]),m=b.useRef(null);return b.useEffect(()=>{if(m.current){const g=m.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.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:[s&&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:i,children:n}),c]}):null}v9.displayName="EdgeText";const Coe=b.memo(v9);function gg({path:e,labelX:t,labelY:n,label:i,labelStyle:s,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:Qi(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Ea(t)&&Ea(n)?o.jsx(Coe,{x:t,y:n,label:i,labelStyle:s,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function hO({pos:e,x1:t,y1:n,x2:i,y2:s}){return e===Ye.Left||e===Ye.Right?[.5*(t+i),n]:[t,.5*(n+s)]}function w9({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:i,targetY:s,targetPosition:r=Ye.Top}){const[a,l]=hO({pos:n,x1:e,y1:t,x2:i,y2:s}),[c,u]=hO({pos:r,x1:i,y1:s,x2:e,y2:t}),[d,f,h,p]=U8({sourceX:e,sourceY:t,targetX:i,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${i},${s}`,d,f,h,p]}function _9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:y})=>{const[x,E,w]=w9({sourceX:n,sourceY:i,sourcePosition:a,targetX:s,targetY:r,targetPosition:l}),N=e.isInternal?void 0:t;return o.jsx(gg,{id:N,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:y})})}const Ioe=_9({isInternal:!1}),S9=_9({isInternal:!0});Ioe.displayName="SimpleBezierEdge";S9.displayName="SimpleBezierEdgeInternal";function N9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Ye.Bottom,targetPosition:m=Ye.Top,markerEnd:g,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,N]=Xy({sourceX:n,sourceY:i,sourcePosition:p,targetX:s,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(gg,{id:_,path:E,labelX:w,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:v,interactionWidth:x})})}const T9=N9({isInternal:!1}),k9=N9({isInternal:!0});T9.displayName="SmoothStepEdge";k9.displayName="SmoothStepEdgeInternal";function A9(e){return b.memo(({id:t,...n})=>{var s;const i=e.isInternal?void 0:t;return o.jsx(T9,{...n,id:i,pathOptions:b.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Roe=A9({isInternal:!1}),C9=A9({isInternal:!0});Roe.displayName="StepEdge";C9.displayName="StepEdgeInternal";function I9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})=>{const[v,y,x]=H8({sourceX:n,sourceY:i,targetX:s,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(gg,{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:g})})}const joe=I9({isInternal:!1}),R9=I9({isInternal:!0});joe.displayName="StraightEdge";R9.displayName="StraightEdgeInternal";function j9(e){return b.memo(({id:t,sourceX:n,sourceY:i,targetX:s,targetY:r,sourcePosition:a=Ye.Bottom,targetPosition:l=Ye.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,N]=F8({sourceX:n,sourceY:i,sourcePosition:a,targetX:s,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),_=e.isInternal?void 0:t;return o.jsx(gg,{id:_,path:E,labelX:w,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:v,interactionWidth:x})})}const Ooe=j9({isInternal:!1}),O9=j9({isInternal:!0});Ooe.displayName="BezierEdge";O9.displayName="BezierEdgeInternal";const pO={default:O9,straight:R9,step:C9,smoothstep:k9,simplebezier:S9},mO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Moe=(e,t,n)=>n===Ye.Left?e-t:n===Ye.Right?e+t:e,Loe=(e,t,n)=>n===Ye.Top?e-t:n===Ye.Bottom?e+t:e,gO="react-flow__edgeupdater";function bO({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:s,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:s,onMouseEnter:r,onMouseOut:a,className:Qi([gO,`${gO}-${l}`]),cx:Moe(t,i,e),cy:Loe(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Doe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:s,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=di(),g=(w,N)=>{if(w.button!==0)return;const{autoPanOnConnect:_,domNode:T,connectionMode:k,connectionRadius:C,lib:I,onConnectStart:O,cancelConnection:L,nodeLookup:G,rfId:D,panBy:F,updateConnection:A}=m.getState(),j=N.type==="target",P=(Y,Z)=>{h(!1),f==null||f(Y,n,N.type,Z)},$=Y=>u==null?void 0:u(n,Y),R=(Y,Z)=>{h(!0),d==null||d(w,n,N.type),O==null||O(Y,Z)};_S.onPointerDown(w.nativeEvent,{autoPanOnConnect:_,connectionMode:k,connectionRadius:C,domNode:T,handleId:N.id,nodeId:N.nodeId,nodeLookup:G,isTarget:j,edgeUpdaterType:N.type,lib:I,flowId:D,cancelConnection:L,panBy:F,isValidConnection:(...Y)=>{var Z,B;return((B=(Z=m.getState()).isValidConnection)==null?void 0:B.call(Z,...Y))??!0},onConnect:$,onConnectStart:R,onConnectEnd:(...Y)=>{var Z,B;return(B=(Z=m.getState()).onConnectEnd)==null?void 0:B.call(Z,...Y)},onReconnectEnd:P,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>g(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>g(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(bO,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(bO,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function Poe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:s,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:g,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=Kt(de=>de.edgeLookup.get(e));const w=Kt(de=>de.defaultEdgeOptions);E=w?{...w,...E}:E;let N=E.type||"default",_=(g==null?void 0:g[N])||pO[N];_===void 0&&(y==null||y("011",Ta.error011(N)),N="default",_=(g==null?void 0:g.default)||pO.default);const T=!!(E.focusable||t&&typeof E.focusable>"u"),k=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),C=!!(E.selectable||i&&typeof E.selectable>"u"),I=b.useRef(null),[O,L]=b.useState(!1),[G,D]=b.useState(!1),F=di(),{zIndex:A,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z}=Kt(b.useCallback(de=>{const ge=de.nodeLookup.get(E.source),Oe=de.nodeLookup.get(E.target);if(!ge||!Oe)return{zIndex:E.zIndex,...mO};const Ee=pre({id:e,sourceNode:ge,targetNode:Oe,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:de.connectionMode,onError:y});return{zIndex:are({selected:E.selected,zIndex:E.zIndex,sourceNode:ge,targetNode:Oe,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Ee||mO}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),ui),B=b.useMemo(()=>E.markerStart?`url('#${vS(E.markerStart,m)}')`:void 0,[E.markerStart,m]),te=b.useMemo(()=>E.markerEnd?`url('#${vS(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||j===null||P===null||$===null||R===null)return null;const K=de=>{var ae;const{addSelectedEdges:ge,unselectNodesAndEdges:Oe,multiSelectionActive:Ee}=F.getState();C&&(F.setState({nodesSelectionActive:!1}),E.selected&&Ee?(Oe({nodes:[],edges:[E]}),(ae=I.current)==null||ae.blur()):ge([e])),s&&s(de,E)},z=r?de=>{r(de,{...E})}:void 0,W=a?de=>{a(de,{...E})}:void 0,q=l?de=>{l(de,{...E})}:void 0,ce=c?de=>{c(de,{...E})}:void 0,me=u?de=>{u(de,{...E})}:void 0,_e=de=>{var ge;if(!x&&T8.includes(de.key)&&C){const{unselectNodesAndEdges:Oe,addSelectedEdges:Ee}=F.getState();de.key==="Escape"?((ge=I.current)==null||ge.blur(),Oe({edges:[E]})):Ee([e])}};return o.jsx("svg",{style:{zIndex:A},children:o.jsxs("g",{className:Qi(["react-flow__edge",`react-flow__edge-${N}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!C&&!s,updating:O,selectable:C}]),onClick:K,onDoubleClick:z,onContextMenu:W,onMouseEnter:q,onMouseMove:ce,onMouseLeave:me,onKeyDown:T?_e: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?`${o9}-${m}`:void 0,ref:I,...E.domAttributes,children:[!G&&o.jsx(_,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:C,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:B,markerEnd:te,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),k&&o.jsx(Doe,{edge:E,isReconnectable:k,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:j,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:Z,setUpdateHover:L,setReconnecting:D})]})})}var Boe=b.memo(Poe);const Uoe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function M9({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:s,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:g}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=Kt(Uoe,ui),w=_oe(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(Aoe,{defaultColor:e,rfId:n}),w.map(N=>o.jsx(Boe,{id:N,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:s,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:i,disableKeyboardA11y:g},N))]})}M9.displayName="EdgeRenderer";const Foe=b.memo(M9),$oe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Hoe({children:e}){const t=Kt($oe);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function zoe(e){const t=mx(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Voe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Goe(e){const t=Kt(Voe),n=di();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Koe(e){return e.connection.inProgress?{...e.connection,to:Zf(e.connection.to,e.transform)}:{...e.connection}}function qoe(e){return Koe}function Yoe(e){const t=qoe();return Kt(t,ui)}const Woe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Xoe({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:s,width:r,height:a,isValid:l,inProgress:c}=Kt(Woe,ui);return!(r&&s&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Qi(["react-flow__connection",C8(l)]),children:o.jsx(L9,{style:t,type:n,CustomComponent:i,isValid:l})})})}const L9=({style:e,type:t=Cl.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:s,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Yoe();if(!s)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:C8(i),toNode:d,toHandle:f,pointer:p});let m="";const g={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Cl.Bezier:[m]=F8(g);break;case Cl.SimpleBezier:[m]=w9(g);break;case Cl.Step:[m]=Xy({...g,borderRadius:0});break;case Cl.SmoothStep:[m]=Xy(g);break;default:[m]=H8(g)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};L9.displayName="ConnectionLine";const Qoe={};function yO(e=Qoe){b.useRef(e),di(),b.useEffect(()=>{},[e])}function Zoe(){di(),b.useRef(!1),b.useEffect(()=>{},[])}function D9({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:g,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:T,deleteKeyCode:k,onlyRenderVisibleElements:C,elementsSelectable:I,defaultViewport:O,translateExtent:L,minZoom:G,maxZoom:D,preventScrolling:F,defaultMarkerColor:A,zoomOnScroll:j,zoomOnPinch:P,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,zoomOnDoubleClick:Z,panOnDrag:B,autoPanOnSelection:te,onPaneClick:K,onPaneMouseEnter:z,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneScroll:ce,onPaneContextMenu:me,paneClickDistance:_e,nodeClickDistance:de,onEdgeContextMenu:ge,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ee,onEdgeMouseLeave:ae,reconnectRadius:Ne,onReconnect:ve,onReconnectStart:Qe,onReconnectEnd:Me,noDragClassName:ze,noWheelClassName:Se,noPanClassName:Ue,disableKeyboardA11y:Pe,nodeExtent:Ke,rfId:Q,viewport:oe,onViewportChange:ie}){return yO(e),yO(t),Zoe(),zoe(n),Goe(oe),o.jsx(hoe,{onPaneClick:K,onPaneMouseEnter:z,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneContextMenu:me,onPaneScroll:ce,paneClickDistance:_e,deleteKeyCode:k,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:T,elementsSelectable:I,zoomOnScroll:j,zoomOnPinch:P,zoomOnDoubleClick:Z,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,panOnDrag:B,autoPanOnSelection:te,defaultViewport:O,translateExtent:L,minZoom:G,maxZoom:D,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:ze,noWheelClassName:Se,noPanClassName:Ue,disableKeyboardA11y:Pe,onViewportChange:ie,isControlledViewport:!!oe,children:o.jsxs(Hoe,{children:[o.jsx(Foe,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:ve,onReconnectStart:Qe,onReconnectEnd:Me,onlyRenderVisibleElements:C,onEdgeContextMenu:ge,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ee,onEdgeMouseLeave:ae,reconnectRadius:Ne,defaultMarkerColor:A,noPanClassName:Ue,disableKeyboardA11y:Pe,rfId:Q}),o.jsx(Xoe,{style:g,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(woe,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:de,onlyRenderVisibleElements:C,noPanClassName:Ue,noDragClassName:ze,disableKeyboardA11y:Pe,nodeExtent:Ke,rfId:Q}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}D9.displayName="GraphView";const Joe=b.memo(D9),ele=M8(),xO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,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,g=new Map,v=new Map,y=i??t??[],x=n??e??[],E=d??[0,0],w=f??Tm;G8(g,v,y);const{nodesInitialized:N}=wS(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let _=[0,0,1];if(a&&s&&r){const T=pg(p,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:k,y:C,zoom:I}=Vk(T,s,r,c,u,(l==null?void 0:l.padding)??.1);_=[k,C,I]}return{rfId:"1",width:s??0,height:r??0,transform:_,nodes:x,nodesInitialized:N,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Tm,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:xf.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:{...A8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ele,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:k8,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},tle=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>bae((p,m)=>{async function g(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:N,minZoom:_,maxZoom:T}=m();y&&(await Jse({nodes:v,width:w,height:N,panZoom:y,minZoom:_,maxZoom:T},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...xO({nodes:e,edges:t,width:s,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:N,zIndexMode:_,nodesSelectionActive:T}=m(),{nodesInitialized:k,hasSelectedNodes:C}=wS(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:_}),I=T&&C;N&&k?(g(),p({nodes:v,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:v,nodesInitialized:k,nodesSelectionActive:I})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();G8(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:N,nodeExtent:_,debug:T,fitViewQueued:k,zIndexMode:C}=m(),{changes:I,updatedInternals:O}=wre(v,x,E,w,N,_,C);O&&(yre(x,E,{nodeOrigin:N,nodeExtent:_,zIndexMode:C}),k?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(T&&console.log("React Flow: trigger node changes",I),y==null||y(I)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:N,connection:_,updateConnection:T,onNodesChangeMiddlewareMap:k}=m();for(const[C,I]of v){const O=w.get(C),L=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(I!=null&&I.position)),G={id:C,type:"position",position:L?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:y};if(O&&_.inProgress&&_.fromNode.id===O.id){const D=uu(O,_.fromHandle,Ye.Left,!0);T({..._,from:D})}L&&O.parentId&&x.push({id:C,parentId:O.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),E.push(G)}if(x.length>0){const{parentLookup:C,nodeOrigin:I}=m(),O=Qk(x,w,C,I);E.push(...O)}for(const C of k.values())E=C(E);N(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:N}=m();if(v!=null&&v.length){if(w){const _=u9(v,E);x(_)}N&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:N}=m();if(v!=null&&v.length){if(w){const _=d9(v,E);x(_)}N&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:N}=m();if(y){const _=v.map(T=>Ic(T,!0));w(_);return}w(Id(E,new Set([...v]),!0)),N(Id(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:N}=m();if(y){const _=v.map(T=>Ic(T,!0));N(_);return}N(Id(x,new Set([...v]))),w(Id(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:_}=m(),T=v||E,k=y||x,C=[];for(const O of T){if(!O.selected)continue;const L=w.get(O.id);L&&(L.selected=!1),C.push(Ic(O.id,!1))}const I=[];for(const O of k)O.selected&&I.push(Ic(O.id,!1));N(C),_(I)},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 N=y.reduce((T,k)=>k.selected?[...T,Ic(k.id,!1)]:T,[]),_=v.reduce((T,k)=>k.selected?[...T,Ic(k.id,!1)]:T,[]);x(N),E(_)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:N,nodeExtent:_,zIndexMode:T}=m();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(wS(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:T}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:N}=m();return _re({delta:v,panZoom:w,transform:y,translateExtent:N,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:N,panZoom:_}=m();if(!_)return!1;const T=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:N;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:{...A8}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...xO()})}},Object.is);function Jk({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:s,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=b.useState(()=>tle({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:s,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(yae,{value:m,children:o.jsx(Hae,{children:p})})}function nle({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(hx)?o.jsx(o.Fragment,{children:e}):o.jsx(Jk,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:s,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const ile={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function sle({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:s,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:C,onNodesDelete:I,onEdgesDelete:O,onDelete:L,onSelectionChange:G,onSelectionDragStart:D,onSelectionDrag:F,onSelectionDragStop:A,onSelectionContextMenu:j,onSelectionStart:P,onSelectionEnd:$,onBeforeDelete:R,connectionMode:Y,connectionLineType:Z=Cl.Bezier,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:K,deleteKeyCode:z="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:q=!1,selectionMode:ce=km.Full,panActivationKeyCode:me="Space",multiSelectionKeyCode:_e=Cm()?"Meta":"Control",zoomActivationKeyCode:de=Cm()?"Meta":"Control",snapToGrid:ge,snapGrid:Oe,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:ae,nodesDraggable:Ne,autoPanOnNodeFocus:ve,nodesConnectable:Qe,nodesFocusable:Me,nodeOrigin:ze=l9,edgesFocusable:Se,edgesReconnectable:Ue,elementsSelectable:Pe=!0,defaultViewport:Ke=Rae,minZoom:Q=.5,maxZoom:oe=2,translateExtent:ie=Tm,preventScrolling:be=!0,nodeExtent:Le,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:gt=!0,zoomOnPinch:lt=!0,panOnScroll:ln=!1,panOnScrollSpeed:Mt=.5,panOnScrollMode:kt=Wc.Free,zoomOnDoubleClick:Vt=!0,panOnDrag:He=!0,onPaneClick:Xt,onPaneMouseEnter:nt,onPaneMouseMove:yt,onPaneMouseLeave:Je,onPaneScroll:ot,onPaneContextMenu:ye,paneClickDistance:Xe=1,nodeClickDistance:St=0,children:Qt,onReconnect:Rn,onReconnectStart:Bt,onReconnectEnd:Ze,onEdgeContextMenu:cn,onEdgeDoubleClick:un,onEdgeMouseEnter:Et,onEdgeMouseMove:nn,onEdgeMouseLeave:Ci,reconnectRadius:ii=10,onNodesChange:Dn,onEdgesChange:Pn,noDragClassName:gn="nodrag",noWheelClassName:_n="nowheel",noPanClassName:Bn="nopan",fitView:$i,fitViewOptions:gs,connectOnClick:Ii,attributionPosition:Ri,proOptions:Un,defaultEdgeOptions:vi,elevateNodesOnSelect:Sn=!0,elevateEdgesOnSelect:si=!1,disableKeyboardA11y:ji=!1,autoPanOnConnect:Oi,autoPanOnNodeDrag:bn,autoPanOnSelection:jn=!0,autoPanSpeed:Fn,connectionRadius:$n,isValidConnection:yn,onError:_t,style:ue,id:fe,nodeDragThreshold:De,connectionDragThreshold:We,viewport:rt,onViewportChange:at,width:sn,height:rn,colorMode:fi="light",debug:Zi,onScroll:dn,ariaLabelConfig:Hn,zIndexMode:Ut="basic",...vt},wi){const bs=fe||"1",lo=Lae(fi),rs=b.useCallback(Us=>{Us.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),dn==null||dn(Us)},[dn]);return o.jsx("div",{"data-testid":"rf__wrapper",...vt,onScroll:rs,style:{...ue,...ile},ref:wi,className:Qi(["react-flow",s,lo]),id:fe,role:"application",children:o.jsxs(nle,{nodes:e,edges:t,width:sn,height:rn,fitView:$i,fitViewOptions:gs,minZoom:Q,maxZoom:oe,nodeOrigin:ze,nodeExtent:Le,zIndexMode:Ut,children:[o.jsx(Mae,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:Ne,autoPanOnNodeFocus:ve,nodesConnectable:Qe,nodesFocusable:Me,edgesFocusable:Se,edgesReconnectable:Ue,elementsSelectable:Pe,elevateNodesOnSelect:Sn,elevateEdgesOnSelect:si,minZoom:Q,maxZoom:oe,nodeExtent:Le,onNodesChange:Dn,onEdgesChange:Pn,snapToGrid:ge,snapGrid:Oe,connectionMode:Y,translateExtent:ie,connectOnClick:Ii,defaultEdgeOptions:vi,fitView:$i,fitViewOptions:gs,onNodesDelete:I,onEdgesDelete:O,onDelete:L,onNodeDragStart:T,onNodeDrag:k,onNodeDragStop:C,onSelectionDrag:F,onSelectionDragStart:D,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Bn,nodeOrigin:ze,rfId:bs,autoPanOnConnect:Oi,autoPanOnNodeDrag:bn,autoPanSpeed:Fn,onError:_t,connectionRadius:$n,isValidConnection:yn,selectNodesOnDrag:ae,nodeDragThreshold:De,connectionDragThreshold:We,onBeforeDelete:R,debug:Zi,ariaLabelConfig:Hn,zIndexMode:Ut}),o.jsx(Joe,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,nodeTypes:r,edgeTypes:a,connectionLineType:Z,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:K,selectionKeyCode:W,selectionOnDrag:q,selectionMode:ce,deleteKeyCode:z,multiSelectionKeyCode:_e,panActivationKeyCode:me,zoomActivationKeyCode:de,onlyRenderVisibleElements:Ee,defaultViewport:Ke,translateExtent:ie,minZoom:Q,maxZoom:oe,preventScrolling:be,zoomOnScroll:gt,zoomOnPinch:lt,zoomOnDoubleClick:Vt,panOnScroll:ln,panOnScrollSpeed:Mt,panOnScrollMode:kt,panOnDrag:He,autoPanOnSelection:jn,onPaneClick:Xt,onPaneMouseEnter:nt,onPaneMouseMove:yt,onPaneMouseLeave:Je,onPaneScroll:ot,onPaneContextMenu:ye,paneClickDistance:Xe,nodeClickDistance:St,onSelectionContextMenu:j,onSelectionStart:P,onSelectionEnd:$,onReconnect:Rn,onReconnectStart:Bt,onReconnectEnd:Ze,onEdgeContextMenu:cn,onEdgeDoubleClick:un,onEdgeMouseEnter:Et,onEdgeMouseMove:nn,onEdgeMouseLeave:Ci,reconnectRadius:ii,defaultMarkerColor:qe,noDragClassName:gn,noWheelClassName:_n,noPanClassName:Bn,rfId:bs,disableKeyboardA11y:ji,nodeExtent:Le,viewport:rt,onViewportChange:at}),o.jsx(Iae,{onSelectionChange:G}),Qt,o.jsx(Nae,{proOptions:Un,position:Ri}),o.jsx(Sae,{rfId:bs,disableKeyboardA11y:ji})]})})}var P9=h9(sle);const rle=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function ale({children:e}){const t=Kt(rle);return t?ks.createPortal(e,t):null}function B9(e){const[t,n]=b.useState(e),i=b.useCallback(s=>n(r=>u9(s,r)),[]);return[t,n,i]}function U9(e){const[t,n]=b.useState(e),i=b.useCallback(s=>n(r=>d9(s,r)),[]);return[t,n,i]}const ole=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||!Gk(n.userNode))return!1;return!0};function lle(e={includeHiddenNodes:!1}){return Kt(ole(e))}function cle({dimensions:e,lineWidth:t,variant:n,className:i}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Qi(["react-flow__background-pattern",n,i])})}function ule({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Qi(["react-flow__background-pattern","dots",t])})}var ql;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ql||(ql={}));const dle={[ql.Dots]:1,[ql.Lines]:1,[ql.Cross]:6},fle=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function F9({id:e,variant:t=ql.Dots,gap:n=20,size:i,lineWidth:s=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=Kt(fle,ui),m=i||dle[t],g=t===ql.Dots,v=t===ql.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],N=v?[E,E]:x,_=[w[0]*h[2]||1+N[0]/2,w[1]*h[2]||1+N[1]/2],T=`${p}${e||""}`;return o.jsxs("svg",{className:Qi(["react-flow__background",u]),style:{...c,...gx,"--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:g?o.jsx(ule,{radius:E/2,className:d}):o.jsx(cle,{dimensions:N,lineWidth:s,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}F9.displayName="Background";const $9=b.memo(F9);function hle(){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 ple(){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 mle(){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 gle(){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 ble(){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 D0({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Qi(["react-flow__controls-button",t]),...n,children:e})}const yle=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function H9({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=di(),{isInteractive:g,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=Kt(yle,ui),{zoomIn:E,zoomOut:w,fitView:N}=mx(),_=()=>{E(),r==null||r()},T=()=>{w(),a==null||a()},k=()=>{N(s),l==null||l()},C=()=>{m.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},I=h==="horizontal"?"horizontal":"vertical";return o.jsxs(px,{className:Qi(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(D0,{onClick:_,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(hle,{})}),o.jsx(D0,{onClick:T,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(ple,{})})]}),n&&o.jsx(D0,{className:"react-flow__controls-fitview",onClick:k,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(mle,{})}),i&&o.jsx(D0,{className:"react-flow__controls-interactive",onClick:C,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:g?o.jsx(ble,{}):o.jsx(gle,{})}),d]})}H9.displayName="Controls";const z9=b.memo(H9);function xle({id:e,x:t,y:n,width:i,height:s,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:g}=r||{},v=a||m||g;return o.jsx("rect",{className:Qi(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:s,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const Ele=b.memo(xle),vle=e=>e.nodes.map(t=>t.id),Ov=e=>e instanceof Function?e:()=>e;function wle({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:r=Ele,onClick:a}){const l=Kt(vle,ui),c=Ov(t),u=Ov(e),d=Ov(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(Sle,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function _le({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Kt(m=>{const g=m.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const v=g.internals.userNode,{x:y,y:x}=g.internals.positionAbsolute,{width:E,height:w}=Jo(v);return{node:v,x:y,y:x,width:E,height:w}},ui);return!u||u.hidden||!Gk(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const Sle=b.memo(_le);var Nle=b.memo(wle);const Tle=200,kle=150,Ale=e=>!e.hidden,Cle=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?O8(pg(e.nodeLookup,{filter:Ale}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ile="react-flow__minimap-desc";function V9({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:g=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const N=di(),_=b.useRef(null),{boundingRect:T,viewBB:k,rfId:C,panZoom:I,translateExtent:O,flowWidth:L,flowHeight:G,ariaLabelConfig:D}=Kt(Cle,ui),F=(e==null?void 0:e.width)??Tle,A=(e==null?void 0:e.height)??kle,j=T.width/F,P=T.height/A,$=Math.max(j,P),R=$*F,Y=$*A,Z=w*$,B=T.x-(R-T.width)/2-Z,te=T.y-(Y-T.height)/2-Z,K=R+Z*2,z=Y+Z*2,W=`${Ile}-${C}`,q=b.useRef(0),ce=b.useRef();q.current=$,b.useEffect(()=>{if(_.current&&I)return ce.current=jre({domNode:_.current,panZoom:I,getTransform:()=>N.getState().transform,getViewScale:()=>q.current}),()=>{var ge;(ge=ce.current)==null||ge.destroy()}},[I]),b.useEffect(()=>{var ge;(ge=ce.current)==null||ge.update({translateExtent:O,width:L,height:G,inversePan:x,pannable:g,zoomStep:E,zoomable:v})},[g,v,x,E,O,L,G]);const me=p?ge=>{var ae;const[Oe,Ee]=((ae=ce.current)==null?void 0:ae.pointer(ge))||[0,0];p(ge,{x:Oe,y:Ee})}:void 0,_e=m?b.useCallback((ge,Oe)=>{const Ee=N.getState().nodeLookup.get(Oe).internals.userNode;m(ge,Ee)},[]):void 0,de=y??D["minimap.ariaLabel"];return o.jsx(px,{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 i=="string"?i: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:Qi(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:A,viewBox:`${B} ${te} ${K} ${z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:_,onClick:me,children:[de&&o.jsx("title",{id:W,children:de}),o.jsx(Nle,{onClick:_e,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-Z},${te-Z}h${K+Z*2}v${z+Z*2}h${-K-Z*2}z + M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}V9.displayName="MiniMap";const Rle=b.memo(V9),jle=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Ole={[Sf.Line]:"right",[Sf.Handle]:"bottom-right"};function Mle({nodeId:e,position:t,variant:n=Sf.Handle,className:i,style:s=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:g,onResize:v,onResizeEnd:y}){const x=b9(),E=typeof e=="string"?e:x,w=di(),N=b.useRef(null),_=n===Sf.Handle,T=Kt(b.useCallback(jle(_&&p),[_,p]),ui),k=b.useRef(null),C=t??Ole[n];b.useEffect(()=>{if(!(!N.current||!E))return k.current||(k.current=Gre({domNode:N.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:O,transform:L,snapGrid:G,snapToGrid:D,nodeOrigin:F,domNode:A}=w.getState();return{nodeLookup:O,transform:L,snapGrid:G,snapToGrid:D,nodeOrigin:F,paneDomNode:A}},onChange:(O,L)=>{const{triggerNodeChanges:G,nodeLookup:D,parentLookup:F,nodeOrigin:A}=w.getState(),j=[],P={x:O.x,y:O.y},$=D.get(E);if($&&$.expandParent&&$.parentId){const R=$.origin??A,Y=O.width??$.measured.width??0,Z=O.height??$.measured.height??0,B={id:$.id,parentId:$.parentId,rect:{width:Y,height:Z,...L8({x:O.x??$.position.x,y:O.y??$.position.y},{width:Y,height:Z},$.parentId,D,R)}},te=Qk([B],D,F,A);j.push(...te),P.x=O.x?Math.max(R[0]*Y,O.x):void 0,P.y=O.y?Math.max(R[1]*Z,O.y):void 0}if(P.x!==void 0&&P.y!==void 0){const R={id:E,type:"position",position:{...P}};j.push(R)}if(O.width!==void 0&&O.height!==void 0){const Y={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};j.push(Y)}for(const R of L){const Y={...R,type:"position"};j.push(Y)}G(j)},onEnd:({width:O,height:L})=>{const G={id:E,type:"dimensions",resizing:!1,dimensions:{width:O,height:L}};w.getState().triggerNodeChanges([G])}})),k.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var O;(O=k.current)==null||O.destroy()}},[C,l,c,u,d,f,g,v,y,m]);const I=C.split("-");return o.jsx("div",{className:Qi(["react-flow__resize-control","nodrag",...I,n,i]),ref:N,style:{...s,scale:T,...a&&{[_?"backgroundColor":"borderColor"]:a}},children:r})}b.memo(Mle);var G9=Object.defineProperty,Lle=(e,t,n)=>t in e?G9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dle=(e,t)=>{for(var n in t)G9(e,n,{get:t[n],enumerable:!0})},Ple=(e,t,n)=>Lle(e,t+"",n),K9={};Dle(K9,{Graph:()=>ta,alg:()=>eA,json:()=>Y9,version:()=>Fle});var Ble=Object.defineProperty,q9=(e,t)=>{for(var n in t)Ble(e,n,{get:t[n],enumerable:!0})},ta=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(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),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=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),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 i=n;i!==void 0;i=this.parent(i))if(i===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 i=new Set(n);for(let s of this.successors(t))i.add(s);return Array.from(i.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 i={},s=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(i[r]=a??void 0,a??void 0):a in i?i[a]:s(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,s(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((i,s)=>(n!==void 0?this.setEdge(i,s,n):this.setEdge(i,s),s)),this}setEdge(t,n,i,s){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=s,arguments.length>2&&(c=i,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=cp(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=Ule(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,EO(this._preds[a],r),EO(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,i){let s=arguments.length===1?Mv(this._isDirected,t):cp(this._isDirected,t,n,i);return this._edgeLabels[s]}edgeAsObj(t,n,i){let s=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof s!="object"?{label:s}:s}hasEdge(t,n,i){return(arguments.length===1?Mv(this._isDirected,t):cp(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let s=arguments.length===1?Mv(this._isDirected,t):cp(this._isDirected,t,n,i),r=this._edgeObjs[s];if(r){let a=r.v,l=r.w;delete this._edgeLabels[s],delete this._edgeObjs[s],vO(this._preds[l],a),vO(this._sucs[a],l),delete this._in[l][s],delete this._out[a][s],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,i){if(!t)return;let s=Object.values(t);return i?s.filter(r=>r.v===n&&r.w===i||r.v===i&&r.w===n):s}};function EO(e,t){e[t]?e[t]++:e[t]=1}function vO(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function cp(e,t,n,i){let s=""+t,r=""+n;if(!e&&s>r){let a=s;s=r,r=a}return s+""+r+""+(i===void 0?"\0":i)}function Ule(e,t,n,i){let s=""+t,r=""+n;if(!e&&s>r){let l=s;s=r,r=l}let a={v:s,w:r};return i&&(a.name=i),a}function Mv(e,t){return cp(e,t.v,t.w,t.name)}var Fle="4.0.1",Y9={};q9(Y9,{read:()=>Vle,write:()=>$le});function $le(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Hle(e),edges:zle(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Hle(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),i!==void 0&&(s.parent=i),s})}function zle(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function Vle(e){let t=new ta(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 eA={};q9(eA,{CycleException:()=>Jy,bellmanFord:()=>W9,components:()=>qle,dijkstra:()=>Zy,dijkstraAll:()=>Xle,findCycles:()=>Qle,floydWarshall:()=>Jle,isAcyclic:()=>tce,postorder:()=>ice,preorder:()=>sce,prim:()=>rce,shortestPaths:()=>ace,tarjan:()=>Q9,topsort:()=>Z9});var Gle=()=>1;function W9(e,t,n,i){return Kle(e,String(t),n||Gle,i||function(s){return e.outEdges(s)})}function Kle(e,t,n,i){let s={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);s[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,i=String(e);if(!(i in n)){let s=this._arr,r=s.length;return n[i]=r,s.push({key:i,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 i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,s=e;n>1,!(t[i].priority1;function Zy(e,t,n,i){let s=function(r){return e.outEdges(r)};return Wle(e,String(t),n||Yle,i||s)}function Wle(e,t,n,i){let s={},r=new X9,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=s[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=s[a],l.distance!==Number.POSITIVE_INFINITY);)i(a).forEach(c);return s}function Xle(e,t,n){return e.nodes().reduce(function(i,s){return i[s]=Zy(e,s,t,n),i},{})}function Q9(e){let t=0,n=[],i={},s=[];function r(a){let l=i[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in i?i[c].onStack&&(l.lowlink=Math.min(l.lowlink,i[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,i[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in i||r(a)}),s}function Qle(e){return Q9(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Zle=()=>1;function Jle(e,t,n){return ece(e,t||Zle,n||function(i){return e.outEdges(i)})}function ece(e,t,n){let i={},s=e.nodes();return s.forEach(function(r){i[r]={},i[r][r]={distance:0,predecessor:""},s.forEach(function(a){r!==a&&(i[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);i[r][l]={distance:c,predecessor:r}})}),s.forEach(function(r){let a=i[r];s.forEach(function(l){let c=i[l];s.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);s=J9(e,l,n==="post",a,r,i,s)}),s}function J9(e,t,n,i,s,r,a){return t in i||(i[t]=!0,n||(a=r(a,t)),s(t).forEach(function(l){a=J9(e,l,n,i,s,r,a)}),n&&(a=r(a,t))),a}function eU(e,t,n){return nce(e,t,n,function(i,s){return i.push(s),i},[])}function ice(e,t){return eU(e,t,"post")}function sce(e,t){return eU(e,t,"pre")}function rce(e,t){let n=new ta,i={},s=new X9,r;function a(c){let u=c.v===r?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=s.removeMin(),r in i)n.setEdge(r,i[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function ace(e,t,n,i){return oce(e,t,n,i??(s=>{let r=e.outEdges(s);return r??[]}))}function oce(e,t,n,i){if(n===void 0)return Zy(e,t,n,i);let s=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+s.weight,minlen:Math.max(i.minlen,s.minlen)})}),t}function tU(e){let t=new ta({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 wO(e,t){let n=e.x,i=e.y,s=t.x-n,r=t.y-i,a=e.width/2,l=e.height/2;if(!s&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(s)*l?(r<0&&(l=-l),c=l*s/r,u=l):(s<0&&(a=-a),c=a,u=a*r/s),{x:n+c,y:i+u}}function bg(e){let t=Rm(iU(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),s=i.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][i.order]=n)}),t}function cce(e){let t=e.nodes().map(i=>{let s=e.node(i).rank;return s===void 0?Number.MAX_VALUE:s}),n=Qa(Math.min,t);e.nodes().forEach(i=>{let s=e.node(i);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function uce(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Qa(Math.min,t),i=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;i[l]||(i[l]=[]),i[l].push(a)});let s=0,r=e.graph().nodeRankFactor;Array.from(i).forEach((a,l)=>{a===void 0&&l%r!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function _O(e,t,n,i){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=i),Jf(e,"border",s,t)}function dce(e,t=nU){let n=[];for(let i=0;inU){let n=dce(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function iU(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return Qa(Math.max,t)}function fce(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function sU(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function rU(e,t){return t()}var hce=0;function tA(e){let t=++hce;return e+(""+t)}function Rm(e,t,n=1){t==null&&(t=e,e=0);let i=r=>rti[t]:n=t,Object.entries(e).reduce((i,[s,r])=>(i[s]=n(r,s),i),{})}function pce(e,t){return e.reduce((n,i,s)=>(n[i]=t[s],n),{})}var yx="\0",mce="3.0.0",gce=class{constructor(){Ple(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return SO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&SO(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,bce)),n=n._prev;return"["+e.join(", ")+"]"}};function SO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function bce(e,t){if(e!=="_next"&&e!=="_prev")return t}var yce=gce,xce=()=>1;function Ece(e,t){if(e.nodeCount()<=1)return[];let n=wce(e,t||xce);return vce(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function vce(e,t,n){var i;let s=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Lv(e,t,n,l);for(;l=r.dequeue();)Lv(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(i=t[c])==null?void 0:i.dequeue(),l){s=s.concat(Lv(e,t,n,l,!0)||[]);break}}}return s}function Lv(e,t,n,i,s){let r=[],a=s?r:void 0;return(e.inEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);s&&r.push({v:l.v,w:l.w}),u.out-=c,NS(t,n,u)}),(e.outEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,NS(t,n,d)}),e.removeNode(i.v),a}function wce(e,t){let n=new ta,i=0,s=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);s=Math.max(s,f.out+=u),i=Math.max(i,h.in+=u)});let r=_ce(s+i+3).map(()=>new yce),a=i+1;return n.nodes().forEach(l=>{NS(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function NS(e,t,n){var i,s,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(i=e[0])==null||i.enqueue(n)}function _ce(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,tA("rev"))});function t(n){return i=>n.edge(i).weight}}function Nce(e){let t=[],n={},i={};function s(r){Object.hasOwn(i,r)||(i[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[r])}return e.nodes().forEach(s),t}function Tce(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function kce(e){e.graph().dummyChains=[],e.edges().forEach(t=>Ace(e,t))}function Ace(e,t){let n=t.v,i=e.node(n).rank,s=t.w,r=e.node(s).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i{let n=e.node(t),i=n.edgeLabel,s;for(e.setEdge(n.edgeObj,i);n.dummy;)s=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=s,n=e.node(t)})}function nA(e){let t={};function n(i){let s=e.node(i);if(Object.hasOwn(t,i))return s.rank;t[i]=!0;let r=e.outEdges(i),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=Qa(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),s.rank=l}e.sources().forEach(n)}function Tf(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var aU=Ice;function Ice(e){let t=new ta({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],s=e.nodeCount();t.setNode(i,{});let r,a;for(;Rce(t,e){let a=r.v,l=i===a?r.w:a;!e.hasNode(l)&&!Tf(t,r)&&(e.setNode(l,{}),e.setEdge(i,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function jce(e,t){return t.edges().reduce((n,i)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(s=Tf(t,i)),st.node(i).rank+=n)}var{preorder:Mce,postorder:Lce}=eA,Dce=_u;_u.initLowLimValues=sA;_u.initCutValues=iA;_u.calcCutValue=oU;_u.leaveEdge=cU;_u.enterEdge=uU;_u.exchangeEdges=dU;function _u(e){e=lce(e),nA(e);let t=aU(e);sA(t),iA(t,e);let n,i;for(;n=cU(t);)i=uU(t,e,n),dU(t,e,n,i)}function iA(e,t){let n=Lce(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>Pce(e,t,i))}function Pce(e,t,n){let i=e.node(n).parent,s=e.edge(n,i);s.cutvalue=oU(e,t,n)}function oU(e,t,n){let i=e.node(n).parent,s=!0,r=t.edge(n,i),a=0;r||(s=!1,r=t.edge(i,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!==i){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,Uce(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function sA(e,t){arguments.length<2&&(t=e.nodes()[0]),lU(e,{},1,t)}function lU(e,t,n,i,s){let r=n,a=e.node(i);t[i]=!0;let l=e.neighbors(i);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=lU(e,t,n,c,i))}),a.low=r,a.lim=n++,s?a.parent=s:delete a.parent,n}function cU(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function uU(e,t,n){let i=n.v,s=n.w;t.hasEdge(i,s)||(i=n.w,s=n.v);let r=e.node(i),a=e.node(s),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===NO(e,e.node(u.v),l)&&c!==NO(e,e.node(u.w),l)).reduce((u,d)=>Tf(t,d)!e.node(s).parent);if(!n)return;let i=Mce(e,[n]);i=i.slice(1),i.forEach(s=>{let r=e.node(s).parent,a=t.edge(s,r),l=!1;a||(a=t.edge(r,s),l=!0),t.node(s).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function Uce(e,t,n){return e.hasEdge(t,n)}function NO(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Fce=$ce;function $ce(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":TO(e);break;case"tight-tree":zce(e);break;case"longest-path":Hce(e);break;case"none":break;default:TO(e)}}var Hce=nA;function zce(e){nA(e),aU(e)}function TO(e){Dce(e)}var Vce=Gce;function Gce(e){let t=qce(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),s=i.edgeObj,r=Kce(e,t,s.v,s.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(i=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=i;for(;(d=e.parent(d))!==u;)r.push(d);return{path:s.concat(r.reverse()),lca:u}}function qce(e){let t={},n=0;function i(s){let r=n;e.children(s).forEach(i),t[s]={low:r,lim:n++}}return e.children(yx).forEach(i),t}function Yce(e){let t=Jf(e,"root",{},"_root"),n=Wce(e),i=Object.values(n),s=Qa(Math.max,i)-1,r=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=Xce(e)+1;e.children(yx).forEach(l=>fU(e,t,r,a,s,n,l)),e.graph().nodeRankFactor=r}function fU(e,t,n,i,s,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=_O(e,"_bt"),d=_O(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;fU(e,t,n,i,s,r,h);let m=e.node(h),g=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?i:2*i,x=g!==v?1:s-((p=r[a])!=null?p:0)+1;e.setEdge(u,g,{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:s+((l=r[a])!=null?l:0)})}function Wce(e){let t={};function n(i,s){let r=e.children(i);r&&r.length&&r.forEach(a=>n(a,s+1)),t[i]=s}return e.children(yx).forEach(i=>n(i,1)),t}function Xce(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Qce(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Zce=Jce;function Jce(e){function t(n){let i=e.children(n),s=e.node(n);if(i.length&&i.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let r=s.minRank,a=s.maxRank+1;rAO(e.node(t))),e.edges().forEach(t=>AO(e.edge(t)))}function AO(e){let t=e.width;e.width=e.height,e.height=t}function nue(e){e.nodes().forEach(t=>Dv(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(Dv),Object.hasOwn(i,"y")&&Dv(i)})}function Dv(e){e.y=-e.y}function iue(e){e.nodes().forEach(t=>Pv(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(Pv),Object.hasOwn(i,"x")&&Pv(i)})}function Pv(e){let t=e.x;e.x=e.y,e.y=t}function sue(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),i=n.map(l=>e.node(l).rank),s=Qa(Math.max,i),r=Rm(s+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 rue(e,t){let n=0;for(let i=1;id)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:i[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 oue(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let s=i.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:s.sum/s.weight,weight:s.weight}}})}function lue(e,t){let n={};e.forEach((s,r)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i:r};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let r=n[s.v],a=n[s.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let i=Object.values(n).filter(s=>!s.indegree);return cue(i)}function cue(e){let t=[];function n(s){return r=>{r.merged||(r.barycenter===void 0||s.barycenter===void 0||r.barycenter>=s.barycenter)&&uue(s,r)}}function i(s){return r=>{r.in.push(s),--r.indegree===0&&e.push(r)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(i(s))}return t.filter(s=>!s.merged).map(s=>e1(s,["vs","i","barycenter","weight"]))}function uue(e,t){let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}function due(e,t){let n=fce(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;i.sort(fue(!!t)),c=CO(r,s,c),i.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=CO(r,s,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function CO(e,t,n){let i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),e.push(i.vs),n++;return n}function fue(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function pU(e,t,n,i){let s=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==l));let u=oue(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=pU(e,h.v,n,i);c[h.v]=p,Object.hasOwn(p,"barycenter")&&pue(h,p)}});let d=lue(u,n);hue(d,c);let f=due(d,i);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),g=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function hue(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function pue(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 mue(e,t,n,i){i||(i=e.nodes());let s=gue(e),r=new ta({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return i.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||s);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 gue(e){let t;for(;e.hasNode(t=tA("_root")););return t}function bue(e,t,n){let i={},s;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=i[l],i[l]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function mU(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,mU);return}let n=iU(e),i=IO(e,Rm(1,n+1),"inEdges"),s=IO(e,Rm(n-1,-1,-1),"outEdges"),r=sue(e);if(RO(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){yue(u%2?i:s,u%4>=2,c),r=bg(e);let f=rue(e,r);f{i.has(r)||i.set(r,[]),i.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&s(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&s(l,r)}return t.map(function(r){return mue(e,r,n,i.get(r)||[])})}function yue(e,t,n){let i=new ta;e.forEach(function(s){n.forEach(l=>i.setEdge(l.left,l.right));let r=s.graph().root,a=pU(s,r,i,t);a.vs.forEach((l,c)=>s.node(l).order=c),bue(s,i,a.vs)})}function RO(e,t){Object.values(t).forEach(n=>n.forEach((i,s)=>e.node(i).order=s))}function xue(e,t){let n={};function i(s,r){let a=0,l=0,c=s.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=vue(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let g=e.predecessors(m);g&&g.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)&&gU(n,p,f)})}})}function s(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,i(a,u,f,l,c),u=f,l=c}}i(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(s),n}function vue(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function gU(e,t,n){if(t>n){let s=t;t=n,n=s}let i=e[t];i||(e[t]=i={}),i[n]=!0}function wue(e,t,n){if(t>n){let s=t;t=n,n=s}let i=e[t];return i!==void 0&&Object.hasOwn(i,n)}function _ue(e,t,n,i){let s={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{s[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=i(u);if(d&&d.length){let f=d.sort((p,m)=>{let g=a[p],v=a[m];return(g!==void 0?g: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 g=f[p];if(g===void 0)continue;let v=a[g];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(g,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=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);g!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(i).forEach(p=>{var m;let g=n[p];g!==void 0&&(r[p]=(m=r[g])!=null?m:0)}),r}function Nue(e,t,n,i){let s=new ta,r=e.graph(),a=Iue(r.nodesep,r.edgesep,i);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function Tue(e,t){return Object.values(t).reduce((n,i)=>{let s=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([l,c])=>{let u=Rue(e,l)/2;s=Math.max(c+u,s),r=Math.min(c-u,r)});let a=s-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=i-Qa(Math.min,u);a!=="l"&&(d=s-Qa(Math.max,u)),d&&(e[l]=bx(c,f=>f+d))})})}function Aue(e,t=void 0){let n=e.ul;return n?bx(n,(i,s)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let l=Object.values(e).map(c=>{let u=c[s];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 Cue(e){let t=bg(e),n=Object.assign(xue(e,t),Eue(e,t)),i={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=_ue(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=Sue(e,s,c.root,c.align,l==="r");l==="r"&&(u=bx(u,d=>-d)),i[a+l]=u})});let r=Tue(e,i);return kue(i,r),Aue(i,e.graph().align)}function Iue(e,t,n){return(i,s,r)=>{let a=i.node(s),l=i.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 Rue(e,t){return e.node(t).width}function jue(e){e=tU(e),Oue(e),Object.entries(Cue(e)).forEach(([t,n])=>e.node(t).x=n)}function Oue(e){let t=bg(e),n=e.graph(),i=n.ranksep,s=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);s==="top"?u.y=r+u.height/2:s==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+i})}function Mue(e,t={}){let n=t.debugTiming?sU:rU;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>Vue(e));return n(" runLayout",()=>Lue(i,n,t)),n(" updateInputGraph",()=>Due(e,i)),i})}function Lue(e,t,n){t(" makeSpaceForEdgeLabels",()=>Gue(e)),t(" removeSelfEdges",()=>ede(e)),t(" acyclic",()=>Sce(e)),t(" nestingGraph.run",()=>Yce(e)),t(" rank",()=>Fce(tU(e))),t(" injectEdgeLabelProxies",()=>Kue(e)),t(" removeEmptyRanks",()=>uce(e)),t(" nestingGraph.cleanup",()=>Qce(e)),t(" normalizeRanks",()=>cce(e)),t(" assignRankMinMax",()=>que(e)),t(" removeEdgeLabelProxies",()=>Yue(e)),t(" normalize.run",()=>kce(e)),t(" parentDummyChains",()=>Vce(e)),t(" addBorderSegments",()=>Zce(e)),t(" order",()=>mU(e,n)),t(" insertSelfEdges",()=>tde(e)),t(" adjustCoordinateSystem",()=>eue(e)),t(" position",()=>jue(e)),t(" positionSelfEdges",()=>nde(e)),t(" removeBorderNodes",()=>Jue(e)),t(" normalize.undo",()=>Cce(e)),t(" fixupEdgeLabelCoords",()=>Que(e)),t(" undoCoordinateSystem",()=>tue(e)),t(" translateGraph",()=>Wue(e)),t(" assignNodeIntersects",()=>Xue(e)),t(" reversePoints",()=>Zue(e)),t(" acyclic.undo",()=>Tce(e))}function Due(e,t){e.nodes().forEach(n=>{let i=e.node(n),s=t.node(n);i&&(i.x=s.x,i.y=s.y,i.order=s.order,i.rank=s.rank,t.children(n).length&&(i.width=s.width,i.height=s.height))}),e.edges().forEach(n=>{let i=e.edge(n),s=t.edge(n);i.points=s.points,Object.hasOwn(s,"x")&&(i.x=s.x,i.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Pue=["nodesep","edgesep","ranksep","marginx","marginy"],Bue={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Uue=["acyclicer","ranker","rankdir","align","rankalign"],Fue=["width","height","rank"],jO={width:0,height:0},$ue=["minlen","weight","width","height","labeloffset"],Hue={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},zue=["labelpos"];function Vue(e){let t=new ta({multigraph:!0,compound:!0}),n=Uv(e.graph());return t.setGraph(Object.assign({},Bue,Bv(n,Pue),e1(n,Uue))),e.nodes().forEach(i=>{let s=Uv(e.node(i)),r=Bv(s,Fue);Object.keys(jO).forEach(l=>{r[l]===void 0&&(r[l]=jO[l])}),t.setNode(i,r);let a=e.parent(i);a!==void 0&&t.setParent(i,a)}),e.edges().forEach(i=>{let s=Uv(e.edge(i));t.setEdge(i,Object.assign({},Hue,Bv(s,$ue),e1(s,zue)))}),t}function Gue(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let i=e.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function Kue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let i=e.node(t.v),s={rank:(e.node(t.w).rank-i.rank)/2+i.rank,e:t};Jf(e,"edge-proxy",s,"_ep")}})}function que(e){let t=0;e.nodes().forEach(n=>{let i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Math.max(t,i.maxRank))}),e.graph().maxRank=t}function Yue(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let i=n;e.edge(i.e).labelRank=n.rank,e.removeNode(t)}})}function Wue(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=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),i=Math.min(i,f-p/2),s=Math.max(s,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,i-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=i}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=i}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=i)}),r.width=n-t+a,r.height=s-i+l}function Xue(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),s=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=s,a=i),n.points.unshift(wO(i,r)),n.points.push(wO(s,a))})}function Que(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 Zue(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Jue(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),i=e.node(n.borderTop),s=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(s.y-i.y),n.x=r.x+n.width/2,n.y=i.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function ede(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 tde(e){bg(e).forEach(t=>{let n=0;t.forEach((i,s)=>{let r=e.node(i);r.order=s+n,(r.selfEdges||[]).forEach(a=>{Jf(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function nde(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let i=n,s=e.node(i.e.v),r=s.x+s.width/2,a=s.y,l=n.x-r,c=s.height/2;e.setEdge(i.e,i.label),e.removeNode(t),i.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}],i.label.x=n.x,i.label.y=n.y}})}function Bv(e,t){return bx(e1(e,t),Number)}function Uv(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function ide(e){let t=bg(e),n=new ta({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+e.node(i).rank)}),e.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),t.forEach((i,s)=>{let r="layer"+s;n.setNode(r,{rank:"same"}),i.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var sde={graphlib:K9,version:mce,layout:Mue,debug:ide,util:{time:sU,notime:rU}},OO=sde;/*! For license information please see dagre.esm.js.LEGAL.txt */const up={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:su},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:WP},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:$P},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:xk},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:X1}},TS=220,kS=88,MO=96,LO=34,Fp=64,Fv=310,Rd=24,bU=56,AS=40,DO=40,rde=18,ade=58,ode=!1,lde=e=>e==="sequential"||e==="parallel"||e==="loop";function CS(e,t){const n=e.agentType??"llm";return lde(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function IS(e,t=[],n="horizontal",i=!1){const s=e.agentType??"llm";if(!CS(e,t))return{width:TS,height:kS};if(i&&e.subAgents.length===0)return{width:Fv,height:Fp};const r=e.subAgents.map((f,h)=>IS(f,[...t,h],n,i)),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&&s!=="parallel"?bU:Rd,u=n==="horizontal"?s!=="parallel":s==="parallel",d=r.length?s==="parallel"?rde+DO:s==="loop"?ade:0:DO;return u?{width:Math.max(Fv,r.reduce((f,h)=>f+h.width,0)+AS*Math.max(0,r.length-1)+c*2),height:Fp+Rd+l+d+Rd}:{width:Math.max(Fv,a+Rd*2),height:Fp+c+r.reduce((f,h)=>f+h.height,0)+AS*Math.max(0,r.length-1)+d+c}}function Uh(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function cde(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function PO(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Fh(e,t,n,i){const s=(i==null?void 0:i.tone)==="sequential"?"hsl(213 40% 40%)":(i==null?void 0:i.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${i!=null&&i.loop?"-loop":""}`,source:e,target:t,sourceHandle:i!=null&&i.loop?"loop-source":void 0,targetHandle:i!=null&&i.loop?"loop-target":void 0,label:n,type:"insertStep",data:i?{insert:i.insert,loop:i.loop,tone:i.tone}:void 0,animated:i==null?void 0:i.loop,markerEnd:{type:Ef.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function BO(e,t,n=!1){const i=[{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}],s=[];function r(d,f,h,p,m){const g=d.agentType??"llm",v=Uh(f);return CS(d,f)?(a(d,f,h,p,m),v):(i.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:g==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:g,description:d.description.trim()||up[g].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const g=d.agentType??"sequential",v=Uh(f),y=IS(d,f,t,n);i.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":up[g].label),pattern:g,description:d.description.trim()||up[g].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)=>IS(T,[...f,k],t,n)),E=x.length&&g!=="parallel"?bU:Rd,w=t==="horizontal"?g!=="parallel":g==="parallel";let N=E;const _=d.subAgents.map((T,k)=>{const C=x[k],I=w?{x:N,y:Fp+Rd}:{x:(y.width-C.width)/2,y:Fp+N};return N+=(w?C.width:C.height)+AS,r(T,[...f,k],v,I,g)});if(g==="sequential"||g==="loop"){for(let T=0;T<_.length-1;T+=1)s.push(Fh(_[T],_[T+1],"然后",{tone:g,insert:{parentPath:f,index:T+1}}));g==="loop"&&_.length>1&&s.push(Fh(_[_.length-1],_[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=Uh(f);if(CS(d,f))return a(d,f),[p];if(i.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()||up[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((g,v)=>{const y=[...f,v],x=Uh(y);s.push(Fh(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(g,y))}),m},c=Uh([]),u=l(e,[]);return s.push(Fh("terminal-input",c)),u.forEach(d=>s.push(Fh(d,"terminal-output"))),ude(i,s,t)}function ude(e,t,n){const i=new OO.graphlib.Graph().setDefaultEdgeLabel(()=>({}));i.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=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";i.setNode(r.id,{width:a?MO:r.data.layoutWidth??TS,height:a?LO:r.data.layoutHeight??kS})}),t.filter(r=>s.has(r.source)&&s.has(r.target)).forEach(r=>i.setEdge(r.source,r.target)),OO.layout(i),{nodes:e.map(r=>{if(r.parentId)return r;const a=i.node(r.id),l=r.data.kind==="terminal",c=l?MO:r.data.layoutWidth??TS,u=l?LO:r.data.layoutHeight??kS;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const xx=b.createContext(null),Ex=b.createContext("horizontal");function dde({id:e,sourceX:t,sourceY:n,targetX:i,targetY:s,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=b.useContext(xx),[h,p]=b.useState(!1),[m,g,v]=Xy({sourceX:t,sourceY:n,targetX:i,targetY:s,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(gg,{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(ale,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}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(Ns,{})})]})})]})}function fde({data:e,selected:t}){const n=b.useContext(xx),i=b.useContext(Ex),s=i==="vertical"?Ye.Top:Ye.Left,r=i==="vertical"?Ye.Bottom:Ye.Right,a=i==="vertical"?Ye.Right:Ye.Bottom,l=e.pattern??"llm",c=up[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(Ms,{type:"target",position:s,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(ic,{})}),o.jsx(Ms,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Ms,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Ms,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function hde({data:e,selected:t}){const n=b.useContext(xx),i=b.useContext(Ex),s=i==="vertical"?Ye.Top:Ye.Left,r=i==="vertical"?Ye.Bottom:Ye.Right,a=i==="vertical"?Ye.Right:Ye.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(Ms,{type:"target",position:s,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(Ns,{})}),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(Ns,{})})]}),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(Ns,{}),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(Ns,{}),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(ic,{})}),o.jsx(Ms,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Ms,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Ms,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function pde({data:e}){const t=b.useContext(Ex);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Ms,{type:"target",position:t==="vertical"?Ye.Top:Ye.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Ms,{type:"source",position:t==="vertical"?Ye.Bottom:Ye.Right,className:"abc-handle"})]})}const mde={agent:fde,group:hde,terminal:pde},gde={insertStep:dde};function bde({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:s,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=b.useMemo(()=>BO(e,c,a),[]),[d,f,h]=B9(u.nodes),[p,m,g]=U9(u.edges),v=lle(),y=b.useRef(`${c}:${a?"readonly":"editable"}:${PO(e)}`),x=b.useRef(null),{fitView:E}=mx(),w=b.useMemo(()=>BO(e,c,a),[c,e,a]),[N,_]=b.useState(()=>window.matchMedia("(max-width: 860px)").matches),T=b.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:N?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[N,a]),k=b.useCallback((I=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const O=x.current;if(O&&(O.clientWidth===0||O.clientHeight===0)&&I<8){k(I+1);return}E(T)})})},[T,E]);b.useEffect(()=>{const I=window.matchMedia("(max-width: 860px)"),O=L=>_(L.matches);return I.addEventListener("change",O),()=>I.removeEventListener("change",O)},[]),b.useEffect(()=>{const I=`${c}:${a?"readonly":"editable"}:${PO(e)}`,O=I!==y.current;y.current=I,m(w.edges),f(L=>{const G=new Map(L.map(D=>[D.id,D]));return w.nodes.map(D=>{const F=G.get(D.id);return{...D,measured:!O&&F&&F.type===D.type?F.measured:void 0,position:!O&&F?F.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&cde(D.data.path,t)}})}),O&&k()},[w,e,k,t,m,f]),b.useEffect(()=>{k()},[N,k]),b.useEffect(()=>{v&&k()},[w,k,v]),b.useEffect(()=>{if(!a||!x.current)return;const I=new ResizeObserver(()=>k());return I.observe(x.current),k(),()=>I.disconnect()},[k,a]);const C=b.useMemo(()=>a?null:{onAdd:i,onInsert:s,onDelete:r},[i,r,s,a]);return o.jsx(Ex.Provider,{value:c,children:o.jsx(xx.Provider,{value:C,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(P9,{nodes:d,edges:p,nodeTypes:mde,edgeTypes:gde,onNodesChange:h,onEdgesChange:g,onNodeClick:(I,O)=>{!a&&O.data.kind==="agent"&&O.data.path&&n(O.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($9,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(z9,{showInteractive:!1}),ode]})})})})})}function jm(e){return o.jsx(Jk,{children:o.jsx(bde,{...e})})}const yde="https://ark.cn-beijing.volces.com/api/v3/",Pb=[{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:yde}],kf=[],UO={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},xde={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},Ede="https://api.vikingdb.cn-beijing.volces.com/openviking",vde=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,Ph=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],va={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},lU=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:va.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:va.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:va.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],wu=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Nf},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Nf},{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"}]}],lde=new Set(["web_scraper","text_to_speech","vesearch"]),cU=wu.filter(e=>!lde.has(e.id)),SS=[{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}]}],NS=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Rb,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},...Rb],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},...Rb],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:Nf},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:ade,comment:"OpenViking 服务地址",link:RO},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:RO},{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:ode,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:rde}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],cu="viking",TS=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:Nf},{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},...Rb],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Nf,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],cde=[{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:[...Nf,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],ude="doubao-seed-2-1-pro-260628",dde="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",fde=`你是一个专业、可靠的智能助手。 +}`,$h=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],wa={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},yU=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:wa.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:wa.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:wa.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],Su=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:kf},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:kf},{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"}]}],wde=new Set(["web_scraper","text_to_speech","vesearch"]),xU=Su.filter(e=>!wde.has(e.id)),RS=[{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}]}],jS=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Pb,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},...Pb],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},...Pb],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:kf},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:Ede,comment:"OpenViking 服务地址",link:UO},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:UO},{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:vde,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:xde}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],du="viking",OS=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:kf},{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},...Pb],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...kf,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],_de=[{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:[...kf,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Sde="doubao-seed-2-1-pro-260628",Nde="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",Tde=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function Es(){return{name:"",description:dde,instruction:fde,agentType:"llm",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:ude,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:cu,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}async function hg(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Cn(void 0,Gf)});if(t.status===409)throw new Error("服务端未配置 Volcengine 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 uU(){return(await hg("/web/skill-spaces?region=all")).items||[]}async function hde(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),hg(`/web/skill-spaces?${t.toString()}`)}async function dU(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await hg(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function pde(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),hg(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function mde(e,t,n,i,s){const r=[];n&&r.push(`version=${encodeURIComponent(n)}`),i&&r.push(`region=${encodeURIComponent(i)}`),s&&r.push(`project=${encodeURIComponent(s)}`);const a=r.length>0?`?${r.join("&")}`:"";return hg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function gde(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 bde(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function jO({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 yde={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function kS(e){const t=wu.find(n=>n.id===e||n.toolNames.includes(e));return yde[e]??(t==null?void 0:t.label)??e}function OO(e){const t=wu.find(i=>i.id===e||i.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function xde(){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 Ede(){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 MO(){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 fU({title:e,description:t,icon:n,wide:i=!1,onClose:s,children:r}){const a=b.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return b.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[s]),Ss.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),o.jsxs("section",{className:`session-capability-dialog${i?" 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:s,children:o.jsx(xde,{})})]}),r]})]}),document.body)}function jb({value:e,placeholder:t,label:n,onChange:i,autoFocus:s=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(Ede,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:r=>i(r.target.value)})]})}function vde({agentName:e,tools:t,selectedNames:n,mutating:i,onAdd:s,onClose:r}){const[a,l]=b.useState(""),[c,u]=b.useState(""),d=b.useMemo(()=>new Set(n),[n]),f=b.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${kS(m)} ${m} ${OO(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&r()};return o.jsx(fU,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(jO,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(jb,{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),g=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(jO,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:kS(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:OO(p)})]}),o.jsx("button",{type:"button",disabled:m||i||!!c,onClick:()=>void h(p),children:m?"已添加":g?"添加中…":"添加"})]},p)})})]})})}function wde({appName:e,agentName:t,selectedNames:n,mutating:i,onAdd:s,onClose:r}){const[a,l]=b.useState("public"),[c,u]=b.useState(""),[d,f]=b.useState([]),[h,p]=b.useState(0),[m,g]=b.useState(!0),[v,y]=b.useState(""),[x,E]=b.useState([]),[w,N]=b.useState(null),[_,T]=b.useState([]),[k,C]=b.useState(""),[I,O]=b.useState(""),[M,G]=b.useState(!0),[D,F]=b.useState(!1),[A,j]=b.useState(""),[P,$]=b.useState(""),R=b.useMemo(()=>new Set(n),[n]);b.useEffect(()=>{if(a!=="public")return;let z=!0;const q=window.setTimeout(()=>{g(!0),y(""),hB(e,c.trim()).then(W=>{z&&(f(W.items),p(W.totalCount))}).catch(W=>{z&&(f([]),p(0),y(W instanceof Error?W.message:"搜索 Skill Hub 失败"))}).finally(()=>{z&&g(!1)})},250);return()=>{z=!1,window.clearTimeout(q)}},[e,c,a]),b.useEffect(()=>{if(a!=="agentkit")return;let z=!0;return G(!0),j(""),uU().then(q=>{z&&(E(q),N(q[0]??null))}).catch(q=>{z&&j(q instanceof Error?q.message:"读取 Skill Space 失败")}).finally(()=>{z&&G(!1)}),()=>{z=!1}},[a]),b.useEffect(()=>{if(a!=="agentkit")return;if(!w){T([]);return}let z=!0;return F(!0),j(""),dU(w.id,w.region).then(q=>{z&&T(q)}).catch(q=>{z&&j(q instanceof Error?q.message:"读取技能失败")}).finally(()=>{z&&F(!1)}),()=>{z=!1}},[w,a]);const Y=b.useMemo(()=>{const z=k.trim().toLowerCase();return z?x.filter(q=>`${q.name} ${q.id} ${q.description}`.toLowerCase().includes(z)):x},[k,x]),Z=b.useMemo(()=>{const z=I.trim().toLowerCase();return z?_.filter(q=>`${q.skillName} ${q.skillDescription}`.toLowerCase().includes(z)):_},[I,_]),B=async z=>{if(!w)return;$(z.skillId);const q=await s({kind:"skill",name:z.skillName,skillSourceId:w.id,description:z.skillDescription,version:z.version});$(""),q&&r()},te=async z=>{$(z.slug);const q=await s({kind:"skill",name:z.name,skillSourceId:`findskill:${z.slug}`,description:z.description,version:z.version||z.updatedAt});$(""),q&&r()};return o.jsx(fU,{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(jb,{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(z=>{const q=R.has(z.name),W=P===z.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:z.name}),o.jsx("span",{children:z.description||"暂无描述"}),o.jsxs("small",{children:[z.sourceRepo||z.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),z.downloadCount.toLocaleString()," 次下载",z.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),z.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:q||i||!!P,onClick:()=>void te(z),children:q?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(MO,{}),"添加"]})})]},z.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(jb,{value:k,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:M?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):Y.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):Y.map(z=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===z.id?" is-active":""}`,onClick:()=>{N(z),O("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:z.name||z.id}),o.jsx("small",{children:z.description||z.id}),o.jsxs("em",{children:[z.skillCount??0," 个技能"]})]})},`${z.projectName??"default"}:${z.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(jb,{value:I,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:O})]}),o.jsx("div",{className:"session-skill-pane-list",children:A?o.jsx("div",{className:"session-capability-error",children:A}):w?D?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):Z.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):Z.map(z=>{const q=R.has(z.skillName),W=P===z.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:z.skillName}),o.jsx("span",{children:z.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",z.version||"—"]})]}),o.jsx("button",{type:"button",disabled:q||i||!!P,onClick:()=>void B(z),children:q?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(MO,{}),"添加"]})})]},`${z.skillId}:${z.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function wa({as:e="span",className:t="",duration:n=4,spread:i=20,children:s,style:r,...a}){const l=Math.min(Math.max(i,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:s})}function hU(e){return 1+e.children.reduce((t,n)=>t+hU(n),0)}function pU(e){return e.id||e.name}function _de(e,t){const n=pU(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const i=/^agent_sub_(\d+)$/.exec(n);return i?`子 Agent ${i[1]}`:e.name||n}function mU(e,t=!0){return{...e,id:pU(e),name:_de(e,t),children:e.children.map(n=>mU(n,!1))}}function gU(e){const t=Es();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(gU)}}function Sde(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function Nde(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function Mv({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 Tde({appName:e,info:t,loading:n,variant:i="rail",capabilities:s=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=b.useState(null),[h,p]=b.useState(!1),m=b.useRef(null),g=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=m.current)==null?void 0:_.focus()})};if(b.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,T=k=>{k.key==="Escape"&&g()};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${i==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(wa,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=mU(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=(s==null?void 0:s.tools)??Sde(t.tools).map(_=>({id:`base:tool:${_}`,kind:"tool",name:_,custom:!1})),x=(s==null?void 0:s.skills)??Nde(t.skills).map(_=>({id:`base:skill:${_.name}`,kind:"skill",name:_.name,description:_.description,custom:!1})),E=!!(s&&c&&u),w=gU(v),N=_=>o.jsx(Am,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${i==="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(Mv,{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:kS(_.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(Mv,{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(Mv,{title:"结构拓扑",count:hU(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(Gc,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:N(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(vde,{agentName:t.name,tools:l,selectedNames:y.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(wde,{appName:e,agentName:t.name,selectedNames:x.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&Ss.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:g,autoFocus:!0,children:o.jsx(Ns,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:N(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function Eje(){}function LO(e){const t=[],n=String(e||"");let i=n.indexOf(","),s=0,r=!1;for(;!r;){i===-1&&(i=n.length,r=!0);const a=n.slice(s,i).trim();(a||!r)&&t.push(a),s=i+1,i=n.indexOf(",",s)}return t}function bU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const kde=/[$_\p{ID_Start}]/u,Ade=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,Cde=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,Ide=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rde=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yU={};function vje(e){return e?kde.test(String.fromCodePoint(e)):!1}function wje(e,t){const i=(t||yU).jsx?Cde:Ade;return e?i.test(String.fromCodePoint(e)):!1}function DO(e,t){return(yU.jsx?Rde:Ide).test(e)}const jde=/[ \t\n\f\r]/g;function Ode(e){return typeof e=="object"?e.type==="text"?PO(e.value):!1:PO(e)}function PO(e){return e.replace(jde,"")===""}let pg=class{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}};pg.prototype.normal={};pg.prototype.property={};pg.prototype.space=void 0;function xU(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new pg(n,i,t)}function Cm(e){return e.toLowerCase()}class dr{constructor(t,n){this.attribute=n,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let Mde=0;const Ot=_u(),zi=_u(),AS=_u(),Be=_u(),Bn=_u(),Kd=_u(),hr=_u();function _u(){return 2**++Mde}const CS=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:zi,commaOrSpaceSeparated:hr,commaSeparated:Kd,number:Be,overloadedBoolean:AS,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),Lv=Object.keys(CS);class Qk extends dr{constructor(t,n,i,s){let r=-1;if(super(t,n),BO(this,"space",s),typeof i=="number")for(;++r4&&n.slice(0,4)==="data"&&Ude.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(UO,$de);i="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!UO.test(r)){let a=r.replace(Bde,Fde);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Qk}return new s(i,t)}function Fde(e){return"-"+e.toLowerCase()}function $de(e){return e.charAt(1).toUpperCase()}const mg=xU([EU,Lde,_U,SU,NU],"html"),oc=xU([EU,Dde,_U,SU,NU],"svg");function FO(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function TU(e){return e.join(" ").trim()}var Zk={},$O=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Hde=/\n/g,zde=/^\s*/,Vde=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Gde=/^:\s*/,Kde=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,qde=/^[;\s]*/,Yde=/^\s+|\s+$/g,Wde=` -`,HO="/",zO="*",jc="",Xde="comment",Qde="declaration";function Zde(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function s(m){var g=m.match(Hde);g&&(n+=g.length);var v=m.lastIndexOf(Wde);i=~v?m.length-v:i+m.length}function r(){var m={line:n,column:i};return function(g){return g.position=new a(m),u(),g}}function a(m){this.start=m,this.end={line:n,column:i},this.source=t.source}a.prototype.content=e;function l(m){var g=new Error(t.source+":"+n+":"+i+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=i,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var v=g[0];return s(v),e=e.slice(v.length),g}}function u(){c(zde)}function d(m){var g;for(m=m||[];g=f();)g!==!1&&m.push(g);return m}function f(){var m=r();if(!(HO!=e.charAt(0)||zO!=e.charAt(1))){for(var g=2;jc!=e.charAt(g)&&(zO!=e.charAt(g)||HO!=e.charAt(g+1));)++g;if(g+=2,jc===e.charAt(g-1))return l("End of comment missing");var v=e.slice(2,g-2);return i+=2,s(v),e=e.slice(g),i+=2,m({type:Xde,comment:v})}}function h(){var m=r(),g=c(Vde);if(g){if(f(),!c(Gde))return l("property missing ':'");var v=c(Kde),y=m({type:Qde,property:VO(g[0].replace($O,jc)),value:v?VO(v[0].replace($O,jc)):jc});return c(qde),y}}function p(){var m=[];d(m);for(var g;g=h();)g!==!1&&(m.push(g),d(m));return m}return u(),p()}function VO(e){return e?e.replace(Yde,jc):jc}var Jde=Zde,efe=Al&&Al.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zk,"__esModule",{value:!0});Zk.default=nfe;const tfe=efe(Jde);function nfe(e,t){let n=null;if(!e||typeof e!="string")return n;const i=(0,tfe.default)(e),s=typeof t=="function";return i.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;s?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var mx={};Object.defineProperty(mx,"__esModule",{value:!0});mx.camelCase=void 0;var ife=/^--[a-zA-Z0-9_-]+$/,sfe=/-([a-z])/g,rfe=/^[^-]+$/,afe=/^-(webkit|moz|ms|o|khtml)-/,ofe=/^-(ms)-/,lfe=function(e){return!e||rfe.test(e)||ife.test(e)},cfe=function(e,t){return t.toUpperCase()},GO=function(e,t){return"".concat(t,"-")},ufe=function(e,t){return t===void 0&&(t={}),lfe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ofe,GO):e=e.replace(afe,GO),e.replace(sfe,cfe))};mx.camelCase=ufe;var dfe=Al&&Al.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ffe=dfe(Zk),hfe=mx;function IS(e,t){var n={};return!e||typeof e!="string"||(0,ffe.default)(e,function(i,s){i&&s&&(n[(0,hfe.camelCase)(i,t)]=s)}),n}IS.default=IS;var pfe=IS;const mfe=Of(pfe),gx=kU("end"),ro=kU("start");function kU(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function gfe(e){const t=ro(e),n=gx(e);if(t&&n)return{start:t,end:n}}function Pp(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?KO(e.position):"start"in e||"end"in e?KO(e):"line"in e||"column"in e?RS(e):""}function RS(e){return qO(e&&e.line)+":"+qO(e&&e.column)}function KO(e){return RS(e&&e.start)+"-"+RS(e&&e.end)}function qO(e){return e&&typeof e=="number"?e:1}class Ms extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",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"?s=t:!r.cause&&t&&(a=!0,s=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof i=="string"){const c=i.indexOf(":");c===-1?r.ruleId=i:(r.source=i.slice(0,c),r.ruleId=i.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=s,this.line=l?l.line:void 0,this.name=Pp(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}}Ms.prototype.file="";Ms.prototype.name="";Ms.prototype.reason="";Ms.prototype.message="";Ms.prototype.stack="";Ms.prototype.column=void 0;Ms.prototype.line=void 0;Ms.prototype.ancestors=void 0;Ms.prototype.cause=void 0;Ms.prototype.fatal=void 0;Ms.prototype.place=void 0;Ms.prototype.ruleId=void 0;Ms.prototype.source=void 0;const Jk={}.hasOwnProperty,bfe=new Map,yfe=/[A-Z]/g,xfe=new Set(["table","tbody","thead","tfoot","tr"]),Efe=new Set(["td","th"]),AU="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vfe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Cfe(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");i=Afe(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,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"?oc:mg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=CU(s,e,void 0);return r&&typeof r!="string"?r:s.create(e,s.Fragment,{children:r||void 0},void 0)}function CU(e,t,n){if(t.type==="element")return wfe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return _fe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Nfe(e,t,n);if(t.type==="mdxjsEsm")return Sfe(e,t);if(t.type==="root")return Tfe(e,t,n);if(t.type==="text")return kfe(e,t)}function wfe(e,t,n){const i=e.schema;let s=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=oc,e.schema=s),e.ancestors.push(t);const r=RU(e,t.tagName,!1),a=Ife(e,t);let l=tA(e,t);return xfe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Ode(c):!0})),IU(e,a,r,t),eA(a,l),e.ancestors.pop(),e.schema=i,e.create(t,r,a,n)}function _fe(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Im(e,t.position)}function Sfe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Im(e,t.position)}function Nfe(e,t,n){const i=e.schema;let s=i;t.name==="svg"&&i.space==="html"&&(s=oc,e.schema=s),e.ancestors.push(t);const r=t.name===null?e.Fragment:RU(e,t.name,!0),a=Rfe(e,t),l=tA(e,t);return IU(e,a,r,t),eA(a,l),e.ancestors.pop(),e.schema=i,e.create(t,r,a,n)}function Tfe(e,t,n){const i={};return eA(i,tA(e,t)),e.create(t,e.Fragment,i,n)}function kfe(e,t){return t.value}function IU(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function eA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Afe(e,t,n){return i;function i(s,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function Cfe(e,t){return n;function n(i,s,r,a){const l=Array.isArray(r.children),c=ro(i);return t(s,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Ife(e,t){const n={};let i,s;for(s in t.properties)if(s!=="children"&&Jk.call(t.properties,s)){const r=jfe(e,s,t.properties[s]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Efe.has(t.tagName)?i=l:n[a]=l}}if(i){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function Rfe(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const r=i.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 Im(e,t.position);else{const s=i.name;let r;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Im(e,t.position);else r=i.value===null?!0:i.value;n[s]=r}return n}function tA(e,t){const n=[];let i=-1;const s=e.passKeys?new Map:bfe;for(;++is?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)a=Array.from(i),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Tr(e,e.length,0,t),e):t}const XO={}.hasOwnProperty;function OU(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 _a(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vs=lc(/[A-Za-z]/),js=lc(/[\dA-Za-z]/),$fe=lc(/[#-'*+\--9=?A-Z^-~]/);function Wy(e){return e!==null&&(e<32||e===127)}const jS=lc(/\d/),Hfe=lc(/[\dA-Fa-f]/),zfe=lc(/[!-/:-@[-`{-~]/);function pt(e){return e!==null&&e<-2}function Rn(e){return e!==null&&(e<0||e===32)}function Gt(e){return e===-2||e===-1||e===32}const bx=lc(new RegExp("\\p{P}|\\p{S}","u")),uu=lc(/\s/);function lc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Zf(e){const t=[];let n=-1,i=0,s=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),s=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(i,n),encodeURIComponent(a)),i=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function en(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return Gt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Gt(c)&&r++a))return;const T=t.events.length;let k=T,C,I;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(C){I=t.events[k][1].end;break}C=!0}for(y(i),_=T;_E;){const N=n[w];t.containerState=N[1],N[0].exit.call(t,e)}n.length=E}function x(){s.write([null]),r=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Yfe(e,t,n){return en(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tf(e){if(e===null||Rn(e)||uu(e))return 1;if(bx(e))return 2}function yx(e,t,n){const i=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[i][1].end},h={...e[n][1].start};ZO(f,-c),ZO(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[i][1].end={...a.start},e[n][1].start={...l.end},u=[],e[i][1].end.offset-e[i][1].start.offset&&(u=Ur(u,[["enter",e[i][1],t],["exit",e[i][1],t]])),u=Ur(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=Ur(u,yx(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),u=Ur(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Ur(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Tr(e,i-1,n-i+3,u),n=i+u.length-d-2;break}}for(n=-1;++n0&&Gt(_)?en(e,x,"linePrefix",r+1)(_):x(_)}function x(_){return _===null||pt(_)?e.check(JO,g,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 N(_,T,k){let C=0;return I;function I(F){return _.enter("lineEnding"),_.consume(F),_.exit("lineEnding"),O}function O(F){return _.enter("codeFencedFence"),Gt(F)?en(_,M,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):M(F)}function M(F){return F===l?(_.enter("codeFencedFenceSequence"),G(F)):k(F)}function G(F){return F===l?(C++,_.consume(F),G):C>=a?(_.exit("codeFencedFenceSequence"),Gt(F)?en(_,D,"whitespace")(F):D(F)):k(F)}function D(F){return F===null||pt(F)?(_.exit("codeFencedFence"),T(F)):k(F)}}}function ahe(e,t,n){const i=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return i.parser.lazy[i.now().line]?n(a):t(a)}}const Pv={name:"codeIndented",tokenize:lhe},ohe={partial:!0,tokenize:che};function lhe(e,t,n){const i=this;return s;function s(u){return e.enter("codeIndented"),en(e,r,"linePrefix",5)(u)}function r(u){const d=i.events[i.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(ohe,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 che(e,t,n){const i=this;return s;function s(a){return i.parser.lazy[i.now().line]?n(a):pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):en(e,r,"linePrefix",5)(a)}function r(a){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):pt(a)?s(a):n(a)}}const uhe={name:"codeText",previous:fhe,resolve:dhe,tokenize:hhe};function dhe(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i=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-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&Bh(this.left,i),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),Bh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Bh(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(i.parser.constructs.flow,n,t)(a)}}function UU(e,t,n,i,s,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(i),e.enter(s),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||Wy(y)?n(y):(e.enter(i),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(s),e.exit(i),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 g(y){return!d&&(y===null||y===41||Rn(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(i),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(s),e.consume(p),e.exit(s),e.exit(i),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=!Gt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function $U(e,t,n,i,s,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(i),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"),en(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 Bp(e,t){let n;return i;function i(s){return pt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):Gt(s)?en(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const vhe={name:"definition",tokenize:_he},whe={partial:!0,tokenize:She};function _he(e,t,n){const i=this;let s;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return FU.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=_a(i.sliceSerialize(i.events[i.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 Rn(p)?Bp(e,u)(p):u(p)}function u(p){return UU(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(whe,f,f)(p)}function f(p){return Gt(p)?en(e,h,"whitespace")(p):h(p)}function h(p){return p===null||pt(p)?(e.exit("definition"),i.parser.defined.push(s),t(p)):n(p)}}function She(e,t,n){return i;function i(l){return Rn(l)?Bp(e,s)(l):n(l)}function s(l){return $U(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return Gt(l)?en(e,a,"whitespace")(l):a(l)}function a(l){return l===null||pt(l)?t(l):n(l)}}const Nhe={name:"hardBreakEscape",tokenize:The};function The(e,t,n){return i;function i(r){return e.enter("hardBreakEscape"),e.consume(r),s}function s(r){return pt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const khe={name:"headingAtx",resolve:Ahe,tokenize:Che};function Ahe(e,t){let n=e.length-2,i=3,s,r;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},r={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Tr(e,i,n-i+1,[["enter",s,t],["enter",r,t],["exit",r,t],["exit",s,t]])),e}function Che(e,t,n){let i=0;return s;function s(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&i++<6?(e.consume(d),a):d===null||Rn(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)):Gt(d)?en(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||Rn(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const Ihe=["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"],tM=["pre","script","style","textarea"],Rhe={concrete:!0,name:"htmlFlow",resolveTo:Mhe,tokenize:Lhe},jhe={partial:!0,tokenize:Phe},Ohe={partial:!0,tokenize:Dhe};function Mhe(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 Lhe(e,t,n){const i=this;let s,r,a,l,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),r=!0,g):B===63?(e.consume(B),s=3,i.interrupt?t:R):Vs(B)?(e.consume(B),a=String.fromCharCode(B),v):n(B)}function h(B){return B===45?(e.consume(B),s=2,p):B===91?(e.consume(B),s=5,l=0,m):Vs(B)?(e.consume(B),s=4,i.interrupt?t:R):n(B)}function p(B){return B===45?(e.consume(B),i.interrupt?t:R):n(B)}function m(B){const te="CDATA[";return B===te.charCodeAt(l++)?(e.consume(B),l===te.length?i.interrupt?t:M:m):n(B)}function g(B){return Vs(B)?(e.consume(B),a=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||Rn(B)){const te=B===47,z=a.toLowerCase();return!te&&!r&&tM.includes(z)?(s=1,i.interrupt?t(B):M(B)):Ihe.includes(a.toLowerCase())?(s=6,te?(e.consume(B),y):i.interrupt?t(B):M(B)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(B):r?x(B):E(B))}return B===45||js(B)?(e.consume(B),a+=String.fromCharCode(B),v):n(B)}function y(B){return B===62?(e.consume(B),i.interrupt?t:M):n(B)}function x(B){return Gt(B)?(e.consume(B),x):I(B)}function E(B){return B===47?(e.consume(B),I):B===58||B===95||Vs(B)?(e.consume(B),w):Gt(B)?(e.consume(B),E):I(B)}function w(B){return B===45||B===46||B===58||B===95||js(B)?(e.consume(B),w):N(B)}function N(B){return B===61?(e.consume(B),_):Gt(B)?(e.consume(B),N):E(B)}function _(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,T):Gt(B)?(e.consume(B),_):k(B)}function T(B){return B===c?(e.consume(B),c=null,C):B===null||pt(B)?n(B):(e.consume(B),T)}function k(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Rn(B)?N(B):(e.consume(B),k)}function C(B){return B===47||B===62||Gt(B)?E(B):n(B)}function I(B){return B===62?(e.consume(B),O):n(B)}function O(B){return B===null||pt(B)?M(B):Gt(B)?(e.consume(B),O):n(B)}function M(B){return B===45&&s===2?(e.consume(B),A):B===60&&s===1?(e.consume(B),j):B===62&&s===4?(e.consume(B),Y):B===63&&s===3?(e.consume(B),R):B===93&&s===5?(e.consume(B),$):pt(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(jhe,Z,G)(B)):B===null||pt(B)?(e.exit("htmlFlowData"),G(B)):(e.consume(B),M)}function G(B){return e.check(Ohe,D,Z)(B)}function D(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),F}function F(B){return B===null||pt(B)?G(B):(e.enter("htmlFlowData"),M(B))}function A(B){return B===45?(e.consume(B),R):M(B)}function j(B){return B===47?(e.consume(B),a="",P):M(B)}function P(B){if(B===62){const te=a.toLowerCase();return tM.includes(te)?(e.consume(B),Y):M(B)}return Vs(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),P):M(B)}function $(B){return B===93?(e.consume(B),R):M(B)}function R(B){return B===62?(e.consume(B),Y):B===45&&s===2?(e.consume(B),R):M(B)}function Y(B){return B===null||pt(B)?(e.exit("htmlFlowData"),Z(B)):(e.consume(B),Y)}function Z(B){return e.exit("htmlFlow"),t(B)}}function Dhe(e,t,n){const i=this;return s;function s(a){return pt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return i.parser.lazy[i.now().line]?n(a):t(a)}}function Phe(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(gg,t,n)}}const Bhe={name:"htmlText",tokenize:Uhe};function Uhe(e,t,n){const i=this;let s,r,a;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),N):R===63?(e.consume(R),E):Vs(R)?(e.consume(R),k):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),r=0,m):Vs(R)?(e.consume(R),x):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),h):pt(R)?(a=f,j(R)):(e.consume(R),f)}function h(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?A(R):R===45?h(R):f(R)}function m(R){const Y="CDATA[";return R===Y.charCodeAt(r++)?(e.consume(R),r===Y.length?g:m):n(R)}function g(R){return R===null?n(R):R===93?(e.consume(R),v):pt(R)?(a=g,j(R)):(e.consume(R),g)}function v(R){return R===93?(e.consume(R),y):g(R)}function y(R){return R===62?A(R):R===93?(e.consume(R),y):g(R)}function x(R){return R===null||R===62?A(R):pt(R)?(a=x,j(R)):(e.consume(R),x)}function E(R){return R===null?n(R):R===63?(e.consume(R),w):pt(R)?(a=E,j(R)):(e.consume(R),E)}function w(R){return R===62?A(R):E(R)}function N(R){return Vs(R)?(e.consume(R),_):n(R)}function _(R){return R===45||js(R)?(e.consume(R),_):T(R)}function T(R){return pt(R)?(a=T,j(R)):Gt(R)?(e.consume(R),T):A(R)}function k(R){return R===45||js(R)?(e.consume(R),k):R===47||R===62||Rn(R)?C(R):n(R)}function C(R){return R===47?(e.consume(R),A):R===58||R===95||Vs(R)?(e.consume(R),I):pt(R)?(a=C,j(R)):Gt(R)?(e.consume(R),C):A(R)}function I(R){return R===45||R===46||R===58||R===95||js(R)?(e.consume(R),I):O(R)}function O(R){return R===61?(e.consume(R),M):pt(R)?(a=O,j(R)):Gt(R)?(e.consume(R),O):C(R)}function M(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,G):pt(R)?(a=M,j(R)):Gt(R)?(e.consume(R),M):(e.consume(R),D)}function G(R){return R===s?(e.consume(R),s=void 0,F):R===null?n(R):pt(R)?(a=G,j(R)):(e.consume(R),G)}function D(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rn(R)?C(R):(e.consume(R),D)}function F(R){return R===47||R===62||Rn(R)?C(R):n(R)}function A(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function j(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),P}function P(R){return Gt(R)?en(e,$,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):$(R)}function $(R){return e.enter("htmlTextData"),a(R)}}const sA={name:"labelEnd",resolveAll:zhe,resolveTo:Vhe,tokenize:Ghe},Fhe={tokenize:Khe},$he={tokenize:qhe},Hhe={tokenize:Yhe};function zhe(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===s?(e.consume(u),i++,c):(e.exit("thematicBreakSequence"),Gt(u)?en(e,l,"whitespace")(u):l(u))}}const tr={continuation:{tokenize:spe},exit:ape,name:"list",tokenize:ipe},tpe={partial:!0,tokenize:ope},npe={partial:!0,tokenize:rpe};function ipe(e,t,n){const i=this,s=i.events[i.events.length-1];let r=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(p){const m=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:jS(p)){if(i.containerState.type||(i.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ob,n,u)(p):u(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return jS(p)&&++a<10?(e.consume(p),c):(!i.interrupt||a<2)&&(i.containerState.marker?p===i.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"),i.containerState.marker=i.containerState.marker||p,e.check(gg,i.interrupt?n:d,e.attempt(tpe,h,f))}function d(p){return i.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return Gt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return i.containerState.size=r+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function spe(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(gg,s,r);function s(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,en(e,t,"listItemIndent",i.containerState.size+1)(l)}function r(l){return i.containerState.furtherBlankLines||!Gt(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(npe,t,a)(l))}function a(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,en(e,e.attempt(tr,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function rpe(e,t,n){const i=this;return en(e,s,"listItemIndent",i.containerState.size+1);function s(r){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?t(r):n(r)}}function ape(e){e.exit(this.containerState.type)}function ope(e,t,n){const i=this;return en(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(r){const a=i.events[i.events.length-1];return!Gt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const nM={name:"setextUnderline",resolveTo:lpe,tokenize:cpe};function lpe(e,t){let n=e.length,i,s,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=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[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",r?(e.splice(s,0,["enter",a,t]),e.splice(r+1,0,["exit",e[i][1],t]),e[i][1].end={...e[r][1].end}):e[i][1]=a,e.push(["exit",a,t]),e}function cpe(e,t,n){const i=this;let s;return r;function r(u){let d=i.events.length,f;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){f=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Gt(u)?en(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||pt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const upe={tokenize:dpe};function dpe(e){const t=this,n=e.attempt(gg,i,e.attempt(this.parser.constructs.flowInitial,s,en(e,e.attempt(this.parser.constructs.flow,s,e.attempt(ghe,s)),"linePrefix")));return n;function i(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const fpe={resolveAll:zU()},hpe=HU("string"),ppe=HU("text");function HU(e){return{resolveAll:zU(e==="text"?mpe:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],r=n.attempt(s,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=s[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(i):a.shift()}r>0&&a.push(e[s].slice(0,r))}return a}function Ape(e,t){let n=-1;const i=[];let s;for(;++n0?`?${r.join("&")}`:"";return yg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function Ide(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 Rde(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function FO({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 jde={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function MS(e){const t=Su.find(n=>n.id===e||n.toolNames.includes(e));return jde[e]??(t==null?void 0:t.label)??e}function $O(e){const t=Su.find(i=>i.id===e||i.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function Ode(){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 Mde(){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 HO(){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 wU({title:e,description:t,icon:n,wide:i=!1,onClose:s,children:r}){const a=b.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return b.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[s]),ks.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),o.jsxs("section",{className:`session-capability-dialog${i?" 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:s,children:o.jsx(Ode,{})})]}),r]})]}),document.body)}function Bb({value:e,placeholder:t,label:n,onChange:i,autoFocus:s=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(Mde,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:r=>i(r.target.value)})]})}function Lde({agentName:e,tools:t,selectedNames:n,mutating:i,onAdd:s,onClose:r}){const[a,l]=b.useState(""),[c,u]=b.useState(""),d=b.useMemo(()=>new Set(n),[n]),f=b.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${MS(m)} ${m} ${$O(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&r()};return o.jsx(wU,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(FO,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(Bb,{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),g=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(FO,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:MS(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:$O(p)})]}),o.jsx("button",{type:"button",disabled:m||i||!!c,onClick:()=>void h(p),children:m?"已添加":g?"添加中…":"添加"})]},p)})})]})})}function Dde({appName:e,agentName:t,selectedNames:n,mutating:i,onAdd:s,onClose:r}){const[a,l]=b.useState("public"),[c,u]=b.useState(""),[d,f]=b.useState([]),[h,p]=b.useState(0),[m,g]=b.useState(!0),[v,y]=b.useState(""),[x,E]=b.useState([]),[w,N]=b.useState(null),[_,T]=b.useState([]),[k,C]=b.useState(""),[I,O]=b.useState(""),[L,G]=b.useState(!0),[D,F]=b.useState(!1),[A,j]=b.useState(""),[P,$]=b.useState(""),R=b.useMemo(()=>new Set(n),[n]);b.useEffect(()=>{if(a!=="public")return;let K=!0;const z=window.setTimeout(()=>{g(!0),y(""),_B(e,c.trim()).then(W=>{K&&(f(W.items),p(W.totalCount))}).catch(W=>{K&&(f([]),p(0),y(W instanceof Error?W.message:"搜索 Skill Hub 失败"))}).finally(()=>{K&&g(!1)})},250);return()=>{K=!1,window.clearTimeout(z)}},[e,c,a]),b.useEffect(()=>{if(a!=="agentkit")return;let K=!0;return G(!0),j(""),EU().then(z=>{K&&(E(z),N(z[0]??null))}).catch(z=>{K&&j(z instanceof Error?z.message:"读取 Skill Space 失败")}).finally(()=>{K&&G(!1)}),()=>{K=!1}},[a]),b.useEffect(()=>{if(a!=="agentkit")return;if(!w){T([]);return}let K=!0;return F(!0),j(""),vU(w.id,w.region).then(z=>{K&&T(z)}).catch(z=>{K&&j(z instanceof Error?z.message:"读取技能失败")}).finally(()=>{K&&F(!1)}),()=>{K=!1}},[w,a]);const Y=b.useMemo(()=>{const K=k.trim().toLowerCase();return K?x.filter(z=>`${z.name} ${z.id} ${z.description}`.toLowerCase().includes(K)):x},[k,x]),Z=b.useMemo(()=>{const K=I.trim().toLowerCase();return K?_.filter(z=>`${z.skillName} ${z.skillDescription}`.toLowerCase().includes(K)):_},[I,_]),B=async K=>{if(!w)return;$(K.skillId);const z=await s({kind:"skill",name:K.skillName,skillSourceId:w.id,description:K.skillDescription,version:K.version});$(""),z&&r()},te=async K=>{$(K.slug);const z=await s({kind:"skill",name:K.name,skillSourceId:`findskill:${K.slug}`,description:K.description,version:K.version||K.updatedAt});$(""),z&&r()};return o.jsx(wU,{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(Bb,{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(K=>{const z=R.has(K.name),W=P===K.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:K.name}),o.jsx("span",{children:K.description||"暂无描述"}),o.jsxs("small",{children:[K.sourceRepo||K.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),K.downloadCount.toLocaleString()," 次下载",K.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),K.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:z||i||!!P,onClick:()=>void te(K),children:z?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(HO,{}),"添加"]})})]},K.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(Bb,{value:k,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:L?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):Y.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):Y.map(K=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===K.id?" is-active":""}`,onClick:()=>{N(K),O("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:K.name||K.id}),o.jsx("small",{children:K.description||K.id}),o.jsxs("em",{children:[K.skillCount??0," 个技能"]})]})},`${K.projectName??"default"}:${K.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(Bb,{value:I,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:O})]}),o.jsx("div",{className:"session-skill-pane-list",children:A?o.jsx("div",{className:"session-capability-error",children:A}):w?D?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):Z.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):Z.map(K=>{const z=R.has(K.skillName),W=P===K.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:K.skillName}),o.jsx("span",{children:K.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",K.version||"—"]})]}),o.jsx("button",{type:"button",disabled:z||i||!!P,onClick:()=>void B(K),children:z?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(HO,{}),"添加"]})})]},`${K.skillId}:${K.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function _a({as:e="span",className:t="",duration:n=4,spread:i=20,children:s,style:r,...a}){const l=Math.min(Math.max(i,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:s})}function _U(e){return 1+e.children.reduce((t,n)=>t+_U(n),0)}function SU(e){return e.id||e.name}function Pde(e,t){const n=SU(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const i=/^agent_sub_(\d+)$/.exec(n);return i?`子 Agent ${i[1]}`:e.name||n}function NU(e,t=!0){return{...e,id:SU(e),name:Pde(e,t),children:e.children.map(n=>NU(n,!1))}}function TU(e){const t=_s();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(TU)}}function Bde(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function Ude(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function $v({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 Fde({appName:e,info:t,loading:n,variant:i="rail",capabilities:s=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=b.useState(null),[h,p]=b.useState(!1),m=b.useRef(null),g=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=m.current)==null?void 0:_.focus()})};if(b.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,T=k=>{k.key==="Escape"&&g()};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${i==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(_a,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=NU(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=(s==null?void 0:s.tools)??Bde(t.tools).map(_=>({id:`base:tool:${_}`,kind:"tool",name:_,custom:!1})),x=(s==null?void 0:s.skills)??Ude(t.skills).map(_=>({id:`base:skill:${_.name}`,kind:"skill",name:_.name,description:_.description,custom:!1})),E=!!(s&&c&&u),w=TU(v),N=_=>o.jsx(jm,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${i==="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($v,{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:MS(_.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($v,{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($v,{title:"结构拓扑",count:_U(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(Kc,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:N(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(Lde,{agentName:t.name,tools:l,selectedNames:y.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(Dde,{appName:e,agentName:t.name,selectedNames:x.map(_=>_.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&ks.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:g,autoFocus:!0,children:o.jsx(As,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:N(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function Wje(){}function zO(e){const t=[],n=String(e||"");let i=n.indexOf(","),s=0,r=!1;for(;!r;){i===-1&&(i=n.length,r=!0);const a=n.slice(s,i).trim();(a||!r)&&t.push(a),s=i+1,i=n.indexOf(",",s)}return t}function kU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $de=/[$_\p{ID_Start}]/u,Hde=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,zde=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,Vde=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gde=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AU={};function Xje(e){return e?$de.test(String.fromCodePoint(e)):!1}function Qje(e,t){const i=(t||AU).jsx?zde:Hde;return e?i.test(String.fromCodePoint(e)):!1}function VO(e,t){return(AU.jsx?Gde:Vde).test(e)}const Kde=/[ \t\n\f\r]/g;function qde(e){return typeof e=="object"?e.type==="text"?GO(e.value):!1:GO(e)}function GO(e){return e.replace(Kde,"")===""}let xg=class{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}};xg.prototype.normal={};xg.prototype.property={};xg.prototype.space=void 0;function CU(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new xg(n,i,t)}function Om(e){return e.toLowerCase()}class hr{constructor(t,n){this.attribute=n,this.property=t}}hr.prototype.attribute="";hr.prototype.booleanish=!1;hr.prototype.boolean=!1;hr.prototype.commaOrSpaceSeparated=!1;hr.prototype.commaSeparated=!1;hr.prototype.defined=!1;hr.prototype.mustUseProperty=!1;hr.prototype.number=!1;hr.prototype.overloadedBoolean=!1;hr.prototype.property="";hr.prototype.spaceSeparated=!1;hr.prototype.space=void 0;let Yde=0;const Rt=Nu(),Gi=Nu(),LS=Nu(),Be=Nu(),Vn=Nu(),Wd=Nu(),mr=Nu();function Nu(){return 2**++Yde}const DS=Object.freeze(Object.defineProperty({__proto__:null,boolean:Rt,booleanish:Gi,commaOrSpaceSeparated:mr,commaSeparated:Wd,number:Be,overloadedBoolean:LS,spaceSeparated:Vn},Symbol.toStringTag,{value:"Module"})),Hv=Object.keys(DS);class rA extends hr{constructor(t,n,i,s){let r=-1;if(super(t,n),KO(this,"space",s),typeof i=="number")for(;++r4&&n.slice(0,4)==="data"&&Jde.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(qO,tfe);i="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!qO.test(r)){let a=r.replace(Zde,efe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=rA}return new s(i,t)}function efe(e){return"-"+e.toLowerCase()}function tfe(e){return e.charAt(1).toUpperCase()}const Eg=CU([IU,Wde,OU,MU,LU],"html"),cc=CU([IU,Xde,OU,MU,LU],"svg");function YO(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function DU(e){return e.join(" ").trim()}var aA={},WO=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,nfe=/\n/g,ife=/^\s*/,sfe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rfe=/^:\s*/,afe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ofe=/^[;\s]*/,lfe=/^\s+|\s+$/g,cfe=` +`,XO="/",QO="*",Oc="",ufe="comment",dfe="declaration";function ffe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function s(m){var g=m.match(nfe);g&&(n+=g.length);var v=m.lastIndexOf(cfe);i=~v?m.length-v:i+m.length}function r(){var m={line:n,column:i};return function(g){return g.position=new a(m),u(),g}}function a(m){this.start=m,this.end={line:n,column:i},this.source=t.source}a.prototype.content=e;function l(m){var g=new Error(t.source+":"+n+":"+i+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=i,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var v=g[0];return s(v),e=e.slice(v.length),g}}function u(){c(ife)}function d(m){var g;for(m=m||[];g=f();)g!==!1&&m.push(g);return m}function f(){var m=r();if(!(XO!=e.charAt(0)||QO!=e.charAt(1))){for(var g=2;Oc!=e.charAt(g)&&(QO!=e.charAt(g)||XO!=e.charAt(g+1));)++g;if(g+=2,Oc===e.charAt(g-1))return l("End of comment missing");var v=e.slice(2,g-2);return i+=2,s(v),e=e.slice(g),i+=2,m({type:ufe,comment:v})}}function h(){var m=r(),g=c(sfe);if(g){if(f(),!c(rfe))return l("property missing ':'");var v=c(afe),y=m({type:dfe,property:ZO(g[0].replace(WO,Oc)),value:v?ZO(v[0].replace(WO,Oc)):Oc});return c(ofe),y}}function p(){var m=[];d(m);for(var g;g=h();)g!==!1&&(m.push(g),d(m));return m}return u(),p()}function ZO(e){return e?e.replace(lfe,Oc):Oc}var hfe=ffe,pfe=Il&&Il.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(aA,"__esModule",{value:!0});aA.default=gfe;const mfe=pfe(hfe);function gfe(e,t){let n=null;if(!e||typeof e!="string")return n;const i=(0,mfe.default)(e),s=typeof t=="function";return i.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;s?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var wx={};Object.defineProperty(wx,"__esModule",{value:!0});wx.camelCase=void 0;var bfe=/^--[a-zA-Z0-9_-]+$/,yfe=/-([a-z])/g,xfe=/^[^-]+$/,Efe=/^-(webkit|moz|ms|o|khtml)-/,vfe=/^-(ms)-/,wfe=function(e){return!e||xfe.test(e)||bfe.test(e)},_fe=function(e,t){return t.toUpperCase()},JO=function(e,t){return"".concat(t,"-")},Sfe=function(e,t){return t===void 0&&(t={}),wfe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(vfe,JO):e=e.replace(Efe,JO),e.replace(yfe,_fe))};wx.camelCase=Sfe;var Nfe=Il&&Il.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Tfe=Nfe(aA),kfe=wx;function PS(e,t){var n={};return!e||typeof e!="string"||(0,Tfe.default)(e,function(i,s){i&&s&&(n[(0,kfe.camelCase)(i,t)]=s)}),n}PS.default=PS;var Afe=PS;const Cfe=Df(Afe),_x=PU("end"),ao=PU("start");function PU(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Ife(e){const t=ao(e),n=_x(e);if(t&&n)return{start:t,end:n}}function $p(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?eM(e.position):"start"in e||"end"in e?eM(e):"line"in e||"column"in e?BS(e):""}function BS(e){return tM(e&&e.line)+":"+tM(e&&e.column)}function eM(e){return BS(e&&e.start)+"-"+BS(e&&e.end)}function tM(e){return e&&typeof e=="number"?e:1}class Ps extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",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"?s=t:!r.cause&&t&&(a=!0,s=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof i=="string"){const c=i.indexOf(":");c===-1?r.ruleId=i:(r.source=i.slice(0,c),r.ruleId=i.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=s,this.line=l?l.line:void 0,this.name=$p(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}}Ps.prototype.file="";Ps.prototype.name="";Ps.prototype.reason="";Ps.prototype.message="";Ps.prototype.stack="";Ps.prototype.column=void 0;Ps.prototype.line=void 0;Ps.prototype.ancestors=void 0;Ps.prototype.cause=void 0;Ps.prototype.fatal=void 0;Ps.prototype.place=void 0;Ps.prototype.ruleId=void 0;Ps.prototype.source=void 0;const oA={}.hasOwnProperty,Rfe=new Map,jfe=/[A-Z]/g,Ofe=new Set(["table","tbody","thead","tfoot","tr"]),Mfe=new Set(["td","th"]),BU="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lfe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=zfe(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");i=Hfe(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,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"?cc:Eg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=UU(s,e,void 0);return r&&typeof r!="string"?r:s.create(e,s.Fragment,{children:r||void 0},void 0)}function UU(e,t,n){if(t.type==="element")return Dfe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Pfe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ufe(e,t,n);if(t.type==="mdxjsEsm")return Bfe(e,t);if(t.type==="root")return Ffe(e,t,n);if(t.type==="text")return $fe(e,t)}function Dfe(e,t,n){const i=e.schema;let s=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=cc,e.schema=s),e.ancestors.push(t);const r=$U(e,t.tagName,!1),a=Vfe(e,t);let l=cA(e,t);return Ofe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!qde(c):!0})),FU(e,a,r,t),lA(a,l),e.ancestors.pop(),e.schema=i,e.create(t,r,a,n)}function Pfe(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Mm(e,t.position)}function Bfe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Mm(e,t.position)}function Ufe(e,t,n){const i=e.schema;let s=i;t.name==="svg"&&i.space==="html"&&(s=cc,e.schema=s),e.ancestors.push(t);const r=t.name===null?e.Fragment:$U(e,t.name,!0),a=Gfe(e,t),l=cA(e,t);return FU(e,a,r,t),lA(a,l),e.ancestors.pop(),e.schema=i,e.create(t,r,a,n)}function Ffe(e,t,n){const i={};return lA(i,cA(e,t)),e.create(t,e.Fragment,i,n)}function $fe(e,t){return t.value}function FU(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function lA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Hfe(e,t,n){return i;function i(s,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function zfe(e,t){return n;function n(i,s,r,a){const l=Array.isArray(r.children),c=ao(i);return t(s,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Vfe(e,t){const n={};let i,s;for(s in t.properties)if(s!=="children"&&oA.call(t.properties,s)){const r=Kfe(e,s,t.properties[s]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Mfe.has(t.tagName)?i=l:n[a]=l}}if(i){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function Gfe(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const r=i.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 Mm(e,t.position);else{const s=i.name;let r;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Mm(e,t.position);else r=i.value===null?!0:i.value;n[s]=r}return n}function cA(e,t){const n=[];let i=-1;const s=e.passKeys?new Map:Rfe;for(;++is?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)a=Array.from(i),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Ar(e,e.length,0,t),e):t}const sM={}.hasOwnProperty;function zU(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 Sa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ks=uc(/[A-Za-z]/),Ls=uc(/[\dA-Za-z]/),the=uc(/[#-'*+\--9=?A-Z^-~]/);function t1(e){return e!==null&&(e<32||e===127)}const US=uc(/\d/),nhe=uc(/[\dA-Fa-f]/),ihe=uc(/[!-/:-@[-`{-~]/);function mt(e){return e!==null&&e<-2}function Ln(e){return e!==null&&(e<0||e===32)}function zt(e){return e===-2||e===-1||e===32}const Sx=uc(new RegExp("\\p{P}|\\p{S}","u")),fu=uc(/\s/);function uc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function th(e){const t=[];let n=-1,i=0,s=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),s=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(i,n),encodeURIComponent(a)),i=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function Jt(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return zt(c)?(e.enter(n),l(c)):t(c)}function l(c){return zt(c)&&r++a))return;const T=t.events.length;let k=T,C,I;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(C){I=t.events[k][1].end;break}C=!0}for(y(i),_=T;_E;){const N=n[w];t.containerState=N[1],N[0].exit.call(t,e)}n.length=E}function x(){s.write([null]),r=void 0,s=void 0,t.containerState._closeFlow=void 0}}function lhe(e,t,n){return Jt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Af(e){if(e===null||Ln(e)||fu(e))return 1;if(Sx(e))return 2}function Nx(e,t,n){const i=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[i][1].end},h={...e[n][1].start};aM(f,-c),aM(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[i][1].end={...a.start},e[n][1].start={...l.end},u=[],e[i][1].end.offset-e[i][1].start.offset&&(u=$r(u,[["enter",e[i][1],t],["exit",e[i][1],t]])),u=$r(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=$r(u,Nx(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),u=$r(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=$r(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ar(e,i-1,n-i+3,u),n=i+u.length-d-2;break}}for(n=-1;++n0&&zt(_)?Jt(e,x,"linePrefix",r+1)(_):x(_)}function x(_){return _===null||mt(_)?e.check(oM,g,w)(_):(e.enter("codeFlowValue"),E(_))}function E(_){return _===null||mt(_)?(e.exit("codeFlowValue"),x(_)):(e.consume(_),E)}function w(_){return e.exit("codeFenced"),t(_)}function N(_,T,k){let C=0;return I;function I(F){return _.enter("lineEnding"),_.consume(F),_.exit("lineEnding"),O}function O(F){return _.enter("codeFencedFence"),zt(F)?Jt(_,L,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):L(F)}function L(F){return F===l?(_.enter("codeFencedFenceSequence"),G(F)):k(F)}function G(F){return F===l?(C++,_.consume(F),G):C>=a?(_.exit("codeFencedFenceSequence"),zt(F)?Jt(_,D,"whitespace")(F):D(F)):k(F)}function D(F){return F===null||mt(F)?(_.exit("codeFencedFence"),T(F)):k(F)}}}function Ehe(e,t,n){const i=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return i.parser.lazy[i.now().line]?n(a):t(a)}}const Vv={name:"codeIndented",tokenize:whe},vhe={partial:!0,tokenize:_he};function whe(e,t,n){const i=this;return s;function s(u){return e.enter("codeIndented"),Jt(e,r,"linePrefix",5)(u)}function r(u){const d=i.events[i.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):mt(u)?e.attempt(vhe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||mt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function _he(e,t,n){const i=this;return s;function s(a){return i.parser.lazy[i.now().line]?n(a):mt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Jt(e,r,"linePrefix",5)(a)}function r(a){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):mt(a)?s(a):n(a)}}const She={name:"codeText",previous:The,resolve:Nhe,tokenize:khe};function Nhe(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i=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-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&Hh(this.left,i),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),Hh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Hh(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(i.parser.constructs.flow,n,t)(a)}}function WU(e,t,n,i,s,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(i),e.enter(s),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||t1(y)?n(y):(e.enter(i),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(s),e.exit(i),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||mt(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 g(y){return!d&&(y===null||y===41||Ln(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(i),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(s),e.consume(p),e.exit(s),e.exit(i),t):mt(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||mt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!zt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function QU(e,t,n,i,s,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(i),t):(e.enter(r),u(h))}function u(h){return h===a?(e.exit(r),c(a)):h===null?n(h):mt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Jt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||mt(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 Hp(e,t){let n;return i;function i(s){return mt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):zt(s)?Jt(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const Lhe={name:"definition",tokenize:Phe},Dhe={partial:!0,tokenize:Bhe};function Phe(e,t,n){const i=this;let s;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return XU.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=Sa(i.sliceSerialize(i.events[i.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 Ln(p)?Hp(e,u)(p):u(p)}function u(p){return WU(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Dhe,f,f)(p)}function f(p){return zt(p)?Jt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||mt(p)?(e.exit("definition"),i.parser.defined.push(s),t(p)):n(p)}}function Bhe(e,t,n){return i;function i(l){return Ln(l)?Hp(e,s)(l):n(l)}function s(l){return QU(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return zt(l)?Jt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||mt(l)?t(l):n(l)}}const Uhe={name:"hardBreakEscape",tokenize:Fhe};function Fhe(e,t,n){return i;function i(r){return e.enter("hardBreakEscape"),e.consume(r),s}function s(r){return mt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const $he={name:"headingAtx",resolve:Hhe,tokenize:zhe};function Hhe(e,t){let n=e.length-2,i=3,s,r;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},r={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Ar(e,i,n-i+1,[["enter",s,t],["enter",r,t],["exit",r,t],["exit",s,t]])),e}function zhe(e,t,n){let i=0;return s;function s(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&i++<6?(e.consume(d),a):d===null||Ln(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||mt(d)?(e.exit("atxHeading"),t(d)):zt(d)?Jt(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||Ln(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const Vhe=["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"],cM=["pre","script","style","textarea"],Ghe={concrete:!0,name:"htmlFlow",resolveTo:Yhe,tokenize:Whe},Khe={partial:!0,tokenize:Qhe},qhe={partial:!0,tokenize:Xhe};function Yhe(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 Whe(e,t,n){const i=this;let s,r,a,l,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),r=!0,g):B===63?(e.consume(B),s=3,i.interrupt?t:R):Ks(B)?(e.consume(B),a=String.fromCharCode(B),v):n(B)}function h(B){return B===45?(e.consume(B),s=2,p):B===91?(e.consume(B),s=5,l=0,m):Ks(B)?(e.consume(B),s=4,i.interrupt?t:R):n(B)}function p(B){return B===45?(e.consume(B),i.interrupt?t:R):n(B)}function m(B){const te="CDATA[";return B===te.charCodeAt(l++)?(e.consume(B),l===te.length?i.interrupt?t:L:m):n(B)}function g(B){return Ks(B)?(e.consume(B),a=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||Ln(B)){const te=B===47,K=a.toLowerCase();return!te&&!r&&cM.includes(K)?(s=1,i.interrupt?t(B):L(B)):Vhe.includes(a.toLowerCase())?(s=6,te?(e.consume(B),y):i.interrupt?t(B):L(B)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(B):r?x(B):E(B))}return B===45||Ls(B)?(e.consume(B),a+=String.fromCharCode(B),v):n(B)}function y(B){return B===62?(e.consume(B),i.interrupt?t:L):n(B)}function x(B){return zt(B)?(e.consume(B),x):I(B)}function E(B){return B===47?(e.consume(B),I):B===58||B===95||Ks(B)?(e.consume(B),w):zt(B)?(e.consume(B),E):I(B)}function w(B){return B===45||B===46||B===58||B===95||Ls(B)?(e.consume(B),w):N(B)}function N(B){return B===61?(e.consume(B),_):zt(B)?(e.consume(B),N):E(B)}function _(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,T):zt(B)?(e.consume(B),_):k(B)}function T(B){return B===c?(e.consume(B),c=null,C):B===null||mt(B)?n(B):(e.consume(B),T)}function k(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Ln(B)?N(B):(e.consume(B),k)}function C(B){return B===47||B===62||zt(B)?E(B):n(B)}function I(B){return B===62?(e.consume(B),O):n(B)}function O(B){return B===null||mt(B)?L(B):zt(B)?(e.consume(B),O):n(B)}function L(B){return B===45&&s===2?(e.consume(B),A):B===60&&s===1?(e.consume(B),j):B===62&&s===4?(e.consume(B),Y):B===63&&s===3?(e.consume(B),R):B===93&&s===5?(e.consume(B),$):mt(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Khe,Z,G)(B)):B===null||mt(B)?(e.exit("htmlFlowData"),G(B)):(e.consume(B),L)}function G(B){return e.check(qhe,D,Z)(B)}function D(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),F}function F(B){return B===null||mt(B)?G(B):(e.enter("htmlFlowData"),L(B))}function A(B){return B===45?(e.consume(B),R):L(B)}function j(B){return B===47?(e.consume(B),a="",P):L(B)}function P(B){if(B===62){const te=a.toLowerCase();return cM.includes(te)?(e.consume(B),Y):L(B)}return Ks(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),P):L(B)}function $(B){return B===93?(e.consume(B),R):L(B)}function R(B){return B===62?(e.consume(B),Y):B===45&&s===2?(e.consume(B),R):L(B)}function Y(B){return B===null||mt(B)?(e.exit("htmlFlowData"),Z(B)):(e.consume(B),Y)}function Z(B){return e.exit("htmlFlow"),t(B)}}function Xhe(e,t,n){const i=this;return s;function s(a){return mt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return i.parser.lazy[i.now().line]?n(a):t(a)}}function Qhe(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(vg,t,n)}}const Zhe={name:"htmlText",tokenize:Jhe};function Jhe(e,t,n){const i=this;let s,r,a;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),N):R===63?(e.consume(R),E):Ks(R)?(e.consume(R),k):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),r=0,m):Ks(R)?(e.consume(R),x):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),h):mt(R)?(a=f,j(R)):(e.consume(R),f)}function h(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?A(R):R===45?h(R):f(R)}function m(R){const Y="CDATA[";return R===Y.charCodeAt(r++)?(e.consume(R),r===Y.length?g:m):n(R)}function g(R){return R===null?n(R):R===93?(e.consume(R),v):mt(R)?(a=g,j(R)):(e.consume(R),g)}function v(R){return R===93?(e.consume(R),y):g(R)}function y(R){return R===62?A(R):R===93?(e.consume(R),y):g(R)}function x(R){return R===null||R===62?A(R):mt(R)?(a=x,j(R)):(e.consume(R),x)}function E(R){return R===null?n(R):R===63?(e.consume(R),w):mt(R)?(a=E,j(R)):(e.consume(R),E)}function w(R){return R===62?A(R):E(R)}function N(R){return Ks(R)?(e.consume(R),_):n(R)}function _(R){return R===45||Ls(R)?(e.consume(R),_):T(R)}function T(R){return mt(R)?(a=T,j(R)):zt(R)?(e.consume(R),T):A(R)}function k(R){return R===45||Ls(R)?(e.consume(R),k):R===47||R===62||Ln(R)?C(R):n(R)}function C(R){return R===47?(e.consume(R),A):R===58||R===95||Ks(R)?(e.consume(R),I):mt(R)?(a=C,j(R)):zt(R)?(e.consume(R),C):A(R)}function I(R){return R===45||R===46||R===58||R===95||Ls(R)?(e.consume(R),I):O(R)}function O(R){return R===61?(e.consume(R),L):mt(R)?(a=O,j(R)):zt(R)?(e.consume(R),O):C(R)}function L(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,G):mt(R)?(a=L,j(R)):zt(R)?(e.consume(R),L):(e.consume(R),D)}function G(R){return R===s?(e.consume(R),s=void 0,F):R===null?n(R):mt(R)?(a=G,j(R)):(e.consume(R),G)}function D(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Ln(R)?C(R):(e.consume(R),D)}function F(R){return R===47||R===62||Ln(R)?C(R):n(R)}function A(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function j(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),P}function P(R){return zt(R)?Jt(e,$,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):$(R)}function $(R){return e.enter("htmlTextData"),a(R)}}const fA={name:"labelEnd",resolveAll:ipe,resolveTo:spe,tokenize:rpe},epe={tokenize:ape},tpe={tokenize:ope},npe={tokenize:lpe};function ipe(e){let t=-1;const n=[];for(;++t=3&&(u===null||mt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),i++,c):(e.exit("thematicBreakSequence"),zt(u)?Jt(e,l,"whitespace")(u):l(u))}}const ir={continuation:{tokenize:ype},exit:Epe,name:"list",tokenize:bpe},mpe={partial:!0,tokenize:vpe},gpe={partial:!0,tokenize:xpe};function bpe(e,t,n){const i=this,s=i.events[i.events.length-1];let r=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(p){const m=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:US(p)){if(i.containerState.type||(i.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ub,n,u)(p):u(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return US(p)&&++a<10?(e.consume(p),c):(!i.interrupt||a<2)&&(i.containerState.marker?p===i.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"),i.containerState.marker=i.containerState.marker||p,e.check(vg,i.interrupt?n:d,e.attempt(mpe,h,f))}function d(p){return i.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return zt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return i.containerState.size=r+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function ype(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(vg,s,r);function s(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Jt(e,t,"listItemIndent",i.containerState.size+1)(l)}function r(l){return i.containerState.furtherBlankLines||!zt(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(gpe,t,a)(l))}function a(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,Jt(e,e.attempt(ir,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function xpe(e,t,n){const i=this;return Jt(e,s,"listItemIndent",i.containerState.size+1);function s(r){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?t(r):n(r)}}function Epe(e){e.exit(this.containerState.type)}function vpe(e,t,n){const i=this;return Jt(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(r){const a=i.events[i.events.length-1];return!zt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const uM={name:"setextUnderline",resolveTo:wpe,tokenize:_pe};function wpe(e,t){let n=e.length,i,s,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=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[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",r?(e.splice(s,0,["enter",a,t]),e.splice(r+1,0,["exit",e[i][1],t]),e[i][1].end={...e[r][1].end}):e[i][1]=a,e.push(["exit",a,t]),e}function _pe(e,t,n){const i=this;let s;return r;function r(u){let d=i.events.length,f;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){f=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),zt(u)?Jt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||mt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Spe={tokenize:Npe};function Npe(e){const t=this,n=e.attempt(vg,i,e.attempt(this.parser.constructs.flowInitial,s,Jt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Ihe,s)),"linePrefix")));return n;function i(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Tpe={resolveAll:JU()},kpe=ZU("string"),Ape=ZU("text");function ZU(e){return{resolveAll:JU(e==="text"?Cpe:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],r=n.attempt(s,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=s[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(i):a.shift()}r>0&&a.push(e[s].slice(0,r))}return a}function Hpe(e,t){let n=-1;const i=[];let s;for(;++n0){const Ye=ie.tokenStack[ie.tokenStack.length-1];(Ye[1]||sM).call(ie,void 0,Ye[0])}for(ae.position={start:pl(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:pl(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},Ue=-1;++Ue0&&(i.className=["language-"+s[0]]);let r={type:"element",tagName:"code",properties:i,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 Hpe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zpe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vpe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=Zf(i.toLowerCase()),r=e.footnoteOrder.indexOf(i);let a,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(i,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(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 Gpe(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 Kpe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function KU(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const s=e.all(t),r=s[0];r&&r.type==="text"?r.value="["+r.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=i:s.push({type:"text",value:i}),s}function qpe(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return KU(e,t);const s={src:Zf(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const r={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,r),e.applyData(t,r)}function Ype(e,t){const n={src:Zf(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 i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function Wpe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function Xpe(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return KU(e,t);const s={href:Zf(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const r={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Qpe(e,t){const n={href:Zf(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Zpe(e,t,n){const i=e.all(t),s=n?Jpe(n):qU(t),r={},a=[];if(typeof t.checked=="boolean"){const d=i[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},i.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 qe=ie.tokenStack[ie.tokenStack.length-1];(qe[1]||fM).call(ie,void 0,qe[0])}for(oe.position={start:gl(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:gl(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},Le=-1;++Le0&&(i.className=["language-"+s[0]]);let r={type:"element",tagName:"code",properties:i,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 nme(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ime(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sme(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=th(i.toLowerCase()),r=e.footnoteOrder.indexOf(i);let a,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(i,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(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 rme(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 ame(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function n7(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const s=e.all(t),r=s[0];r&&r.type==="text"?r.value="["+r.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=i:s.push({type:"text",value:i}),s}function ome(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return n7(e,t);const s={src:th(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const r={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,r),e.applyData(t,r)}function lme(e,t){const n={src:th(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 i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function cme(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function ume(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return n7(e,t);const s={href:th(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const r={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function dme(e,t){const n={href:th(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function fme(e,t,n){const i=e.all(t),s=n?hme(n):i7(t),r={},a=[];if(typeof t.checked=="boolean"){const d=i[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},i.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 eme(e,t){const n={},i=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ro(t.children[1]),c=gx(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,r),e.applyData(t,r)}function rme(e,t,n){const i=n?n.children:void 0,r=(i?i.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),i[0]),s=i.index+i[0].length,i=n.exec(t);return r.push(oM(t.slice(s),s>0,!1)),r.join("")}function oM(e,t,n){let i=0,s=e.length;if(t){let r=e.codePointAt(i);for(;r===rM||r===aM;)i++,r=e.codePointAt(i)}if(n){let r=e.codePointAt(s-1);for(;r===rM||r===aM;)s--,r=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function lme(e,t){const n={type:"text",value:ome(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function cme(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ume={blockquote:Upe,break:Fpe,code:$pe,delete:Hpe,emphasis:zpe,footnoteReference:Vpe,heading:Gpe,html:Kpe,imageReference:qpe,image:Ype,inlineCode:Wpe,linkReference:Xpe,link:Qpe,listItem:Zpe,list:eme,paragraph:tme,root:nme,strong:ime,table:sme,tableCell:ame,tableRow:rme,text:lme,thematicBreak:cme,toml:j0,yaml:j0,definition:j0,footnoteDefinition:j0};function j0(){}const YU=-1,xx=0,Up=1,Xy=2,rA=3,aA=4,oA=5,lA=6,WU=7,XU=8,dme=typeof self=="object"?self:globalThis,lM=(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 dme[e](t)},fme=(e,t)=>{const n=(s,r)=>(e.set(r,s),s),i=s=>{if(e.has(s))return e.get(s);const[r,a]=t[s];switch(r){case xx:case YU:return n(a,s);case Up:{const l=n([],s);for(const c of a)l.push(i(c));return l}case Xy:{const l=n({},s);for(const[c,u]of a)l[i(c)]=i(u);return l}case rA:return n(new Date(a),s);case aA:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case oA:{const l=n(new Map,s);for(const[c,u]of a)l.set(i(c),i(u));return l}case lA:{const l=n(new Set,s);for(const c of a)l.add(i(c));return l}case WU:{const{name:l,message:c}=a;return n(lM(l,c),s)}case XU:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);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(lM(r,a),s)};return i},cM=e=>fme(new Map,e)(0),Vu="",{toString:hme}={},{keys:pme}=Object,Uh=e=>{const t=typeof e;if(t!=="object"||!e)return[xx,t];const n=hme.call(e).slice(8,-1);switch(n){case"Array":return[Up,Vu];case"Object":return[Xy,Vu];case"Date":return[rA,Vu];case"RegExp":return[aA,Vu];case"Map":return[oA,Vu];case"Set":return[lA,Vu];case"DataView":return[Up,n]}return n.includes("Array")?[Up,n]:n.includes("Error")?[WU,n]:[Xy,n]},O0=([e,t])=>e===xx&&(t==="function"||t==="symbol"),mme=(e,t,n,i)=>{const s=(a,l)=>{const c=i.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=Uh(a);switch(l){case xx:{let d=a;switch(c){case"bigint":l=XU,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([YU],a)}return s([l,d],a)}case Up:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([l,d],a);for(const h of a)d.push(r(h));return f}case Xy:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=s([l,d],a);for(const h of pme(a))(e||!O0(Uh(a[h])))&&d.push([r(h),r(a[h])]);return f}case rA:return s([l,a.toISOString()],a);case aA:{const{source:d,flags:f}=a;return s([l,{source:d,flags:f}],a)}case oA:{const d=[],f=s([l,d],a);for(const[h,p]of a)(e||!(O0(Uh(h))||O0(Uh(p))))&&d.push([r(h),r(p)]);return f}case lA:{const d=[],f=s([l,d],a);for(const h of a)(e||!O0(Uh(h)))&&d.push(r(h));return f}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return r},uM=(e,{json:t,lossy:n}={})=>{const i=[];return mme(!(t||n),!!t,new Map,i)(e),i},kf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?cM(uM(e,t)):structuredClone(e):(e,t)=>cM(uM(e,t));function gme(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 bme(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function yme(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||gme,i=e.options.footnoteBackLabel||bme,s=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 i=="string"?i:i(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:{...kf(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:r,children:a};return e.patch(t,u),e.applyData(t,u)}function hme(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i1}function pme(e,t){const n={},i=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ao(t.children[1]),c=_x(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,r),e.applyData(t,r)}function xme(e,t,n){const i=n?n.children:void 0,r=(i?i.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),i[0]),s=i.index+i[0].length,i=n.exec(t);return r.push(mM(t.slice(s),s>0,!1)),r.join("")}function mM(e,t,n){let i=0,s=e.length;if(t){let r=e.codePointAt(i);for(;r===hM||r===pM;)i++,r=e.codePointAt(i)}if(n){let r=e.codePointAt(s-1);for(;r===hM||r===pM;)s--,r=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function wme(e,t){const n={type:"text",value:vme(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _me(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Sme={blockquote:Jpe,break:eme,code:tme,delete:nme,emphasis:ime,footnoteReference:sme,heading:rme,html:ame,imageReference:ome,image:lme,inlineCode:cme,linkReference:ume,link:dme,listItem:fme,list:pme,paragraph:mme,root:gme,strong:bme,table:yme,tableCell:Eme,tableRow:xme,text:wme,thematicBreak:_me,toml:P0,yaml:P0,definition:P0,footnoteDefinition:P0};function P0(){}const s7=-1,Tx=0,zp=1,n1=2,hA=3,pA=4,mA=5,gA=6,r7=7,a7=8,Nme=typeof self=="object"?self:globalThis,gM=(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 Nme[e](t)},Tme=(e,t)=>{const n=(s,r)=>(e.set(r,s),s),i=s=>{if(e.has(s))return e.get(s);const[r,a]=t[s];switch(r){case Tx:case s7:return n(a,s);case zp:{const l=n([],s);for(const c of a)l.push(i(c));return l}case n1:{const l=n({},s);for(const[c,u]of a)l[i(c)]=i(u);return l}case hA:return n(new Date(a),s);case pA:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case mA:{const l=n(new Map,s);for(const[c,u]of a)l.set(i(c),i(u));return l}case gA:{const l=n(new Set,s);for(const c of a)l.add(i(c));return l}case r7:{const{name:l,message:c}=a;return n(gM(l,c),s)}case a7:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);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(gM(r,a),s)};return i},bM=e=>Tme(new Map,e)(0),Ku="",{toString:kme}={},{keys:Ame}=Object,zh=e=>{const t=typeof e;if(t!=="object"||!e)return[Tx,t];const n=kme.call(e).slice(8,-1);switch(n){case"Array":return[zp,Ku];case"Object":return[n1,Ku];case"Date":return[hA,Ku];case"RegExp":return[pA,Ku];case"Map":return[mA,Ku];case"Set":return[gA,Ku];case"DataView":return[zp,n]}return n.includes("Array")?[zp,n]:n.includes("Error")?[r7,n]:[n1,n]},B0=([e,t])=>e===Tx&&(t==="function"||t==="symbol"),Cme=(e,t,n,i)=>{const s=(a,l)=>{const c=i.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=zh(a);switch(l){case Tx:{let d=a;switch(c){case"bigint":l=a7,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([s7],a)}return s([l,d],a)}case zp:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([l,d],a);for(const h of a)d.push(r(h));return f}case n1:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=s([l,d],a);for(const h of Ame(a))(e||!B0(zh(a[h])))&&d.push([r(h),r(a[h])]);return f}case hA:return s([l,a.toISOString()],a);case pA:{const{source:d,flags:f}=a;return s([l,{source:d,flags:f}],a)}case mA:{const d=[],f=s([l,d],a);for(const[h,p]of a)(e||!(B0(zh(h))||B0(zh(p))))&&d.push([r(h),r(p)]);return f}case gA:{const d=[],f=s([l,d],a);for(const h of a)(e||!B0(zh(h)))&&d.push(r(h));return f}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return r},yM=(e,{json:t,lossy:n}={})=>{const i=[];return Cme(!(t||n),!!t,new Map,i)(e),i},Cf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?bM(yM(e,t)):structuredClone(e):(e,t)=>bM(yM(e,t));function Ime(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 Rme(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function jme(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Ime,i=e.options.footnoteBackLabel||Rme,s=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 i=="string"?i:i(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:{...Cf(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const bg=function(e){if(e==null)return wme;if(typeof e=="function")return Ex(e);if(typeof e=="object")return Array.isArray(e)?xme(e):Eme(e);if(typeof e=="string")return vme(e);throw new Error("Expected function, string, or object as test")};function xme(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=QU,m,g,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=Tme(n(c,d)),p[0]===MS))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==Nme)for(g=(i?y.children.length:-1)+a,v=d.concat(y);g>-1&&g":""))+")"})}return h;function h(){let p=o7,m,g,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=Fme(n(c,d)),p[0]===$S))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==Ume)for(g=(i?y.children.length:-1)+a,v=d.concat(y);g>-1&&g0&&n.push({type:"text",value:` -`}),n}function dM(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function fM(e,t){const n=Ame(e,t),i=n.one(e,void 0),s=yme(n),r=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&r.children.push({type:"text",value:` -`},s),r}function Ome(e,t){return e&&"run"in e?async function(n,i){const s=fM(n,{file:i,...t});await e.run(s,i)}:function(n,i){return fM(n,{file:i,...e||t})}}function hM(e){if(e)throw e}var Mb=Object.prototype.hasOwnProperty,JU=Object.prototype.toString,pM=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,gM=function(t){return typeof Array.isArray=="function"?Array.isArray(t):JU.call(t)==="[object Array]"},bM=function(t){if(!t||JU.call(t)!=="[object Object]")return!1;var n=Mb.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Mb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;var s;for(s in t);return typeof s>"u"||Mb.call(t,s)},yM=function(t,n){pM&&n.name==="__proto__"?pM(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},xM=function(t,n){if(n==="__proto__")if(Mb.call(t,n)){if(mM)return mM(t,n).value}else return;return t[n]},Mme=function e(){var t,n,i,s,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(s);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,s):c instanceof Error?s(c):r(c))}function s(a,...l){n||(n=!0,t(a,...l))}function r(a){s(null,a)}}const Va={basename:Pme,dirname:Bme,extname:Ume,join:Fme,sep:"/"};function Pme(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');xg(e);let n=0,i=-1,s=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(r){n=s+1;break}}else i<0&&(r=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let a=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(r){n=s+1;break}}else a<0&&(r=!0,a=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(i=s):(l=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)}function Bme(e){if(xg(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Ume(e){xg(e);let t=e.length,n=-1,i=0,s=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){i=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?s<0?s=t:r!==1&&(r=1):s>-1&&(r=-1)}return s<0||n<0||r===0||r===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function Fme(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Hme(e,t){let n="",i=0,s=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",i=0):(n=n.slice(0,c),i=n.length-1-n.lastIndexOf("/")),s=a,r=0;continue}}else if(n.length>0){n="",i=0,s=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),i=a-s-1;s=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function xg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zme={cwd:Vme};function Vme(){return"/"}function PS(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Gme(e){if(typeof e=="string")e=new URL(e);else if(!PS(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 Kme(e)}function Kme(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const g=i[h][1];DS(g)&&DS(p)&&(p=Uv(!0,g,p)),i[h]=[u,p,...m]}}}}const Xme=new cA().freeze();function zv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gv(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 vM(e){if(!DS(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wM(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function M0(e){return Qme(e)?e:new e7(e)}function Qme(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Zme(e){return typeof e=="string"||Jme(e)}function Jme(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ege="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_M=[],SM={allowDangerousHtml:!0},tge=/^(https?|ircs?|mailto|xmpp)$/i,nge=[{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 ige(e){const t=sge(e),n=rge(e);return age(t.runSync(t.parse(n),n),e)}function sge(e){const t=e.rehypePlugins||_M,n=e.remarkPlugins||_M,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...SM}:SM;return Xme().use(Bpe).use(n).use(Ome,i).use(t)}function rge(e){const t=e.children||"",n=new e7;return typeof t=="string"&&(n.value=t),n}function age(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||oge;for(const d of nge)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+ege+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),yg(e,u),vfe(e,{Fragment:o.Fragment,components:s,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 Dv)if(Object.hasOwn(Dv,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=Dv[p];(g===null||g.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&&i&&typeof f=="number"&&(p=!i(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 oge(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||tge.test(e.slice(0,t))?e:""}function NM(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,s=n.indexOf(t);for(;s!==-1;)i++,s=n.indexOf(t,s+t.length);return i}function lge(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cge(e,t,n){const s=bg((n||{}).ignore||[]),r=uge(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],i=n.indexOf(")");const s=NM(e,"(");let r=NM(e,")");for(;i!==-1&&s>r;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),r++;return[e,n]}function t7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||uu(n)||bx(n))&&(!t||n!==47)}n7.peek=Oge;function Nge(){this.buffer()}function Tge(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function kge(){this.buffer()}function Age(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Cge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ige(e){this.exit(e)}function Rge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jge(e){this.exit(e)}function Oge(){return"["}function n7(e,t,n,i){const s=n.createTracker(i);let r=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=s.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=s.move("]"),r}function Mge(){return{enter:{gfmFootnoteCallString:Nge,gfmFootnoteCall:Tge,gfmFootnoteDefinitionLabelString:kge,gfmFootnoteDefinition:Age},exit:{gfmFootnoteCallString:Cge,gfmFootnoteCall:Ige,gfmFootnoteDefinitionLabelString:Rge,gfmFootnoteDefinition:jge}}}function Lge(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:n7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,s,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(i),{before:c,after:"]"})),d(),c+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+r.indentLines(r.containerFlow(i,l.current()),t?i7:Dge))),u(),c}}function Dge(e,t,n){return t===0?e:i7(e,t,n)}function i7(e,t,n){return(n?"":" ")+e}const Pge=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];s7.peek=Hge;function Bge(){return{canContainEols:["delete"],enter:{strikethrough:Fge},exit:{strikethrough:$ge}}}function Uge(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Pge}],handlers:{delete:s7}}}function Fge(e){this.enter({type:"delete",children:[]},e)}function $ge(e){this.exit(e)}function s7(e,t,n,i){const s=n.createTracker(i),r=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),r(),a}function Hge(){return"~"}function zge(e){return e.length}function Vge(e,t){const n=t||{},i=(n.align||[]).concat(),s=n.stringLength||zge,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}g.push(x)}a[d]=g,l[d]=v}let f=-1;if(typeof i=="object"&&"length"in i)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()),qge);return s(),a}function qge(e,t,n){return">"+(n?"":" ")+e}function Yge(e,t){return AM(e,t.inConstruct,!0)&&!AM(e,t.notInConstruct,!1)}function AM(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++ia&&(a=r):r=1,s=i+t.length,i=n.indexOf(t,s);return a}function Xge(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 Qge(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 Zge(e,t,n,i){const s=Qge(n),r=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(Xge(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,Jge);return f(),h}const l=n.createTracker(i),c=s.repeat(Math.max(Wge(r,s)+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 xM(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function EM(e,t){const n=Hme(e,t),i=n.one(e,void 0),s=jme(n),r=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&r.children.push({type:"text",value:` +`},s),r}function qme(e,t){return e&&"run"in e?async function(n,i){const s=EM(n,{file:i,...t});await e.run(s,i)}:function(n,i){return EM(n,{file:i,...e||t})}}function vM(e){if(e)throw e}var Fb=Object.prototype.hasOwnProperty,c7=Object.prototype.toString,wM=Object.defineProperty,_M=Object.getOwnPropertyDescriptor,SM=function(t){return typeof Array.isArray=="function"?Array.isArray(t):c7.call(t)==="[object Array]"},NM=function(t){if(!t||c7.call(t)!=="[object Object]")return!1;var n=Fb.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Fb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;var s;for(s in t);return typeof s>"u"||Fb.call(t,s)},TM=function(t,n){wM&&n.name==="__proto__"?wM(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},kM=function(t,n){if(n==="__proto__")if(Fb.call(t,n)){if(_M)return _M(t,n).value}else return;return t[n]},Yme=function e(){var t,n,i,s,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(s);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,s):c instanceof Error?s(c):r(c))}function s(a,...l){n||(n=!0,t(a,...l))}function r(a){s(null,a)}}const Ga={basename:Qme,dirname:Zme,extname:Jme,join:ege,sep:"/"};function Qme(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Sg(e);let n=0,i=-1,s=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(r){n=s+1;break}}else i<0&&(r=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let a=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(r){n=s+1;break}}else a<0&&(r=!0,a=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(i=s):(l=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)}function Zme(e){if(Sg(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Jme(e){Sg(e);let t=e.length,n=-1,i=0,s=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){i=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?s<0?s=t:r!==1&&(r=1):s>-1&&(r=-1)}return s<0||n<0||r===0||r===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function ege(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nge(e,t){let n="",i=0,s=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",i=0):(n=n.slice(0,c),i=n.length-1-n.lastIndexOf("/")),s=a,r=0;continue}}else if(n.length>0){n="",i=0,s=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),i=a-s-1;s=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function Sg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ige={cwd:sge};function sge(){return"/"}function VS(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rge(e){if(typeof e=="string")e=new URL(e);else if(!VS(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 age(e)}function age(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const g=i[h][1];zS(g)&&zS(p)&&(p=Kv(!0,g,p)),i[h]=[u,p,...m]}}}}const uge=new bA().freeze();function Xv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Zv(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 CM(e){if(!zS(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function IM(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function U0(e){return dge(e)?e:new u7(e)}function dge(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fge(e){return typeof e=="string"||hge(e)}function hge(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pge="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",RM=[],jM={allowDangerousHtml:!0},mge=/^(https?|ircs?|mailto|xmpp)$/i,gge=[{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 bge(e){const t=yge(e),n=xge(e);return Ege(t.runSync(t.parse(n),n),e)}function yge(e){const t=e.rehypePlugins||RM,n=e.remarkPlugins||RM,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jM}:jM;return uge().use(Zpe).use(n).use(qme,i).use(t)}function xge(e){const t=e.children||"",n=new u7;return typeof t=="string"&&(n.value=t),n}function Ege(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||vge;for(const d of gge)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+pge+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),_g(e,u),Lfe(e,{Fragment:o.Fragment,components:s,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 zv)if(Object.hasOwn(zv,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=zv[p];(g===null||g.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&&i&&typeof f=="number"&&(p=!i(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 vge(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||mge.test(e.slice(0,t))?e:""}function OM(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,s=n.indexOf(t);for(;s!==-1;)i++,s=n.indexOf(t,s+t.length);return i}function wge(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function _ge(e,t,n){const s=wg((n||{}).ignore||[]),r=Sge(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],i=n.indexOf(")");const s=OM(e,"(");let r=OM(e,")");for(;i!==-1&&s>r;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),r++;return[e,n]}function d7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||fu(n)||Sx(n))&&(!t||n!==47)}f7.peek=qge;function Uge(){this.buffer()}function Fge(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function $ge(){this.buffer()}function Hge(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function zge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vge(e){this.exit(e)}function Gge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Kge(e){this.exit(e)}function qge(){return"["}function f7(e,t,n,i){const s=n.createTracker(i);let r=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=s.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=s.move("]"),r}function Yge(){return{enter:{gfmFootnoteCallString:Uge,gfmFootnoteCall:Fge,gfmFootnoteDefinitionLabelString:$ge,gfmFootnoteDefinition:Hge},exit:{gfmFootnoteCallString:zge,gfmFootnoteCall:Vge,gfmFootnoteDefinitionLabelString:Gge,gfmFootnoteDefinition:Kge}}}function Wge(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:f7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,s,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(i),{before:c,after:"]"})),d(),c+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+r.indentLines(r.containerFlow(i,l.current()),t?h7:Xge))),u(),c}}function Xge(e,t,n){return t===0?e:h7(e,t,n)}function h7(e,t,n){return(n?"":" ")+e}const Qge=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];p7.peek=n0e;function Zge(){return{canContainEols:["delete"],enter:{strikethrough:e0e},exit:{strikethrough:t0e}}}function Jge(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Qge}],handlers:{delete:p7}}}function e0e(e){this.enter({type:"delete",children:[]},e)}function t0e(e){this.exit(e)}function p7(e,t,n,i){const s=n.createTracker(i),r=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),r(),a}function n0e(){return"~"}function i0e(e){return e.length}function s0e(e,t){const n=t||{},i=(n.align||[]).concat(),s=n.stringLength||i0e,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}g.push(x)}a[d]=g,l[d]=v}let f=-1;if(typeof i=="object"&&"length"in i)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()),o0e);return s(),a}function o0e(e,t,n){return">"+(n?"":" ")+e}function l0e(e,t){return DM(e,t.inConstruct,!0)&&!DM(e,t.notInConstruct,!1)}function DM(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++ia&&(a=r):r=1,s=i+t.length,i=n.indexOf(t,s);return a}function u0e(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 d0e(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 f0e(e,t,n,i){const s=d0e(n),r=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(u0e(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,h0e);return f(),h}const l=n.createTracker(i),c=s.repeat(Math.max(c0e(r,s)+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 Jge(e,t,n){return(n?"":" ")+e}function uA(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 e0e(e,t,n,i){const s=uA(n),r=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(i);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(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),a(),u}function t0e(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 Rm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Qy(e,t,n){const i=Tf(e),s=Tf(t);return i===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}a7.peek=n0e;function a7(e,t,n,i){const s=t0e(n),r=n.enter("emphasis"),a=n.createTracker(i),l=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:l,...a.current()}));const u=c.charCodeAt(0),d=Qy(i.before.charCodeAt(i.before.length-1),u,s);d.inside&&(c=Rm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Qy(i.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Rm(f));const p=a.move(s);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function n0e(e,t,n){return n.options.emphasis||"*"}function i0e(e,t){let n=!1;return yg(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,MS}),!!((!e.depth||e.depth<3)&&nA(e)&&(t.options.setext||n))}function s0e(e,t,n,i){const s=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(i);if(i0e(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 h0e(e,t,n){return(n?"":" ")+e}function yA(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 p0e(e,t,n,i){const s=yA(n),r=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(i);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(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),a(),u}function m0e(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 Lm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function i1(e,t,n){const i=Af(e),s=Af(t);return i===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}g7.peek=g0e;function g7(e,t,n,i){const s=m0e(n),r=n.enter("emphasis"),a=n.createTracker(i),l=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:l,...a.current()}));const u=c.charCodeAt(0),d=i1(i.before.charCodeAt(i.before.length-1),u,s);d.inside&&(c=Lm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=i1(i.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Lm(f));const p=a.move(s);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function g0e(e,t,n){return n.options.emphasis||"*"}function b0e(e,t){let n=!1;return _g(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,$S}),!!((!e.depth||e.depth<3)&&uA(e)&&(t.options.setext||n))}function y0e(e,t,n,i){const s=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(i);if(b0e(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...r.current(),before:` `,after:` `});return f(),d(),h+` `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(s),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=Rm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}o7.peek=r0e;function o7(e){return e.value||""}function r0e(){return"<"}l7.peek=a0e;function l7(e,t,n,i){const s=uA(n),r=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(i);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(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),a(),u}function a0e(){return"!"}c7.peek=o0e;function c7(e,t,n,i){const s=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(i);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(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function o0e(){return"!"}u7.peek=l0e;function u7(e,t,n){let i=e.value||"",s="`",r=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++r\u007F]/.test(e.url))}f7.peek=c0e;function f7(e,t,n,i){const s=uA(n),r=s==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let l,c;if(d7(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(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),l(),u}function c0e(e,t,n){return d7(e,n)?"<":"["}h7.peek=u0e;function h7(e,t,n,i){const s=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(i);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(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function u0e(){return"["}function dA(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 d0e(e){const t=dA(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 f0e(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 p7(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 h0e(e,t,n,i){const s=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?f0e(n):dA(n);const l=e.ordered?a==="."?")":".":d0e(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),p7(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;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(i);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 g0e(e,t,n,i){const s=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,i);return r(),s(),a}const b0e=bg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function y0e(e,t,n,i){return(e.children.some(function(a){return b0e(a)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function x0e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}m7.peek=E0e;function m7(e,t,n,i){const s=x0e(n),r=n.enter("strong"),a=n.createTracker(i),l=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:l,...a.current()}));const u=c.charCodeAt(0),d=Qy(i.before.charCodeAt(i.before.length-1),u,s);d.inside&&(c=Rm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Qy(i.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Rm(f));const p=a.move(s+s);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function E0e(e,t,n){return n.options.strong||"*"}function v0e(e,t,n,i){return n.safe(e.value,i)}function w0e(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 _0e(e,t,n){const i=(p7(n)+(n.options.ruleSpaces?" ":"")).repeat(w0e(n));return n.options.ruleSpaces?i.slice(0,-1):i}const g7={blockquote:Kge,break:CM,code:Zge,definition:e0e,emphasis:a7,hardBreak:CM,heading:s0e,html:o7,image:l7,imageReference:c7,inlineCode:u7,link:f7,linkReference:h7,list:h0e,listItem:m0e,paragraph:g0e,root:y0e,strong:m7,text:v0e,thematicBreak:_0e};function S0e(){return{enter:{table:N0e,tableData:IM,tableHeader:IM,tableRow:k0e},exit:{codeText:A0e,table:T0e,tableData:Wv,tableHeader:Wv,tableRow:Wv}}}function N0e(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 T0e(e){this.exit(e),this.data.inTable=void 0}function k0e(e){this.enter({type:"tableRow",children:[]},e)}function Wv(e){this.exit(e)}function IM(e){this.enter({type:"tableCell",children:[]},e)}function A0e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,C0e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function C0e(e,t){return t==="|"?t:e}function I0e(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,s=t.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...r.current()});return/^[\t ]/.test(u)&&(u=Lm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}b7.peek=x0e;function b7(e){return e.value||""}function x0e(){return"<"}y7.peek=E0e;function y7(e,t,n,i){const s=yA(n),r=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(i);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(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),a(),u}function E0e(){return"!"}x7.peek=v0e;function x7(e,t,n,i){const s=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(i);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(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function v0e(){return"!"}E7.peek=w0e;function E7(e,t,n){let i=e.value||"",s="`",r=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++r\u007F]/.test(e.url))}w7.peek=_0e;function w7(e,t,n,i){const s=yA(n),r=s==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let l,c;if(v7(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(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),l(),u}function _0e(e,t,n){return v7(e,n)?"<":"["}_7.peek=S0e;function _7(e,t,n,i){const s=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(i);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(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function S0e(){return"["}function xA(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 N0e(e){const t=xA(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 T0e(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 S7(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 k0e(e,t,n,i){const s=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?T0e(n):xA(n);const l=e.ordered?a==="."?")":".":N0e(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),S7(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;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(i);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 I0e(e,t,n,i){const s=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,i);return r(),s(),a}const R0e=wg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function j0e(e,t,n,i){return(e.children.some(function(a){return R0e(a)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function O0e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}N7.peek=M0e;function N7(e,t,n,i){const s=O0e(n),r=n.enter("strong"),a=n.createTracker(i),l=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:l,...a.current()}));const u=c.charCodeAt(0),d=i1(i.before.charCodeAt(i.before.length-1),u,s);d.inside&&(c=Lm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=i1(i.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Lm(f));const p=a.move(s+s);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function M0e(e,t,n){return n.options.strong||"*"}function L0e(e,t,n,i){return n.safe(e.value,i)}function D0e(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 P0e(e,t,n){const i=(S7(n)+(n.options.ruleSpaces?" ":"")).repeat(D0e(n));return n.options.ruleSpaces?i.slice(0,-1):i}const T7={blockquote:a0e,break:PM,code:f0e,definition:p0e,emphasis:g7,hardBreak:PM,heading:y0e,html:b7,image:y7,imageReference:x7,inlineCode:E7,link:w7,linkReference:_7,list:k0e,listItem:C0e,paragraph:I0e,root:j0e,strong:N7,text:L0e,thematicBreak:P0e};function B0e(){return{enter:{table:U0e,tableData:BM,tableHeader:BM,tableRow:$0e},exit:{codeText:H0e,table:F0e,tableData:nw,tableHeader:nw,tableRow:nw}}}function U0e(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 F0e(e){this.exit(e),this.data.inTable=void 0}function $0e(e){this.enter({type:"tableRow",children:[]},e)}function nw(e){this.exit(e)}function BM(e){this.enter({type:"tableCell",children:[]},e)}function H0e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,z0e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function z0e(e,t){return t==="|"?t:e}function V0e(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,s=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,g,v){return u(d(p,g,v),p.align)}function l(p,m,g,v){const y=f(p,g,v),x=u([y]);return x.slice(0,x.indexOf(` -`))}function c(p,m,g,v){const y=g.enter("tableCell"),x=g.enter("phrasing"),E=g.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return Vge(p,{align:m,alignDelimiters:i,padding:n,stringLength:s})}function d(p,m,g){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 Y0e={tokenize:nbe,partial:!0};function W0e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:J0e,continuation:{tokenize:ebe},exit:tbe}},text:{91:{name:"gfmFootnoteCall",tokenize:Z0e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:X0e,resolveTo:Q0e}}}}function X0e(e,t,n){const i=this;let s=i.events.length;const r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;s--;){const c=i.events[s][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=_a(i.sliceSerialize({start:a.end,end:i.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 Q0e(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 i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},s.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",i,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function Z0e(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.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||Rn(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(_a(i.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Rn(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 J0e(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.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||Rn(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return r=_a(i.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Rn(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"),s.includes(r)||s.push(r),en(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function ebe(e,t,n){return e.check(gg,t,e.attempt(Y0e,t,n))}function tbe(e){e.exit("gfmFootnoteDefinition")}function nbe(e,t,n){const i=this;return en(e,s,"gfmFootnoteDefinitionIndent",5);function s(r){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function ibe(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:r,resolveAll:s};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(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=Tf(m);return v._open=!y||y===2&&!!g,v._close=!g||g===2&&!!y,l(m)}}}class sbe{constructor(){this.map=[]}add(t,n,i){rbe(this,t,n,i)}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 i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const r of s)t.push(r);s=i.pop()}this.map.length=0}}function rbe(e,t,n,i){let s=0;if(!(n===0&&i.length===0)){for(;s-1;){const D=i.events[O][1].type;if(D==="lineEnding"||D==="linePrefix")O--;else break}const M=O>-1?i.events[O][1].type:null,G=M==="tableHead"||M==="tableRow"?_:c;return G===_&&i.parser.lazy[i.now().line]?n(I):G(I)}function c(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,r+=1),d(I)}function d(I){return I===null?n(I):pt(I)?r>1?(r=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):Gt(I)?en(e,d,"whitespace")(I):(r+=1,a&&(a=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(I)))}function f(I){return I===null||I===124||Rn(I)?(e.exit("data"),d(I)):(e.consume(I),I===92?h:f)}function h(I){return I===92||I===124?(e.consume(I),f):f(I)}function p(I){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,Gt(I)?en(e,m,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?v(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),g):N(I)}function g(I){return Gt(I)?en(e,v,"whitespace")(I):v(I)}function v(I){return I===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):I===45?(r+=1,y(I)):I===null||pt(I)?w(I):N(I)}function y(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):N(I)}function x(I){return I===45?(e.consume(I),x):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return Gt(I)?en(e,w,"whitespace")(I):w(I)}function w(I){return I===124?m(I):I===null||pt(I)?!a||s!==r?N(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):N(I)}function N(I){return n(I)}function _(I){return e.enter("tableRow"),T(I)}function T(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),T):I===null||pt(I)?(e.exit("tableRow"),t(I)):Gt(I)?en(e,T,"whitespace")(I):(e.enter("data"),k(I))}function k(I){return I===null||I===124||Rn(I)?(e.exit("data"),T(I)):(e.consume(I),I===92?C:k)}function C(I){return I===92||I===124?(e.consume(I),k):k(I)}}function cbe(e,t){let n=-1,i=!0,s=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new sbe;for(;++nn[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(r.end=Object.assign({},rd(t.events,s)),e.add(s,0,[["exit",r,t]]),r=void 0),r}function jM(e,t,n,i,s){const r=[],a=rd(t.events,n);s&&(s.end=Object.assign({},a),r.push(["exit",s,t])),i.end=Object.assign({},a),r.push(["exit",i,t]),e.add(n+1,0,r)}function rd(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const ube={name:"tasklistCheck",tokenize:fbe};function dbe(){return{text:{91:ube}}}function fbe(e,t,n){const i=this;return s;function s(c){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return Rn(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):Gt(c)?e.check({tokenize:hbe},t,n)(c):n(c)}}function hbe(e,t,n){return en(e,i,"whitespace");function i(s){return s===null?n(s):t(s)}}function pbe(e){return OU([U0e(),W0e(),ibe(e),obe(),dbe()])}const mbe={};function gbe(e){const t=this,n=e||mbe,i=t.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),r=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(pbe(n)),r.push(L0e()),a.push(D0e(n))}const OM=function(e,t,n){const i=bg(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 T7(e,t,n){return e.type==="element"?Sbe(e,t,n):e.type==="text"?n.whitespace==="normal"?k7(e,n):Nbe(e):[]}function Sbe(e,t,n){const i=A7(e,n),s=e.children||[];let r=-1,a=[];if(wbe(e))return a;let l,c;for(US(e)||PM(e)&&OM(t,e,PM)?c=` -`:vbe(e)?(l=2,c=2):N7(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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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"],g=["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:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[N,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:i,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 jbe(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=Rbe(e),i=n.keywords;return i.type=[...i.type,...t.type],i.literal=[...i.literal,...t.literal],i.built_in=[...i.built_in,...t.built_in],i._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function C7(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const s={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,s]};s.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},g=["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"],N=["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:g,literal:v,built_in:[...x,...E,"set","shopt",...w,...N]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function Obe(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+i+"|"+t.optional(s)+"[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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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:i,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 Mbe(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+i+"|"+t.optional(s)+"[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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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"],g=["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:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[N,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:i,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 Lbe(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"],i=["default","false","null","true"],s=["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:s.concat(r),built_in:t,literal:i},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]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,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,g,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 Dbe=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_-]*/}}),Pbe=["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"],Bbe=["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"],Ube=[...Pbe,...Bbe],Fbe=["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(),$be=["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(),Hbe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),zbe=["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 Vbe(e){const t=e.regex,n=Dbe(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="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,i,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:":("+$be.join("|")+")"},{begin:":(:)?("+Hbe.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+zbe.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:s,attribute:Fbe.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Ube.join("|")+")\\b"}]}}function Gbe(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 Kbe(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:"R7(e,t,n-1))}function Ybe(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",i=n+R7("(?:<"+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:["(?:"+i+"\\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,BM,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},BM,u]}}const UM="[A-Za-z$_][0-9A-Za-z$_]*",Wbe=["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"],Xbe=["true","false","null","undefined","NaN","Infinity"],j7=["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"],O7=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],M7=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Qbe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Zbe=[].concat(M7,j7,O7);function L7(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let Z;const B=P.input.substring(R);if(Z=B.match(/^\s*=/)){$.ignoreMatch();return}if((Z=B.match(/^\s+extends\s+/))&&Z.index===0){$.ignoreMatch();return}}},l={$pattern:UM,keyword:Wbe,literal:Xbe,built_in:Zbe,"variable.language":Qbe},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"}},g={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:i+"(?=\\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,g,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),N=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:N},T={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],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:{_:[...j7,...O7]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(P){return t.concat("(?!",P.join("|"),")")}const G={match:t.concat(/\b/,M([...M7,"super","import"].map(P=>`${P}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{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:A,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.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"]}]}]},I,{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:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},G,O,T,F,{match:/\$[(.]/}]}}function D7(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],s={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var od="[0-9](_*[0-9])*",B0=`\\.(${od})`,U0="[0-9a-fA-F](_*[0-9a-fA-F])*",Jbe={className:"number",variants:[{begin:`(\\b(${od})((${B0})|\\.)?|(${B0}))[eE][+-]?(${od})[fFdD]?\\b`},{begin:`\\b(${od})((${B0})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${B0})[fFdD]?\\b`},{begin:`\\b(${od})[fFdD]\\b`},{begin:`\\b0[xX]((${U0})\\.?|(${U0})?\\.(${U0}))[pP][+-]?(${od})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${U0})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function eye(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+/}]}},i={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={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,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,s]}]};s.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=Jbe,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,i,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 tye=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_-]*/}}),nye=["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"],iye=["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"],sye=[...nye,...iye],rye=["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(),P7=["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(),B7=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),aye=["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(),oye=P7.concat(B7).sort().reverse();function lye(e){const t=tye(e),n=oye,i="and or not only",s="[\\w-]+",r="("+s+"|@\\{"+s+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,N){return{className:E,begin:w,relevance:N}},d={$pattern:/[a-z-]+/,keyword:i,attribute:rye.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","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\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("+aye.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={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:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],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","@\\{"+s+"\\}"),{begin:"\\b("+sye.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:":("+P7.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+B7.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function cye(e){const t="\\[=*\\[",n="\\]=*\\]",i={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[i],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:s.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:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[i],relevance:5}])}}function U7(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},s={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:"$"},s,i,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function uye(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 dye(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"],i=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},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=(g,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",g,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,i)},p=(g,v,y)=>t.concat(t.concat("(?:",g,")"),v,/(?:\\.|[^\\\/])*?/,y,i),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:s,contains:m}}function fye(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,i=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=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:"\\$+"+i},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":(D,F)=>{F.data._beginMatch=D[1]||D[2]},"on:end":(D,F)=>{F.data._beginMatch!==D[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]},g={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:(D=>{const F=[];return D.forEach(A=>{F.push(A),A.toLowerCase()===A?F.push(A.toUpperCase()):F.push(A.toLowerCase())}),F})(v),built_in:x},N=D=>D.map(F=>F.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",N(x).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(i,"\\b(?!\\()"),k={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,k,e.C_BLOCK_COMMENT_MODE,m,g,_]},O={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",N(y).join("\\b|"),"|",N(x).join("\\b|"),"\\b)"),i,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(O);const M=[C,k,e.C_BLOCK_COMMENT_MODE,m,g,_],G={begin:t.concat(/#\[\s*\\?/,t.either(s,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...M]},...M,{scope:"meta",variants:[{match:s},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[G,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,O,k,{match:[/const/,/\s/,i],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",G,a,k,e.C_BLOCK_COMMENT_MODE,m,g]}]},{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,g]}}function hye(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 pye(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function $7(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["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:i,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|${i.join("|")}`,g={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,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{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:[g,y,f]}]}}function mye(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function gye(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=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]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,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:[s,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[r,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function bye(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",i=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(i,/(::\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"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},_=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:i,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{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=_,g.contains=_;const I=[{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(I).concat(u).concat(_)}}function yye(e){const t=e.regex,n=/(r#)?/,i=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),r={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,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 xye=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_-]*/}}),Eye=["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"],vye=["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"],wye=[...Eye,...vye],_ye=["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(),Sye=["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(),Nye=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Tye=["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 kye(e){const t=xye(e),n=Nye,i=Sye,s="@[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("+wye.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+i.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Tye.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:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:_ye.join(" ")},contains:[{begin:s,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 Aye(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Cye(e){const t=e.regex,n=e.COMMENT("--","$"),i={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={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(N=>!d.includes(N)),g={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(N){return t.concat(/\b/,t.either(...N.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(N,{exceptions:_,when:T}={}){const k=T;return _=_||[],N.map(C=>C.match(/\|\d+$/)||_.includes(C)?C:k(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:N=>N.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,g,i,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function H7(e){return e?typeof e=="string"?e:e.source:null}function Fh(e){return Sn("(?=",e,")")}function Sn(...e){return e.map(n=>H7(n)).join("")}function Iye(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Hs(...e){return"("+(Iye(e).capture?"":"?:")+e.map(i=>H7(i)).join("|")+")"}const pA=e=>Sn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Rye=["Protocol","Type"].map(pA),FM=["init","self"].map(pA),jye=["Any","Self"],Xv=["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"],$M=["false","nil","true"],Oye=["assignment","associativity","higherThan","left","lowerThan","none","right"],Mye=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],HM=["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"],z7=Hs(/[/=\-+!*%<>&|^~?]/,/[\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]/),V7=Hs(z7,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Qv=Sn(z7,V7,"*"),G7=Hs(/[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]/),Zy=Hs(G7,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),za=Sn(G7,Zy,"*"),F0=Sn(/[A-Z]/,Zy,"*"),Lye=["attached","autoclosure",Sn(/convention\(/,Hs("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Sn(/objc\(/,za,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Dye=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Pye(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),i=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,Hs(...Rye,...FM)],className:{2:"keyword"}},r={match:Sn(/\./,Hs(...Xv)),relevance:0},a=Xv.filter(oe=>typeof oe=="string").concat(["_|0"]),l=Xv.filter(oe=>typeof oe!="string").concat(jye).map(pA),c={variants:[{className:"keyword",match:Hs(...l,...FM)}]},u={$pattern:Hs(/\b\w+/,/#\w+/),keyword:a.concat(Mye),literal:$M},d=[s,r,c],f={match:Sn(/\./,Hs(...HM)),relevance:0},h={className:"built_in",match:Sn(/\b/,Hs(...HM),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Qv},{match:`\\.(\\.|${V7})+`}]},v=[m,g],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=(oe="")=>({className:"subst",variants:[{match:Sn(/\\/,oe,/[0\\tnr"']/)},{match:Sn(/\\/,oe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(oe="")=>({className:"subst",match:Sn(/\\/,oe,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(oe="")=>({className:"subst",label:"interpol",begin:Sn(/\\/,oe,/\(/),end:/\)/}),T=(oe="")=>({begin:Sn(oe,/"""/),end:Sn(/"""/,oe),contains:[w(oe),N(oe),_(oe)]}),k=(oe="")=>({begin:Sn(oe,/"/),end:Sn(/"/,oe),contains:[w(oe),_(oe)]}),C={className:"string",variants:[T(),T("#"),T("##"),T("###"),k(),k("#"),k("##"),k("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],O={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},M=oe=>{const Te=Sn(oe,/\//),ve=Sn(/\//,oe);return{begin:Te,end:ve,contains:[...I,{scope:"comment",begin:`#(?!.*${ve})`,end:/$/}]}},G={scope:"regexp",variants:[M("###"),M("##"),M("#"),O]},D={match:Sn(/`/,za,/`/)},F={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${Zy}+`},j=[D,F,A],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Dye,contains:[...v,E,C]}]}},$={scope:"keyword",match:Sn(/@/,Hs(...Lye),Fh(Hs(/\(/,/\s+/)))},R={scope:"meta",match:Sn(/@/,za)},Y=[P,$,R],Z={match:Fh(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Sn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Zy,"+")},{className:"type",match:F0,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Sn(/\s+&\s+/,Fh(F0)),relevance:0}]},B={begin://,keywords:u,contains:[...i,...d,...Y,m,Z]};Z.contains.push(B);const te={match:Sn(za,/\s*:/),keywords:"_|0",relevance:0},z={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",te,...i,G,...d,...p,...v,E,C,...j,...Y,Z]},q={begin://,keywords:"repeat each",contains:[...i,Z]},W={begin:Hs(Fh(Sn(za,/\s*:/)),Fh(Sn(za,/\s+/,za,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:za}]},K={begin:/\(/,end:/\)/,keywords:u,contains:[W,...i,...d,...v,E,C,...Y,Z,z],endsParent:!0,illegal:/["']/},ue={match:[/(func|macro)/,/\s+/,Hs(D.match,za,Qv)],className:{1:"keyword",3:"title.function"},contains:[q,K,t],illegal:[/\[/,/%/]},pe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[q,K,t],illegal:/\[|%/},_e={match:[/operator/,/\s+/,Qv],className:{1:"keyword",3:"title"}},fe={begin:[/precedencegroup/,/\s+/,F0],className:{1:"keyword",3:"title"},contains:[Z],keywords:[...Oye,...$M],end:/}/},me={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Re={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ge={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,za,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[q,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:F0},...d],relevance:0}]};for(const oe of C.variants){const Te=oe.contains.find(Xe=>Xe.label==="interpol");Te.keywords=u;const ve=[...d,...p,...v,E,C,...j];Te.contains=[...ve,{begin:/\(/,end:/\)/,contains:["self",...ve]}]}return{name:"Swift",keywords:u,contains:[...i,ue,pe,me,Re,ge,_e,fe,{beginKeywords:"import",end:/$/,contains:[...i],relevance:0},G,...d,...p,...v,E,C,...j,...Y,Z,z]}}const Jy="[A-Za-z$_][0-9A-Za-z$_]*",K7=["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"],q7=["true","false","null","undefined","NaN","Infinity"],Y7=["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"],W7=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],X7=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Q7=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Z7=[].concat(X7,Y7,W7);function Bye(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let Z;const B=P.input.substring(R);if(Z=B.match(/^\s*=/)){$.ignoreMatch();return}if((Z=B.match(/^\s+extends\s+/))&&Z.index===0){$.ignoreMatch();return}}},l={$pattern:Jy,keyword:K7,literal:q7,built_in:Z7,"variable.language":Q7},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"}},g={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:i+"(?=\\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,g,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),N=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:N},T={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],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:{_:[...Y7,...W7]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(P){return t.concat("(?!",P.join("|"),")")}const G={match:t.concat(/\b/,M([...X7,"super","import"].map(P=>`${P}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{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:A,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.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"]}]}]},I,{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:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},G,O,T,F,{match:/\$[(.]/}]}}function J7(e){const t=e.regex,n=Bye(e),i=Jy,s=["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:s},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:Jy,keyword:K7.concat(c),literal:q7,built_in:Z7.concat(s),"variable.language":Q7},d={className:"meta",begin:"@"+i},f=(g,v,y)=>{const x=g.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");g.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(i,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(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Uye(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},i={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\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,s),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,s),/ +/,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,i,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 Fye(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),i=["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"],s={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:i},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,s,e.QUOTE_STRING_MODE,c,u,l]}}function $ye(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),i=/[\p{L}0-9._:-]+/u,s={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},s,{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 eF(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",i={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={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,s]},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},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},v=[i,{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,g,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const Hye={arduino:jbe,bash:C7,c:Obe,cpp:Mbe,csharp:Lbe,css:Vbe,diff:Gbe,go:Kbe,graphql:qbe,ini:I7,java:Ybe,javascript:L7,json:D7,kotlin:eye,less:lye,lua:cye,makefile:U7,markdown:F7,objectivec:uye,perl:dye,php:fye,"php-template":hye,plaintext:pye,python:$7,"python-repl":mye,r:gye,ruby:bye,rust:yye,scss:kye,shell:Aye,sql:Cye,swift:Pye,typescript:J7,vbnet:Uye,wasm:Fye,xml:$ye,yaml:eF};function tF(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],i=typeof n;(i==="object"||i==="function")&&!Object.isFrozen(n)&&tF(n)}),e}let zM=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function nF(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ml(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(i){for(const s in i)n[s]=i[s]}),n}const zye="",VM=e=>!!e.scope,Vye=(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((i,s)=>`${i}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class Gye{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=nF(t)}openNode(t){if(!VM(t))return;const n=Vye(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){VM(t)&&(this.buffer+=zye)}value(){return this.buffer}span(t){this.buffer+=``}}const GM=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class mA{constructor(){this.rootNode=GM(),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=GM({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(i=>this._walk(t,i)),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=>{mA._collapse(n)}))}}class Kye extends mA{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const i=t.root;n&&(i.scope=`language:${n}`),this.add(i)}toHTML(){return new Gye(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function jm(e){return e?typeof e=="string"?e:e.source:null}function iF(e){return Nu("(?=",e,")")}function qye(e){return Nu("(?:",e,")*")}function Yye(e){return Nu("(?:",e,")?")}function Nu(...e){return e.map(n=>jm(n)).join("")}function Wye(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function gA(...e){return"("+(Wye(e).capture?"":"?:")+e.map(i=>jm(i)).join("|")+")"}function sF(e){return new RegExp(e.toString()+"|").exec("").length-1}function Xye(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Qye=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function bA(e,{joinWith:t}){let n=0;return e.map(i=>{n+=1;const s=n;let r=jm(i),a="";for(;r.length>0;){const l=Qye.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])+s):(a+=l[0],l[0]==="("&&n++)}return a}).map(i=>`(${i})`).join(t)}const Zye=/\b\B/,rF="[a-zA-Z]\\w*",yA="[a-zA-Z_]\\w*",aF="\\b\\d+(\\.\\d+)?",oF="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",lF="\\b(0b[01]+)",Jye="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e1e=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Nu(t,/.*\b/,e.binary,/\b.*/)),Ml({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},Om={begin:"\\\\[\\s\\S]",relevance:0},t1e={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Om]},n1e={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Om]},i1e={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/},vx=function(e,t,n={}){const i=Ml({scope:"comment",begin:e,end:t,contains:[]},n);i.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 s=gA("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 i.contains.push({begin:Nu(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},s1e=vx("//","$"),r1e=vx("/\\*","\\*/"),a1e=vx("#","$"),o1e={scope:"number",begin:aF,relevance:0},l1e={scope:"number",begin:oF,relevance:0},c1e={scope:"number",begin:lF,relevance:0},u1e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Om,{begin:/\[/,end:/\]/,relevance:0,contains:[Om]}]},d1e={scope:"title",begin:rF,relevance:0},f1e={scope:"title",begin:yA,relevance:0},h1e={begin:"\\.\\s*"+yA,relevance:0},p1e=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 $0=Object.freeze({__proto__:null,APOS_STRING_MODE:t1e,BACKSLASH_ESCAPE:Om,BINARY_NUMBER_MODE:c1e,BINARY_NUMBER_RE:lF,COMMENT:vx,C_BLOCK_COMMENT_MODE:r1e,C_LINE_COMMENT_MODE:s1e,C_NUMBER_MODE:l1e,C_NUMBER_RE:oF,END_SAME_AS_BEGIN:p1e,HASH_COMMENT_MODE:a1e,IDENT_RE:rF,MATCH_NOTHING_RE:Zye,METHOD_GUARD:h1e,NUMBER_MODE:o1e,NUMBER_RE:aF,PHRASAL_WORDS_MODE:i1e,QUOTE_STRING_MODE:n1e,REGEXP_MODE:u1e,RE_STARTERS_RE:Jye,SHEBANG:e1e,TITLE_MODE:d1e,UNDERSCORE_IDENT_RE:yA,UNDERSCORE_TITLE_MODE:f1e});function m1e(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function g1e(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function b1e(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=m1e,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function y1e(e,t){Array.isArray(e.illegal)&&(e.illegal=gA(...e.illegal))}function x1e(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 E1e(e,t){e.relevance===void 0&&(e.relevance=1)}const v1e=(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(i=>{delete e[i]}),e.keywords=n.keywords,e.begin=Nu(n.beforeMatch,iF(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},w1e=["of","and","for","in","not","or","if","then","parent","list","value"],_1e="keyword";function cF(e,t,n=_1e){const i=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(r){Object.assign(i,cF(e[r],t,r))}),i;function s(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");i[c[0]]=[r,S1e(c[0],c[1])]})}}function S1e(e,t){return t?Number(t):N1e(e)?0:1}function N1e(e){return w1e.includes(e.toLowerCase())}const KM={},Wc=e=>{console.error(e)},qM=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Gu=(e,t)=>{KM[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),KM[`${e}/${t}`]=!0)},e1=new Error;function uF(e,t,{key:n}){let i=0;const s=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+i]=s[l],r[l+i]=!0,i+=sF(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function T1e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Wc("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),e1;if(typeof e.beginScope!="object"||e.beginScope===null)throw Wc("beginScope must be object"),e1;uF(e,e.begin,{key:"beginScope"}),e.begin=bA(e.begin,{joinWith:""})}}function k1e(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Wc("skip, excludeEnd, returnEnd not compatible with endScope: {}"),e1;if(typeof e.endScope!="object"||e.endScope===null)throw Wc("endScope must be object"),e1;uF(e,e.end,{key:"endScope"}),e.end=bA(e.end,{joinWith:""})}}function A1e(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function C1e(e){A1e(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),T1e(e),k1e(e)}function I1e(e){function t(a,l){return new RegExp(jm(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+=sF(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(bA(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 i{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 s(a){const l=new i;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;[g1e,x1e,C1e,v1e].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[b1e,y1e,E1e].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=cF(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=jm(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 R1e(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=s(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=Ml(e.classNameAliases||{}),r(e)}function dF(e){return e?e.endsWithParent||dF(e.starts):!1}function R1e(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ml(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:dF(e)?Ml(e,{starts:e.starts?Ml(e.starts):null}):Object.isFrozen(e)?Ml(e):e}var j1e="11.11.1";class O1e extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Zv=nF,YM=Ml,WM=Symbol("nomatch"),M1e=7,fF=function(e){const t=Object.create(null),n=Object.create(null),i=[];let s=!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:Kye};function c(A){return l.noHighlightRe.test(A)}function u(A){let j=A.className+" ";j+=A.parentNode?A.parentNode.className:"";const P=l.languageDetectRe.exec(j);if(P){const $=k(P[1]);return $||(qM(r.replace("{}",P[1])),qM("Falling back to no-highlight mode for this block.",A)),$?P[1]:"no-highlight"}return j.split(/\s+/).find($=>c($)||k($))}function d(A,j,P){let $="",R="";typeof j=="object"?($=A,P=j.ignoreIllegals,R=j.language):(Gu("10.7.0","highlight(lang, code, ...args) has been deprecated."),Gu("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),R=A,$=j),P===void 0&&(P=!0);const Y={code:$,language:R};D("before:highlight",Y);const Z=Y.result?Y.result:f(Y.language,Y.code,P);return Z.code=Y.code,D("after:highlight",Z),Z}function f(A,j,P,$){const R=Object.create(null);function Y(Q,ae){return Q.keywords[ae]}function Z(){if(!ve.keywords){De.addText(ze);return}let Q=0;ve.keywordPatternRe.lastIndex=0;let ae=ve.keywordPatternRe.exec(ze),ie="";for(;ae;){ie+=ze.substring(Q,ae.index);const be=ge.case_insensitive?ae[0].toLowerCase():ae[0],Ue=Y(ve,be);if(Ue){const[Ye,yt]=Ue;if(De.addText(ie),ie="",R[be]=(R[be]||0)+1,R[be]<=M1e&&(Ne+=yt),Ye.startsWith("_"))ie+=ae[0];else{const lt=ge.classNameAliases[Ye]||Ye;z(ae[0],lt)}}else ie+=ae[0];Q=ve.keywordPatternRe.lastIndex,ae=ve.keywordPatternRe.exec(ze)}ie+=ze.substring(Q),De.addText(ie)}function B(){if(ze==="")return;let Q=null;if(typeof ve.subLanguage=="string"){if(!t[ve.subLanguage]){De.addText(ze);return}Q=f(ve.subLanguage,ze,!0,Xe[ve.subLanguage]),Xe[ve.subLanguage]=Q._top}else Q=p(ze,ve.subLanguage.length?ve.subLanguage:null);ve.relevance>0&&(Ne+=Q.relevance),De.__addSublanguage(Q._emitter,Q.language)}function te(){ve.subLanguage!=null?B():Z(),ze=""}function z(Q,ae){Q!==""&&(De.startScope(ae),De.addText(Q),De.endScope())}function q(Q,ae){let ie=1;const be=ae.length-1;for(;ie<=be;){if(!Q._emit[ie]){ie++;continue}const Ue=ge.classNameAliases[Q[ie]]||Q[ie],Ye=ae[ie];Ue?z(Ye,Ue):(ze=Ye,Z(),ze=""),ie++}}function W(Q,ae){return Q.scope&&typeof Q.scope=="string"&&De.openNode(ge.classNameAliases[Q.scope]||Q.scope),Q.beginScope&&(Q.beginScope._wrap?(z(ze,ge.classNameAliases[Q.beginScope._wrap]||Q.beginScope._wrap),ze=""):Q.beginScope._multi&&(q(Q.beginScope,ae),ze="")),ve=Object.create(Q,{parent:{value:ve}}),ve}function K(Q,ae,ie){let be=Xye(Q.endRe,ie);if(be){if(Q["on:end"]){const Ue=new zM(Q);Q["on:end"](ae,Ue),Ue.isMatchIgnored&&(be=!1)}if(be){for(;Q.endsParent&&Q.parent;)Q=Q.parent;return Q}}if(Q.endsWithParent)return K(Q.parent,ae,ie)}function ue(Q){return ve.matcher.regexIndex===0?(ze+=Q[0],1):(qe=!0,0)}function pe(Q){const ae=Q[0],ie=Q.rule,be=new zM(ie),Ue=[ie.__beforeBegin,ie["on:begin"]];for(const Ye of Ue)if(Ye&&(Ye(Q,be),be.isMatchIgnored))return ue(ae);return ie.skip?ze+=ae:(ie.excludeBegin&&(ze+=ae),te(),!ie.returnBegin&&!ie.excludeBegin&&(ze=ae)),W(ie,Q),ie.returnBegin?0:ae.length}function _e(Q){const ae=Q[0],ie=j.substring(Q.index),be=K(ve,Q,ie);if(!be)return WM;const Ue=ve;ve.endScope&&ve.endScope._wrap?(te(),z(ae,ve.endScope._wrap)):ve.endScope&&ve.endScope._multi?(te(),q(ve.endScope,Q)):Ue.skip?ze+=ae:(Ue.returnEnd||Ue.excludeEnd||(ze+=ae),te(),Ue.excludeEnd&&(ze=ae));do ve.scope&&De.closeNode(),!ve.skip&&!ve.subLanguage&&(Ne+=ve.relevance),ve=ve.parent;while(ve!==be.parent);return be.starts&&W(be.starts,Q),Ue.returnEnd?0:ae.length}function fe(){const Q=[];for(let ae=ve;ae!==ge;ae=ae.parent)ae.scope&&Q.unshift(ae.scope);Q.forEach(ae=>De.openNode(ae))}let me={};function Re(Q,ae){const ie=ae&&ae[0];if(ze+=Q,ie==null)return te(),0;if(me.type==="begin"&&ae.type==="end"&&me.index===ae.index&&ie===""){if(ze+=j.slice(ae.index,ae.index+1),!s){const be=new Error(`0 width match regex (${A})`);throw be.languageName=A,be.badRule=me.rule,be}return 1}if(me=ae,ae.type==="begin")return pe(ae);if(ae.type==="illegal"&&!P){const be=new Error('Illegal lexeme "'+ie+'" for mode "'+(ve.scope||"")+'"');throw be.mode=ve,be}else if(ae.type==="end"){const be=_e(ae);if(be!==WM)return be}if(ae.type==="illegal"&&ie==="")return ze+=` -`,1;if(Fe>1e5&&Fe>ae.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ze+=ie,ie.length}const ge=k(A);if(!ge)throw Wc(r.replace("{}",A)),new Error('Unknown language: "'+A+'"');const oe=I1e(ge);let Te="",ve=$||oe;const Xe={},De=new l.__emitter(l);fe();let ze="",Ne=0,Pe=0,Fe=0,qe=!1;try{if(ge.__emitTokens)ge.__emitTokens(j,De);else{for(ve.matcher.considerAll();;){Fe++,qe?qe=!1:ve.matcher.considerAll(),ve.matcher.lastIndex=Pe;const Q=ve.matcher.exec(j);if(!Q)break;const ae=j.substring(Pe,Q.index),ie=Re(ae,Q);Pe=Q.index+ie}Re(j.substring(Pe))}return De.finalize(),Te=De.toHTML(),{language:A,value:Te,relevance:Ne,illegal:!1,_emitter:De,_top:ve}}catch(Q){if(Q.message&&Q.message.includes("Illegal"))return{language:A,value:Zv(j),illegal:!0,relevance:0,_illegalBy:{message:Q.message,index:Pe,context:j.slice(Pe-100,Pe+100),mode:Q.mode,resultSoFar:Te},_emitter:De};if(s)return{language:A,value:Zv(j),illegal:!1,relevance:0,errorRaised:Q,_emitter:De,_top:ve};throw Q}}function h(A){const j={value:Zv(A),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return j._emitter.addText(A),j}function p(A,j){j=j||l.languages||Object.keys(t);const P=h(A),$=j.filter(k).filter(I).map(te=>f(te,A,!1));$.unshift(P);const R=$.sort((te,z)=>{if(te.relevance!==z.relevance)return z.relevance-te.relevance;if(te.language&&z.language){if(k(te.language).supersetOf===z.language)return 1;if(k(z.language).supersetOf===te.language)return-1}return 0}),[Y,Z]=R,B=Y;return B.secondBest=Z,B}function m(A,j,P){const $=j&&n[j]||P;A.classList.add("hljs"),A.classList.add(`language-${$}`)}function g(A){let j=null;const P=u(A);if(c(P))return;if(D("before:highlightElement",{el:A,language:P}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.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(A)),l.throwUnescapedHTML))throw new O1e("One of your code blocks includes unescaped HTML.",A.innerHTML);j=A;const $=j.textContent,R=P?d($,{language:P,ignoreIllegals:!0}):p($);A.innerHTML=R.value,A.dataset.highlighted="yes",m(A,P,R.language),A.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(A.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),D("after:highlightElement",{el:A,result:R,text:$})}function v(A){l=YM(l,A)}const y=()=>{w(),Gu("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),Gu("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function A(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",A,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function N(A,j){let P=null;try{P=j(e)}catch($){if(Wc("Language definition for '{}' could not be registered.".replace("{}",A)),s)Wc($);else throw $;P=a}P.name||(P.name=A),t[A]=P,P.rawDefinition=j.bind(null,e),P.aliases&&C(P.aliases,{languageName:A})}function _(A){delete t[A];for(const j of Object.keys(n))n[j]===A&&delete n[j]}function T(){return Object.keys(t)}function k(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:j}){typeof A=="string"&&(A=[A]),A.forEach(P=>{n[P.toLowerCase()]=j})}function I(A){const j=k(A);return j&&!j.disableAutodetect}function O(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=j=>{A["before:highlightBlock"](Object.assign({block:j.el},j))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=j=>{A["after:highlightBlock"](Object.assign({block:j.el},j))})}function M(A){O(A),i.push(A)}function G(A){const j=i.indexOf(A);j!==-1&&i.splice(j,1)}function D(A,j){const P=A;i.forEach(function($){$[P]&&$[P](j)})}function F(A){return Gu("10.7.0","highlightBlock will be removed entirely in v12.0"),Gu("10.7.0","Please use highlightElement now."),g(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:g,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:N,unregisterLanguage:_,listLanguages:T,getLanguage:k,registerAliases:C,autoDetection:I,inherit:YM,addPlugin:M,removePlugin:G}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=j1e,e.regex={concat:Nu,lookahead:iF,either:gA,optional:Yye,anyNumberOfTimes:qye};for(const A in $0)typeof $0[A]=="object"&&tF($0[A]);return Object.assign(e,$0),e},Af=fF({});Af.newInstance=()=>fF({});var L1e=Af;Af.HighlightJS=Af;Af.default=Af;const or=Of(L1e),XM={},D1e="hljs-";function P1e(e){const t=or.newInstance();return e&&r(e),{highlight:n,highlightAuto:i,listLanguages:s,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||XM,h=typeof f.prefix=="string"?f.prefix:D1e;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:B1e,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,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function i(c,u){const f=(u||XM).subset||s();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 s(){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 B1e{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],i=n.children[n.children.length-1];i&&i.type==="text"?i.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const i=this.stack[this.stack.length-1],s=t.root.children;n?i.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):i.children.push(...s)}openNode(t){const n=this,i=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:i},children:[]};s.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const U1e={};function QM(e){const t=e||U1e,n=t.aliases,i=t.detect||!1,s=t.languages||Hye,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=P1e(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){yg(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const g=F1e(h);if(g===!1||!g&&!i||g&&r&&r.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=_be(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(g&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function F1e(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let i;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=eL(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 s(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 fxe(e){return e>=56320&&e<=57343}function hxe(e,t){return(e-55296)*1024+9216+t}function yF(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function xF(e){return e>=64976&&e<=65007||dxe.has(e)}var xe;(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"})(xe||(xe={}));const pxe=65536;class mxe{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=pxe,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:i,col:s,offset:r}=this,a=s+n,l=r+n;return{code:t,startLine:i,endLine:i,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(fxe(n))return this.pos++,this._addGap(),hxe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,V.EOF;return this._err(xe.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 i=0;i=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,V.EOF;const i=this.html.charCodeAt(n);return i===V.CARRIAGE_RETURN?V.LINE_FEED:i}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,V.EOF;let t=this.html.charCodeAt(this.pos);return t===V.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,V.LINE_FEED):t===V.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,bF(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===V.LINE_FEED||t===V.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){yF(t)?this._err(xe.controlCharacterInInputStream):xF(t)&&this._err(xe.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 gxe=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))),bxe=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 yxe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=bxe.get(e))!==null&&t!==void 0?t:e}var fs;(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"})(fs||(fs={}));const xxe=32;var Ll;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Ll||(Ll={}));function $S(e){return e>=fs.ZERO&&e<=fs.NINE}function Exe(e){return e>=fs.UPPER_A&&e<=fs.UPPER_F||e>=fs.LOWER_A&&e<=fs.LOWER_F}function vxe(e){return e>=fs.UPPER_A&&e<=fs.UPPER_Z||e>=fs.LOWER_A&&e<=fs.LOWER_Z||$S(e)}function wxe(e){return e===fs.EQUALS||vxe(e)}var ls;(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"})(ls||(ls={}));var No;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(No||(No={}));class _xe{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=ls.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=No.Strict}startEntity(t){this.decodeMode=t,this.state=ls.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case ls.EntityStart:return t.charCodeAt(n)===fs.NUM?(this.state=ls.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ls.NamedEntity,this.stateNamedEntity(t,n));case ls.NumericStart:return this.stateNumericStart(t,n);case ls.NumericDecimal:return this.stateNumericDecimal(t,n);case ls.NumericHex:return this.stateNumericHex(t,n);case ls.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|xxe)===fs.LOWER_X?(this.state=ls.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ls.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,i,s){if(n!==i){const r=i-n;this.result=this.result*Math.pow(s,r)+Number.parseInt(t.substr(n,r),s),this.consumed+=r}}stateNumericHex(t,n){const i=n;for(;n>14;for(;n>14,r!==0){if(a===fs.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==No.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:i}=this,s=(i[n]&Ll.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,i){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Ll.VALUE_LENGTH:s[t+1],i),n===3&&this.emitCodePoint(s[t+2],i),i}end(){var t;switch(this.state){case ls.NamedEntity:return this.result!==0&&(this.decodeMode!==No.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ls.NumericDecimal:return this.emitNumericEntity(0,2);case ls.NumericHex:return this.emitNumericEntity(0,3);case ls.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ls.EntityStart:return 0}}}function Sxe(e,t,n,i){const s=(t&Ll.BRANCH_LENGTH)>>7,r=t&Ll.JUMP_TABLE;if(s===0)return r!==0&&i===r?n:-1;if(r){const c=i-r;return c<0||c>=s?-1:e[n+c]-1}let a=n,l=a+s-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(ui)l=c-1;else return e[c+s]}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 Xc;(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"})(Xc||(Xc={}));var Fr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Fr||(Fr={}));var de;(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"})(de||(de={}));var S;(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"})(S||(S={}));const Nxe=new Map([[de.A,S.A],[de.ADDRESS,S.ADDRESS],[de.ANNOTATION_XML,S.ANNOTATION_XML],[de.APPLET,S.APPLET],[de.AREA,S.AREA],[de.ARTICLE,S.ARTICLE],[de.ASIDE,S.ASIDE],[de.B,S.B],[de.BASE,S.BASE],[de.BASEFONT,S.BASEFONT],[de.BGSOUND,S.BGSOUND],[de.BIG,S.BIG],[de.BLOCKQUOTE,S.BLOCKQUOTE],[de.BODY,S.BODY],[de.BR,S.BR],[de.BUTTON,S.BUTTON],[de.CAPTION,S.CAPTION],[de.CENTER,S.CENTER],[de.CODE,S.CODE],[de.COL,S.COL],[de.COLGROUP,S.COLGROUP],[de.DD,S.DD],[de.DESC,S.DESC],[de.DETAILS,S.DETAILS],[de.DIALOG,S.DIALOG],[de.DIR,S.DIR],[de.DIV,S.DIV],[de.DL,S.DL],[de.DT,S.DT],[de.EM,S.EM],[de.EMBED,S.EMBED],[de.FIELDSET,S.FIELDSET],[de.FIGCAPTION,S.FIGCAPTION],[de.FIGURE,S.FIGURE],[de.FONT,S.FONT],[de.FOOTER,S.FOOTER],[de.FOREIGN_OBJECT,S.FOREIGN_OBJECT],[de.FORM,S.FORM],[de.FRAME,S.FRAME],[de.FRAMESET,S.FRAMESET],[de.H1,S.H1],[de.H2,S.H2],[de.H3,S.H3],[de.H4,S.H4],[de.H5,S.H5],[de.H6,S.H6],[de.HEAD,S.HEAD],[de.HEADER,S.HEADER],[de.HGROUP,S.HGROUP],[de.HR,S.HR],[de.HTML,S.HTML],[de.I,S.I],[de.IMG,S.IMG],[de.IMAGE,S.IMAGE],[de.INPUT,S.INPUT],[de.IFRAME,S.IFRAME],[de.KEYGEN,S.KEYGEN],[de.LABEL,S.LABEL],[de.LI,S.LI],[de.LINK,S.LINK],[de.LISTING,S.LISTING],[de.MAIN,S.MAIN],[de.MALIGNMARK,S.MALIGNMARK],[de.MARQUEE,S.MARQUEE],[de.MATH,S.MATH],[de.MENU,S.MENU],[de.META,S.META],[de.MGLYPH,S.MGLYPH],[de.MI,S.MI],[de.MO,S.MO],[de.MN,S.MN],[de.MS,S.MS],[de.MTEXT,S.MTEXT],[de.NAV,S.NAV],[de.NOBR,S.NOBR],[de.NOFRAMES,S.NOFRAMES],[de.NOEMBED,S.NOEMBED],[de.NOSCRIPT,S.NOSCRIPT],[de.OBJECT,S.OBJECT],[de.OL,S.OL],[de.OPTGROUP,S.OPTGROUP],[de.OPTION,S.OPTION],[de.P,S.P],[de.PARAM,S.PARAM],[de.PLAINTEXT,S.PLAINTEXT],[de.PRE,S.PRE],[de.RB,S.RB],[de.RP,S.RP],[de.RT,S.RT],[de.RTC,S.RTC],[de.RUBY,S.RUBY],[de.S,S.S],[de.SCRIPT,S.SCRIPT],[de.SEARCH,S.SEARCH],[de.SECTION,S.SECTION],[de.SELECT,S.SELECT],[de.SOURCE,S.SOURCE],[de.SMALL,S.SMALL],[de.SPAN,S.SPAN],[de.STRIKE,S.STRIKE],[de.STRONG,S.STRONG],[de.STYLE,S.STYLE],[de.SUB,S.SUB],[de.SUMMARY,S.SUMMARY],[de.SUP,S.SUP],[de.TABLE,S.TABLE],[de.TBODY,S.TBODY],[de.TEMPLATE,S.TEMPLATE],[de.TEXTAREA,S.TEXTAREA],[de.TFOOT,S.TFOOT],[de.TD,S.TD],[de.TH,S.TH],[de.THEAD,S.THEAD],[de.TITLE,S.TITLE],[de.TR,S.TR],[de.TRACK,S.TRACK],[de.TT,S.TT],[de.U,S.U],[de.UL,S.UL],[de.SVG,S.SVG],[de.VAR,S.VAR],[de.WBR,S.WBR],[de.XMP,S.XMP]]);function eh(e){var t;return(t=Nxe.get(e))!==null&&t!==void 0?t:S.UNKNOWN}const Me=S,Txe={[je.HTML]:new Set([Me.ADDRESS,Me.APPLET,Me.AREA,Me.ARTICLE,Me.ASIDE,Me.BASE,Me.BASEFONT,Me.BGSOUND,Me.BLOCKQUOTE,Me.BODY,Me.BR,Me.BUTTON,Me.CAPTION,Me.CENTER,Me.COL,Me.COLGROUP,Me.DD,Me.DETAILS,Me.DIR,Me.DIV,Me.DL,Me.DT,Me.EMBED,Me.FIELDSET,Me.FIGCAPTION,Me.FIGURE,Me.FOOTER,Me.FORM,Me.FRAME,Me.FRAMESET,Me.H1,Me.H2,Me.H3,Me.H4,Me.H5,Me.H6,Me.HEAD,Me.HEADER,Me.HGROUP,Me.HR,Me.HTML,Me.IFRAME,Me.IMG,Me.INPUT,Me.LI,Me.LINK,Me.LISTING,Me.MAIN,Me.MARQUEE,Me.MENU,Me.META,Me.NAV,Me.NOEMBED,Me.NOFRAMES,Me.NOSCRIPT,Me.OBJECT,Me.OL,Me.P,Me.PARAM,Me.PLAINTEXT,Me.PRE,Me.SCRIPT,Me.SECTION,Me.SELECT,Me.SOURCE,Me.STYLE,Me.SUMMARY,Me.TABLE,Me.TBODY,Me.TD,Me.TEMPLATE,Me.TEXTAREA,Me.TFOOT,Me.TH,Me.THEAD,Me.TITLE,Me.TR,Me.TRACK,Me.UL,Me.WBR,Me.XMP]),[je.MATHML]:new Set([Me.MI,Me.MO,Me.MN,Me.MS,Me.MTEXT,Me.ANNOTATION_XML]),[je.SVG]:new Set([Me.TITLE,Me.FOREIGN_OBJECT,Me.DESC]),[je.XLINK]:new Set,[je.XML]:new Set,[je.XMLNS]:new Set},HS=new Set([Me.H1,Me.H2,Me.H3,Me.H4,Me.H5,Me.H6]);de.STYLE,de.SCRIPT,de.XMP,de.IFRAME,de.NOEMBED,de.NOFRAMES,de.PLAINTEXT;var X;(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"})(X||(X={}));const Oi={DATA:X.DATA,RCDATA:X.RCDATA,RAWTEXT:X.RAWTEXT,SCRIPT_DATA:X.SCRIPT_DATA,PLAINTEXT:X.PLAINTEXT,CDATA_SECTION:X.CDATA_SECTION};function kxe(e){return e>=V.DIGIT_0&&e<=V.DIGIT_9}function op(e){return e>=V.LATIN_CAPITAL_A&&e<=V.LATIN_CAPITAL_Z}function Axe(e){return e>=V.LATIN_SMALL_A&&e<=V.LATIN_SMALL_Z}function bl(e){return Axe(e)||op(e)}function nL(e){return bl(e)||kxe(e)}function H0(e){return e+32}function vF(e){return e===V.SPACE||e===V.LINE_FEED||e===V.TABULATION||e===V.FORM_FEED}function iL(e){return vF(e)||e===V.SOLIDUS||e===V.GREATER_THAN_SIGN}function Cxe(e){return e===V.NULL?xe.nullCharacterReference:e>1114111?xe.characterReferenceOutsideUnicodeRange:bF(e)?xe.surrogateCharacterReference:xF(e)?xe.noncharacterCharacterReference:yF(e)||e===V.CARRIAGE_RETURN?xe.controlCharacterReference:null}class Ixe{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=X.DATA,this.returnState=X.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new mxe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new _xe(gxe,(i,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(i)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(xe.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:i=>{this._err(xe.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+i)},validateNumericCharacterReference:i=>{const s=Cxe(i);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var i,s;(s=(i=this.handler).onParseError)===null||s===void 0||s.call(i,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,i){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||i==null||i()}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(xe.endTagWithAttributes),t.selfClosing&&this._err(xe.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 Ht.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Ht.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Ht.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:Ht.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=vF(t)?Ht.WHITESPACE_CHARACTER:t===V.NULL?Ht.NULL_CHARACTER:Ht.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Ht.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=X.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?No.Attribute:No.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===X.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case X.DATA:{this._stateData(t);break}case X.RCDATA:{this._stateRcdata(t);break}case X.RAWTEXT:{this._stateRawtext(t);break}case X.SCRIPT_DATA:{this._stateScriptData(t);break}case X.PLAINTEXT:{this._statePlaintext(t);break}case X.TAG_OPEN:{this._stateTagOpen(t);break}case X.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case X.TAG_NAME:{this._stateTagName(t);break}case X.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case X.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case X.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case X.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case X.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case X.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case X.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case X.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case X.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case X.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case X.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case X.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case X.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case X.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case X.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case X.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case X.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case X.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case X.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case X.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case X.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case X.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case X.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case X.BOGUS_COMMENT:{this._stateBogusComment(t);break}case X.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case X.COMMENT_START:{this._stateCommentStart(t);break}case X.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case X.COMMENT:{this._stateComment(t);break}case X.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case X.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case X.COMMENT_END:{this._stateCommentEnd(t);break}case X.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case X.DOCTYPE:{this._stateDoctype(t);break}case X.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case X.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case X.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case X.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case X.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case X.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case X.CDATA_SECTION:{this._stateCdataSection(t);break}case X.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case X.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case X.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case X.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.TAG_OPEN;break}case V.AMPERSAND:{this._startCharacterReference();break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitCodePoint(t);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case V.AMPERSAND:{this._startCharacterReference();break}case V.LESS_THAN_SIGN:{this.state=X.RCDATA_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(ni);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.RAWTEXT_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(ni);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.SCRIPT_DATA_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(ni);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(ni);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(bl(t))this._createStartTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case V.EXCLAMATION_MARK:{this.state=X.MARKUP_DECLARATION_OPEN;break}case V.SOLIDUS:{this.state=X.END_TAG_OPEN;break}case V.QUESTION_MARK:{this._err(xe.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=X.BOGUS_COMMENT,this._stateBogusComment(t);break}case V.EOF:{this._err(xe.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(xe.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=X.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(bl(t))this._createEndTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case V.GREATER_THAN_SIGN:{this._err(xe.missingEndTagName),this.state=X.DATA;break}case V.EOF:{this._err(xe.eofBeforeTagName),this._emitChars("");break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(ni);break}case V.EOF:{this._err(xe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===V.SOLIDUS?this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:bl(t)?(this._emitChars("<"),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){bl(t)?(this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(ni);break}case V.EOF:{this._err(xe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===V.SOLIDUS?(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(er.SCRIPT,!1)&&iL(this.preprocessor.peek(er.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 i=this._indexOf(t);this.items[i]=n,i===this.stackTop&&(this.current=n)}insertAfter(t,n,i){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,i),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===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;i--)if(t.has(this.tagIDs[i])&&this.treeAdapter.getNamespaceURI(this.items[i])===n)return i;return-1}clearBackTo(t,n){const i=this._indexOfTagNames(t,n);this.shortenToLength(i+1)}clearBackToTableContext(){this.clearBackTo(Lxe,je.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Mxe,je.HTML)}clearBackToTableRowContext(){this.clearBackTo(Oxe,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]===S.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]===S.HTML}hasInDynamicScope(t,n){for(let i=this.stackTop;i>=0;i--){const s=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case je.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case je.SVG:{if(aL.has(s))return!1;break}case je.MATHML:{if(rL.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,t1)}hasInListItemScope(t){return this.hasInDynamicScope(t,Rxe)}hasInButtonScope(t){return this.hasInDynamicScope(t,jxe)}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(HS.has(n))return!0;if(t1.has(n))return!1;break}case je.SVG:{if(aL.has(n))return!1;break}case je.MATHML:{if(rL.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 S.TABLE:case S.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 S.TBODY:case S.THEAD:case S.TFOOT:return!0;case S.TABLE:case S.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 S.OPTION:case S.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&wF.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&sL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&sL.has(this.currentTagId);)this.pop()}}const Jv=3;var Ka;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ka||(Ka={}));const oL={type:Ka.Marker};class Bxe{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],s=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;as.get(c.name)===c.value)&&(r+=1,r>=Jv&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(oL)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ka.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:Ka.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(oL);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===Ka.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===Ka.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ka.Element&&n.element===t)}}const yl={createDocument(){return{nodeName:"#document",mode:Fr.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 i=e.childNodes.indexOf(n);e.childNodes.splice(i,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,i){const s=e.childNodes.find(r=>r.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=i;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:i,parentNode:null};yl.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(yl.isTextNode(n)){n.value+=t;return}}yl.appendChild(e,yl.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&yl.isTextNode(i)?i.value+=t:yl.insertBefore(e,yl.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function Vxe(e){return e.name===_F&&e.publicId===null&&(e.systemId===null||e.systemId===Uxe)}function Gxe(e){if(e.name!==_F)return Fr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===Fxe)return Fr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Hxe.has(n))return Fr.QUIRKS;let i=t===null?$xe:SF;if(lL(n,i))return Fr.QUIRKS;if(i=t===null?NF:zxe,lL(n,i))return Fr.LIMITED_QUIRKS}return Fr.NO_QUIRKS}const cL={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Kxe="definitionurl",qxe="definitionURL",Yxe=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])),Wxe=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}]]),Xxe=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])),Qxe=new Set([S.B,S.BIG,S.BLOCKQUOTE,S.BODY,S.BR,S.CENTER,S.CODE,S.DD,S.DIV,S.DL,S.DT,S.EM,S.EMBED,S.H1,S.H2,S.H3,S.H4,S.H5,S.H6,S.HEAD,S.HR,S.I,S.IMG,S.LI,S.LISTING,S.MENU,S.META,S.NOBR,S.OL,S.P,S.PRE,S.RUBY,S.S,S.SMALL,S.SPAN,S.STRONG,S.STRIKE,S.SUB,S.SUP,S.TABLE,S.TT,S.U,S.UL,S.VAR]);function Zxe(e){const t=e.tagID;return t===S.FONT&&e.attrs.some(({name:i})=>i===Xc.COLOR||i===Xc.SIZE||i===Xc.FACE)||Qxe.has(t)}function TF(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var i,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(i=this.treeAdapter).onItemPop)===null||s===void 0||s.call(i,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 i=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===je.HTML;this.currentNotInHTML=!i,this.tokenizer.inForeignNode=!i&&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=J.TEXT}switchToPlaintextParsing(){this.insertionMode=J.TEXT,this.originalInsertionMode=J.IN_BODY,this.tokenizer.state=Oi.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)===de.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 S.TITLE:case S.TEXTAREA:{this.tokenizer.state=Oi.RCDATA;break}case S.STYLE:case S.XMP:case S.IFRAME:case S.NOEMBED:case S.NOFRAMES:case S.NOSCRIPT:{this.tokenizer.state=Oi.RAWTEXT;break}case S.SCRIPT:{this.tokenizer.state=Oi.SCRIPT_DATA;break}case S.PLAINTEXT:{this.tokenizer.state=Oi.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",i=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,i,s),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 i=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,i)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const i=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(i??this.document,t)}}_appendElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location)}_insertElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location),this.openElements.push(i,t.tagID)}_insertFakeElement(t,n){const i=this.treeAdapter.createElement(t,je.HTML,[]);this._attachElementToTree(i,null),this.openElements.push(i,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,je.HTML,t.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,i),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(de.HTML,je.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,S.HTML)}_appendCommentNode(t,n){const i=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,i),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_insertCharacters(t){let n,i;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:i}=this._findFosterParentingLocation(),i?this.treeAdapter.insertTextBefore(n,t.chars,i):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),r=i?s.lastIndexOf(i):s.length,a=s[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 i=this.treeAdapter.getFirstChild(t);i;i=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(n,i)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const i=n.location,s=this.treeAdapter.getTagName(t),r=n.type===Ht.END_TAG&&s===n.tagName?{endTag:{...i},endLine:i.endLine,endCol:i.endCol,endOffset:i.endOffset}:{endLine:i.startLine,endCol:i.startCol,endOffset:i.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,i;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,i=this.fragmentContextID):{current:n,currentTagId:i}=this.openElements,t.tagID===S.SVG&&this.treeAdapter.getTagName(n)===de.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===je.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===S.MGLYPH||t.tagID===S.MALIGNMARK)&&i!==void 0&&!this._isIntegrationPoint(i,n,je.HTML)}_processToken(t){switch(t.type){case Ht.CHARACTER:{this.onCharacter(t);break}case Ht.NULL_CHARACTER:{this.onNullCharacter(t);break}case Ht.COMMENT:{this.onComment(t);break}case Ht.DOCTYPE:{this.onDoctype(t);break}case Ht.START_TAG:{this._processStartTag(t);break}case Ht.END_TAG:{this.onEndTag(t);break}case Ht.EOF:{this.onEof(t);break}case Ht.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,i){const s=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return nEe(t,s,r,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===Ka.Marker||this.openElements.contains(s.element)),i=n===-1?t-1:n-1;for(let s=i;s>=0;s--){const r=this.activeFormattingElements.entries[s];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(S.P),this.openElements.popUntilTagNamePopped(S.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case S.TR:{this.insertionMode=J.IN_ROW;return}case S.TBODY:case S.THEAD:case S.TFOOT:{this.insertionMode=J.IN_TABLE_BODY;return}case S.CAPTION:{this.insertionMode=J.IN_CAPTION;return}case S.COLGROUP:{this.insertionMode=J.IN_COLUMN_GROUP;return}case S.TABLE:{this.insertionMode=J.IN_TABLE;return}case S.BODY:{this.insertionMode=J.IN_BODY;return}case S.FRAMESET:{this.insertionMode=J.IN_FRAMESET;return}case S.SELECT:{this._resetInsertionModeForSelect(t);return}case S.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case S.HTML:{this.insertionMode=this.headElement?J.AFTER_HEAD:J.BEFORE_HEAD;return}case S.TD:case S.TH:{if(t>0){this.insertionMode=J.IN_CELL;return}break}case S.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 i=this.openElements.tagIDs[n];if(i===S.TEMPLATE)break;if(i===S.TABLE){this.insertionMode=J.IN_SELECT_IN_TABLE;return}}this.insertionMode=J.IN_SELECT}_isElementCausesFosterParenting(t){return AF.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 S.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===je.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case S.TABLE:{const i=this.treeAdapter.getParentNode(n);return i?{parent:i,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 i=this.treeAdapter.getNamespaceURI(t);return Txe[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Dve(this,t);return}switch(this.insertionMode){case J.INITIAL:{$h(this,t);break}case J.BEFORE_HTML:{Fp(this,t);break}case J.BEFORE_HEAD:{$p(this,t);break}case J.IN_HEAD:{Hp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{zp(this,t);break}case J.AFTER_HEAD:{Vp(this,t);break}case J.IN_BODY:case J.IN_CAPTION:case J.IN_CELL:case J.IN_TEMPLATE:{IF(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:{ew(this,t);break}case J.IN_TABLE_TEXT:{DF(this,t);break}case J.IN_COLUMN_GROUP:{n1(this,t);break}case J.AFTER_BODY:{i1(this,t);break}case J.AFTER_AFTER_BODY:{Db(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Lve(this,t);return}switch(this.insertionMode){case J.INITIAL:{$h(this,t);break}case J.BEFORE_HTML:{Fp(this,t);break}case J.BEFORE_HEAD:{$p(this,t);break}case J.IN_HEAD:{Hp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{zp(this,t);break}case J.AFTER_HEAD:{Vp(this,t);break}case J.TEXT:{this._insertCharacters(t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{ew(this,t);break}case J.IN_COLUMN_GROUP:{n1(this,t);break}case J.AFTER_BODY:{i1(this,t);break}case J.AFTER_AFTER_BODY:{Db(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){zS(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:{zS(this,t);break}case J.IN_TABLE_TEXT:{Hh(this,t);break}case J.AFTER_BODY:{hEe(this,t);break}case J.AFTER_AFTER_BODY:case J.AFTER_AFTER_FRAMESET:{pEe(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case J.INITIAL:{mEe(this,t);break}case J.BEFORE_HEAD:case J.IN_HEAD:case J.IN_HEAD_NO_SCRIPT:case J.AFTER_HEAD:{this._err(t,xe.misplacedDoctype);break}case J.IN_TABLE_TEXT:{Hh(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,xe.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Pve(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{$h(this,t);break}case J.BEFORE_HTML:{gEe(this,t);break}case J.BEFORE_HEAD:{yEe(this,t);break}case J.IN_HEAD:{Ca(this,t);break}case J.IN_HEAD_NO_SCRIPT:{vEe(this,t);break}case J.AFTER_HEAD:{_Ee(this,t);break}case J.IN_BODY:{Ls(this,t);break}case J.IN_TABLE:{Cf(this,t);break}case J.IN_TABLE_TEXT:{Hh(this,t);break}case J.IN_CAPTION:{xve(this,t);break}case J.IN_COLUMN_GROUP:{SA(this,t);break}case J.IN_TABLE_BODY:{Sx(this,t);break}case J.IN_ROW:{Nx(this,t);break}case J.IN_CELL:{wve(this,t);break}case J.IN_SELECT:{UF(this,t);break}case J.IN_SELECT_IN_TABLE:{Sve(this,t);break}case J.IN_TEMPLATE:{Tve(this,t);break}case J.AFTER_BODY:{Ave(this,t);break}case J.IN_FRAMESET:{Cve(this,t);break}case J.AFTER_FRAMESET:{Rve(this,t);break}case J.AFTER_AFTER_BODY:{Ove(this,t);break}case J.AFTER_AFTER_FRAMESET:{Mve(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Bve(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{$h(this,t);break}case J.BEFORE_HTML:{bEe(this,t);break}case J.BEFORE_HEAD:{xEe(this,t);break}case J.IN_HEAD:{EEe(this,t);break}case J.IN_HEAD_NO_SCRIPT:{wEe(this,t);break}case J.AFTER_HEAD:{SEe(this,t);break}case J.IN_BODY:{_x(this,t);break}case J.TEXT:{cve(this,t);break}case J.IN_TABLE:{Mm(this,t);break}case J.IN_TABLE_TEXT:{Hh(this,t);break}case J.IN_CAPTION:{Eve(this,t);break}case J.IN_COLUMN_GROUP:{vve(this,t);break}case J.IN_TABLE_BODY:{VS(this,t);break}case J.IN_ROW:{BF(this,t);break}case J.IN_CELL:{_ve(this,t);break}case J.IN_SELECT:{FF(this,t);break}case J.IN_SELECT_IN_TABLE:{Nve(this,t);break}case J.IN_TEMPLATE:{kve(this,t);break}case J.AFTER_BODY:{HF(this,t);break}case J.IN_FRAMESET:{Ive(this,t);break}case J.AFTER_FRAMESET:{jve(this,t);break}case J.AFTER_AFTER_BODY:{Db(this,t);break}}}onEof(t){switch(this.insertionMode){case J.INITIAL:{$h(this,t);break}case J.BEFORE_HTML:{Fp(this,t);break}case J.BEFORE_HEAD:{$p(this,t);break}case J.IN_HEAD:{Hp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{zp(this,t);break}case J.AFTER_HEAD:{Vp(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:{MF(this,t);break}case J.TEXT:{uve(this,t);break}case J.IN_TABLE_TEXT:{Hh(this,t);break}case J.IN_TEMPLATE:{$F(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:{_A(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===V.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:{CF(this,t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{ew(this,t);break}case J.IN_TABLE_TEXT:{LF(this,t);break}}}};function oEe(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):OF(e,t),n}function lEe(e,t){let n=null,i=e.openElements.stackTop;for(;i>=0;i--){const s=e.openElements.items[i];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[i])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(i,0)),e.activeFormattingElements.removeEntry(t)),n}function cEe(e,t,n){let i=t,s=e.openElements.getCommonAncestor(t);for(let r=0,a=s;a!==n;r++,a=s){s=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=rEe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=uEe(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(a,i),i=a)}return i}function uEe(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),i=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,i),t.element=i,i}function dEe(e,t,n){const i=e.treeAdapter.getTagName(t),s=eh(i);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);s===S.TEMPLATE&&r===je.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function fEe(e,t,n){const i=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,r=e.treeAdapter.createElement(s.tagName,i,s.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,s.tagID)}function wA(e,t){for(let n=0;n=n;i--)e._setEndLocation(e.openElements.items[i],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const i=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(i);if(s&&!s.endTag&&(e._setEndLocation(i,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function mEe(e,t){e._setDocumentType(t);const n=t.forceQuirks?Fr.QUIRKS:Gxe(t);Vxe(t)||e._err(t,xe.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=J.BEFORE_HTML}function $h(e,t){e._err(t,xe.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Fr.QUIRKS),e.insertionMode=J.BEFORE_HTML,e._processToken(t)}function gEe(e,t){t.tagID===S.HTML?(e._insertElement(t,je.HTML),e.insertionMode=J.BEFORE_HEAD):Fp(e,t)}function bEe(e,t){const n=t.tagID;(n===S.HTML||n===S.HEAD||n===S.BODY||n===S.BR)&&Fp(e,t)}function Fp(e,t){e._insertFakeRootElement(),e.insertionMode=J.BEFORE_HEAD,e._processToken(t)}function yEe(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.HEAD:{e._insertElement(t,je.HTML),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD;break}default:$p(e,t)}}function xEe(e,t){const n=t.tagID;n===S.HEAD||n===S.BODY||n===S.HTML||n===S.BR?$p(e,t):e._err(t,xe.endTagWithoutMatchingOpenElement)}function $p(e,t){e._insertFakeElement(de.HEAD,S.HEAD),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD,e._processToken(t)}function Ca(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case S.TITLE:{e._switchToTextParsing(t,Oi.RCDATA);break}case S.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Oi.RAWTEXT):(e._insertElement(t,je.HTML),e.insertionMode=J.IN_HEAD_NO_SCRIPT);break}case S.NOFRAMES:case S.STYLE:{e._switchToTextParsing(t,Oi.RAWTEXT);break}case S.SCRIPT:{e._switchToTextParsing(t,Oi.SCRIPT_DATA);break}case S.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=J.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(J.IN_TEMPLATE);break}case S.HEAD:{e._err(t,xe.misplacedStartTagForHeadElement);break}default:Hp(e,t)}}function EEe(e,t){switch(t.tagID){case S.HEAD:{e.openElements.pop(),e.insertionMode=J.AFTER_HEAD;break}case S.BODY:case S.BR:case S.HTML:{Hp(e,t);break}case S.TEMPLATE:{Tu(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function Tu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==S.TEMPLATE&&e._err(t,xe.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(S.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,xe.endTagWithoutMatchingOpenElement)}function Hp(e,t){e.openElements.pop(),e.insertionMode=J.AFTER_HEAD,e._processToken(t)}function vEe(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.BASEFONT:case S.BGSOUND:case S.HEAD:case S.LINK:case S.META:case S.NOFRAMES:case S.STYLE:{Ca(e,t);break}case S.NOSCRIPT:{e._err(t,xe.nestedNoscriptInHead);break}default:zp(e,t)}}function wEe(e,t){switch(t.tagID){case S.NOSCRIPT:{e.openElements.pop(),e.insertionMode=J.IN_HEAD;break}case S.BR:{zp(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function zp(e,t){const n=t.type===Ht.EOF?xe.openElementsLeftAfterEof:xe.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=J.IN_HEAD,e._processToken(t)}function _Ee(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.BODY:{e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=J.IN_BODY;break}case S.FRAMESET:{e._insertElement(t,je.HTML),e.insertionMode=J.IN_FRAMESET;break}case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:case S.NOFRAMES:case S.SCRIPT:case S.STYLE:case S.TEMPLATE:case S.TITLE:{e._err(t,xe.abandonedHeadElementChild),e.openElements.push(e.headElement,S.HEAD),Ca(e,t),e.openElements.remove(e.headElement);break}case S.HEAD:{e._err(t,xe.misplacedStartTagForHeadElement);break}default:Vp(e,t)}}function SEe(e,t){switch(t.tagID){case S.BODY:case S.HTML:case S.BR:{Vp(e,t);break}case S.TEMPLATE:{Tu(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function Vp(e,t){e._insertFakeElement(de.BODY,S.BODY),e.insertionMode=J.IN_BODY,wx(e,t)}function wx(e,t){switch(t.type){case Ht.CHARACTER:{IF(e,t);break}case Ht.WHITESPACE_CHARACTER:{CF(e,t);break}case Ht.COMMENT:{zS(e,t);break}case Ht.START_TAG:{Ls(e,t);break}case Ht.END_TAG:{_x(e,t);break}case Ht.EOF:{MF(e,t);break}}}function CF(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function IF(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function NEe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function TEe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function kEe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,je.HTML),e.insertionMode=J.IN_FRAMESET)}function AEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function CEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&HS.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,je.HTML)}function IEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function REe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML),n||(e.formElement=e.openElements.current))}function jEe(e,t){e.framesetOk=!1;const n=t.tagID;for(let i=e.openElements.stackTop;i>=0;i--){const s=e.openElements.tagIDs[i];if(n===S.LI&&s===S.LI||(n===S.DD||n===S.DT)&&(s===S.DD||s===S.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==S.ADDRESS&&s!==S.DIV&&s!==S.P&&e._isSpecialElement(e.openElements.items[i],s))break}e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function OEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.tokenizer.state=Oi.PLAINTEXT}function MEe(e,t){e.openElements.hasInScope(S.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(S.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.framesetOk=!1}function LEe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(de.A);n&&(wA(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 DEe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function PEe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(S.NOBR)&&(wA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function BEe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function UEe(e,t){e.treeAdapter.getDocumentMode(e.document)!==Fr.QUIRKS&&e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=J.IN_TABLE}function RF(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function jF(e){const t=EF(e,Xc.TYPE);return t!=null&&t.toLowerCase()===iEe}function FEe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),jF(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function $Ee(e,t){e._appendElement(t,je.HTML),t.ackSelfClosing=!0}function HEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function zEe(e,t){t.tagName=de.IMG,t.tagID=S.IMG,RF(e,t)}function VEe(e,t){e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Oi.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=J.TEXT}function GEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Oi.RAWTEXT)}function KEe(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Oi.RAWTEXT)}function fL(e,t){e._switchToTextParsing(t,Oi.RAWTEXT)}function qEe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.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 YEe(e,t){e.openElements.currentTagId===S.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function WEe(e,t){e.openElements.hasInScope(S.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,je.HTML)}function XEe(e,t){e.openElements.hasInScope(S.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(S.RTC),e._insertElement(t,je.HTML)}function QEe(e,t){e._reconstructActiveFormattingElements(),TF(t),vA(t),t.selfClosing?e._appendElement(t,je.MATHML):e._insertElement(t,je.MATHML),t.ackSelfClosing=!0}function ZEe(e,t){e._reconstructActiveFormattingElements(),kF(t),vA(t),t.selfClosing?e._appendElement(t,je.SVG):e._insertElement(t,je.SVG),t.ackSelfClosing=!0}function hL(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function Ls(e,t){switch(t.tagID){case S.I:case S.S:case S.B:case S.U:case S.EM:case S.TT:case S.BIG:case S.CODE:case S.FONT:case S.SMALL:case S.STRIKE:case S.STRONG:{DEe(e,t);break}case S.A:{LEe(e,t);break}case S.H1:case S.H2:case S.H3:case S.H4:case S.H5:case S.H6:{CEe(e,t);break}case S.P:case S.DL:case S.OL:case S.UL:case S.DIV:case S.DIR:case S.NAV:case S.MAIN:case S.MENU:case S.ASIDE:case S.CENTER:case S.FIGURE:case S.FOOTER:case S.HEADER:case S.HGROUP:case S.DIALOG:case S.DETAILS:case S.ADDRESS:case S.ARTICLE:case S.SEARCH:case S.SECTION:case S.SUMMARY:case S.FIELDSET:case S.BLOCKQUOTE:case S.FIGCAPTION:{AEe(e,t);break}case S.LI:case S.DD:case S.DT:{jEe(e,t);break}case S.BR:case S.IMG:case S.WBR:case S.AREA:case S.EMBED:case S.KEYGEN:{RF(e,t);break}case S.HR:{HEe(e,t);break}case S.RB:case S.RTC:{WEe(e,t);break}case S.RT:case S.RP:{XEe(e,t);break}case S.PRE:case S.LISTING:{IEe(e,t);break}case S.XMP:{GEe(e,t);break}case S.SVG:{ZEe(e,t);break}case S.HTML:{NEe(e,t);break}case S.BASE:case S.LINK:case S.META:case S.STYLE:case S.TITLE:case S.SCRIPT:case S.BGSOUND:case S.BASEFONT:case S.TEMPLATE:{Ca(e,t);break}case S.BODY:{TEe(e,t);break}case S.FORM:{REe(e,t);break}case S.NOBR:{PEe(e,t);break}case S.MATH:{QEe(e,t);break}case S.TABLE:{UEe(e,t);break}case S.INPUT:{FEe(e,t);break}case S.PARAM:case S.TRACK:case S.SOURCE:{$Ee(e,t);break}case S.IMAGE:{zEe(e,t);break}case S.BUTTON:{MEe(e,t);break}case S.APPLET:case S.OBJECT:case S.MARQUEE:{BEe(e,t);break}case S.IFRAME:{KEe(e,t);break}case S.SELECT:{qEe(e,t);break}case S.OPTION:case S.OPTGROUP:{YEe(e,t);break}case S.NOEMBED:case S.NOFRAMES:{fL(e,t);break}case S.FRAMESET:{kEe(e,t);break}case S.TEXTAREA:{VEe(e,t);break}case S.NOSCRIPT:{e.options.scriptingEnabled?fL(e,t):hL(e,t);break}case S.PLAINTEXT:{OEe(e,t);break}case S.COL:case S.TH:case S.TD:case S.TR:case S.HEAD:case S.FRAME:case S.TBODY:case S.TFOOT:case S.THEAD:case S.CAPTION:case S.COLGROUP:break;default:hL(e,t)}}function JEe(e,t){if(e.openElements.hasInScope(S.BODY)&&(e.insertionMode=J.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function eve(e,t){e.openElements.hasInScope(S.BODY)&&(e.insertionMode=J.AFTER_BODY,HF(e,t))}function tve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function nve(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(S.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(S.FORM):n&&e.openElements.remove(n))}function ive(e){e.openElements.hasInButtonScope(S.P)||e._insertFakeElement(de.P,S.P),e._closePElement()}function sve(e){e.openElements.hasInListItemScope(S.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(S.LI),e.openElements.popUntilTagNamePopped(S.LI))}function rve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function ave(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ove(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function lve(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(de.BR,S.BR),e.openElements.pop(),e.framesetOk=!1}function OF(e,t){const n=t.tagName,i=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const r=e.openElements.items[s],a=e.openElements.tagIDs[s];if(i===a&&(i!==S.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(r,a))break}}function _x(e,t){switch(t.tagID){case S.A:case S.B:case S.I:case S.S:case S.U:case S.EM:case S.TT:case S.BIG:case S.CODE:case S.FONT:case S.NOBR:case S.SMALL:case S.STRIKE:case S.STRONG:{wA(e,t);break}case S.P:{ive(e);break}case S.DL:case S.UL:case S.OL:case S.DIR:case S.DIV:case S.NAV:case S.PRE:case S.MAIN:case S.MENU:case S.ASIDE:case S.BUTTON:case S.CENTER:case S.FIGURE:case S.FOOTER:case S.HEADER:case S.HGROUP:case S.DIALOG:case S.ADDRESS:case S.ARTICLE:case S.DETAILS:case S.SEARCH:case S.SECTION:case S.SUMMARY:case S.LISTING:case S.FIELDSET:case S.BLOCKQUOTE:case S.FIGCAPTION:{tve(e,t);break}case S.LI:{sve(e);break}case S.DD:case S.DT:{rve(e,t);break}case S.H1:case S.H2:case S.H3:case S.H4:case S.H5:case S.H6:{ave(e);break}case S.BR:{lve(e);break}case S.BODY:{JEe(e,t);break}case S.HTML:{eve(e,t);break}case S.FORM:{nve(e);break}case S.APPLET:case S.OBJECT:case S.MARQUEE:{ove(e,t);break}case S.TEMPLATE:{Tu(e,t);break}default:OF(e,t)}}function MF(e,t){e.tmplInsertionModeStack.length>0?$F(e,t):_A(e,t)}function cve(e,t){var n;t.tagID===S.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function uve(e,t){e._err(t,xe.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function ew(e,t){if(e.openElements.currentTagId!==void 0&&AF.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 Ht.CHARACTER:{DF(e,t);break}case Ht.WHITESPACE_CHARACTER:{LF(e,t);break}}else Eg(e,t)}function dve(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,je.HTML),e.insertionMode=J.IN_CAPTION}function fve(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=J.IN_COLUMN_GROUP}function hve(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(de.COLGROUP,S.COLGROUP),e.insertionMode=J.IN_COLUMN_GROUP,SA(e,t)}function pve(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=J.IN_TABLE_BODY}function mve(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(de.TBODY,S.TBODY),e.insertionMode=J.IN_TABLE_BODY,Sx(e,t)}function gve(e,t){e.openElements.hasInTableScope(S.TABLE)&&(e.openElements.popUntilTagNamePopped(S.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function bve(e,t){jF(t)?e._appendElement(t,je.HTML):Eg(e,t),t.ackSelfClosing=!0}function yve(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,je.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Cf(e,t){switch(t.tagID){case S.TD:case S.TH:case S.TR:{mve(e,t);break}case S.STYLE:case S.SCRIPT:case S.TEMPLATE:{Ca(e,t);break}case S.COL:{hve(e,t);break}case S.FORM:{yve(e,t);break}case S.TABLE:{gve(e,t);break}case S.TBODY:case S.TFOOT:case S.THEAD:{pve(e,t);break}case S.INPUT:{bve(e,t);break}case S.CAPTION:{dve(e,t);break}case S.COLGROUP:{fve(e,t);break}default:Eg(e,t)}}function Mm(e,t){switch(t.tagID){case S.TABLE:{e.openElements.hasInTableScope(S.TABLE)&&(e.openElements.popUntilTagNamePopped(S.TABLE),e._resetInsertionMode());break}case S.TEMPLATE:{Tu(e,t);break}case S.BODY:case S.CAPTION:case S.COL:case S.COLGROUP:case S.HTML:case S.TBODY:case S.TD:case S.TFOOT:case S.TH:case S.THEAD:case S.TR:break;default:Eg(e,t)}}function Eg(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,wx(e,t),e.fosterParentingEnabled=n}function LF(e,t){e.pendingCharacterTokens.push(t)}function DF(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Hh(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===S.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===S.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===S.OPTGROUP&&e.openElements.pop();break}case S.OPTION:{e.openElements.currentTagId===S.OPTION&&e.openElements.pop();break}case S.SELECT:{e.openElements.hasInSelectScope(S.SELECT)&&(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode());break}case S.TEMPLATE:{Tu(e,t);break}}}function Sve(e,t){const n=t.tagID;n===S.CAPTION||n===S.TABLE||n===S.TBODY||n===S.TFOOT||n===S.THEAD||n===S.TR||n===S.TD||n===S.TH?(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode(),e._processStartTag(t)):UF(e,t)}function Nve(e,t){const n=t.tagID;n===S.CAPTION||n===S.TABLE||n===S.TBODY||n===S.TFOOT||n===S.THEAD||n===S.TR||n===S.TD||n===S.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode(),e.onEndTag(t)):FF(e,t)}function Tve(e,t){switch(t.tagID){case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:case S.NOFRAMES:case S.SCRIPT:case S.STYLE:case S.TEMPLATE:case S.TITLE:{Ca(e,t);break}case S.CAPTION:case S.COLGROUP:case S.TBODY:case S.TFOOT:case S.THEAD:{e.tmplInsertionModeStack[0]=J.IN_TABLE,e.insertionMode=J.IN_TABLE,Cf(e,t);break}case S.COL:{e.tmplInsertionModeStack[0]=J.IN_COLUMN_GROUP,e.insertionMode=J.IN_COLUMN_GROUP,SA(e,t);break}case S.TR:{e.tmplInsertionModeStack[0]=J.IN_TABLE_BODY,e.insertionMode=J.IN_TABLE_BODY,Sx(e,t);break}case S.TD:case S.TH:{e.tmplInsertionModeStack[0]=J.IN_ROW,e.insertionMode=J.IN_ROW,Nx(e,t);break}default:e.tmplInsertionModeStack[0]=J.IN_BODY,e.insertionMode=J.IN_BODY,Ls(e,t)}}function kve(e,t){t.tagID===S.TEMPLATE&&Tu(e,t)}function $F(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(S.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):_A(e,t)}function Ave(e,t){t.tagID===S.HTML?Ls(e,t):i1(e,t)}function HF(e,t){var n;if(t.tagID===S.HTML){if(e.fragmentContext||(e.insertionMode=J.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===S.HTML){e._setEndLocation(e.openElements.items[0],t);const i=e.openElements.items[1];i&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(i))===null||n===void 0)&&n.endTag)&&e._setEndLocation(i,t)}}else i1(e,t)}function i1(e,t){e.insertionMode=J.IN_BODY,wx(e,t)}function Cve(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.FRAMESET:{e._insertElement(t,je.HTML);break}case S.FRAME:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case S.NOFRAMES:{Ca(e,t);break}}}function Ive(e,t){t.tagID===S.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==S.FRAMESET&&(e.insertionMode=J.AFTER_FRAMESET))}function Rve(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.NOFRAMES:{Ca(e,t);break}}}function jve(e,t){t.tagID===S.HTML&&(e.insertionMode=J.AFTER_AFTER_FRAMESET)}function Ove(e,t){t.tagID===S.HTML?Ls(e,t):Db(e,t)}function Db(e,t){e.insertionMode=J.IN_BODY,wx(e,t)}function Mve(e,t){switch(t.tagID){case S.HTML:{Ls(e,t);break}case S.NOFRAMES:{Ca(e,t);break}}}function Lve(e,t){t.chars=ni,e._insertCharacters(t)}function Dve(e,t){e._insertCharacters(t),e.framesetOk=!1}function zF(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 Pve(e,t){if(Zxe(t))zF(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===je.MATHML?TF(t):i===je.SVG&&(Jxe(t),kF(t)),vA(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function Bve(e,t){if(t.tagID===S.P||t.tagID===S.BR){zF(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const i=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(i)===je.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(i);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}de.AREA,de.BASE,de.BASEFONT,de.BGSOUND,de.BR,de.COL,de.EMBED,de.FRAME,de.HR,de.IMG,de.INPUT,de.KEYGEN,de.LINK,de.META,de.PARAM,de.SOURCE,de.TRACK,de.WBR;const Uve=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Fve=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),pL={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function VF(e,t){const n=Xve(e),i=r7("type",{handlers:{root:$ve,element:Hve,text:zve,comment:KF,doctype:Vve,raw:Kve},unknown:qve}),s={parser:n?new dL(pL):dL.getFragmentParser(void 0,pL),handle(l){i(l,s)},stitches:!1,options:t||{}};i(e,s),th(s,ro());const r=n?s.parser.document:s.parser.getFragment(),a=Q1e(r,{file:s.options.file});return s.stitches&&yg(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 GF(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Ht.CHARACTER,chars:e.value,location:vg(e)};th(t,ro(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Vve(e,t){const n={type:Ht.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:vg(e)};th(t,ro(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Gve(e,t){t.stitches=!0;const n=Qve(e);if("children"in e&&"children"in n){const i=VF({type:"root",children:e.children},t.options);n.children=i.children}KF({type:"comment",value:{stitch:n}},t)}function KF(e,t){const n=e.value,i={type:Ht.COMMENT,data:n,location:vg(e)};th(t,ro(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function Kve(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,qF(t,ro(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Uve,"<$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 qve(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Gve(n,t);else{let i="";throw Fve.has(n.type)&&(i=". 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"+i)}}function th(e,t){qF(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=Oi.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 qF(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 Yve(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Oi.PLAINTEXT)return;th(t,ro(e));const i=t.parser.openElements.current;let s="namespaceURI"in i?i.namespaceURI:Lc.html;s===Lc.html&&n==="svg"&&(s=Lc.svg);const r=nxe({...e,children:[]},{space:s===Lc.svg?"svg":"html"}),a={type:Ht.START_TAG,tagName:n,tagID:eh(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:vg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Wve(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&uxe.includes(n)||t.parser.tokenizer.state===Oi.PLAINTEXT)return;th(t,gx(e));const i={type:Ht.END_TAG,tagName:n,tagID:eh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:vg(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Oi.RCDATA||t.parser.tokenizer.state===Oi.RAWTEXT||t.parser.tokenizer.state===Oi.SCRIPT_DATA)&&(t.parser.tokenizer.state=Oi.DATA)}function Xve(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function vg(e){const t=ro(e)||{line:void 0,column:void 0,offset:void 0},n=gx(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 Qve(e){return"children"in e?kf({...e,children:[]}):kf(e)}function Zve(e){return function(t,n){return VF(t,{...e,file:n})}}const YF=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function WF(e){if(!e)return!1;try{const t=e.toLowerCase();return YF.some(n=>t.includes(n))}catch{return!1}}function Jve(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(WF(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return YF.some(r=>s.includes(r))}return!1}function ewe({text:e,className:t,allowRawHtml:n=!0}){const[i,s]=b.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 g=d(m);if(g)return g}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(ige,{remarkPlugins:[gbe],rehypePlugins:n?[Zve,QM]:[QM],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(WF(d)||Jve(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:()=>s({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(Gc,{})})]}),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(CP,{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(Gc,{})})]})}):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:()=>s({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(Gc,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),i&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(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:i.title||a(i.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:i.src,download:i.title||a(i.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(H1,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(Ns,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const nh=b.memo(ewe),mL=6,gL=7,twe={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function GS(e){return twe[(e||"").trim().toLowerCase()]||"未知"}function bL(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 nwe(e){if(!e)return"";const t=e.trim(),n=Number(t),i=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(i.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(i)}function iwe(e){const t=e.replace(/\r\n/g,` +`))}function c(p,m,g,v){const y=g.enter("tableCell"),x=g.enter("phrasing"),E=g.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return s0e(p,{align:m,alignDelimiters:i,padding:n,stringLength:s})}function d(p,m,g){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 lbe={tokenize:gbe,partial:!0};function cbe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hbe,continuation:{tokenize:pbe},exit:mbe}},text:{91:{name:"gfmFootnoteCall",tokenize:fbe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ube,resolveTo:dbe}}}}function ube(e,t,n){const i=this;let s=i.events.length;const r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;s--;){const c=i.events[s][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=Sa(i.sliceSerialize({start:a.end,end:i.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 dbe(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 i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},s.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",i,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function fbe(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.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||Ln(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Sa(i.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ln(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 hbe(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.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||Ln(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return r=Sa(i.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ln(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"),s.includes(r)||s.push(r),Jt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function pbe(e,t,n){return e.check(vg,t,e.attempt(lbe,t,n))}function mbe(e){e.exit("gfmFootnoteDefinition")}function gbe(e,t,n){const i=this;return Jt(e,s,"gfmFootnoteDefinitionIndent",5);function s(r){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function bbe(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:r,resolveAll:s};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(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=Af(m);return v._open=!y||y===2&&!!g,v._close=!g||g===2&&!!y,l(m)}}}class ybe{constructor(){this.map=[]}add(t,n,i){xbe(this,t,n,i)}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 i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const r of s)t.push(r);s=i.pop()}this.map.length=0}}function xbe(e,t,n,i){let s=0;if(!(n===0&&i.length===0)){for(;s-1;){const D=i.events[O][1].type;if(D==="lineEnding"||D==="linePrefix")O--;else break}const L=O>-1?i.events[O][1].type:null,G=L==="tableHead"||L==="tableRow"?_:c;return G===_&&i.parser.lazy[i.now().line]?n(I):G(I)}function c(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,r+=1),d(I)}function d(I){return I===null?n(I):mt(I)?r>1?(r=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):zt(I)?Jt(e,d,"whitespace")(I):(r+=1,a&&(a=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(I)))}function f(I){return I===null||I===124||Ln(I)?(e.exit("data"),d(I)):(e.consume(I),I===92?h:f)}function h(I){return I===92||I===124?(e.consume(I),f):f(I)}function p(I){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,zt(I)?Jt(e,m,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?v(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),g):N(I)}function g(I){return zt(I)?Jt(e,v,"whitespace")(I):v(I)}function v(I){return I===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):I===45?(r+=1,y(I)):I===null||mt(I)?w(I):N(I)}function y(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):N(I)}function x(I){return I===45?(e.consume(I),x):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return zt(I)?Jt(e,w,"whitespace")(I):w(I)}function w(I){return I===124?m(I):I===null||mt(I)?!a||s!==r?N(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):N(I)}function N(I){return n(I)}function _(I){return e.enter("tableRow"),T(I)}function T(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),T):I===null||mt(I)?(e.exit("tableRow"),t(I)):zt(I)?Jt(e,T,"whitespace")(I):(e.enter("data"),k(I))}function k(I){return I===null||I===124||Ln(I)?(e.exit("data"),T(I)):(e.consume(I),I===92?C:k)}function C(I){return I===92||I===124?(e.consume(I),k):k(I)}}function _be(e,t){let n=-1,i=!0,s=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new ybe;for(;++nn[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(r.end=Object.assign({},od(t.events,s)),e.add(s,0,[["exit",r,t]]),r=void 0),r}function FM(e,t,n,i,s){const r=[],a=od(t.events,n);s&&(s.end=Object.assign({},a),r.push(["exit",s,t])),i.end=Object.assign({},a),r.push(["exit",i,t]),e.add(n+1,0,r)}function od(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const Sbe={name:"tasklistCheck",tokenize:Tbe};function Nbe(){return{text:{91:Sbe}}}function Tbe(e,t,n){const i=this;return s;function s(c){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return Ln(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 mt(c)?t(c):zt(c)?e.check({tokenize:kbe},t,n)(c):n(c)}}function kbe(e,t,n){return Jt(e,i,"whitespace");function i(s){return s===null?n(s):t(s)}}function Abe(e){return zU([J0e(),cbe(),bbe(e),vbe(),Nbe()])}const Cbe={};function Ibe(e){const t=this,n=e||Cbe,i=t.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),r=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(Abe(n)),r.push(W0e()),a.push(X0e(n))}const $M=function(e,t,n){const i=wg(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 D7(e,t,n){return e.type==="element"?Bbe(e,t,n):e.type==="text"?n.whitespace==="normal"?P7(e,n):Ube(e):[]}function Bbe(e,t,n){const i=B7(e,n),s=e.children||[];let r=-1,a=[];if(Dbe(e))return a;let l,c;for(KS(e)||GM(e)&&$M(t,e,GM)?c=` +`:Lbe(e)?(l=2,c=2):L7(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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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"],g=["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:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[N,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:i,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 Kbe(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=Gbe(e),i=n.keywords;return i.type=[...i.type,...t.type],i.literal=[...i.literal,...t.literal],i.built_in=[...i.built_in,...t.built_in],i._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function U7(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const s={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,s]};s.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},g=["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"],N=["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:g,literal:v,built_in:[...x,...E,"set","shopt",...w,...N]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function qbe(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+i+"|"+t.optional(s)+"[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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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:i,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 Ybe(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+i+"|"+t.optional(s)+"[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(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+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"],g=["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:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[N,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:i,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 Wbe(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"],i=["default","false","null","true"],s=["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:s.concat(r),built_in:t,literal:i},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]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,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,g,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 Xbe=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_-]*/}}),Qbe=["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"],Zbe=["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"],Jbe=[...Qbe,...Zbe],eye=["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(),tye=["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(),nye=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),iye=["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 sye(e){const t=e.regex,n=Xbe(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="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,i,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:":("+tye.join("|")+")"},{begin:":(:)?("+nye.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+iye.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:s,attribute:eye.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Jbe.join("|")+")\\b"}]}}function rye(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 aye(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:"$7(e,t,n-1))}function lye(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",i=n+$7("(?:<"+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:["(?:"+i+"\\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,KM,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},KM,u]}}const qM="[A-Za-z$_][0-9A-Za-z$_]*",cye=["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"],uye=["true","false","null","undefined","NaN","Infinity"],H7=["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"],z7=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],V7=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],dye=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fye=[].concat(V7,H7,z7);function G7(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let Z;const B=P.input.substring(R);if(Z=B.match(/^\s*=/)){$.ignoreMatch();return}if((Z=B.match(/^\s+extends\s+/))&&Z.index===0){$.ignoreMatch();return}}},l={$pattern:qM,keyword:cye,literal:uye,built_in:fye,"variable.language":dye},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"}},g={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:i+"(?=\\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,g,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),N=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:N},T={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],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:{_:[...H7,...z7]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const G={match:t.concat(/\b/,L([...V7,"super","import"].map(P=>`${P}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{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:A,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.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"]}]}]},I,{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:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},G,O,T,F,{match:/\$[(.]/}]}}function K7(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],s={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var cd="[0-9](_*[0-9])*",z0=`\\.(${cd})`,V0="[0-9a-fA-F](_*[0-9a-fA-F])*",hye={className:"number",variants:[{begin:`(\\b(${cd})((${z0})|\\.)?|(${z0}))[eE][+-]?(${cd})[fFdD]?\\b`},{begin:`\\b(${cd})((${z0})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${z0})[fFdD]?\\b`},{begin:`\\b(${cd})[fFdD]\\b`},{begin:`\\b0[xX]((${V0})\\.?|(${V0})?\\.(${V0}))[pP][+-]?(${cd})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${V0})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function pye(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+/}]}},i={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={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,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,s]}]};s.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=hye,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,i,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 mye=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_-]*/}}),gye=["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"],bye=["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"],yye=[...gye,...bye],xye=["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(),q7=["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(),Y7=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Eye=["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(),vye=q7.concat(Y7).sort().reverse();function wye(e){const t=mye(e),n=vye,i="and or not only",s="[\\w-]+",r="("+s+"|@\\{"+s+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,N){return{className:E,begin:w,relevance:N}},d={$pattern:/[a-z-]+/,keyword:i,attribute:xye.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","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\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("+Eye.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={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:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],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","@\\{"+s+"\\}"),{begin:"\\b("+yye.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:":("+q7.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Y7.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function _ye(e){const t="\\[=*\\[",n="\\]=*\\]",i={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[i],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:s.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:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[i],relevance:5}])}}function W7(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},s={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:"$"},s,i,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Sye(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 Nye(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"],i=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},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=(g,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",g,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,i)},p=(g,v,y)=>t.concat(t.concat("(?:",g,")"),v,/(?:\\.|[^\\\/])*?/,y,i),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:s,contains:m}}function Tye(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,i=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=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:"\\$+"+i},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":(D,F)=>{F.data._beginMatch=D[1]||D[2]},"on:end":(D,F)=>{F.data._beginMatch!==D[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]},g={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:(D=>{const F=[];return D.forEach(A=>{F.push(A),A.toLowerCase()===A?F.push(A.toUpperCase()):F.push(A.toLowerCase())}),F})(v),built_in:x},N=D=>D.map(F=>F.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",N(x).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(i,"\\b(?!\\()"),k={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,k,e.C_BLOCK_COMMENT_MODE,m,g,_]},O={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",N(y).join("\\b|"),"|",N(x).join("\\b|"),"\\b)"),i,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(O);const L=[C,k,e.C_BLOCK_COMMENT_MODE,m,g,_],G={begin:t.concat(/#\[\s*\\?/,t.either(s,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...L]},...L,{scope:"meta",variants:[{match:s},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[G,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,O,k,{match:[/const/,/\s/,i],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",G,a,k,e.C_BLOCK_COMMENT_MODE,m,g]}]},{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,g]}}function kye(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 Aye(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Q7(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["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:i,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|${i.join("|")}`,g={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,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{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:[g,y,f]}]}}function Cye(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Iye(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=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]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,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:[s,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[r,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Rye(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",i=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(i,/(::\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"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},_=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:i,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{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=_,g.contains=_;const I=[{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(I).concat(u).concat(_)}}function jye(e){const t=e.regex,n=/(r#)?/,i=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),r={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,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 Oye=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_-]*/}}),Mye=["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"],Lye=["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"],Dye=[...Mye,...Lye],Pye=["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(),Bye=["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(),Uye=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Fye=["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 $ye(e){const t=Oye(e),n=Uye,i=Bye,s="@[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("+Dye.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+i.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Fye.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:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:Pye.join(" ")},contains:[{begin:s,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 Hye(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function zye(e){const t=e.regex,n=e.COMMENT("--","$"),i={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={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(N=>!d.includes(N)),g={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(N){return t.concat(/\b/,t.either(...N.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(N,{exceptions:_,when:T}={}){const k=T;return _=_||[],N.map(C=>C.match(/\|\d+$/)||_.includes(C)?C:k(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:N=>N.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,g,i,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function Z7(e){return e?typeof e=="string"?e:e.source:null}function Vh(e){return kn("(?=",e,")")}function kn(...e){return e.map(n=>Z7(n)).join("")}function Vye(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Vs(...e){return"("+(Vye(e).capture?"":"?:")+e.map(i=>Z7(i)).join("|")+")"}const wA=e=>kn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Gye=["Protocol","Type"].map(wA),YM=["init","self"].map(wA),Kye=["Any","Self"],iw=["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"],WM=["false","nil","true"],qye=["assignment","associativity","higherThan","left","lowerThan","none","right"],Yye=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],XM=["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"],J7=Vs(/[/=\-+!*%<>&|^~?]/,/[\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]/),eF=Vs(J7,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),sw=kn(J7,eF,"*"),tF=Vs(/[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]/),s1=Vs(tF,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Va=kn(tF,s1,"*"),G0=kn(/[A-Z]/,s1,"*"),Wye=["attached","autoclosure",kn(/convention\(/,Vs("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",kn(/objc\(/,Va,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Xye=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Qye(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),i=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,Vs(...Gye,...YM)],className:{2:"keyword"}},r={match:kn(/\./,Vs(...iw)),relevance:0},a=iw.filter(ae=>typeof ae=="string").concat(["_|0"]),l=iw.filter(ae=>typeof ae!="string").concat(Kye).map(wA),c={variants:[{className:"keyword",match:Vs(...l,...YM)}]},u={$pattern:Vs(/\b\w+/,/#\w+/),keyword:a.concat(Yye),literal:WM},d=[s,r,c],f={match:kn(/\./,Vs(...XM)),relevance:0},h={className:"built_in",match:kn(/\b/,Vs(...XM),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:sw},{match:`\\.(\\.|${eF})+`}]},v=[m,g],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:kn(/\\/,ae,/[0\\tnr"']/)},{match:kn(/\\/,ae,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(ae="")=>({className:"subst",match:kn(/\\/,ae,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(ae="")=>({className:"subst",label:"interpol",begin:kn(/\\/,ae,/\(/),end:/\)/}),T=(ae="")=>({begin:kn(ae,/"""/),end:kn(/"""/,ae),contains:[w(ae),N(ae),_(ae)]}),k=(ae="")=>({begin:kn(ae,/"/),end:kn(/"/,ae),contains:[w(ae),_(ae)]}),C={className:"string",variants:[T(),T("#"),T("##"),T("###"),k(),k("#"),k("##"),k("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],O={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},L=ae=>{const Ne=kn(ae,/\//),ve=kn(/\//,ae);return{begin:Ne,end:ve,contains:[...I,{scope:"comment",begin:`#(?!.*${ve})`,end:/$/}]}},G={scope:"regexp",variants:[L("###"),L("##"),L("#"),O]},D={match:kn(/`/,Va,/`/)},F={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${s1}+`},j=[D,F,A],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Xye,contains:[...v,E,C]}]}},$={scope:"keyword",match:kn(/@/,Vs(...Wye),Vh(Vs(/\(/,/\s+/)))},R={scope:"meta",match:kn(/@/,Va)},Y=[P,$,R],Z={match:Vh(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:kn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,s1,"+")},{className:"type",match:G0,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:kn(/\s+&\s+/,Vh(G0)),relevance:0}]},B={begin://,keywords:u,contains:[...i,...d,...Y,m,Z]};Z.contains.push(B);const te={match:kn(Va,/\s*:/),keywords:"_|0",relevance:0},K={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",te,...i,G,...d,...p,...v,E,C,...j,...Y,Z]},z={begin://,keywords:"repeat each",contains:[...i,Z]},W={begin:Vs(Vh(kn(Va,/\s*:/)),Vh(kn(Va,/\s+/,Va,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Va}]},q={begin:/\(/,end:/\)/,keywords:u,contains:[W,...i,...d,...v,E,C,...Y,Z,K],endsParent:!0,illegal:/["']/},ce={match:[/(func|macro)/,/\s+/,Vs(D.match,Va,sw)],className:{1:"keyword",3:"title.function"},contains:[z,q,t],illegal:[/\[/,/%/]},me={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[z,q,t],illegal:/\[|%/},_e={match:[/operator/,/\s+/,sw],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,G0],className:{1:"keyword",3:"title"},contains:[Z],keywords:[...qye,...WM],end:/}/},ge={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Oe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Va,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[z,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:G0},...d],relevance:0}]};for(const ae of C.variants){const Ne=ae.contains.find(Qe=>Qe.label==="interpol");Ne.keywords=u;const ve=[...d,...p,...v,E,C,...j];Ne.contains=[...ve,{begin:/\(/,end:/\)/,contains:["self",...ve]}]}return{name:"Swift",keywords:u,contains:[...i,ce,me,ge,Oe,Ee,_e,de,{beginKeywords:"import",end:/$/,contains:[...i],relevance:0},G,...d,...p,...v,E,C,...j,...Y,Z,K]}}const r1="[A-Za-z$_][0-9A-Za-z$_]*",nF=["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"],iF=["true","false","null","undefined","NaN","Infinity"],sF=["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"],rF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],aF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],oF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],lF=[].concat(aF,sF,rF);function Zye(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let Z;const B=P.input.substring(R);if(Z=B.match(/^\s*=/)){$.ignoreMatch();return}if((Z=B.match(/^\s+extends\s+/))&&Z.index===0){$.ignoreMatch();return}}},l={$pattern:r1,keyword:nF,literal:iF,built_in:lF,"variable.language":oF},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"}},g={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:i+"(?=\\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,g,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),N=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:N},T={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],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:{_:[...sF,...rF]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const G={match:t.concat(/\b/,L([...aF,"super","import"].map(P=>`${P}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,v,x,{match:/\$\d+/},f,k,{scope:"attr",match:i+t.lookahead(":"),relevance:0},j,{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:A,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.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"]}]}]},I,{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:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},G,O,T,F,{match:/\$[(.]/}]}}function cF(e){const t=e.regex,n=Zye(e),i=r1,s=["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:s},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:r1,keyword:nF.concat(c),literal:iF,built_in:lF.concat(s),"variable.language":oF},d={className:"meta",begin:"@"+i},f=(g,v,y)=>{const x=g.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");g.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(i,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(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Jye(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},i={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\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,s),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,s),/ +/,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,i,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 e1e(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),i=["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"],s={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:i},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,s,e.QUOTE_STRING_MODE,c,u,l]}}function t1e(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),i=/[\p{L}0-9._:-]+/u,s={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},s,{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 uF(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",i={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={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,s]},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},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},v=[i,{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,g,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const n1e={arduino:Kbe,bash:U7,c:qbe,cpp:Ybe,csharp:Wbe,css:sye,diff:rye,go:aye,graphql:oye,ini:F7,java:lye,javascript:G7,json:K7,kotlin:pye,less:wye,lua:_ye,makefile:W7,markdown:X7,objectivec:Sye,perl:Nye,php:Tye,"php-template":kye,plaintext:Aye,python:Q7,"python-repl":Cye,r:Iye,ruby:Rye,rust:jye,scss:$ye,shell:Hye,sql:zye,swift:Qye,typescript:cF,vbnet:Jye,wasm:e1e,xml:t1e,yaml:uF};function dF(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],i=typeof n;(i==="object"||i==="function")&&!Object.isFrozen(n)&&dF(n)}),e}let QM=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function fF(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Dl(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(i){for(const s in i)n[s]=i[s]}),n}const i1e="",ZM=e=>!!e.scope,s1e=(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((i,s)=>`${i}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class r1e{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fF(t)}openNode(t){if(!ZM(t))return;const n=s1e(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){ZM(t)&&(this.buffer+=i1e)}value(){return this.buffer}span(t){this.buffer+=``}}const JM=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class _A{constructor(){this.rootNode=JM(),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=JM({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(i=>this._walk(t,i)),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=>{_A._collapse(n)}))}}class a1e extends _A{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const i=t.root;n&&(i.scope=`language:${n}`),this.add(i)}toHTML(){return new r1e(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Dm(e){return e?typeof e=="string"?e:e.source:null}function hF(e){return ku("(?=",e,")")}function o1e(e){return ku("(?:",e,")*")}function l1e(e){return ku("(?:",e,")?")}function ku(...e){return e.map(n=>Dm(n)).join("")}function c1e(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function SA(...e){return"("+(c1e(e).capture?"":"?:")+e.map(i=>Dm(i)).join("|")+")"}function pF(e){return new RegExp(e.toString()+"|").exec("").length-1}function u1e(e,t){const n=e&&e.exec(t);return n&&n.index===0}const d1e=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function NA(e,{joinWith:t}){let n=0;return e.map(i=>{n+=1;const s=n;let r=Dm(i),a="";for(;r.length>0;){const l=d1e.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])+s):(a+=l[0],l[0]==="("&&n++)}return a}).map(i=>`(${i})`).join(t)}const f1e=/\b\B/,mF="[a-zA-Z]\\w*",TA="[a-zA-Z_]\\w*",gF="\\b\\d+(\\.\\d+)?",bF="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",yF="\\b(0b[01]+)",h1e="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",p1e=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=ku(t,/.*\b/,e.binary,/\b.*/)),Dl({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},Pm={begin:"\\\\[\\s\\S]",relevance:0},m1e={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Pm]},g1e={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Pm]},b1e={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/},Ax=function(e,t,n={}){const i=Dl({scope:"comment",begin:e,end:t,contains:[]},n);i.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 s=SA("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 i.contains.push({begin:ku(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},y1e=Ax("//","$"),x1e=Ax("/\\*","\\*/"),E1e=Ax("#","$"),v1e={scope:"number",begin:gF,relevance:0},w1e={scope:"number",begin:bF,relevance:0},_1e={scope:"number",begin:yF,relevance:0},S1e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Pm,{begin:/\[/,end:/\]/,relevance:0,contains:[Pm]}]},N1e={scope:"title",begin:mF,relevance:0},T1e={scope:"title",begin:TA,relevance:0},k1e={begin:"\\.\\s*"+TA,relevance:0},A1e=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 K0=Object.freeze({__proto__:null,APOS_STRING_MODE:m1e,BACKSLASH_ESCAPE:Pm,BINARY_NUMBER_MODE:_1e,BINARY_NUMBER_RE:yF,COMMENT:Ax,C_BLOCK_COMMENT_MODE:x1e,C_LINE_COMMENT_MODE:y1e,C_NUMBER_MODE:w1e,C_NUMBER_RE:bF,END_SAME_AS_BEGIN:A1e,HASH_COMMENT_MODE:E1e,IDENT_RE:mF,MATCH_NOTHING_RE:f1e,METHOD_GUARD:k1e,NUMBER_MODE:v1e,NUMBER_RE:gF,PHRASAL_WORDS_MODE:b1e,QUOTE_STRING_MODE:g1e,REGEXP_MODE:S1e,RE_STARTERS_RE:h1e,SHEBANG:p1e,TITLE_MODE:N1e,UNDERSCORE_IDENT_RE:TA,UNDERSCORE_TITLE_MODE:T1e});function C1e(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function I1e(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function R1e(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=C1e,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function j1e(e,t){Array.isArray(e.illegal)&&(e.illegal=SA(...e.illegal))}function O1e(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 M1e(e,t){e.relevance===void 0&&(e.relevance=1)}const L1e=(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(i=>{delete e[i]}),e.keywords=n.keywords,e.begin=ku(n.beforeMatch,hF(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},D1e=["of","and","for","in","not","or","if","then","parent","list","value"],P1e="keyword";function xF(e,t,n=P1e){const i=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(r){Object.assign(i,xF(e[r],t,r))}),i;function s(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");i[c[0]]=[r,B1e(c[0],c[1])]})}}function B1e(e,t){return t?Number(t):U1e(e)?0:1}function U1e(e){return D1e.includes(e.toLowerCase())}const eL={},Xc=e=>{console.error(e)},tL=(e,...t)=>{console.log(`WARN: ${e}`,...t)},qu=(e,t)=>{eL[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),eL[`${e}/${t}`]=!0)},a1=new Error;function EF(e,t,{key:n}){let i=0;const s=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+i]=s[l],r[l+i]=!0,i+=pF(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function F1e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Xc("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),a1;if(typeof e.beginScope!="object"||e.beginScope===null)throw Xc("beginScope must be object"),a1;EF(e,e.begin,{key:"beginScope"}),e.begin=NA(e.begin,{joinWith:""})}}function $1e(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Xc("skip, excludeEnd, returnEnd not compatible with endScope: {}"),a1;if(typeof e.endScope!="object"||e.endScope===null)throw Xc("endScope must be object"),a1;EF(e,e.end,{key:"endScope"}),e.end=NA(e.end,{joinWith:""})}}function H1e(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function z1e(e){H1e(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),F1e(e),$1e(e)}function V1e(e){function t(a,l){return new RegExp(Dm(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+=pF(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(NA(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 i{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 s(a){const l=new i;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;[I1e,O1e,z1e,L1e].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[R1e,j1e,M1e].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=xF(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=Dm(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 G1e(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=s(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=Dl(e.classNameAliases||{}),r(e)}function vF(e){return e?e.endsWithParent||vF(e.starts):!1}function G1e(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Dl(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:vF(e)?Dl(e,{starts:e.starts?Dl(e.starts):null}):Object.isFrozen(e)?Dl(e):e}var K1e="11.11.1";class q1e extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const rw=fF,nL=Dl,iL=Symbol("nomatch"),Y1e=7,wF=function(e){const t=Object.create(null),n=Object.create(null),i=[];let s=!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:a1e};function c(A){return l.noHighlightRe.test(A)}function u(A){let j=A.className+" ";j+=A.parentNode?A.parentNode.className:"";const P=l.languageDetectRe.exec(j);if(P){const $=k(P[1]);return $||(tL(r.replace("{}",P[1])),tL("Falling back to no-highlight mode for this block.",A)),$?P[1]:"no-highlight"}return j.split(/\s+/).find($=>c($)||k($))}function d(A,j,P){let $="",R="";typeof j=="object"?($=A,P=j.ignoreIllegals,R=j.language):(qu("10.7.0","highlight(lang, code, ...args) has been deprecated."),qu("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),R=A,$=j),P===void 0&&(P=!0);const Y={code:$,language:R};D("before:highlight",Y);const Z=Y.result?Y.result:f(Y.language,Y.code,P);return Z.code=Y.code,D("after:highlight",Z),Z}function f(A,j,P,$){const R=Object.create(null);function Y(Q,oe){return Q.keywords[oe]}function Z(){if(!ve.keywords){Me.addText(ze);return}let Q=0;ve.keywordPatternRe.lastIndex=0;let oe=ve.keywordPatternRe.exec(ze),ie="";for(;oe;){ie+=ze.substring(Q,oe.index);const be=Ee.case_insensitive?oe[0].toLowerCase():oe[0],Le=Y(ve,be);if(Le){const[qe,gt]=Le;if(Me.addText(ie),ie="",R[be]=(R[be]||0)+1,R[be]<=Y1e&&(Se+=gt),qe.startsWith("_"))ie+=oe[0];else{const lt=Ee.classNameAliases[qe]||qe;K(oe[0],lt)}}else ie+=oe[0];Q=ve.keywordPatternRe.lastIndex,oe=ve.keywordPatternRe.exec(ze)}ie+=ze.substring(Q),Me.addText(ie)}function B(){if(ze==="")return;let Q=null;if(typeof ve.subLanguage=="string"){if(!t[ve.subLanguage]){Me.addText(ze);return}Q=f(ve.subLanguage,ze,!0,Qe[ve.subLanguage]),Qe[ve.subLanguage]=Q._top}else Q=p(ze,ve.subLanguage.length?ve.subLanguage:null);ve.relevance>0&&(Se+=Q.relevance),Me.__addSublanguage(Q._emitter,Q.language)}function te(){ve.subLanguage!=null?B():Z(),ze=""}function K(Q,oe){Q!==""&&(Me.startScope(oe),Me.addText(Q),Me.endScope())}function z(Q,oe){let ie=1;const be=oe.length-1;for(;ie<=be;){if(!Q._emit[ie]){ie++;continue}const Le=Ee.classNameAliases[Q[ie]]||Q[ie],qe=oe[ie];Le?K(qe,Le):(ze=qe,Z(),ze=""),ie++}}function W(Q,oe){return Q.scope&&typeof Q.scope=="string"&&Me.openNode(Ee.classNameAliases[Q.scope]||Q.scope),Q.beginScope&&(Q.beginScope._wrap?(K(ze,Ee.classNameAliases[Q.beginScope._wrap]||Q.beginScope._wrap),ze=""):Q.beginScope._multi&&(z(Q.beginScope,oe),ze="")),ve=Object.create(Q,{parent:{value:ve}}),ve}function q(Q,oe,ie){let be=u1e(Q.endRe,ie);if(be){if(Q["on:end"]){const Le=new QM(Q);Q["on:end"](oe,Le),Le.isMatchIgnored&&(be=!1)}if(be){for(;Q.endsParent&&Q.parent;)Q=Q.parent;return Q}}if(Q.endsWithParent)return q(Q.parent,oe,ie)}function ce(Q){return ve.matcher.regexIndex===0?(ze+=Q[0],1):(Ke=!0,0)}function me(Q){const oe=Q[0],ie=Q.rule,be=new QM(ie),Le=[ie.__beforeBegin,ie["on:begin"]];for(const qe of Le)if(qe&&(qe(Q,be),be.isMatchIgnored))return ce(oe);return ie.skip?ze+=oe:(ie.excludeBegin&&(ze+=oe),te(),!ie.returnBegin&&!ie.excludeBegin&&(ze=oe)),W(ie,Q),ie.returnBegin?0:oe.length}function _e(Q){const oe=Q[0],ie=j.substring(Q.index),be=q(ve,Q,ie);if(!be)return iL;const Le=ve;ve.endScope&&ve.endScope._wrap?(te(),K(oe,ve.endScope._wrap)):ve.endScope&&ve.endScope._multi?(te(),z(ve.endScope,Q)):Le.skip?ze+=oe:(Le.returnEnd||Le.excludeEnd||(ze+=oe),te(),Le.excludeEnd&&(ze=oe));do ve.scope&&Me.closeNode(),!ve.skip&&!ve.subLanguage&&(Se+=ve.relevance),ve=ve.parent;while(ve!==be.parent);return be.starts&&W(be.starts,Q),Le.returnEnd?0:oe.length}function de(){const Q=[];for(let oe=ve;oe!==Ee;oe=oe.parent)oe.scope&&Q.unshift(oe.scope);Q.forEach(oe=>Me.openNode(oe))}let ge={};function Oe(Q,oe){const ie=oe&&oe[0];if(ze+=Q,ie==null)return te(),0;if(ge.type==="begin"&&oe.type==="end"&&ge.index===oe.index&&ie===""){if(ze+=j.slice(oe.index,oe.index+1),!s){const be=new Error(`0 width match regex (${A})`);throw be.languageName=A,be.badRule=ge.rule,be}return 1}if(ge=oe,oe.type==="begin")return me(oe);if(oe.type==="illegal"&&!P){const be=new Error('Illegal lexeme "'+ie+'" for mode "'+(ve.scope||"")+'"');throw be.mode=ve,be}else if(oe.type==="end"){const be=_e(oe);if(be!==iL)return be}if(oe.type==="illegal"&&ie==="")return ze+=` +`,1;if(Pe>1e5&&Pe>oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ze+=ie,ie.length}const Ee=k(A);if(!Ee)throw Xc(r.replace("{}",A)),new Error('Unknown language: "'+A+'"');const ae=V1e(Ee);let Ne="",ve=$||ae;const Qe={},Me=new l.__emitter(l);de();let ze="",Se=0,Ue=0,Pe=0,Ke=!1;try{if(Ee.__emitTokens)Ee.__emitTokens(j,Me);else{for(ve.matcher.considerAll();;){Pe++,Ke?Ke=!1:ve.matcher.considerAll(),ve.matcher.lastIndex=Ue;const Q=ve.matcher.exec(j);if(!Q)break;const oe=j.substring(Ue,Q.index),ie=Oe(oe,Q);Ue=Q.index+ie}Oe(j.substring(Ue))}return Me.finalize(),Ne=Me.toHTML(),{language:A,value:Ne,relevance:Se,illegal:!1,_emitter:Me,_top:ve}}catch(Q){if(Q.message&&Q.message.includes("Illegal"))return{language:A,value:rw(j),illegal:!0,relevance:0,_illegalBy:{message:Q.message,index:Ue,context:j.slice(Ue-100,Ue+100),mode:Q.mode,resultSoFar:Ne},_emitter:Me};if(s)return{language:A,value:rw(j),illegal:!1,relevance:0,errorRaised:Q,_emitter:Me,_top:ve};throw Q}}function h(A){const j={value:rw(A),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return j._emitter.addText(A),j}function p(A,j){j=j||l.languages||Object.keys(t);const P=h(A),$=j.filter(k).filter(I).map(te=>f(te,A,!1));$.unshift(P);const R=$.sort((te,K)=>{if(te.relevance!==K.relevance)return K.relevance-te.relevance;if(te.language&&K.language){if(k(te.language).supersetOf===K.language)return 1;if(k(K.language).supersetOf===te.language)return-1}return 0}),[Y,Z]=R,B=Y;return B.secondBest=Z,B}function m(A,j,P){const $=j&&n[j]||P;A.classList.add("hljs"),A.classList.add(`language-${$}`)}function g(A){let j=null;const P=u(A);if(c(P))return;if(D("before:highlightElement",{el:A,language:P}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.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(A)),l.throwUnescapedHTML))throw new q1e("One of your code blocks includes unescaped HTML.",A.innerHTML);j=A;const $=j.textContent,R=P?d($,{language:P,ignoreIllegals:!0}):p($);A.innerHTML=R.value,A.dataset.highlighted="yes",m(A,P,R.language),A.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(A.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),D("after:highlightElement",{el:A,result:R,text:$})}function v(A){l=nL(l,A)}const y=()=>{w(),qu("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),qu("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function A(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",A,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function N(A,j){let P=null;try{P=j(e)}catch($){if(Xc("Language definition for '{}' could not be registered.".replace("{}",A)),s)Xc($);else throw $;P=a}P.name||(P.name=A),t[A]=P,P.rawDefinition=j.bind(null,e),P.aliases&&C(P.aliases,{languageName:A})}function _(A){delete t[A];for(const j of Object.keys(n))n[j]===A&&delete n[j]}function T(){return Object.keys(t)}function k(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:j}){typeof A=="string"&&(A=[A]),A.forEach(P=>{n[P.toLowerCase()]=j})}function I(A){const j=k(A);return j&&!j.disableAutodetect}function O(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=j=>{A["before:highlightBlock"](Object.assign({block:j.el},j))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=j=>{A["after:highlightBlock"](Object.assign({block:j.el},j))})}function L(A){O(A),i.push(A)}function G(A){const j=i.indexOf(A);j!==-1&&i.splice(j,1)}function D(A,j){const P=A;i.forEach(function($){$[P]&&$[P](j)})}function F(A){return qu("10.7.0","highlightBlock will be removed entirely in v12.0"),qu("10.7.0","Please use highlightElement now."),g(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:g,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:N,unregisterLanguage:_,listLanguages:T,getLanguage:k,registerAliases:C,autoDetection:I,inherit:nL,addPlugin:L,removePlugin:G}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=K1e,e.regex={concat:ku,lookahead:hF,either:SA,optional:l1e,anyNumberOfTimes:o1e};for(const A in K0)typeof K0[A]=="object"&&dF(K0[A]);return Object.assign(e,K0),e},If=wF({});If.newInstance=()=>wF({});var W1e=If;If.HighlightJS=If;If.default=If;const cr=Df(W1e),sL={},X1e="hljs-";function Q1e(e){const t=cr.newInstance();return e&&r(e),{highlight:n,highlightAuto:i,listLanguages:s,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||sL,h=typeof f.prefix=="string"?f.prefix:X1e;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:Z1e,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,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function i(c,u){const f=(u||sL).subset||s();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 s(){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 Z1e{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],i=n.children[n.children.length-1];i&&i.type==="text"?i.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const i=this.stack[this.stack.length-1],s=t.root.children;n?i.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):i.children.push(...s)}openNode(t){const n=this,i=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:i},children:[]};s.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const J1e={};function rL(e){const t=e||J1e,n=t.aliases,i=t.detect||!1,s=t.languages||n1e,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=Q1e(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){_g(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const g=exe(h);if(g===!1||!g&&!i||g&&r&&r.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=Pbe(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(g&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function exe(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let i;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=lL(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 s(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 Txe(e){return e>=56320&&e<=57343}function kxe(e,t){return(e-55296)*1024+9216+t}function AF(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function CF(e){return e>=64976&&e<=65007||Nxe.has(e)}var xe;(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"})(xe||(xe={}));const Axe=65536;class Cxe{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=Axe,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:i,col:s,offset:r}=this,a=s+n,l=r+n;return{code:t,startLine:i,endLine:i,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(Txe(n))return this.pos++,this._addGap(),kxe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,V.EOF;return this._err(xe.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 i=0;i=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,V.EOF;const i=this.html.charCodeAt(n);return i===V.CARRIAGE_RETURN?V.LINE_FEED:i}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,V.EOF;let t=this.html.charCodeAt(this.pos);return t===V.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,V.LINE_FEED):t===V.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,kF(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===V.LINE_FEED||t===V.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){AF(t)?this._err(xe.controlCharacterInInputStream):CF(t)&&this._err(xe.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 Ixe=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))),Rxe=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 jxe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Rxe.get(e))!==null&&t!==void 0?t:e}var ps;(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"})(ps||(ps={}));const Oxe=32;var Pl;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Pl||(Pl={}));function YS(e){return e>=ps.ZERO&&e<=ps.NINE}function Mxe(e){return e>=ps.UPPER_A&&e<=ps.UPPER_F||e>=ps.LOWER_A&&e<=ps.LOWER_F}function Lxe(e){return e>=ps.UPPER_A&&e<=ps.UPPER_Z||e>=ps.LOWER_A&&e<=ps.LOWER_Z||YS(e)}function Dxe(e){return e===ps.EQUALS||Lxe(e)}var us;(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"})(us||(us={}));var ko;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(ko||(ko={}));class Pxe{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=us.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ko.Strict}startEntity(t){this.decodeMode=t,this.state=us.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case us.EntityStart:return t.charCodeAt(n)===ps.NUM?(this.state=us.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=us.NamedEntity,this.stateNamedEntity(t,n));case us.NumericStart:return this.stateNumericStart(t,n);case us.NumericDecimal:return this.stateNumericDecimal(t,n);case us.NumericHex:return this.stateNumericHex(t,n);case us.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Oxe)===ps.LOWER_X?(this.state=us.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=us.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,i,s){if(n!==i){const r=i-n;this.result=this.result*Math.pow(s,r)+Number.parseInt(t.substr(n,r),s),this.consumed+=r}}stateNumericHex(t,n){const i=n;for(;n>14;for(;n>14,r!==0){if(a===ps.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==ko.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:i}=this,s=(i[n]&Pl.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,i){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Pl.VALUE_LENGTH:s[t+1],i),n===3&&this.emitCodePoint(s[t+2],i),i}end(){var t;switch(this.state){case us.NamedEntity:return this.result!==0&&(this.decodeMode!==ko.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case us.NumericDecimal:return this.emitNumericEntity(0,2);case us.NumericHex:return this.emitNumericEntity(0,3);case us.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case us.EntityStart:return 0}}}function Bxe(e,t,n,i){const s=(t&Pl.BRANCH_LENGTH)>>7,r=t&Pl.JUMP_TABLE;if(s===0)return r!==0&&i===r?n:-1;if(r){const c=i-r;return c<0||c>=s?-1:e[n+c]-1}let a=n,l=a+s-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(ui)l=c-1;else return e[c+s]}return-1}var Ie;(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/"})(Ie||(Ie={}));var Qc;(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"})(Qc||(Qc={}));var Hr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Hr||(Hr={}));var he;(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"})(he||(he={}));var S;(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"})(S||(S={}));const Uxe=new Map([[he.A,S.A],[he.ADDRESS,S.ADDRESS],[he.ANNOTATION_XML,S.ANNOTATION_XML],[he.APPLET,S.APPLET],[he.AREA,S.AREA],[he.ARTICLE,S.ARTICLE],[he.ASIDE,S.ASIDE],[he.B,S.B],[he.BASE,S.BASE],[he.BASEFONT,S.BASEFONT],[he.BGSOUND,S.BGSOUND],[he.BIG,S.BIG],[he.BLOCKQUOTE,S.BLOCKQUOTE],[he.BODY,S.BODY],[he.BR,S.BR],[he.BUTTON,S.BUTTON],[he.CAPTION,S.CAPTION],[he.CENTER,S.CENTER],[he.CODE,S.CODE],[he.COL,S.COL],[he.COLGROUP,S.COLGROUP],[he.DD,S.DD],[he.DESC,S.DESC],[he.DETAILS,S.DETAILS],[he.DIALOG,S.DIALOG],[he.DIR,S.DIR],[he.DIV,S.DIV],[he.DL,S.DL],[he.DT,S.DT],[he.EM,S.EM],[he.EMBED,S.EMBED],[he.FIELDSET,S.FIELDSET],[he.FIGCAPTION,S.FIGCAPTION],[he.FIGURE,S.FIGURE],[he.FONT,S.FONT],[he.FOOTER,S.FOOTER],[he.FOREIGN_OBJECT,S.FOREIGN_OBJECT],[he.FORM,S.FORM],[he.FRAME,S.FRAME],[he.FRAMESET,S.FRAMESET],[he.H1,S.H1],[he.H2,S.H2],[he.H3,S.H3],[he.H4,S.H4],[he.H5,S.H5],[he.H6,S.H6],[he.HEAD,S.HEAD],[he.HEADER,S.HEADER],[he.HGROUP,S.HGROUP],[he.HR,S.HR],[he.HTML,S.HTML],[he.I,S.I],[he.IMG,S.IMG],[he.IMAGE,S.IMAGE],[he.INPUT,S.INPUT],[he.IFRAME,S.IFRAME],[he.KEYGEN,S.KEYGEN],[he.LABEL,S.LABEL],[he.LI,S.LI],[he.LINK,S.LINK],[he.LISTING,S.LISTING],[he.MAIN,S.MAIN],[he.MALIGNMARK,S.MALIGNMARK],[he.MARQUEE,S.MARQUEE],[he.MATH,S.MATH],[he.MENU,S.MENU],[he.META,S.META],[he.MGLYPH,S.MGLYPH],[he.MI,S.MI],[he.MO,S.MO],[he.MN,S.MN],[he.MS,S.MS],[he.MTEXT,S.MTEXT],[he.NAV,S.NAV],[he.NOBR,S.NOBR],[he.NOFRAMES,S.NOFRAMES],[he.NOEMBED,S.NOEMBED],[he.NOSCRIPT,S.NOSCRIPT],[he.OBJECT,S.OBJECT],[he.OL,S.OL],[he.OPTGROUP,S.OPTGROUP],[he.OPTION,S.OPTION],[he.P,S.P],[he.PARAM,S.PARAM],[he.PLAINTEXT,S.PLAINTEXT],[he.PRE,S.PRE],[he.RB,S.RB],[he.RP,S.RP],[he.RT,S.RT],[he.RTC,S.RTC],[he.RUBY,S.RUBY],[he.S,S.S],[he.SCRIPT,S.SCRIPT],[he.SEARCH,S.SEARCH],[he.SECTION,S.SECTION],[he.SELECT,S.SELECT],[he.SOURCE,S.SOURCE],[he.SMALL,S.SMALL],[he.SPAN,S.SPAN],[he.STRIKE,S.STRIKE],[he.STRONG,S.STRONG],[he.STYLE,S.STYLE],[he.SUB,S.SUB],[he.SUMMARY,S.SUMMARY],[he.SUP,S.SUP],[he.TABLE,S.TABLE],[he.TBODY,S.TBODY],[he.TEMPLATE,S.TEMPLATE],[he.TEXTAREA,S.TEXTAREA],[he.TFOOT,S.TFOOT],[he.TD,S.TD],[he.TH,S.TH],[he.THEAD,S.THEAD],[he.TITLE,S.TITLE],[he.TR,S.TR],[he.TRACK,S.TRACK],[he.TT,S.TT],[he.U,S.U],[he.UL,S.UL],[he.SVG,S.SVG],[he.VAR,S.VAR],[he.WBR,S.WBR],[he.XMP,S.XMP]]);function ih(e){var t;return(t=Uxe.get(e))!==null&&t!==void 0?t:S.UNKNOWN}const je=S,Fxe={[Ie.HTML]:new Set([je.ADDRESS,je.APPLET,je.AREA,je.ARTICLE,je.ASIDE,je.BASE,je.BASEFONT,je.BGSOUND,je.BLOCKQUOTE,je.BODY,je.BR,je.BUTTON,je.CAPTION,je.CENTER,je.COL,je.COLGROUP,je.DD,je.DETAILS,je.DIR,je.DIV,je.DL,je.DT,je.EMBED,je.FIELDSET,je.FIGCAPTION,je.FIGURE,je.FOOTER,je.FORM,je.FRAME,je.FRAMESET,je.H1,je.H2,je.H3,je.H4,je.H5,je.H6,je.HEAD,je.HEADER,je.HGROUP,je.HR,je.HTML,je.IFRAME,je.IMG,je.INPUT,je.LI,je.LINK,je.LISTING,je.MAIN,je.MARQUEE,je.MENU,je.META,je.NAV,je.NOEMBED,je.NOFRAMES,je.NOSCRIPT,je.OBJECT,je.OL,je.P,je.PARAM,je.PLAINTEXT,je.PRE,je.SCRIPT,je.SECTION,je.SELECT,je.SOURCE,je.STYLE,je.SUMMARY,je.TABLE,je.TBODY,je.TD,je.TEMPLATE,je.TEXTAREA,je.TFOOT,je.TH,je.THEAD,je.TITLE,je.TR,je.TRACK,je.UL,je.WBR,je.XMP]),[Ie.MATHML]:new Set([je.MI,je.MO,je.MN,je.MS,je.MTEXT,je.ANNOTATION_XML]),[Ie.SVG]:new Set([je.TITLE,je.FOREIGN_OBJECT,je.DESC]),[Ie.XLINK]:new Set,[Ie.XML]:new Set,[Ie.XMLNS]:new Set},WS=new Set([je.H1,je.H2,je.H3,je.H4,je.H5,je.H6]);he.STYLE,he.SCRIPT,he.XMP,he.IFRAME,he.NOEMBED,he.NOFRAMES,he.PLAINTEXT;var X;(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"})(X||(X={}));const Di={DATA:X.DATA,RCDATA:X.RCDATA,RAWTEXT:X.RAWTEXT,SCRIPT_DATA:X.SCRIPT_DATA,PLAINTEXT:X.PLAINTEXT,CDATA_SECTION:X.CDATA_SECTION};function $xe(e){return e>=V.DIGIT_0&&e<=V.DIGIT_9}function dp(e){return e>=V.LATIN_CAPITAL_A&&e<=V.LATIN_CAPITAL_Z}function Hxe(e){return e>=V.LATIN_SMALL_A&&e<=V.LATIN_SMALL_Z}function xl(e){return Hxe(e)||dp(e)}function uL(e){return xl(e)||$xe(e)}function q0(e){return e+32}function RF(e){return e===V.SPACE||e===V.LINE_FEED||e===V.TABULATION||e===V.FORM_FEED}function dL(e){return RF(e)||e===V.SOLIDUS||e===V.GREATER_THAN_SIGN}function zxe(e){return e===V.NULL?xe.nullCharacterReference:e>1114111?xe.characterReferenceOutsideUnicodeRange:kF(e)?xe.surrogateCharacterReference:CF(e)?xe.noncharacterCharacterReference:AF(e)||e===V.CARRIAGE_RETURN?xe.controlCharacterReference:null}class Vxe{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=X.DATA,this.returnState=X.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Cxe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Pxe(Ixe,(i,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(i)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(xe.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:i=>{this._err(xe.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+i)},validateNumericCharacterReference:i=>{const s=zxe(i);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var i,s;(s=(i=this.handler).onParseError)===null||s===void 0||s.call(i,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,i){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||i==null||i()}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(xe.endTagWithAttributes),t.selfClosing&&this._err(xe.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=RF(t)?Ft.WHITESPACE_CHARACTER:t===V.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=X.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ko.Attribute:ko.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===X.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case X.DATA:{this._stateData(t);break}case X.RCDATA:{this._stateRcdata(t);break}case X.RAWTEXT:{this._stateRawtext(t);break}case X.SCRIPT_DATA:{this._stateScriptData(t);break}case X.PLAINTEXT:{this._statePlaintext(t);break}case X.TAG_OPEN:{this._stateTagOpen(t);break}case X.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case X.TAG_NAME:{this._stateTagName(t);break}case X.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case X.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case X.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case X.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case X.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case X.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case X.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case X.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case X.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case X.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case X.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case X.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case X.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case X.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case X.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case X.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case X.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case X.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case X.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case X.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case X.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case X.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case X.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case X.BOGUS_COMMENT:{this._stateBogusComment(t);break}case X.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case X.COMMENT_START:{this._stateCommentStart(t);break}case X.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case X.COMMENT:{this._stateComment(t);break}case X.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case X.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case X.COMMENT_END:{this._stateCommentEnd(t);break}case X.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case X.DOCTYPE:{this._stateDoctype(t);break}case X.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case X.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case X.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case X.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case X.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case X.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case X.CDATA_SECTION:{this._stateCdataSection(t);break}case X.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case X.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case X.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case X.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.TAG_OPEN;break}case V.AMPERSAND:{this._startCharacterReference();break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitCodePoint(t);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case V.AMPERSAND:{this._startCharacterReference();break}case V.LESS_THAN_SIGN:{this.state=X.RCDATA_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(oi);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.RAWTEXT_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(oi);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case V.LESS_THAN_SIGN:{this.state=X.SCRIPT_DATA_LESS_THAN_SIGN;break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(oi);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case V.NULL:{this._err(xe.unexpectedNullCharacter),this._emitChars(oi);break}case V.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(xl(t))this._createStartTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case V.EXCLAMATION_MARK:{this.state=X.MARKUP_DECLARATION_OPEN;break}case V.SOLIDUS:{this.state=X.END_TAG_OPEN;break}case V.QUESTION_MARK:{this._err(xe.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=X.BOGUS_COMMENT,this._stateBogusComment(t);break}case V.EOF:{this._err(xe.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(xe.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=X.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(xl(t))this._createEndTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case V.GREATER_THAN_SIGN:{this._err(xe.missingEndTagName),this.state=X.DATA;break}case V.EOF:{this._err(xe.eofBeforeTagName),this._emitChars("");break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(oi);break}case V.EOF:{this._err(xe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===V.SOLIDUS?this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:xl(t)?(this._emitChars("<"),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){xl(t)?(this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case V.NULL:{this._err(xe.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(oi);break}case V.EOF:{this._err(xe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===V.SOLIDUS?(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(nr.SCRIPT,!1)&&dL(this.preprocessor.peek(nr.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 i=this._indexOf(t);this.items[i]=n,i===this.stackTop&&(this.current=n)}insertAfter(t,n,i){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,i),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===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])!==Ie.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;i--)if(t.has(this.tagIDs[i])&&this.treeAdapter.getNamespaceURI(this.items[i])===n)return i;return-1}clearBackTo(t,n){const i=this._indexOfTagNames(t,n);this.shortenToLength(i+1)}clearBackToTableContext(){this.clearBackTo(Wxe,Ie.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Yxe,Ie.HTML)}clearBackToTableRowContext(){this.clearBackTo(qxe,Ie.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]===S.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]===S.HTML}hasInDynamicScope(t,n){for(let i=this.stackTop;i>=0;i--){const s=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case Ie.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case Ie.SVG:{if(pL.has(s))return!1;break}case Ie.MATHML:{if(hL.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,o1)}hasInListItemScope(t){return this.hasInDynamicScope(t,Gxe)}hasInButtonScope(t){return this.hasInDynamicScope(t,Kxe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Ie.HTML:{if(WS.has(n))return!0;if(o1.has(n))return!1;break}case Ie.SVG:{if(pL.has(n))return!1;break}case Ie.MATHML:{if(hL.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Ie.HTML)switch(this.tagIDs[n]){case t:return!0;case S.TABLE:case S.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Ie.HTML)switch(this.tagIDs[t]){case S.TBODY:case S.THEAD:case S.TFOOT:return!0;case S.TABLE:case S.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Ie.HTML)switch(this.tagIDs[n]){case t:return!0;case S.OPTION:case S.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&jF.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&fL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&fL.has(this.currentTagId);)this.pop()}}const aw=3;var qa;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(qa||(qa={}));const mL={type:qa.Marker};class Zxe{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],s=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;as.get(c.name)===c.value)&&(r+=1,r>=aw&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(mL)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:qa.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:qa.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(mL);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===qa.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===qa.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===qa.Element&&n.element===t)}}const El={createDocument(){return{nodeName:"#document",mode:Hr.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 i=e.childNodes.indexOf(n);e.childNodes.splice(i,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,i){const s=e.childNodes.find(r=>r.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=i;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:i,parentNode:null};El.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(El.isTextNode(n)){n.value+=t;return}}El.appendChild(e,El.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&El.isTextNode(i)?i.value+=t:El.insertBefore(e,El.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function sEe(e){return e.name===OF&&e.publicId===null&&(e.systemId===null||e.systemId===Jxe)}function rEe(e){if(e.name!==OF)return Hr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===eEe)return Hr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),nEe.has(n))return Hr.QUIRKS;let i=t===null?tEe:MF;if(gL(n,i))return Hr.QUIRKS;if(i=t===null?LF:iEe,gL(n,i))return Hr.LIMITED_QUIRKS}return Hr.NO_QUIRKS}const bL={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},aEe="definitionurl",oEe="definitionURL",lEe=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])),cEe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Ie.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Ie.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Ie.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Ie.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Ie.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Ie.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Ie.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Ie.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Ie.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Ie.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Ie.XMLNS}]]),uEe=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])),dEe=new Set([S.B,S.BIG,S.BLOCKQUOTE,S.BODY,S.BR,S.CENTER,S.CODE,S.DD,S.DIV,S.DL,S.DT,S.EM,S.EMBED,S.H1,S.H2,S.H3,S.H4,S.H5,S.H6,S.HEAD,S.HR,S.I,S.IMG,S.LI,S.LISTING,S.MENU,S.META,S.NOBR,S.OL,S.P,S.PRE,S.RUBY,S.S,S.SMALL,S.SPAN,S.STRONG,S.STRIKE,S.SUB,S.SUP,S.TABLE,S.TT,S.U,S.UL,S.VAR]);function fEe(e){const t=e.tagID;return t===S.FONT&&e.attrs.some(({name:i})=>i===Qc.COLOR||i===Qc.SIZE||i===Qc.FACE)||dEe.has(t)}function DF(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var i,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(i=this.treeAdapter).onItemPop)===null||s===void 0||s.call(i,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 i=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Ie.HTML;this.currentNotInHTML=!i,this.tokenizer.inForeignNode=!i&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,Ie.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=Di.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)===he.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Ie.HTML))switch(this.fragmentContextID){case S.TITLE:case S.TEXTAREA:{this.tokenizer.state=Di.RCDATA;break}case S.STYLE:case S.XMP:case S.IFRAME:case S.NOEMBED:case S.NOFRAMES:case S.NOSCRIPT:{this.tokenizer.state=Di.RAWTEXT;break}case S.SCRIPT:{this.tokenizer.state=Di.SCRIPT_DATA;break}case S.PLAINTEXT:{this.tokenizer.state=Di.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",i=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,i,s),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 i=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,i)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const i=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(i??this.document,t)}}_appendElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location)}_insertElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location),this.openElements.push(i,t.tagID)}_insertFakeElement(t,n){const i=this.treeAdapter.createElement(t,Ie.HTML,[]);this._attachElementToTree(i,null),this.openElements.push(i,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,Ie.HTML,t.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,i),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(he.HTML,Ie.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,S.HTML)}_appendCommentNode(t,n){const i=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,i),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_insertCharacters(t){let n,i;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:i}=this._findFosterParentingLocation(),i?this.treeAdapter.insertTextBefore(n,t.chars,i):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),r=i?s.lastIndexOf(i):s.length,a=s[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 i=this.treeAdapter.getFirstChild(t);i;i=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(n,i)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const i=n.location,s=this.treeAdapter.getTagName(t),r=n.type===Ft.END_TAG&&s===n.tagName?{endTag:{...i},endLine:i.endLine,endCol:i.endCol,endOffset:i.endOffset}:{endLine:i.startLine,endCol:i.startCol,endOffset:i.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,i;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,i=this.fragmentContextID):{current:n,currentTagId:i}=this.openElements,t.tagID===S.SVG&&this.treeAdapter.getTagName(n)===he.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===Ie.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===S.MGLYPH||t.tagID===S.MALIGNMARK)&&i!==void 0&&!this._isIntegrationPoint(i,n,Ie.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,i){const s=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return gEe(t,s,r,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===qa.Marker||this.openElements.contains(s.element)),i=n===-1?t-1:n-1;for(let s=i;s>=0;s--){const r=this.activeFormattingElements.entries[s];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(S.P),this.openElements.popUntilTagNamePopped(S.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case S.TR:{this.insertionMode=J.IN_ROW;return}case S.TBODY:case S.THEAD:case S.TFOOT:{this.insertionMode=J.IN_TABLE_BODY;return}case S.CAPTION:{this.insertionMode=J.IN_CAPTION;return}case S.COLGROUP:{this.insertionMode=J.IN_COLUMN_GROUP;return}case S.TABLE:{this.insertionMode=J.IN_TABLE;return}case S.BODY:{this.insertionMode=J.IN_BODY;return}case S.FRAMESET:{this.insertionMode=J.IN_FRAMESET;return}case S.SELECT:{this._resetInsertionModeForSelect(t);return}case S.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case S.HTML:{this.insertionMode=this.headElement?J.AFTER_HEAD:J.BEFORE_HEAD;return}case S.TD:case S.TH:{if(t>0){this.insertionMode=J.IN_CELL;return}break}case S.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 i=this.openElements.tagIDs[n];if(i===S.TEMPLATE)break;if(i===S.TABLE){this.insertionMode=J.IN_SELECT_IN_TABLE;return}}this.insertionMode=J.IN_SELECT}_isElementCausesFosterParenting(t){return BF.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 S.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===Ie.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case S.TABLE:{const i=this.treeAdapter.getParentNode(n);return i?{parent:i,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 i=this.treeAdapter.getNamespaceURI(t);return Fxe[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Xve(this,t);return}switch(this.insertionMode){case J.INITIAL:{Gh(this,t);break}case J.BEFORE_HTML:{Vp(this,t);break}case J.BEFORE_HEAD:{Gp(this,t);break}case J.IN_HEAD:{Kp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{qp(this,t);break}case J.AFTER_HEAD:{Yp(this,t);break}case J.IN_BODY:case J.IN_CAPTION:case J.IN_CELL:case J.IN_TEMPLATE:{FF(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:{ow(this,t);break}case J.IN_TABLE_TEXT:{KF(this,t);break}case J.IN_COLUMN_GROUP:{l1(this,t);break}case J.AFTER_BODY:{c1(this,t);break}case J.AFTER_AFTER_BODY:{Hb(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Wve(this,t);return}switch(this.insertionMode){case J.INITIAL:{Gh(this,t);break}case J.BEFORE_HTML:{Vp(this,t);break}case J.BEFORE_HEAD:{Gp(this,t);break}case J.IN_HEAD:{Kp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{qp(this,t);break}case J.AFTER_HEAD:{Yp(this,t);break}case J.TEXT:{this._insertCharacters(t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{ow(this,t);break}case J.IN_COLUMN_GROUP:{l1(this,t);break}case J.AFTER_BODY:{c1(this,t);break}case J.AFTER_AFTER_BODY:{Hb(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){XS(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:{XS(this,t);break}case J.IN_TABLE_TEXT:{Kh(this,t);break}case J.AFTER_BODY:{kEe(this,t);break}case J.AFTER_AFTER_BODY:case J.AFTER_AFTER_FRAMESET:{AEe(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case J.INITIAL:{CEe(this,t);break}case J.BEFORE_HEAD:case J.IN_HEAD:case J.IN_HEAD_NO_SCRIPT:case J.AFTER_HEAD:{this._err(t,xe.misplacedDoctype);break}case J.IN_TABLE_TEXT:{Kh(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,xe.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Qve(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{Gh(this,t);break}case J.BEFORE_HTML:{IEe(this,t);break}case J.BEFORE_HEAD:{jEe(this,t);break}case J.IN_HEAD:{Ia(this,t);break}case J.IN_HEAD_NO_SCRIPT:{LEe(this,t);break}case J.AFTER_HEAD:{PEe(this,t);break}case J.IN_BODY:{Bs(this,t);break}case J.IN_TABLE:{Rf(this,t);break}case J.IN_TABLE_TEXT:{Kh(this,t);break}case J.IN_CAPTION:{Ove(this,t);break}case J.IN_COLUMN_GROUP:{jA(this,t);break}case J.IN_TABLE_BODY:{Rx(this,t);break}case J.IN_ROW:{jx(this,t);break}case J.IN_CELL:{Dve(this,t);break}case J.IN_SELECT:{WF(this,t);break}case J.IN_SELECT_IN_TABLE:{Bve(this,t);break}case J.IN_TEMPLATE:{Fve(this,t);break}case J.AFTER_BODY:{Hve(this,t);break}case J.IN_FRAMESET:{zve(this,t);break}case J.AFTER_FRAMESET:{Gve(this,t);break}case J.AFTER_AFTER_BODY:{qve(this,t);break}case J.AFTER_AFTER_FRAMESET:{Yve(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Zve(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case J.INITIAL:{Gh(this,t);break}case J.BEFORE_HTML:{REe(this,t);break}case J.BEFORE_HEAD:{OEe(this,t);break}case J.IN_HEAD:{MEe(this,t);break}case J.IN_HEAD_NO_SCRIPT:{DEe(this,t);break}case J.AFTER_HEAD:{BEe(this,t);break}case J.IN_BODY:{Ix(this,t);break}case J.TEXT:{_ve(this,t);break}case J.IN_TABLE:{Bm(this,t);break}case J.IN_TABLE_TEXT:{Kh(this,t);break}case J.IN_CAPTION:{Mve(this,t);break}case J.IN_COLUMN_GROUP:{Lve(this,t);break}case J.IN_TABLE_BODY:{QS(this,t);break}case J.IN_ROW:{YF(this,t);break}case J.IN_CELL:{Pve(this,t);break}case J.IN_SELECT:{XF(this,t);break}case J.IN_SELECT_IN_TABLE:{Uve(this,t);break}case J.IN_TEMPLATE:{$ve(this,t);break}case J.AFTER_BODY:{ZF(this,t);break}case J.IN_FRAMESET:{Vve(this,t);break}case J.AFTER_FRAMESET:{Kve(this,t);break}case J.AFTER_AFTER_BODY:{Hb(this,t);break}}}onEof(t){switch(this.insertionMode){case J.INITIAL:{Gh(this,t);break}case J.BEFORE_HTML:{Vp(this,t);break}case J.BEFORE_HEAD:{Gp(this,t);break}case J.IN_HEAD:{Kp(this,t);break}case J.IN_HEAD_NO_SCRIPT:{qp(this,t);break}case J.AFTER_HEAD:{Yp(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:{VF(this,t);break}case J.TEXT:{Sve(this,t);break}case J.IN_TABLE_TEXT:{Kh(this,t);break}case J.IN_TEMPLATE:{QF(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:{RA(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===V.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:{UF(this,t);break}case J.IN_TABLE:case J.IN_TABLE_BODY:case J.IN_ROW:{ow(this,t);break}case J.IN_TABLE_TEXT:{GF(this,t);break}}}};function vEe(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):zF(e,t),n}function wEe(e,t){let n=null,i=e.openElements.stackTop;for(;i>=0;i--){const s=e.openElements.items[i];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[i])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(i,0)),e.activeFormattingElements.removeEntry(t)),n}function _Ee(e,t,n){let i=t,s=e.openElements.getCommonAncestor(t);for(let r=0,a=s;a!==n;r++,a=s){s=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=xEe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=SEe(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(a,i),i=a)}return i}function SEe(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),i=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,i),t.element=i,i}function NEe(e,t,n){const i=e.treeAdapter.getTagName(t),s=ih(i);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);s===S.TEMPLATE&&r===Ie.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function TEe(e,t,n){const i=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,r=e.treeAdapter.createElement(s.tagName,i,s.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,s.tagID)}function IA(e,t){for(let n=0;n=n;i--)e._setEndLocation(e.openElements.items[i],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const i=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(i);if(s&&!s.endTag&&(e._setEndLocation(i,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function CEe(e,t){e._setDocumentType(t);const n=t.forceQuirks?Hr.QUIRKS:rEe(t);sEe(t)||e._err(t,xe.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=J.BEFORE_HTML}function Gh(e,t){e._err(t,xe.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Hr.QUIRKS),e.insertionMode=J.BEFORE_HTML,e._processToken(t)}function IEe(e,t){t.tagID===S.HTML?(e._insertElement(t,Ie.HTML),e.insertionMode=J.BEFORE_HEAD):Vp(e,t)}function REe(e,t){const n=t.tagID;(n===S.HTML||n===S.HEAD||n===S.BODY||n===S.BR)&&Vp(e,t)}function Vp(e,t){e._insertFakeRootElement(),e.insertionMode=J.BEFORE_HEAD,e._processToken(t)}function jEe(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.HEAD:{e._insertElement(t,Ie.HTML),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD;break}default:Gp(e,t)}}function OEe(e,t){const n=t.tagID;n===S.HEAD||n===S.BODY||n===S.HTML||n===S.BR?Gp(e,t):e._err(t,xe.endTagWithoutMatchingOpenElement)}function Gp(e,t){e._insertFakeElement(he.HEAD,S.HEAD),e.headElement=e.openElements.current,e.insertionMode=J.IN_HEAD,e._processToken(t)}function Ia(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:{e._appendElement(t,Ie.HTML),t.ackSelfClosing=!0;break}case S.TITLE:{e._switchToTextParsing(t,Di.RCDATA);break}case S.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Di.RAWTEXT):(e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_HEAD_NO_SCRIPT);break}case S.NOFRAMES:case S.STYLE:{e._switchToTextParsing(t,Di.RAWTEXT);break}case S.SCRIPT:{e._switchToTextParsing(t,Di.SCRIPT_DATA);break}case S.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=J.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(J.IN_TEMPLATE);break}case S.HEAD:{e._err(t,xe.misplacedStartTagForHeadElement);break}default:Kp(e,t)}}function MEe(e,t){switch(t.tagID){case S.HEAD:{e.openElements.pop(),e.insertionMode=J.AFTER_HEAD;break}case S.BODY:case S.BR:case S.HTML:{Kp(e,t);break}case S.TEMPLATE:{Au(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function Au(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==S.TEMPLATE&&e._err(t,xe.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(S.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,xe.endTagWithoutMatchingOpenElement)}function Kp(e,t){e.openElements.pop(),e.insertionMode=J.AFTER_HEAD,e._processToken(t)}function LEe(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.BASEFONT:case S.BGSOUND:case S.HEAD:case S.LINK:case S.META:case S.NOFRAMES:case S.STYLE:{Ia(e,t);break}case S.NOSCRIPT:{e._err(t,xe.nestedNoscriptInHead);break}default:qp(e,t)}}function DEe(e,t){switch(t.tagID){case S.NOSCRIPT:{e.openElements.pop(),e.insertionMode=J.IN_HEAD;break}case S.BR:{qp(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function qp(e,t){const n=t.type===Ft.EOF?xe.openElementsLeftAfterEof:xe.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=J.IN_HEAD,e._processToken(t)}function PEe(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.BODY:{e._insertElement(t,Ie.HTML),e.framesetOk=!1,e.insertionMode=J.IN_BODY;break}case S.FRAMESET:{e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_FRAMESET;break}case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:case S.NOFRAMES:case S.SCRIPT:case S.STYLE:case S.TEMPLATE:case S.TITLE:{e._err(t,xe.abandonedHeadElementChild),e.openElements.push(e.headElement,S.HEAD),Ia(e,t),e.openElements.remove(e.headElement);break}case S.HEAD:{e._err(t,xe.misplacedStartTagForHeadElement);break}default:Yp(e,t)}}function BEe(e,t){switch(t.tagID){case S.BODY:case S.HTML:case S.BR:{Yp(e,t);break}case S.TEMPLATE:{Au(e,t);break}default:e._err(t,xe.endTagWithoutMatchingOpenElement)}}function Yp(e,t){e._insertFakeElement(he.BODY,S.BODY),e.insertionMode=J.IN_BODY,Cx(e,t)}function Cx(e,t){switch(t.type){case Ft.CHARACTER:{FF(e,t);break}case Ft.WHITESPACE_CHARACTER:{UF(e,t);break}case Ft.COMMENT:{XS(e,t);break}case Ft.START_TAG:{Bs(e,t);break}case Ft.END_TAG:{Ix(e,t);break}case Ft.EOF:{VF(e,t);break}}}function UF(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function FF(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function UEe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function FEe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function $Ee(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_FRAMESET)}function HEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML)}function zEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&WS.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Ie.HTML)}function VEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function GEe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML),n||(e.formElement=e.openElements.current))}function KEe(e,t){e.framesetOk=!1;const n=t.tagID;for(let i=e.openElements.stackTop;i>=0;i--){const s=e.openElements.tagIDs[i];if(n===S.LI&&s===S.LI||(n===S.DD||n===S.DT)&&(s===S.DD||s===S.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==S.ADDRESS&&s!==S.DIV&&s!==S.P&&e._isSpecialElement(e.openElements.items[i],s))break}e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML)}function qEe(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML),e.tokenizer.state=Di.PLAINTEXT}function YEe(e,t){e.openElements.hasInScope(S.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(S.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML),e.framesetOk=!1}function WEe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(he.A);n&&(IA(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function XEe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function QEe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(S.NOBR)&&(IA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Ie.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ZEe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function JEe(e,t){e.treeAdapter.getDocumentMode(e.document)!==Hr.QUIRKS&&e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._insertElement(t,Ie.HTML),e.framesetOk=!1,e.insertionMode=J.IN_TABLE}function $F(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Ie.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function HF(e){const t=IF(e,Qc.TYPE);return t!=null&&t.toLowerCase()===bEe}function eve(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Ie.HTML),HF(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function tve(e,t){e._appendElement(t,Ie.HTML),t.ackSelfClosing=!0}function nve(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._appendElement(t,Ie.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function ive(e,t){t.tagName=he.IMG,t.tagID=S.IMG,$F(e,t)}function sve(e,t){e._insertElement(t,Ie.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Di.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=J.TEXT}function rve(e,t){e.openElements.hasInButtonScope(S.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Di.RAWTEXT)}function ave(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Di.RAWTEXT)}function EL(e,t){e._switchToTextParsing(t,Di.RAWTEXT)}function ove(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.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 lve(e,t){e.openElements.currentTagId===S.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML)}function cve(e,t){e.openElements.hasInScope(S.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Ie.HTML)}function uve(e,t){e.openElements.hasInScope(S.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(S.RTC),e._insertElement(t,Ie.HTML)}function dve(e,t){e._reconstructActiveFormattingElements(),DF(t),CA(t),t.selfClosing?e._appendElement(t,Ie.MATHML):e._insertElement(t,Ie.MATHML),t.ackSelfClosing=!0}function fve(e,t){e._reconstructActiveFormattingElements(),PF(t),CA(t),t.selfClosing?e._appendElement(t,Ie.SVG):e._insertElement(t,Ie.SVG),t.ackSelfClosing=!0}function vL(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Ie.HTML)}function Bs(e,t){switch(t.tagID){case S.I:case S.S:case S.B:case S.U:case S.EM:case S.TT:case S.BIG:case S.CODE:case S.FONT:case S.SMALL:case S.STRIKE:case S.STRONG:{XEe(e,t);break}case S.A:{WEe(e,t);break}case S.H1:case S.H2:case S.H3:case S.H4:case S.H5:case S.H6:{zEe(e,t);break}case S.P:case S.DL:case S.OL:case S.UL:case S.DIV:case S.DIR:case S.NAV:case S.MAIN:case S.MENU:case S.ASIDE:case S.CENTER:case S.FIGURE:case S.FOOTER:case S.HEADER:case S.HGROUP:case S.DIALOG:case S.DETAILS:case S.ADDRESS:case S.ARTICLE:case S.SEARCH:case S.SECTION:case S.SUMMARY:case S.FIELDSET:case S.BLOCKQUOTE:case S.FIGCAPTION:{HEe(e,t);break}case S.LI:case S.DD:case S.DT:{KEe(e,t);break}case S.BR:case S.IMG:case S.WBR:case S.AREA:case S.EMBED:case S.KEYGEN:{$F(e,t);break}case S.HR:{nve(e,t);break}case S.RB:case S.RTC:{cve(e,t);break}case S.RT:case S.RP:{uve(e,t);break}case S.PRE:case S.LISTING:{VEe(e,t);break}case S.XMP:{rve(e,t);break}case S.SVG:{fve(e,t);break}case S.HTML:{UEe(e,t);break}case S.BASE:case S.LINK:case S.META:case S.STYLE:case S.TITLE:case S.SCRIPT:case S.BGSOUND:case S.BASEFONT:case S.TEMPLATE:{Ia(e,t);break}case S.BODY:{FEe(e,t);break}case S.FORM:{GEe(e,t);break}case S.NOBR:{QEe(e,t);break}case S.MATH:{dve(e,t);break}case S.TABLE:{JEe(e,t);break}case S.INPUT:{eve(e,t);break}case S.PARAM:case S.TRACK:case S.SOURCE:{tve(e,t);break}case S.IMAGE:{ive(e,t);break}case S.BUTTON:{YEe(e,t);break}case S.APPLET:case S.OBJECT:case S.MARQUEE:{ZEe(e,t);break}case S.IFRAME:{ave(e,t);break}case S.SELECT:{ove(e,t);break}case S.OPTION:case S.OPTGROUP:{lve(e,t);break}case S.NOEMBED:case S.NOFRAMES:{EL(e,t);break}case S.FRAMESET:{$Ee(e,t);break}case S.TEXTAREA:{sve(e,t);break}case S.NOSCRIPT:{e.options.scriptingEnabled?EL(e,t):vL(e,t);break}case S.PLAINTEXT:{qEe(e,t);break}case S.COL:case S.TH:case S.TD:case S.TR:case S.HEAD:case S.FRAME:case S.TBODY:case S.TFOOT:case S.THEAD:case S.CAPTION:case S.COLGROUP:break;default:vL(e,t)}}function hve(e,t){if(e.openElements.hasInScope(S.BODY)&&(e.insertionMode=J.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function pve(e,t){e.openElements.hasInScope(S.BODY)&&(e.insertionMode=J.AFTER_BODY,ZF(e,t))}function mve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function gve(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(S.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(S.FORM):n&&e.openElements.remove(n))}function bve(e){e.openElements.hasInButtonScope(S.P)||e._insertFakeElement(he.P,S.P),e._closePElement()}function yve(e){e.openElements.hasInListItemScope(S.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(S.LI),e.openElements.popUntilTagNamePopped(S.LI))}function xve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Eve(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function vve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function wve(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(he.BR,S.BR),e.openElements.pop(),e.framesetOk=!1}function zF(e,t){const n=t.tagName,i=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const r=e.openElements.items[s],a=e.openElements.tagIDs[s];if(i===a&&(i!==S.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(r,a))break}}function Ix(e,t){switch(t.tagID){case S.A:case S.B:case S.I:case S.S:case S.U:case S.EM:case S.TT:case S.BIG:case S.CODE:case S.FONT:case S.NOBR:case S.SMALL:case S.STRIKE:case S.STRONG:{IA(e,t);break}case S.P:{bve(e);break}case S.DL:case S.UL:case S.OL:case S.DIR:case S.DIV:case S.NAV:case S.PRE:case S.MAIN:case S.MENU:case S.ASIDE:case S.BUTTON:case S.CENTER:case S.FIGURE:case S.FOOTER:case S.HEADER:case S.HGROUP:case S.DIALOG:case S.ADDRESS:case S.ARTICLE:case S.DETAILS:case S.SEARCH:case S.SECTION:case S.SUMMARY:case S.LISTING:case S.FIELDSET:case S.BLOCKQUOTE:case S.FIGCAPTION:{mve(e,t);break}case S.LI:{yve(e);break}case S.DD:case S.DT:{xve(e,t);break}case S.H1:case S.H2:case S.H3:case S.H4:case S.H5:case S.H6:{Eve(e);break}case S.BR:{wve(e);break}case S.BODY:{hve(e,t);break}case S.HTML:{pve(e,t);break}case S.FORM:{gve(e);break}case S.APPLET:case S.OBJECT:case S.MARQUEE:{vve(e,t);break}case S.TEMPLATE:{Au(e,t);break}default:zF(e,t)}}function VF(e,t){e.tmplInsertionModeStack.length>0?QF(e,t):RA(e,t)}function _ve(e,t){var n;t.tagID===S.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Sve(e,t){e._err(t,xe.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function ow(e,t){if(e.openElements.currentTagId!==void 0&&BF.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:{KF(e,t);break}case Ft.WHITESPACE_CHARACTER:{GF(e,t);break}}else Ng(e,t)}function Nve(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_CAPTION}function Tve(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_COLUMN_GROUP}function kve(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(he.COLGROUP,S.COLGROUP),e.insertionMode=J.IN_COLUMN_GROUP,jA(e,t)}function Ave(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Ie.HTML),e.insertionMode=J.IN_TABLE_BODY}function Cve(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(he.TBODY,S.TBODY),e.insertionMode=J.IN_TABLE_BODY,Rx(e,t)}function Ive(e,t){e.openElements.hasInTableScope(S.TABLE)&&(e.openElements.popUntilTagNamePopped(S.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Rve(e,t){HF(t)?e._appendElement(t,Ie.HTML):Ng(e,t),t.ackSelfClosing=!0}function jve(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Ie.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Rf(e,t){switch(t.tagID){case S.TD:case S.TH:case S.TR:{Cve(e,t);break}case S.STYLE:case S.SCRIPT:case S.TEMPLATE:{Ia(e,t);break}case S.COL:{kve(e,t);break}case S.FORM:{jve(e,t);break}case S.TABLE:{Ive(e,t);break}case S.TBODY:case S.TFOOT:case S.THEAD:{Ave(e,t);break}case S.INPUT:{Rve(e,t);break}case S.CAPTION:{Nve(e,t);break}case S.COLGROUP:{Tve(e,t);break}default:Ng(e,t)}}function Bm(e,t){switch(t.tagID){case S.TABLE:{e.openElements.hasInTableScope(S.TABLE)&&(e.openElements.popUntilTagNamePopped(S.TABLE),e._resetInsertionMode());break}case S.TEMPLATE:{Au(e,t);break}case S.BODY:case S.CAPTION:case S.COL:case S.COLGROUP:case S.HTML:case S.TBODY:case S.TD:case S.TFOOT:case S.TH:case S.THEAD:case S.TR:break;default:Ng(e,t)}}function Ng(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Cx(e,t),e.fosterParentingEnabled=n}function GF(e,t){e.pendingCharacterTokens.push(t)}function KF(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Kh(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===S.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===S.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===S.OPTGROUP&&e.openElements.pop();break}case S.OPTION:{e.openElements.currentTagId===S.OPTION&&e.openElements.pop();break}case S.SELECT:{e.openElements.hasInSelectScope(S.SELECT)&&(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode());break}case S.TEMPLATE:{Au(e,t);break}}}function Bve(e,t){const n=t.tagID;n===S.CAPTION||n===S.TABLE||n===S.TBODY||n===S.TFOOT||n===S.THEAD||n===S.TR||n===S.TD||n===S.TH?(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode(),e._processStartTag(t)):WF(e,t)}function Uve(e,t){const n=t.tagID;n===S.CAPTION||n===S.TABLE||n===S.TBODY||n===S.TFOOT||n===S.THEAD||n===S.TR||n===S.TD||n===S.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(S.SELECT),e._resetInsertionMode(),e.onEndTag(t)):XF(e,t)}function Fve(e,t){switch(t.tagID){case S.BASE:case S.BASEFONT:case S.BGSOUND:case S.LINK:case S.META:case S.NOFRAMES:case S.SCRIPT:case S.STYLE:case S.TEMPLATE:case S.TITLE:{Ia(e,t);break}case S.CAPTION:case S.COLGROUP:case S.TBODY:case S.TFOOT:case S.THEAD:{e.tmplInsertionModeStack[0]=J.IN_TABLE,e.insertionMode=J.IN_TABLE,Rf(e,t);break}case S.COL:{e.tmplInsertionModeStack[0]=J.IN_COLUMN_GROUP,e.insertionMode=J.IN_COLUMN_GROUP,jA(e,t);break}case S.TR:{e.tmplInsertionModeStack[0]=J.IN_TABLE_BODY,e.insertionMode=J.IN_TABLE_BODY,Rx(e,t);break}case S.TD:case S.TH:{e.tmplInsertionModeStack[0]=J.IN_ROW,e.insertionMode=J.IN_ROW,jx(e,t);break}default:e.tmplInsertionModeStack[0]=J.IN_BODY,e.insertionMode=J.IN_BODY,Bs(e,t)}}function $ve(e,t){t.tagID===S.TEMPLATE&&Au(e,t)}function QF(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(S.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):RA(e,t)}function Hve(e,t){t.tagID===S.HTML?Bs(e,t):c1(e,t)}function ZF(e,t){var n;if(t.tagID===S.HTML){if(e.fragmentContext||(e.insertionMode=J.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===S.HTML){e._setEndLocation(e.openElements.items[0],t);const i=e.openElements.items[1];i&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(i))===null||n===void 0)&&n.endTag)&&e._setEndLocation(i,t)}}else c1(e,t)}function c1(e,t){e.insertionMode=J.IN_BODY,Cx(e,t)}function zve(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.FRAMESET:{e._insertElement(t,Ie.HTML);break}case S.FRAME:{e._appendElement(t,Ie.HTML),t.ackSelfClosing=!0;break}case S.NOFRAMES:{Ia(e,t);break}}}function Vve(e,t){t.tagID===S.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==S.FRAMESET&&(e.insertionMode=J.AFTER_FRAMESET))}function Gve(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.NOFRAMES:{Ia(e,t);break}}}function Kve(e,t){t.tagID===S.HTML&&(e.insertionMode=J.AFTER_AFTER_FRAMESET)}function qve(e,t){t.tagID===S.HTML?Bs(e,t):Hb(e,t)}function Hb(e,t){e.insertionMode=J.IN_BODY,Cx(e,t)}function Yve(e,t){switch(t.tagID){case S.HTML:{Bs(e,t);break}case S.NOFRAMES:{Ia(e,t);break}}}function Wve(e,t){t.chars=oi,e._insertCharacters(t)}function Xve(e,t){e._insertCharacters(t),e.framesetOk=!1}function JF(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Ie.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Qve(e,t){if(fEe(t))JF(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===Ie.MATHML?DF(t):i===Ie.SVG&&(hEe(t),PF(t)),CA(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function Zve(e,t){if(t.tagID===S.P||t.tagID===S.BR){JF(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const i=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(i)===Ie.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(i);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}he.AREA,he.BASE,he.BASEFONT,he.BGSOUND,he.BR,he.COL,he.EMBED,he.FRAME,he.HR,he.IMG,he.INPUT,he.KEYGEN,he.LINK,he.META,he.PARAM,he.SOURCE,he.TRACK,he.WBR;const Jve=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,ewe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),wL={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function e$(e,t){const n=uwe(e),i=m7("type",{handlers:{root:twe,element:nwe,text:iwe,comment:n$,doctype:swe,raw:awe},unknown:owe}),s={parser:n?new xL(wL):xL.getFragmentParser(void 0,wL),handle(l){i(l,s)},stitches:!1,options:t||{}};i(e,s),sh(s,ao());const r=n?s.parser.document:s.parser.getFragment(),a=dxe(r,{file:s.options.file});return s.stitches&&_g(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 t$(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Ft.CHARACTER,chars:e.value,location:Tg(e)};sh(t,ao(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function swe(e,t){const n={type:Ft.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Tg(e)};sh(t,ao(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function rwe(e,t){t.stitches=!0;const n=dwe(e);if("children"in e&&"children"in n){const i=e$({type:"root",children:e.children},t.options);n.children=i.children}n$({type:"comment",value:{stitch:n}},t)}function n$(e,t){const n=e.value,i={type:Ft.COMMENT,data:n,location:Tg(e)};sh(t,ao(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function awe(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,i$(t,ao(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Jve,"<$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 owe(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))rwe(n,t);else{let i="";throw ewe.has(n.type)&&(i=". 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"+i)}}function sh(e,t){i$(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=Di.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 i$(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 lwe(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Di.PLAINTEXT)return;sh(t,ao(e));const i=t.parser.openElements.current;let s="namespaceURI"in i?i.namespaceURI:Dc.html;s===Dc.html&&n==="svg"&&(s=Dc.svg);const r=gxe({...e,children:[]},{space:s===Dc.svg?"svg":"html"}),a={type:Ft.START_TAG,tagName:n,tagID:ih(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:Tg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function cwe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Sxe.includes(n)||t.parser.tokenizer.state===Di.PLAINTEXT)return;sh(t,_x(e));const i={type:Ft.END_TAG,tagName:n,tagID:ih(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Tg(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Di.RCDATA||t.parser.tokenizer.state===Di.RAWTEXT||t.parser.tokenizer.state===Di.SCRIPT_DATA)&&(t.parser.tokenizer.state=Di.DATA)}function uwe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Tg(e){const t=ao(e)||{line:void 0,column:void 0,offset:void 0},n=_x(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 dwe(e){return"children"in e?Cf({...e,children:[]}):Cf(e)}function fwe(e){return function(t,n){return e$(t,{...e,file:n})}}const s$=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function r$(e){if(!e)return!1;try{const t=e.toLowerCase();return s$.some(n=>t.includes(n))}catch{return!1}}function hwe(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(r$(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return s$.some(r=>s.includes(r))}return!1}function pwe({text:e,className:t,allowRawHtml:n=!0}){const[i,s]=b.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 g=d(m);if(g)return g}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(bge,{remarkPlugins:[Ibe],rehypePlugins:n?[fwe,rL]:[rL],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(r$(d)||hwe(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:()=>s({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(Kc,{})})]}),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(UP,{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(Kc,{})})]})}):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:()=>s({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(Kc,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),i&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(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:i.title||a(i.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:i.src,download:i.title||a(i.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(W1,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(As,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const rh=b.memo(pwe),_L=6,SL=7,mwe={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function ZS(e){return mwe[(e||"").trim().toLowerCase()]||"未知"}function NL(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 gwe(e){if(!e)return"";const t=e.trim(),n=Number(t),i=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(i.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(i)}function bwe(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 swe({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 rwe(){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 yL({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 KS(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function xL({page:e,total:t,pageSize:n,onPage:i}){const s=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:()=>i(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(yL,{direction:"left"})}),o.jsxs("span",{children:[e," / ",s]}),o.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":"下一页",children:o.jsx(yL,{direction:"right"})})]})]})}function Pb({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function awe({skill:e,space:t,region:n,detail:i,loading:s,error:r,onClose:a}){return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:l=>l.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(swe,{})}),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:a,"aria-label":"关闭技能详情",children:o.jsx(rwe,{})})]}),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:GS(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:n==="cn-beijing"?"北京":"上海"})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(KS,{}),"正在读取技能内容…"]}):r?o.jsx("div",{className:"skillcenter-error",children:r}):i!=null&&i.skillMd?o.jsx(nh,{text:iwe(i.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(Pb,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function owe(){const[e,t]=b.useState("cn-beijing"),[n,i]=b.useState([]),[s,r]=b.useState(1),[a,l]=b.useState(0),[c,u]=b.useState(!1),[d,f]=b.useState(""),[h,p]=b.useState(null),[m,g]=b.useState([]),[v,y]=b.useState(1),[x,E]=b.useState(0),[w,N]=b.useState(!1),[_,T]=b.useState(""),[k,C]=b.useState(null),[I,O]=b.useState(null),[M,G]=b.useState(!1),[D,F]=b.useState(""),A=b.useRef(0);b.useEffect(()=>{let Y=!0;return u(!0),f(""),hde({region:e,page:s,pageSize:mL}).then(Z=>{if(!Y)return;const B=Z.items||[];i(B),l(Z.totalCount||0),p(te=>B.find(z=>z.id===(te==null?void 0:te.id))||null)}).catch(Z=>{Y&&(i([]),l(0),p(null),f(Z instanceof Error?Z.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{Y&&u(!1)}),()=>{Y=!1}},[e,s]),b.useEffect(()=>{if(!h){g([]),E(0);return}let Y=!0;return N(!0),T(""),pde(h.id,{region:e,page:v,pageSize:gL,project:h.projectName}).then(Z=>{Y&&(g(Z.items||[]),E(Z.totalCount||0))}).catch(Z=>{Y&&(g([]),E(0),T(Z instanceof Error?Z.message:"读取技能失败,请稍后重试"))}).finally(()=>{Y&&N(!1)}),()=>{Y=!1}},[e,h,v]);const j=Y=>{Y!==e&&($(),t(Y),r(1),y(1),p(null),g([]))},P=Y=>{$(),p(Y),y(1)},$=()=>{A.current+=1,C(null),O(null),F(""),G(!1)},R=async Y=>{if(!h)return;const Z=A.current+1;A.current=Z,C(Y),O(null),F(""),G(!0);try{const B=await mde(h.id,Y.skillId,Y.version,e,h.projectName);A.current===Z&&O(B)}catch(B){A.current===Z&&F(B instanceof Error?B.message:"读取技能详情失败,请稍后重试")}finally{A.current===Z&&G(!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:a})]}),o.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[o.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>j("cn-beijing"),children:"北京"}),o.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>j("cn-shanghai"),children:"上海"})]})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[c&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(KS,{}),"正在读取技能空间…"]}),d?o.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?o.jsx(Pb,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:n.map(Y=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===Y.id?"active":""}`,onClick:()=>P(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.name,children:Y.name}),o.jsx("span",{className:"skillcenter-item-description",children:Y.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${bL(Y.status)}`,children:GS(Y.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:Y.projectName||"default",children:["Project · ",Y.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[Y.skillCount??0," 个技能"]}),Y.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",nwe(Y.updatedAt)]})]})]})},`${Y.projectName||"default"}:${Y.id}`))})]}),o.jsx(xL,{page:s,total:a,pageSize:mL,onPage:r})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),o.jsx("span",{children:x})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[w&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(KS,{}),"正在读取技能…"]}),_?o.jsx("div",{className:"skillcenter-error",children:_}):m.length===0&&!w?o.jsx(Pb,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(Y=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void R(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.skillName,children:Y.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:Y.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${bL(Y.skillStatus)}`,children:GS(Y.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",Y.version||"—"]})]})]})},`${Y.skillId}:${Y.version}`))})]}),o.jsx(xL,{page:v,total:x,pageSize:gL,onPage:y})]}):o.jsx(Pb,{children:"点击 Skill 空间以查看详情"})})]}),k&&h&&o.jsx(awe,{skill:k,space:h,region:e,detail:I,loading:M,error:D,onClose:$})]})}const XF="veadk_agentkit_connections",lwe=["cn-beijing","cn-shanghai"];function cwe(e){const t=e||"cn-beijing";return[t,...lwe.filter(n=>n!==t)]}function ma(){try{const e=localStorage.getItem(XF);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function Tx(e){try{localStorage.setItem(XF,JSON.stringify(e))}catch{}}function qo(e,t){return`agentkit:${e}:${t}`}function QF(e){try{return new URL(e).host}catch{return e}}function ih(e){qP();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)KP(qo(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function ZF(e,t,n,i,s,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:s,currentVersion:r},l=ma(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,Tx(l),ih(l),a}async function Bb(e,t,n,i){let s=null,r=n||"cn-beijing",a=null;for(const u of cwe(n))try{const d=await _k(e,u,{retryProbe:!0});if(d&&d.length>0){s=d,r=u;break}}catch(d){if(d instanceof Kf)throw s1(e),d;if(d instanceof Er&&d.unsupported){a=d;continue}throw d}if(!s||s.length===0)throw s1(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(s.map(u=>[u,t])),c=ZF(e,t,r,s,l,i);return qo(c.id,s[0])}async function JF(e,t,n,i){const s=t.trim().replace(/\/+$/,""),r=await q1(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||QF(s),base:s,apiKey:n.trim(),apps:r,appLabels:i&&r.length>0?{[r[0]]:i}:void 0},l=[...ma().filter(c=>c.base!==s),a];return Tx(l),ih(l),a}function uwe(e){const t=ma().filter(n=>n.id!==e);return Tx(t),ih(t),t}function s1(e){const t=ma().filter(n=>n.runtimeId!==e);return Tx(t),ih(t),t}function e$(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),i=t.flatMap(s=>s.apps.map(r=>{var l;const a=((l=s.appLabels)==null?void 0:l[r])??r;return{id:qo(s.id,r),label:a,app:r,remote:!0,host:s.runtimeId?s.name:QF(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...i]}const EL=Object.freeze(Object.defineProperty({__proto__:null,addConnection:JF,addRuntimeConnection:ZF,buildAgentEntries:e$,connectRuntime:Bb,loadConnections:ma,registerConnections:ih,remoteAppId:qo,removeConnection:uwe,removeRuntimeConnection:s1},Symbol.toStringTag,{value:"Module"}));function dwe({onAdded:e,onCancel:t}){const[n,i]=b.useState(""),[s,r]=b.useState(""),[a,l]=b.useState(""),[c,u]=b.useState(!1),[d,f]=b.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await JF(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(qo(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=>i(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:s,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(mn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function fwe(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 hwe(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 NA({title:e,description:t,confirmLabel:n,cancelLabel:i="取消",closeLabel:s="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=b.useId(),d=b.useId(),f=b.useRef(null),h=b.useRef(a),p=b.useRef(l);return b.useEffect(()=>{h.current=a,p.current=l},[a,l]),b.useEffect(()=>{var y;const m=document.body.style.overflow,g=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),g!=null&&g.isConnected&&g.focus()}},[]),Ss.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(fwe,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":s,children:o.jsx(hwe,{})})]}),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:i}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const pwe=[{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"}],mwe=[{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"}]}],Ku=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],zh=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function tw(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function gwe(e,t){const n=e.trim();if(!n||!t)return n;try{const i=new URL(n),s=i.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(s))return n;const r=new URL(t);return i.protocol=r.protocol,i.hostname=r.hostname,i.port=r.port,i.toString()}catch{return n}}function vL(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function qS(e){return JSON.stringify(e)}function t$(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function ywe({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 xwe(){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 TL({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 JS(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function kL({page:e,total:t,pageSize:n,onPage:i}){const s=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:()=>i(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(TL,{direction:"left"})}),o.jsxs("span",{children:[e," / ",s]}),o.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":"下一页",children:o.jsx(TL,{direction:"right"})})]})]})}function zb({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function Ewe({skill:e,space:t,region:n,detail:i,loading:s,error:r,onClose:a}){return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:l=>l.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(ywe,{})}),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:a,"aria-label":"关闭技能详情",children:o.jsx(xwe,{})})]}),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:ZS(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:n==="cn-beijing"?"北京":"上海"})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(JS,{}),"正在读取技能内容…"]}):r?o.jsx("div",{className:"skillcenter-error",children:r}):i!=null&&i.skillMd?o.jsx(rh,{text:bwe(i.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(zb,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function vwe(){const[e,t]=b.useState("cn-beijing"),[n,i]=b.useState([]),[s,r]=b.useState(1),[a,l]=b.useState(0),[c,u]=b.useState(!1),[d,f]=b.useState(""),[h,p]=b.useState(null),[m,g]=b.useState([]),[v,y]=b.useState(1),[x,E]=b.useState(0),[w,N]=b.useState(!1),[_,T]=b.useState(""),[k,C]=b.useState(null),[I,O]=b.useState(null),[L,G]=b.useState(!1),[D,F]=b.useState(""),A=b.useRef(0);b.useEffect(()=>{let Y=!0;return u(!0),f(""),kde({region:e,page:s,pageSize:_L}).then(Z=>{if(!Y)return;const B=Z.items||[];i(B),l(Z.totalCount||0),p(te=>B.find(K=>K.id===(te==null?void 0:te.id))||null)}).catch(Z=>{Y&&(i([]),l(0),p(null),f(Z instanceof Error?Z.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{Y&&u(!1)}),()=>{Y=!1}},[e,s]),b.useEffect(()=>{if(!h){g([]),E(0);return}let Y=!0;return N(!0),T(""),Ade(h.id,{region:e,page:v,pageSize:SL,project:h.projectName}).then(Z=>{Y&&(g(Z.items||[]),E(Z.totalCount||0))}).catch(Z=>{Y&&(g([]),E(0),T(Z instanceof Error?Z.message:"读取技能失败,请稍后重试"))}).finally(()=>{Y&&N(!1)}),()=>{Y=!1}},[e,h,v]);const j=Y=>{Y!==e&&($(),t(Y),r(1),y(1),p(null),g([]))},P=Y=>{$(),p(Y),y(1)},$=()=>{A.current+=1,C(null),O(null),F(""),G(!1)},R=async Y=>{if(!h)return;const Z=A.current+1;A.current=Z,C(Y),O(null),F(""),G(!0);try{const B=await Cde(h.id,Y.skillId,Y.version,e,h.projectName);A.current===Z&&O(B)}catch(B){A.current===Z&&F(B instanceof Error?B.message:"读取技能详情失败,请稍后重试")}finally{A.current===Z&&G(!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:a})]}),o.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[o.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>j("cn-beijing"),children:"北京"}),o.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>j("cn-shanghai"),children:"上海"})]})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[c&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(JS,{}),"正在读取技能空间…"]}),d?o.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?o.jsx(zb,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:n.map(Y=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===Y.id?"active":""}`,onClick:()=>P(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.name,children:Y.name}),o.jsx("span",{className:"skillcenter-item-description",children:Y.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${NL(Y.status)}`,children:ZS(Y.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:Y.projectName||"default",children:["Project · ",Y.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[Y.skillCount??0," 个技能"]}),Y.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",gwe(Y.updatedAt)]})]})]})},`${Y.projectName||"default"}:${Y.id}`))})]}),o.jsx(kL,{page:s,total:a,pageSize:_L,onPage:r})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),o.jsx("span",{children:x})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[w&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(JS,{}),"正在读取技能…"]}),_?o.jsx("div",{className:"skillcenter-error",children:_}):m.length===0&&!w?o.jsx(zb,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(Y=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void R(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.skillName,children:Y.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:Y.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${NL(Y.skillStatus)}`,children:ZS(Y.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",Y.version||"—"]})]})]})},`${Y.skillId}:${Y.version}`))})]}),o.jsx(kL,{page:v,total:x,pageSize:SL,onPage:y})]}):o.jsx(zb,{children:"点击 Skill 空间以查看详情"})})]}),k&&h&&o.jsx(Ewe,{skill:k,space:h,region:e,detail:I,loading:L,error:D,onClose:$})]})}const a$="veadk_agentkit_connections",wwe=["cn-beijing","cn-shanghai"];function _we(e){const t=e||"cn-beijing";return[t,...wwe.filter(n=>n!==t)]}function ga(){try{const e=localStorage.getItem(a$);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function Ox(e){try{localStorage.setItem(a$,JSON.stringify(e))}catch{}}function Wo(e,t){return`agentkit:${e}:${t}`}function o$(e){try{return new URL(e).host}catch{return e}}function ah(e){iB();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)nB(Wo(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function l$(e,t,n,i,s,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:s,currentVersion:r},l=ga(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,Ox(l),ah(l),a}async function Vb(e,t,n,i){let s=null,r=n||"cn-beijing",a=null;for(const u of _we(n))try{const d=await Rk(e,u,{retryProbe:!0});if(d&&d.length>0){s=d,r=u;break}}catch(d){if(d instanceof Wf)throw u1(e),d;if(d instanceof wr&&d.unsupported){a=d;continue}throw d}if(!s||s.length===0)throw u1(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(s.map(u=>[u,t])),c=l$(e,t,r,s,l,i);return Wo(c.id,s[0])}async function c$(e,t,n,i){const s=t.trim().replace(/\/+$/,""),r=await ex(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||o$(s),base:s,apiKey:n.trim(),apps:r,appLabels:i&&r.length>0?{[r[0]]:i}:void 0},l=[...ga().filter(c=>c.base!==s),a];return Ox(l),ah(l),a}function Swe(e){const t=ga().filter(n=>n.id!==e);return Ox(t),ah(t),t}function u1(e){const t=ga().filter(n=>n.runtimeId!==e);return Ox(t),ah(t),t}function u$(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),i=t.flatMap(s=>s.apps.map(r=>{var l;const a=((l=s.appLabels)==null?void 0:l[r])??r;return{id:Wo(s.id,r),label:a,app:r,remote:!0,host:s.runtimeId?s.name:o$(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...i]}const AL=Object.freeze(Object.defineProperty({__proto__:null,addConnection:c$,addRuntimeConnection:l$,buildAgentEntries:u$,connectRuntime:Vb,loadConnections:ga,registerConnections:ah,remoteAppId:Wo,removeConnection:Swe,removeRuntimeConnection:u1},Symbol.toStringTag,{value:"Module"}));function Nwe({onAdded:e,onCancel:t}){const[n,i]=b.useState(""),[s,r]=b.useState(""),[a,l]=b.useState(""),[c,u]=b.useState(!1),[d,f]=b.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await c$(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Wo(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=>i(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:s,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(mn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function Twe(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 kwe(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 OA({title:e,description:t,confirmLabel:n,cancelLabel:i="取消",closeLabel:s="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=b.useId(),d=b.useId(),f=b.useRef(null),h=b.useRef(a),p=b.useRef(l);return b.useEffect(()=>{h.current=a,p.current=l},[a,l]),b.useEffect(()=>{var y;const m=document.body.style.overflow,g=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),g!=null&&g.isConnected&&g.focus()}},[]),ks.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(Twe,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":s,children:o.jsx(kwe,{})})]}),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:i}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const Awe=[{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"}],Cwe=[{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"}]}],Yu=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],qh=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function lw(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Iwe(e,t){const n=e.trim();if(!n||!t)return n;try{const i=new URL(n),s=i.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(s))return n;const r=new URL(t);return i.protocol=r.protocol,i.hostname=r.hostname,i.port=r.port,i.toString()}catch{return n}}function CL(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function eN(e){return JSON.stringify(e)}function d$(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 bwe(e,t,n){const i=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function Rwe(e,t,n){const i=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests -BASE_URL = ${qS(i)} -APP_NAME = ${qS(t)} +BASE_URL = ${eN(i)} +APP_NAME = ${eN(t)} USER_ID = "demo-user" SESSION_ID = str(uuid.uuid4()) -${t$(n)} +${d$(n)} session_response = requests.post( f"{BASE_URL}/apps/{APP_NAME}/users/{USER_ID}/sessions/{SESSION_ID}", @@ -620,13 +620,13 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function ywe(e,t){return`\`\`\`python +\`\`\``}function jwe(e,t){return`\`\`\`python import uuid import requests -AGENT_URL = ${qS(e)} -${t$(t)} +AGENT_URL = ${eN(e)} +${d$(t)} response = requests.post( AGENT_URL, @@ -647,11 +647,11 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function xwe({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 wL({available:e,authType:t,value:n,visible:i,loading:s,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:i&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":i?"隐藏 API Key":"显示 API Key",title:i?"隐藏 API Key":"显示 API Key",disabled:s,onClick:a,children:s?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(xwe,{visible:i})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function _L({protocol:e,title:t,available:n,fields:i,example:s}){return o.jsxs("section",{className:`aw-integration-panel${n&&s?" 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:i.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&s&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(nh,{text:s,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function n$(e){const t=e.tools??[],n=wu.filter(s=>s.toolNames.some(r=>t.includes(r))),i=new Set(n.flatMap(s=>s.toolNames));return{...Es(),name:e.name,description:e.description,instruction:e.instruction||Es().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!i.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(n$)}}function Ewe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?n$(e.graph):{...Es(),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(i=>i.name))??[]}}function i$(e){return e?1+e.children.reduce((t,n)=>t+i$(n),0):1}function s$(e){return 1+e.subAgents.reduce((t,n)=>t+s$(n),0)}function YS(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 vwe(e){const t=YS(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function wwe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function _we(e){return e==="high"?"高":e==="medium"?"中":"低"}const Swe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function Nwe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":Swe[e.module]}function Twe(e,t){return e.find(n=>n.kind===t)}function SL(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>YS(n.createdAt)-YS(t.createdAt))}function kwe(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(i=>i.name),(n.mcpTools??[]).map(i=>i.name),n.skills??[],(n.selectedSkills??[]).map(i=>i.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const lp=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],Awe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function Cwe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const Iwe=lp.findIndex(e=>e.phase==="build");function r$(e){const t=e.instanceRange?[...lp.slice(0,-1),Cwe(e.instanceRange),lp[lp.length-1]]:lp;return e.createEvaluationSets?[...t.slice(0,-1),Awe,t[t.length-1]]:t}function a$(e){const t=r$(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],i=t.findIndex(s=>s.phase===n);return i<0?0:i}function Rwe(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 jwe({task:e}){const t=e.buildLog,n=b.useRef(null),i=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&a$(e)===Iwe,[s,r]=b.useState(i),[a,l]=b.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 Owe({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 IL({available:e,authType:t,value:n,visible:i,loading:s,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:i&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":i?"隐藏 API Key":"显示 API Key",title:i?"隐藏 API Key":"显示 API Key",disabled:s,onClick:a,children:s?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(Owe,{visible:i})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function RL({protocol:e,title:t,available:n,fields:i,example:s}){return o.jsxs("section",{className:`aw-integration-panel${n&&s?" 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:i.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&s&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(rh,{text:s,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function f$(e){const t=e.tools??[],n=Su.filter(s=>s.toolNames.some(r=>t.includes(r))),i=new Set(n.flatMap(s=>s.toolNames));return{..._s(),name:e.name,description:e.description,instruction:e.instruction||_s().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!i.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(f$)}}function Mwe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?f$(e.graph):{..._s(),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(i=>i.name))??[]}}function h$(e){return e?1+e.children.reduce((t,n)=>t+h$(n),0):1}function p$(e){return 1+e.subAgents.reduce((t,n)=>t+p$(n),0)}function tN(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 Lwe(e){const t=tN(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function Dwe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function Pwe(e){return e==="high"?"高":e==="medium"?"中":"低"}const Bwe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function Uwe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":Bwe[e.module]}function Fwe(e,t){return e.find(n=>n.kind===t)}function jL(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>tN(n.createdAt)-tN(t.createdAt))}function $we(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(i=>i.name),(n.mcpTools??[]).map(i=>i.name),n.skills??[],(n.selectedSkills??[]).map(i=>i.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const fp=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],Hwe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function zwe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const Vwe=fp.findIndex(e=>e.phase==="build");function m$(e){const t=e.instanceRange?[...fp.slice(0,-1),zwe(e.instanceRange),fp[fp.length-1]]:fp;return e.createEvaluationSets?[...t.slice(0,-1),Hwe,t[t.length-1]]:t}function g$(e){const t=m$(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],i=t.findIndex(s=>s.phase===n);return i<0?0:i}function Gwe(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 Kwe({task:e}){const t=e.buildLog,n=b.useRef(null),i=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&g$(e)===Vwe,[s,r]=b.useState(i),[a,l]=b.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=s?u:d.slice(-36).join(` -`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(b.useEffect(()=>{t&&r(i)},[e.id,t==null?void 0:t.status,i]),b.useEffect(()=>{if(!s||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[s,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=Rwe(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",g=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",g,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}${s?"":" 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:s?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(ka,{"aria-hidden":!0}):o.jsx($1,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),s&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function Owe({task:e}){const t=r$(e),n=a$(e),i=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),s=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(mn,{className:"spin"}):e.status==="success"?o.jsx(aJ,{}):e.status==="error"?o.jsx(ak,{}):o.jsx(YR,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:s}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(i)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i),children:o.jsx("span",{style:{width:`${i}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[jn,ot]=b.useState(()=>new Set),[mt,rn]=b.useState(!1),[fn,At]=b.useState(""),[Wt,Ti]=b.useState(null),[bi,On]=b.useState([]),[$n,hn]=b.useState([]),[vn,Hn]=b.useState(!1),[Bi,Xi]=b.useState(""),[ki,Ui]=b.useState(0),[gn,Ai]=b.useState([]),[zn,Jn]=b.useState(!1),[Ci,yi]=b.useState(""),[pn,An]=b.useState(0),[Mn,Ln]=b.useState(!1),[ce,Se]=b.useState(()=>new Set),[Le,Ee]=b.useState(!1),[rt,it]=b.useState(""),[jt,Pt]=b.useState(""),[oi,Dn]=b.useState(()=>new Set),ps=b.useRef(!1),xi=b.useRef(""),wt=b.useRef(null),Tt=b.useRef(0),Ii=b.useRef(0),[Vn,Ds]=b.useState(mwe),[ta,oo]=b.useState("");b.useEffect(()=>{e.length!==0&&Ds(H=>H.map((ne,he)=>he===0&&ne.agentIds.length===0?{...ne,agentIds:e.slice(0,2).map(Ce=>Ce.id)}:ne))},[e]);const is=b.useMemo(()=>{const H=new Map;for(const ne of e)ne.runtimeId&&H.set(ne.runtimeId,ne);return H},[e]),Ps=b.useMemo(()=>{var ne;const H=new Map;for(const he of t){const Ce=(ne=he.deploymentTarget)==null?void 0:ne.runtimeId;if(!Ce||!is.has(Ce))continue;const et=H.get(Ce);(!et||he.updatedAt>et.updatedAt)&&H.set(Ce,he)}return H},[is,t]),Rr=b.useMemo(()=>{const H=new Map;for(const ne of d){if(!ne.runtimeId)continue;const he=H.get(ne.runtimeId);(!he||ne.startedAt>he.startedAt)&&H.set(ne.runtimeId,ne)}return H},[d]),Jo=b.useMemo(()=>{const H=Ue.trim().toLowerCase();return H?e.filter(ne=>{const he=ne.runtimeId?Ps.get(ne.runtimeId):void 0,Ce=ne.runtimeId?Rr.get(ne.runtimeId):void 0;return[ne.label,ne.app,ne.host??"",(he==null?void 0:he.draft.name)??"",(he==null?void 0:he.draft.description)??"",(Ce==null?void 0:Ce.runtimeName)??""].join(" ").toLowerCase().includes(H)}):e},[e,Rr,Ue,Ps]),Ve=b.useMemo(()=>{const H=Ue.trim().toLowerCase();return t.filter(ne=>{var Ce;const he=(Ce=ne.deploymentTarget)==null?void 0:Ce.runtimeId;return he&&is.has(he)?!1:H?`${ne.draft.name} ${ne.draft.description}`.toLowerCase().includes(H):!0})},[is,t,Ue]),lo=b.useMemo(()=>t.filter(H=>{var he;const ne=(he=H.deploymentTarget)==null?void 0:he.runtimeId;return!ne||!is.has(ne)}).length,[is,t]),uc=b.useMemo(()=>{const H=Ue.trim().toLowerCase();return H?Vn.filter(ne=>ne.name.toLowerCase().includes(H)):Vn},[Vn,Ue]),re=e.find(H=>H.id===A),gt=t.find(H=>H.id===P),cn=f?d.find(H=>H.id===f):void 0,li=re!=null&&re.runtimeId?Ps.get(re.runtimeId):void 0,Jt=v?Q:A&&s===A?i:null,Ei=(Jt==null?void 0:Jt.appName)||(re==null?void 0:re.runtimeApp)||(re==null?void 0:re.app)||"",se=`${(re==null?void 0:re.region)??"cn-beijing"}:${(re==null?void 0:re.runtimeId)??""}`,ke=(fe==null?void 0:fe.requestKey)===se?fe.value:"",$e=(Z==null?void 0:Z.requestKey)===se?Z:null,Je=!!((fc=$e==null?void 0:$e.apiApps)!=null&&fc.length),wn=!!($e!=null&&$e.a2a),ci=((di=$e==null?void 0:$e.apiApps)==null?void 0:di[0])??Ei,Gn=(R==null?void 0:R.endpoint)??"",ss=gwe(((Bs=$e==null?void 0:$e.a2a)==null?void 0:Bs.endpoint)??"",Gn),ui=JSON.stringify([(re==null?void 0:re.runtimeId)??"",(re==null?void 0:re.region)??""]),Xt=(De==null?void 0:De.requestKey)===ui?De.value:null;b.useEffect(()=>{const H=Tt.current+1;Tt.current=H,ze(null),qe("");const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"";if(!l||!ne||!he){Pe(!1);return}const Ce=new AbortController;return Pe(!0),IB({runtimeId:ne,region:he,signal:Ce.signal}).then(et=>{var _t;if(H===Tt.current){if(et.runtime.runtimeId!==ne||et.runtime.region!==he||et.canUpdate&&!((_t=et.agent)!=null&&_t.appName)){qe("Runtime 更新能力响应与当前选择不匹配。");return}ze({requestKey:ui,value:et})}}).catch(et=>{H!==Tt.current||Ce.signal.aborted||qe(et instanceof Error?et.message:"检查 Runtime 更新能力失败。")}).finally(()=>{H===Tt.current&&!Ce.signal.aborted&&Pe(!1)}),()=>Ce.abort()},[l,re==null?void 0:re.region,re==null?void 0:re.runtimeId,ui]);const an=b.useMemo(()=>{const H=new Map(e.map((he,Ce)=>[he.id,Ce])),ne=new Map(n.map((he,Ce)=>[he,Ce]));return[...Jo].sort((he,Ce)=>{const et=he.runtimeId?Rr.get(he.runtimeId):void 0,_t=Ce.runtimeId?Rr.get(Ce.runtimeId):void 0,wi=(et==null?void 0:et.status)==="running"?et.startedAt:0,uo=(_t==null?void 0:_t.status)==="running"?_t.startedAt:0;if(wi!==uo)return uo-wi;const bn=ne.get(he.id),Pa=ne.get(Ce.id);return bn!=null&&Pa!=null?bn-Pa:bn!=null?-1:Pa!=null?1:(H.get(he.id)??0)-(H.get(Ce.id)??0)})},[n,e,Jo,Rr]),Fi=(re==null?void 0:re.label)||(Jt==null?void 0:Jt.name)||(gt==null?void 0:gt.draft.name)||(cn==null?void 0:cn.runtimeName)||"未选择智能体",Ws=Vn.find(H=>H.id===ta),na=an.filter(H=>H.canDelete===!0),Ru=an.filter(H=>Et.has(H.id)&&H.canDelete===!0),dc=Ve.filter(H=>jn.has(H.id)),Lg=na.length+Ve.length,ia=Ru.length+dc.length,ms=b.useMemo(()=>(cn==null?void 0:cn.agentDraft)??(gt==null?void 0:gt.draft)??(li==null?void 0:li.draft)??Ewe(Jt,(re==null?void 0:re.label)??"agent"),[Jt,re==null?void 0:re.label,li==null?void 0:li.draft,gt==null?void 0:gt.draft,cn==null?void 0:cn.agentDraft]),ja=gt?a?"":"当前账号没有新建 Agent 的权限。":l?re!=null&&re.runtimeId?re.region?Ne?"正在检查 Runtime 更新能力…":Fe||(Xt?Xt.canUpdate?(Ts=Xt.agent)!=null&&Ts.appName?"":"Runtime 更新能力响应缺少智能体信息。":Xt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",el="aw-update-disabled-reason",Qx=Xt!=null&&Xt.agent?{runtimeId:Xt.runtime.runtimeId,name:Xt.runtime.name,region:Xt.runtime.region,appName:Xt.agent.appName,currentVersion:Xt.runtime.currentVersion}:li==null?void 0:li.deploymentTarget,co=b.useMemo(()=>{if(Jt)return Jt.tools;const H=(ms.builtinTools??[]).map(ne=>{var he;return((he=wu.find(Ce=>Ce.id===ne))==null?void 0:he.label)??ne});return Array.from(new Set([...ms.tools,...H,...(ms.customTools??[]).map(ne=>ne.name),...(ms.mcpTools??[]).map(ne=>ne.name)].filter(Boolean)))},[ms,Jt]),dh=b.useMemo(()=>Jt?Jt.skillsPreviewSupported?Jt.skills.map(H=>H.name):null:Array.from(new Set([...(ms.selectedSkills??[]).map(H=>H.name),...ms.skills].filter(Boolean))),[ms,Jt]),Bt=b.useMemo(()=>{if(cn)return cn;if(gt)return d.filter(H=>{var ne,he;return((ne=H.agentDraft)==null?void 0:ne.name)===gt.draft.name||H.runtimeName===gt.draft.name||!!((he=gt.deploymentTarget)!=null&&he.runtimeId)&&H.runtimeId===gt.deploymentTarget.runtimeId}).sort((H,ne)=>ne.startedAt-H.startedAt)[0];if(re)return d.filter(H=>!!re.runtimeId&&H.runtimeId===re.runtimeId||H.runtimeName===re.label).sort((H,ne)=>ne.startedAt-H.startedAt)[0]},[d,re,gt,cn]),Zx=!!(f&&Bt&&Bt.id===f),Jx=!!(Bt&&(Bt.status!=="success"||Zx)),Dg=b.useMemo(()=>kwe(ms),[ms]),Qi=(re==null?void 0:re.currentVersion)??(R==null?void 0:R.currentVersion)??null,Pg=Qi??(cn==null?void 0:cn.startedAt)??"unknown",fh=Jt?`runtime:${(re==null?void 0:re.runtimeId)??Jt.name}:v${Pg}:${Dg}`:`draft:${(cn==null?void 0:cn.id)??(gt==null?void 0:gt.id)??(re==null?void 0:re.id)??Fi}:${Dg}`;b.useEffect(()=>{if(!f)return;const H=d.find(he=>he.id===f),ne=H!=null&&H.runtimeId?is.get(H.runtimeId):void 0;if(ne){$(""),j(ne.id),F("basic");return}j(""),$(""),F("basic")},[is,d,f]),b.useEffect(()=>{if(!h){xi.current="";return}const H=`${h}:${p}:${m}`;xi.current!==H&&e.some(ne=>ne.id===h)&&(xi.current=H,$(""),j(h),F(p),p==="evaluations"&&(lt(m),Dt("")))},[e,h,p,m]),b.useEffect(()=>{for(const H of an.slice(0,8)){if(!H.runtimeId)continue;const ne=H.region??"cn-beijing";jB(H.runtimeId,ne),bB(H.runtimeId,ne,H.runtimeApp??""),My(H.runtimeId,ne,H.runtimeApp??"").then(he=>{const Ce=he.appName||H.app;Ce&&Q_({runtimeId:H.runtimeId??"",region:ne,appName:Ce,pageSize:100})}).catch(()=>{})}},[an]),b.useEffect(()=>{!(re!=null&&re.runtimeId)||!Ei||Q_({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:Ei,pageSize:100})},[Ei,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"cn-beijing",Ce=(re==null?void 0:re.runtimeApp)??"",et=ne?gB(ne,he,Ce):null;if(ae(et),be(!!et||!v||!ne),!(!v||!ne))return My(ne,he,Ce,{force:!0}).then(_t=>{H||ae(_t)}).catch(()=>{!H&&!et&&ae(null)}).finally(()=>{H||be(!0)}),()=>{H=!0}},[v,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeApp,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"cn-beijing";if(Ai([]),yi(""),D!=="optimizations"||!ne){Jn(!1);return}if(v&&!Ei){Jn(!ie);return}return Jn(!0),tB({runtimeId:ne,region:he,appName:Ei}).then(Ce=>{H||Ai(Ce.groups)}).catch(Ce=>{H||yi(Ce instanceof Error?Ce.message:String(Ce))}).finally(()=>{H||Jn(!1)}),()=>{H=!0}},[ie,v,pn,D,Ei,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{Ii.current+=1,me(null),ge(!1),Te(!1),Xe(""),_e("api-server")},[se,D]);function Bg(){Ii.current+=1,me(null),ge(!1),Te(!1),Xe("")}function Ug(H){H!==pe&&(Bg(),_e(H))}async function ju(){if(Re){Bg();return}const H=(re==null?void 0:re.runtimeId)??"",ne=(re==null?void 0:re.region)??"cn-beijing";if(!H)return;const he=Ii.current+1;Ii.current=he,Te(!0),Xe("");try{const Ce=await AB(H,ne);if(he!==Ii.current)return;me({requestKey:se,value:Ce}),ge(!0)}catch(Ce){if(he!==Ii.current)return;me(null),ge(!1),Xe(Ce instanceof Error?Ce.message:"读取 Runtime API Key 失败。")}finally{he===Ii.current&&Te(!1)}}b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"cn-beijing",Ce=ne?RB(ne,he):null;if(Y(Ce),!!ne)return Sk(ne,he,{force:!0}).then(et=>{H||Y(et)}).catch(()=>{!H&&!Ce&&Y(null)}),()=>{H=!0}},[re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"cn-beijing",Ce=`${he}:${ne}`;if(W(""),D!=="integrations"||!ne){z(!1),ne||B(null);return}z(!0);const et=_k(ne,he,{retryProbe:!0}).catch(_t=>{if(_t instanceof Er&&_t.unsupported)return null;throw _t});return Promise.all([et,kB(ne,he,{retryProbe:!0})]).then(([_t,wi])=>{H||B({requestKey:Ce,apiApps:_t,a2a:wi})}).catch(_t=>{H||(B(null),W(_t instanceof Error?_t.message:"探测集成方式失败。"))}).finally(()=>{H||z(!1)}),()=>{H=!0}},[K,D,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",he=(re==null?void 0:re.region)??"cn-beijing",Ce=ne&&Ei?nB({runtimeId:ne,region:he,appName:Ei,pageSize:100}):null;if(On(Ce?SL(Ce):[]),hn((Ce==null?void 0:Ce.sets)??[]),Xi(""),D!=="evaluations"||!ne){Hn(!1);return}if(v&&!Ei){Hn(!ie);return}return Hn(!Ce),Y1({runtimeId:ne,region:he,appName:Ei,pageSize:100},{force:!0}).then(et=>{H||(hn(et.sets),On(SL(et)))}).catch(et=>{H||Xi(et instanceof Error?et.message:String(et))}).finally(()=>{H||Hn(!1)}),()=>{H=!0}},[ie,v,ki,D,Ei,Jt==null?void 0:Jt.appName,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{const H=new Set(bi.map(ne=>ne.id));Se(ne=>{const he=new Set([...ne].filter(Ce=>H.has(Ce)));return he.size===ne.size?ne:he}),Dn(ne=>{const he=new Set([...ne].filter(Ce=>H.has(Ce)));return he.size===ne.size?ne:he}),jt&&!H.has(jt)&&Pt("")},[bi,jt]),b.useEffect(()=>{Ln(!1),Se(new Set),Dn(new Set),it(""),Pt("")},[re==null?void 0:re.runtimeId]),b.useEffect(()=>{const H=new Set(an.filter(ne=>ne.canDelete===!0).map(ne=>ne.id));sn(ne=>{const he=new Set([...ne].filter(Ce=>H.has(Ce)));return he.size===ne.size?ne:he})},[an]),b.useEffect(()=>{const H=new Set(Ve.map(ne=>ne.id));ot(ne=>{const he=new Set([...ne].filter(Ce=>H.has(Ce)));return he.size===ne.size?ne:he})},[Ve]);const Oa=b.useMemo(()=>!g||!(re!=null&&re.runtimeId)||g.runtimeId!==re.runtimeId||Ei&&g.agentName&&g.agentName!==Ei?null:{...g,tag:g.kind==="good"?"Good case":"Bad case"},[g,re==null?void 0:re.runtimeId,Ei]),tl=b.useMemo(()=>re!=null&&re.runtimeId?Oa?[Oa,...bi.filter(H=>H.id!==Oa.id&&(!H.messageId||H.messageId!==Oa.messageId))]:bi:pwe,[bi,Oa,re==null?void 0:re.runtimeId]),nl=tl.filter(H=>{if(H.kind!==yt||(H.source==="auto"?"auto":"user")!==kt)return!1;const he=ln.trim().toLowerCase();return he?[H.input,H.output,H.referenceOutput,H.comment,H.tag??"",H.sessionId,H.messageId,H.userId,H.evaluationSetName].join(" ").toLowerCase().includes(he):!0}),Ou=nl.filter(H=>ce.has(H.id)),Ma=!!(re!=null&&re.runtimeId),Ut=H=>{lt(H),Dt(""),it("");const ne=tl.find(he=>he.kind===H);Pt((ne==null?void 0:ne.id)??""),window.setTimeout(()=>{var he;(he=wt.current)==null||he.scrollIntoView({behavior:"smooth",block:"start"})},0)},Fg=H=>{it(""),Se(ne=>{const he=new Set(ne);return he.has(H.id)?he.delete(H.id):he.add(H.id),he})},$g=()=>{it(""),Se(new Set(nl.map(H=>H.id)))},eE=()=>{it(""),Se(new Set),Ln(!1)},hh=H=>{Dn(ne=>{const he=new Set(ne);return he.has(H)?he.delete(H):he.add(H),he})},ph=H=>{Pt(H.id),it(""),!(!H.sessionId||!H.messageId)&&(T==null||T(H))},Hg=async H=>{if(!(re!=null&&re.runtimeId)||!Ei||Le||H.length===0)return;const ne=H.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${H.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(ne))return;const he=H.map(et=>et.id),Ce=new Set(he);Ee(!0),it("");try{await rB({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:Ei,itemIds:he});const et=new Map;for(const _t of H)et.set(_t.kind,(et.get(_t.kind)??0)+1);On(_t=>_t.filter(wi=>!Ce.has(wi.id))),hn(_t=>_t.map(wi=>({...wi,itemCount:Math.max(0,wi.itemCount-(et.get(wi.kind)??0))}))),Se(_t=>new Set([..._t].filter(wi=>!Ce.has(wi)))),Dn(_t=>new Set([..._t].filter(wi=>!Ce.has(wi)))),jt&&Ce.has(jt)&&Pt(""),H.length>1&&Ln(!1),k==null||k(H)}catch(et){it(et instanceof Error?et.message:String(et))}finally{Ee(!1)}},zg=H=>{Ds(ne=>ne.map(he=>he.id===H.id?H:he))},Mu=()=>{const H=new Set(e.map(Ce=>Ce.id)),ne=n.filter(Ce=>H.has(Ce)),he=new Set(ne);return[...ne,...e.filter(Ce=>!he.has(Ce.id)).map(Ce=>Ce.id)]},rs=(H,ne,he)=>{if(!x||H===ne)return;const Ce=Mu().filter(wi=>wi!==H),et=Ce.indexOf(ne),_t=et<0?Ce.length:he==="after"?et+1:et;Ce.splice(_t,0,H),x(Ce)},mh=(H,ne)=>{if(!Ge||Ge===ne)return;const he=H.currentTarget.getBoundingClientRect();at(ne),Nt(H.clientY>he.top+he.height/2?"after":"before")},vi=(H,ne)=>{if(!x)return;const he=Mu(),Ce=he.indexOf(H),et=Math.max(0,Math.min(he.length-1,Ce+ne));Ce<0||Ce===et||(he.splice(Ce,1),he.splice(et,0,H),x(he))},Vg=H=>{H.canDelete===!0&&(At(""),sn(ne=>{const he=new Set(ne);return he.has(H.id)?he.delete(H.id):he.add(H.id),he}))},Pn=H=>{At(""),ot(ne=>{const he=new Set(ne);return he.has(H.id)?he.delete(H.id):he.add(H.id),he})},tE=()=>{At(""),sn(new Set(na.map(H=>H.id))),ot(new Set(Ve.map(H=>H.id)))},as=()=>{At(""),sn(new Set),ot(new Set),Ze(!1)},gh=()=>{if(ia===0||mt)return;const H=Ru.length,ne=dc.length;At(""),Ti({kind:"selection",title:H===1&&ne===0?"删除 Agent?":H===0&&ne===1?"删除草稿?":"删除所选项目?",description:H===1&&ne===0?`"${Ru[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:H===0&&ne===1?`"${dc[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${ia} 个项目。${H>0?`${H} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:H===0&&ne===1?"删除草稿":"删除所选",agents:Ru,drafts:dc})},bh=async()=>{if(!(!Wt||mt)){rn(!0),At("");try{if(Wt.kind==="selection"){const{agents:H,drafts:ne}=Wt;if(H.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E(H)}ne.length>0&&(w==null||w(ne)),sn(new Set),ot(new Set),Ze(!1),H.some(he=>he.id===A)&&j(""),ne.some(he=>he.id===P)&&$("")}else if(Wt.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([Wt.agent]),A===Wt.agent.id&&j("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([Wt.draft]),P===Wt.draft.id&&$("")}Ti(null)}catch(H){At(H instanceof Error?H.message:String(H))}finally{rn(!1)}}},La=H=>{!E||H.canDelete!==!0||mt||(At(""),Ti({kind:"agent",title:"删除 Agent?",description:`"${H.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:H}))},Da=H=>{if(!w||mt)return;const ne=H.draft.name||"未命名 Agent";At(""),Ti({kind:"draft",title:"删除草稿?",description:`"${ne}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:H})},il=()=>{const H=`eval-${Date.now()}`,ne={id:H,name:`新评测组 ${Vn.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Ds(he=>[ne,...he]),oo(H)},Gg=H=>{zg({...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:M==="library"?"is-active":"","aria-pressed":M==="library",onClick:()=>{G("library"),Ye("")},children:"智能体库"}),o.jsx("button",{type:"button",className:M==="evaluation"?"is-active":"","aria-pressed":M==="evaluation",onClick:()=>{G("evaluation"),Ye("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":M==="evaluation"||void 0,ref:H=>{H==null||H.toggleAttribute("inert",M==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":M==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(Cy,{"aria-hidden":!0}),o.jsx("input",{value:Ue,onChange:H=>Ye(H.currentTarget.value),placeholder:M==="library"?"搜索智能体":"搜索评测组","aria-label":M==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:M==="library"?C:il,disabled:M==="library"&&!a,children:[o.jsx(ws,{"aria-hidden":!0}),o.jsx("span",{children:M==="library"?"新建 Agent":"新建评测组"})]}),M==="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:["已选 ",ia," 个"]}),o.jsx("button",{type:"button",onClick:tE,disabled:Lg===0||mt,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void gh(),disabled:ia===0||mt,children:mt?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:as,disabled:mt,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{At(""),Ze(!0)},disabled:Lg===0,children:"选择"})}),M==="library"&&fn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:fn}),o.jsx("div",{className:"aw-agent-list",children:M==="evaluation"?uc.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):uc.map(H=>o.jsxs("button",{type:"button",className:`aw-agent-item${H.id===ta?" is-active":""}`,onClick:()=>oo(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(Rp,{"aria-hidden":!0})]},H.id)):c&&an.length===0&&Ve.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&an.length===0&&Ve.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:"重试"})]}):an.length===0&&Ve.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Ve.map(H=>{const ne=d.filter(Ce=>{var et,_t;return((et=Ce.agentDraft)==null?void 0:et.name)===H.draft.name||Ce.runtimeName===H.draft.name||!!((_t=H.deploymentTarget)!=null&&_t.runtimeId)&&Ce.runtimeId===H.deploymentTarget.runtimeId}).sort((Ce,et)=>et.startedAt-Ce.startedAt)[0],he=jn.has(H.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",ye?"is-selecting":"",he?"is-selected-for-delete":"",H.id===P?"is-active":""].filter(Boolean).join(" "),"aria-pressed":ye?he:void 0,onClick:()=>{if(ye){Pn(H);return}j(""),$(H.id),F("basic")},children:[ye&&o.jsx("span",{className:`aw-select-marker${he?" 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${(ne==null?void 0:ne.status)==="running"?" is-deploying":""}`,children:(ne==null?void 0:ne.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:H.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Rp,{"aria-hidden":!0})]},H.id)}),an.map(H=>{const ne=H.runtimeId?Rr.get(H.runtimeId):void 0,he=H.runtimeId?Ps.get(H.runtimeId):void 0,Ce=Et.has(H.id),et=H.canDelete===!0,_t=(ne==null?void 0:ne.status)==="running"?{label:"部署中",className:" is-deploying"}:(ne==null?void 0:ne.status)==="error"?{label:"失败",className:" is-error"}:(ne==null?void 0:ne.status)==="cancelled"?{label:"已取消",className:" is-muted"}:he?{label:"待更新",className:""}:null,wi=(ne==null?void 0:ne.status)==="running"?"正在更新部署":he?"待更新":H.remote?H.host||"远程智能体":"本地智能体",uo=["aw-agent-item","aw-agent-item--sortable",H.id===A?"is-active":"",ye?"is-selecting":"",Ce?"is-selected-for-delete":"",ye&&!et?"is-selection-disabled":"",H.id===Ge?"is-dragging":"",H.id===nt&&H.id!==Ge?`is-drop-target is-drop-${Qe}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!ye,className:uo,"aria-pressed":ye?Ce:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:bn=>{x&&(ps.current=!0,Kt(H.id),bn.dataTransfer.effectAllowed="move",bn.dataTransfer.setData("text/plain",H.id))},onDragEnter:bn=>{mh(bn,H.id)},onDragOver:bn=>{!Ge||Ge===H.id||(bn.preventDefault(),bn.dataTransfer.dropEffect="move",mh(bn,H.id))},onDragLeave:bn=>{const Pa=bn.relatedTarget;Pa instanceof Node&&bn.currentTarget.contains(Pa)||nt===H.id&&at("")},onDrop:bn=>{bn.preventDefault();const Pa=bn.dataTransfer.getData("text/plain")||Ge;rs(Pa,H.id,Qe),Kt(""),at(""),Nt("before")},onDragEnd:()=>{Kt(""),at(""),Nt("before"),window.setTimeout(()=>{ps.current=!1},0)},onKeyDown:bn=>{bn.altKey&&(bn.key==="ArrowUp"?(bn.preventDefault(),vi(H.id,-1)):bn.key==="ArrowDown"&&(bn.preventDefault(),vi(H.id,1)))},onClick:bn=>{if(ye){bn.preventDefault(),Vg(H);return}if(ps.current){bn.preventDefault(),ps.current=!1;return}$(""),j(H.id),F("basic"),N(H.id)},children:[ye&&o.jsx("span",{className:`aw-select-marker${Ce?" 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]}),_t&&o.jsx("span",{className:`aw-draft-badge${_t.className}`,children:_t.label})]}),o.jsx("small",{children:wi})]}),o.jsx(Rp,{"aria-hidden":!0})]},H.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",M==="library"?e.length+lo:Vn.length," 个"]})]}),M==="evaluation"&&Ws?o.jsx(Bwe,{group:Ws,agents:e,cases:tl,onChange:zg,onRun:Gg}):M==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!re&&!gt&&!cn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[re&&!Jt&&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:"正在读取配置与运行信息…"})]})]})}),D==="integrations"&&te&&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:Fi}),Qi!=null&&o.jsxs("span",{children:["v",Qi]}),gt&&o.jsx("span",{children:"草稿"}),li&&o.jsx("span",{children:"待更新"}),!re&&!gt&&cn&&o.jsx("span",{children:cn.label})]}),o.jsx("p",{children:ms.description||(r||v&&!ie?"正在读取智能体信息…":"暂无描述")})]}),(gt||li||(re==null?void 0:re.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(gt||li)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const H=gt??li;H&&Da(H)},disabled:mt,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(tc,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(re==null?void 0:re.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void La(re),disabled:mt,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(tc,{"aria-hidden":!0}),o.jsx("span",{children:mt?"删除中…":"删除 Agent"})]})]})]}),Bt&&Jx&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(Owe,{task:Bt})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:Ku.map(H=>o.jsx("button",{type:"button",id:`agent-${H.id}-tab`,className:D===H.id?"is-active":"",role:"tab","aria-selected":D===H.id,"aria-controls":`agent-${H.id}-panel`,tabIndex:D===H.id?0:-1,onClick:()=>F(H.id),onKeyDown:ne=>{var _t;if(!["ArrowLeft","ArrowRight","Home","End"].includes(ne.key))return;ne.preventDefault();const he=Ku.findIndex(wi=>wi.id===H.id),Ce=ne.key==="Home"?0:ne.key==="End"?Ku.length-1:(he+(ne.key==="ArrowRight"?1:-1)+Ku.length)%Ku.length,et=Ku[Ce];F(et.id),(_t=document.getElementById(`agent-${et.id}-tab`))==null||_t.focus()},children:H.label},H.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${D}-panel`,role:"tabpanel","aria-labelledby":`agent-${D}-tab`,children:[D==="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:(R==null?void 0:R.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(R==null?void 0:R.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(R==null?void 0:R.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(R==null?void 0:R.region)||(re==null?void 0:re.region)||(Bt==null?void 0:Bt.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:R!=null&&R.networkTypes.length?R.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(Am,{draft:ms,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},fh)})]}),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:(Jt==null?void 0:Jt.model)||ms.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:Jt!=null&&Jt.graph?i$(Jt.graph):s$(ms)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:co.length?co.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:dh===null?"暂不支持预览":dh.length?dh.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Qi!=null?`v${Qi}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:gt?"草稿":(Bt==null?void 0:Bt.status)==="error"?"部署失败":(Bt==null?void 0:Bt.status)==="cancelled"?"已取消":li?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),D==="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 可确认的公开协议与地址。"})]}),q&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:q}),o.jsx("button",{type:"button",onClick:()=>ue(H=>H+1),children:"重试"})]}),!q&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${pe==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),zh.map((H,ne)=>o.jsx("button",{type:"button",id:`integration-${H.id}-tab`,role:"tab","aria-selected":pe===H.id,"aria-controls":`integration-${H.id}-panel`,tabIndex:pe===H.id?0:-1,onClick:()=>Ug(H.id),onKeyDown:he=>{var _t;if(!["ArrowLeft","ArrowRight","Home","End"].includes(he.key))return;he.preventDefault();const Ce=he.key==="Home"?0:he.key==="End"?zh.length-1:(ne+(he.key==="ArrowRight"?1:-1)+zh.length)%zh.length,et=zh[Ce];Ug(et.id),(_t=document.getElementById(`integration-${et.id}-tab`))==null||_t.focus()},children:H.label},H.id))]}),pe==="api-server"?o.jsx(_L,{protocol:"api-server",title:"API Server",available:Je,fields:[{label:"Agent",value:Je?((Lu=$e==null?void 0:$e.apiApps)==null?void 0:Lu.join("、"))??"":""},{label:"发现接口",value:Je?tw(Gn,"/list-apps"):""},{label:"调用接口",value:Je?tw(Gn,"/run_sse"):""},{label:"鉴权方式",value:Je?vL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(wL,{available:Je,authType:R==null?void 0:R.authType,value:ke,visible:Re&&!!ke,loading:oe,error:ve,onToggle:()=>void ju()})}],example:Je?bwe(Gn,ci,R==null?void 0:R.authType):""}):o.jsx(_L,{protocol:"a2a",title:"A2A",available:wn,fields:[{label:"Agent",value:(($i=$e==null?void 0:$e.a2a)==null?void 0:$i.name)??""},{label:"Agent Card",value:wn?tw(Gn,"/.well-known/agent-card.json"):""},{label:"调用地址",value:ss},{label:"鉴权方式",value:wn?vL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(wL,{available:wn,authType:R==null?void 0:R.authType,value:ke,visible:Re&&!!ke,loading:oe,error:ve,onToggle:()=>void ju()})}],example:wn?ywe(ss,R==null?void 0:R.authType):""})]})]}),D==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(re==null?void 0:re.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(H=>{const ne=Twe($n,H),he=tl.filter(et=>et.kind===H).length,Ce=Oa?he:(ne==null?void 0:ne.itemCount)??he;return o.jsxs("button",{type:"button",onClick:()=>Ut(H),children:[o.jsx("strong",{children:Ce}),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:yt===H?"is-active":"","aria-pressed":yt===H,onClick:()=>lt(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:kt===H?"is-active":"","aria-pressed":kt===H,onClick:()=>$t(H),children:H==="auto"?"自动回流":"手动回流"},H))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(Cy,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:ln,onChange:H=>Dt(H.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),Ma&&o.jsx("div",{className:`aw-case-toolbar${Mn?" is-active":""}`,children:Mn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Ou.length," 条"]}),o.jsx("button",{type:"button",onClick:$g,disabled:nl.length===0||Le,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Hg(Ou),disabled:Ou.length===0||Le,children:Le?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:eE,disabled:Le,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{it(""),Ln(!0)},disabled:nl.length===0||Le,children:"选择案例"})}),rt&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:rt}),o.jsx("div",{ref:wt,children:o.jsx(Pwe,{cases:nl,loading:vn&&nl.length===0,error:Bi,runtimeBacked:!!(re!=null&&re.runtimeId),selectionMode:Mn,selectedCaseIds:ce,focusedCaseId:jt,expandedCaseIds:oi,deleting:Le,canDelete:Ma,onOpenCase:ph,onToggleCase:Fg,onToggleExpanded:hh,onDeleteCase:H=>void Hg([H]),onRetry:()=>Ui(H=>H+1)})})]}),D==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),zn?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):Ci?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Ci}),o.jsx("button",{type:"button",onClick:()=>An(H=>H+1),children:"重试"})]}):gn.length>0?o.jsx(Lwe,{groups:gn}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),D==="basic"&&(re||gt)&&o.jsxs("div",{className:"aw-basic-actions",children:[re&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(re),children:[o.jsx(TJ,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${ja?" is-disabled":""}`,tabIndex:ja?0:void 0,"aria-describedby":ja?el:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!ja,"aria-busy":Ne||void 0,"aria-describedby":ja?el:void 0,onClick:()=>{var H;return gt?O==null?void 0:O(gt):li?O==null?void 0:O({...li,deploymentTarget:Qx}):Xt?I(((H=Xt.agent)==null?void 0:H.draft)??ms,Xt):void 0},children:Ne?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):gt||li?"继续编辑":"更新"}),ja&&o.jsx("span",{id:el,className:"aw-update-disabled-reason",role:"tooltip",children:ja})]})]})]})]}),M==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),Wt&&o.jsx(NA,{variant:"danger",title:Wt.title,description:Wt.description,confirmLabel:mt?"删除中...":Wt.confirmLabel,closeLabel:"关闭删除确认",busy:mt,onCancel:()=>Ti(null),onConfirm:()=>void bh()})]})}function Lwe({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:_we(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Nwe(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 Dwe(){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 Pwe({cases:e,loading:t=!1,error:n="",runtimeBacked:i=!1,selectionMode:s=!1,selectedCaseIds:r,focusedCaseId:a="",expandedCaseIds:l,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){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}),m&&o.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(g=>{var T;const v=g.id.startsWith("local:"),y=(r==null?void 0:r.has(g.id))??!1,x=(l==null?void 0:l.has(g.id))??!1,w=g.output.length+g.referenceOutput.length>220||(((T=g.reason)==null?void 0:T.length)??0)>120,N=u&&!v,_=g.source==="auto";return o.jsxs("div",{className:["aw-case-row",a===g.id?"is-focused":"",s?"is-selecting":"",y?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?y:void 0,onClick:()=>{if(s){N&&(f==null||f(g));return}d==null||d(g)},onKeyDown:k=>{k.target===k.currentTarget&&(k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),s?N&&(f==null||f(g)):d==null||d(g)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&N&&o.jsx("span",{className:`aw-select-marker${y?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:g.input,children:g.input||"无用户输入"})]}),g.comment&&o.jsxs("small",{title:g.comment,children:["备注:",g.comment]}),o.jsx("small",{className:"aw-case-time",children:vwe(g.createdAt)}),(g.userId||g.sessionId)&&o.jsx("small",{title:[g.userId,g.sessionId].filter(Boolean).join(" · "),children:[g.userId,g.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:g.output,children:g.output||"无可见回复"}),g.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:g.referenceOutput,children:["Reference: ",g.referenceOutput]}),w&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:k=>{k.stopPropagation(),h==null||h(g.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:wwe(g)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:_?g.reason:void 0,children:_?g.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:N&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:k=>{k.stopPropagation(),p==null||p(g)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(Dwe,{})})})]},g.id)})]})}function Bwe({group:e,agents:t,cases:n,onChange:i,onRun:s}){const[r,a]=b.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];b.useEffect(()=>a("config"),[e.id]);const u=f=>{i({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{i({...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:()=>s(e),disabled:!0,children:[o.jsx(gJ,{"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=>i({...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=>i({...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=>i({...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(ka,{}),"已完成"]}),o.jsx(Rp,{"aria-hidden":!0})]},f.id))})]})})]})}function o$(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let i=.985;n<=80?i=.96:n<=150?i=.97:n<=220?i=.98:n>600&&(i=.995),t.style.setProperty("--scale",i.toString())},WS=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!zwe||typeof window.requestAnimationFrame!="function"||c$&&document.visibilityState==="hidden")return n();let s=2,r=window.requestAnimationFrame(function a(){s-=1,s===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},Vwe=e=>Object.keys(e).reduce((n,i)=>{const s=e[i];if(s||s===0){const r=i.startsWith("--")?"":"--",a=typeof s=="number"?`${s}px`:s;n[`${r}${i}`]=a}return n},{}),Gwe=e=>{const t=b.Children.toArray(e),n=[];let i="";const s=()=>{i!==""&&(n.push(i),i="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){i+=String(r);continue}s(),n.push(r)}return s(),n},d$=e=>{const t=Gwe(e),n=b.Children.count(t);return b.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:o.jsx("span",{children:i});if(b.isValidElement(i)){const s=i,{children:r,...a}=s.props;return r!=null?b.cloneElement(s,a,d$(r)):s}return i})};b.createContext(null);var Kwe=typeof Al=="object"&&Al&&Al.Object===Object&&Al,qwe=typeof self=="object"&&self&&self.Object===Object&&self;Kwe||qwe||Function("return this")();var Ywe=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Wwe(){const e=b.useRef(!1);return b.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),b.useCallback(()=>e.current,[])}var NL={width:void 0,height:void 0};function Xwe(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:s},r]=b.useState(NL),a=Wwe(),l=b.useRef({...NL}),c=b.useRef(void 0);return c.current=e.onResize,b.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=TL(d,f,"inlineSize"),p=TL(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const g={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(g):a()&&r(g)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:i,height:s}}function TL(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 Qwe(e,t){const n=b.useRef(e);Ywe(()=>{n.current=e},[e]),b.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const Zwe="_LoadingIndicator_7yl6f_1",Jwe={LoadingIndicator:Zwe},e_e=({className:e,size:t,strokeWidth:n,style:i,...s})=>o.jsx("div",{...s,className:ea(Jwe.LoadingIndicator,e),style:i||Vwe({"indicator-size":t,"indicator-stroke":n})});function t_e(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const n_e=()=>l$,kL=(e,t=!1,n="TransitionGroup")=>{const i=[];return b.Children.forEach(e,s=>{if(s&&typeof s=="object"&&"key"in s&&s.key)i.push(s);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),i},qu=()=>{},Yu=e=>{const t=b.useRef(e);return t.current=e,b.useCallback(n=>t.current(n),[])};function i_e(e,t,n,i){const s=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:!!s[c.component.key]}));return i==="append"?l.concat(a):a.concat(l)}function s_e(e,t,n){if((l$||Fwe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const r_e="_TransitionGroupChild_1hv1z_1",a_e={TransitionGroupChild:r_e},f$={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},o_e=e=>({...f$,enter:!e}),l_e=(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 f$}},c_e=({ref:e,as:t,children:n,className:i,transitionId:s,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:g,onExitComplete:v})=>{const[y,x]=b.useReducer(l_e,o_e(a||!1)),E=b.useRef(!1),w=b.useRef(null),N=b.useRef(c);N.current=c;const _=b.useRef(u);_.current=u;const T=b.useRef(null),k=b.useCallback(C=>{const I=w.current;if(!(!I||C===T.current))switch(T.current=C,C){case"enter":f(I);break;case"enter-active":h(I);break;case"enter-complete":p(I);break;case"exit":m(I);break;case"exit-active":g(I);break;case"exit-complete":v(I);break}},[f,h,p,m,g,v]);return Mt.useLayoutEffect(()=>{if(!l){let O;x({type:"exit-before"}),k("exit");const M=WS(()=>{x({type:"exit-active"}),k("exit-active"),O=window.setTimeout(()=>{k("exit-complete"),d()},_.current)});return()=>{M(),O!==void 0&&clearTimeout(O)}}if(a&&!E.current){E.current=!0;return}let C;x({type:"enter-before"}),k("enter");const I=WS(()=>{x({type:"enter-active"}),k("enter-active"),C=window.setTimeout(()=>{x({type:"done"}),k("enter-complete")},N.current)});return()=>{I(),C!==void 0&&clearTimeout(C)}},[l,a,d,k]),b.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:t_e([w,e]),className:ea(i,a_e.TransitionGroupChild),"data-transition-id":s,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})},u_e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[s,r]=b.useState(i==null);return Qwe(()=>r(!0),s?null:i),s?o.jsx(c_e,{...e}):null},d_e=e=>{const{ref:t,as:n="span",children:i,className:s,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=n_e()}=e,p=Yu(e.onEnter??qu),m=Yu(e.onEnterActive??qu),g=Yu(e.onEnterComplete??qu),v=Yu(e.onExit??qu),y=Yu(e.onExitActive??qu),x=Yu(e.onExitComplete??qu);b.Children.forEach(i,_=>{if(_&&!_.key)throw new Error("Child elements of must include a `key`")});const E=b.useCallback(_=>({component:_,shouldRender:!0,removeChild:()=>{N(T=>T.filter(k=>_.key!==k.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:g,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,g,v,y,x]),[w,N]=b.useState(()=>kL(i).map(_=>({...E(_),preventMountTransition:u})));return b.useLayoutEffect(()=>{N(_=>{const T=kL(i);return i_e(T,_,E,f)})},[i,f,E]),s_e("TransitionGroup",t,b.Children.count(i)),h?o.jsx(o.Fragment,{children:b.Children.map(i,_=>o.jsx(n,{ref:t,className:s,style:a,"data-transition-id":r,children:_}))}):o.jsx(o.Fragment,{children:w.map(({component:_,...T})=>o.jsx(u_e,{...T,as:n,className:s,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:_},_.key))})},f_e="_Button_1864l_1",h_e="_ButtonInner_1864l_4",p_e="_ButtonLoader_1864l_749",nw={Button:f_e,ButtonInner:h_e,ButtonLoader:p_e},AL=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:s=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:g,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,N=b.useCallback(_=>{v||g==null||g(_)},[g,v]);return o.jsxs("button",{type:t,className:ea(nw.Button,m),"data-color":n,"data-variant":i,"data-pill":s?"":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:u$,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:N,...E,children:[o.jsx(d_e,{className:nw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(e_e,{},"loader")}),o.jsx("span",{className:nw.ButtonInner,children:d$(p)})]})},m_e=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"})}),g_e="_EmptyMessage_1r5gu_1",b_e="_IconBadge_1r5gu_16",y_e="_Title_1r5gu_54",x_e="_Description_1r5gu_69",E_e="_ActionRow_1r5gu_77",wg={EmptyMessage:g_e,IconBadge:b_e,Title:y_e,Description:x_e,ActionRow:E_e},qn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:ea(wg.EmptyMessage,t),"data-fill":n,children:e}),v_e=({size:e="md",color:t="secondary",children:n,className:i})=>o.jsx("div",{className:ea(wg.IconBadge,i),"data-size":e,"data-color":t,children:n}),w_e=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:ea(wg.Title,t),"data-color":n,children:e}),__e=({children:e,className:t})=>o.jsx("div",{className:ea(wg.Description,t),children:e}),S_e=({children:e,className:t})=>o.jsx("div",{className:ea(wg.ActionRow,t),children:e});qn.Icon=v_e;qn.Title=w_e;qn.Description=__e;qn.ActionRow=S_e;const nr="/web/sandbox/sessions",CL=3e4,IL=33e4,N_e=6e4,T_e=6e5,iw=15e3,wo=6e4,k_e=33e4,RL=40;function kx(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 Zi(e){const t=V1(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function Ji(e,t){const n=await e.text().catch(()=>"");let i={};try{i=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const s=i.detail,r=s&&typeof s=="object"&&"message"in s?s.message:s??i.error??i.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function Wu(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:Ax(e.permissions)}}const Vh={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function Ax(e){if(!e||typeof e!="object")return{...Vh};const t=e,n=t.approvalPolicy,i=t.approvalsReviewer,s=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Vh.approvalPolicy,approvalsReviewer:i==="user"||i==="auto_review"?i:Vh.approvalsReviewer,sandboxMode:s==="read-only"||s==="workspace-write"||s==="danger-full-access"?s:Vh.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Vh.networkAccess}}function jL(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:Ax(t.permissions)}}function ga(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function A_e(e){const t=ga(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 C_e(e){const t=ga(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 h$(e){const t=ga(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 z0(e){const t=ga(e),n=h$(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const i=t.messages.flatMap(s=>{const r=ga(s);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:i,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:Ax(t.permissions)}}function XS(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(i=>typeof i!="number"||!Number.isFinite(i)||i<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 I_e(e){const t=XS(e.usage);if(!t||typeof e.turnId!="string")return;const n=XS(e.threadTotal),i=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof i=="number"&&Number.isFinite(i)&&i>=0?{modelContextWindow:Math.trunc(i)}:{}}}function R_e(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 j_e(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),i=new TextDecoder;let s="",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 g;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;g={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;g={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(g)):a[v]=g,u()}function h(p){var y,x,E;let m="message";const g=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&g.push(w.slice(5).trimStart());if(g.length===0)return;let v;try{v=JSON.parse(g.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=R_e(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=I_e(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();s+=i.decode(m,{stream:!p});const g=s.split(/\r?\n\r?\n/);if(s=g.pop()??"",g.forEach(h),p)break}if(s.trim()&&h(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function $a(e,t,{method:n="GET",body:i,options:s={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:Zi(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:Cn(s.signal,wo)});if(!a.ok)throw await Ji(a,r);return a.json()}const nn={async listSessions(e={}){const t=await fetch(Nn(nr),{method:"GET",headers:Zi(),signal:Cn(e.signal,CL)});if(!t.ok)throw await Ji(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(i=>Wu(i))},async startSession(e={}){var n;const t=await fetch(Nn(nr),{method:"POST",headers:Zi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:Cn(e.signal,IL)});if(!t.ok)throw await Ji(t,"无法启动 AgentKit 沙箱,请稍后重试。");return Wu(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(Nn(`/web/${e}/sessions`),{method:"GET",headers:Zi(),signal:Cn(t.signal,CL)});if(!n.ok)throw await Ji(n,`无法读取 ${e} 智能体,请稍后重试。`);const i=await n.json();if(!Array.isArray(i.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return i.sessions.map(s=>Wu(s,e))},async startAgentSession(e,t={}){var i;const n=await fetch(Nn(`/web/${e}/sessions`),{method:"POST",headers:Zi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=t.displayName)==null?void 0:i.trim())??""}),signal:Cn(t.signal,IL)});if(!n.ok)throw await Ji(n,`无法创建 ${e} 智能体,请稍后重试。`);return Wu(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const i=await fetch(Nn(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:Zi(),signal:Cn(n.signal,wo)});if(!i.ok)throw await Ji(i,`无法打开 ${e} 智能体。`);const s=await i.json();if(typeof s.webuiUrl!="string"||!s.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:Wu(s,e),kind:e,webuiUrl:Nn(s.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const i=await fetch(Nn(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:Zi(),signal:Cn(n.signal,wo)});if(!i.ok)throw await Ji(i,`无法打开 ${e} Terminal。`);const s=await i.json();return{url:p$(s.url,`${e} Terminal`),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const i=await fetch(Nn(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:Zi(),signal:Cn(n.signal,iw)});if(!i.ok&&i.status!==404)throw await Ji(i,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:Zi({"Content-Type":"application/json"}),signal:Cn(t.signal,N_e)});if(!n.ok)throw await Ji(n,"无法连接 Codex 智能体,请稍后重试。");const i=Wu(await n.json());if(i.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${i.status}。`);return i},async sendMessage(e,t={}){var i;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(Nn(`${nr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:Zi({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(i=e.skillIds)!=null&&i.length?{skillIds:e.skillIds}:{}}),signal:Cn(t.signal,T_e)});if(!n.ok)throw await Ji(n,"沙箱对话失败,请稍后重试。");return j_e(n,t)},async getStatus(e,t={}){const n=await $a(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),i=jL(n),s=ga(n),r=XS(s==null?void 0:s.threadTotal),a=s==null?void 0:s.modelContextWindow;return{...i,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=ga(await $a(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(i=>{const s=A_e(i);return s?[s]:[]})},async setModel(e,t,n={}){const i=ga(await $a(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(i==null?void 0:i.model)!="string"||!i.model)throw new Error("Sandbox 返回了无效模型。");return i.model},async listSkills(e,t=!1,n={}){const s=ga(await $a(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(s==null?void 0:s.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return s.skills.flatMap(r=>{const a=C_e(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const i=new URLSearchParams;t.cursor&&i.set("cursor",t.cursor),t.search&&i.set("search",t.search),t.archived&&i.set("archived","true");const s=i.size?`?${i}`:"",r=ga(await $a(e,`threads${s}`,{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=h$(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return z0(await $a(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return z0(await $a(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return z0(await $a(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const i=ga(await $a(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((i==null?void 0:i.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...i.thread?{snapshot:z0(i)}:{}}},async compactThread(e,t={}){await $a(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:Zi(),signal:Cn(t.signal,wo)});if(!n.ok)throw await Ji(n,"无法读取 Codex 权限与工作空间。");return jL(await n.json())},async updatePermissions(e,t,n={}){const i=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:Zi({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:Cn(n.signal,wo)});if(!i.ok)throw await Ji(i,"无法更新 Codex 权限。");const s=await i.json();return Ax(s.permissions)},async updateWorkspace(e,t,n={}){const i=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:Zi({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:Cn(n.signal,wo)});if(!i.ok)throw await Ji(i,"无法更新 Codex 工作空间。");const s=await i.json();if(typeof s.cwd!="string"||!s.cwd)throw new Error("Sandbox 返回了无效工作目录。");return s.cwd},async listDirectories(e,t,n={}){const i=new URLSearchParams({path:t}),s=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/directories?${i}`),{method:"GET",headers:Zi(),signal:Cn(n.signal,wo)});if(!s.ok)throw await Ji(s,"无法读取 Sandbox 目录。");const r=await s.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,i={}){const s=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:Zi({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:Cn(i.signal,wo)});if(!s.ok)throw await Ji(s,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return OL(e,"terminal",t)},async launchBrowser(e,t={}){return OL(e,"browser",t)},async uploadFile(e,t,n={}){const i=new FormData;i.set("file",t,t.name);const s=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:Zi(),body:i,signal:Cn(n.signal,k_e)});if(!s.ok)throw await Ji(s,"无法上传文件到 Sandbox。");const r=await s.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(Nn(`${nr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:Zi(),signal:Cn(t.signal,iw)});if(!n.ok&&n.status!==404)throw await Ji(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(Nn(`${nr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:Zi(),signal:Cn(t.signal,iw)});if(!n.ok&&n.status!==404)throw await Ji(n,"无法删除 Codex 智能体。")}};async function OL(e,t,n){const i=await fetch(Nn(`${nr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:Zi(),signal:Cn(n.signal,wo)});if(!i.ok)throw await Ji(i,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:p$(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function p$(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return Nn(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const i=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!i)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function Rd(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${i}`,n?`请求:${n}`:""].filter(Boolean).join(` -`)}function O_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:"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 M_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:"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 L_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:"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 Lm({kind:e,...t}){return e==="codex"?o.jsx(O_e,{...t}):e==="openclaw"?o.jsx(M_e,{...t}):o.jsx(L_e,{...t})}const ML="cn-beijing",sw=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],D_e=24,P_e=3e4,jd=new Map,Yd=new Map,B_e=new Set;function V0(e){if(!e){jd.clear(),Yd.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of Yd)i.page.runtimes.some(s=>t.has(s.runtimeId))&&Yd.delete(n);jd.clear()}}function U_e(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 rw(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 F_e({type:e}){return e==="general"?o.jsx(Kc,{}):o.jsx(Lm,{kind:e})}function TA(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 $_e(e){return e==="cn-shanghai"?"上海":e==="cn-beijing"?"北京":e||"—"}function LL(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:TA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function H_e(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:kx(e.status),createdAt:TA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function z_e(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:TA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function V_e(e,t,n){const i=`${e}:all:${t}`,s=Yd.get(i);if(s&&s.expiresAt>Date.now())return n(s.page.runtimes.map(LL)),s.page.nextToken;s&&Yd.delete(i);let r=jd.get(i);r||(r=W1({scope:e,region:"all",pageSize:D_e,nextToken:t}),jd.set(i,r),r.then(()=>jd.delete(i),()=>jd.delete(i)));const a=await r;return Yd.set(i,{page:a,expiresAt:Date.now()+P_e}),n(a.runtimes.map(LL)),a.nextToken}function G_e({agent:e,onUse:t,onViewDetails:n,connecting:i,connected:s,showOwnership:r,deploymentTask:a,onViewDeploymentTask:l,onEditDraft:c,onDeleteDraft:u}){const d=!!(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:a?"部署中":"草稿"}):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:[a?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:$_e(e.runtime.region)}),r&&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":a?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>a?l==null?void 0:l(a):c==null?void 0:c(e.draft),children:a?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>u==null?void 0:u(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!d,"aria-label":a?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>a?l==null?void 0:l(a):n==null?void 0:n(e),children:a?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!d||i||s,"aria-busy":i||void 0,"aria-label":s?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(t==null?void 0:t(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):s?"已连接":"使用"})]})})]})}function K_e({canCreate:e,runtimeScope:t,onCreateAgent:n,onUseAgent:i,onViewAgentDetails:s,onCreateSandboxAgent:r,onUseSandboxAgent:a,onViewSandboxAgentDetails:l,sandboxRefreshKey:c=0,connectedRuntimeId:u="",hiddenRuntimeIds:d=B_e,drafts:f=[],deploymentTasks:h=[],draftDeploymentTaskIds:p={},onViewDeploymentTask:m,onEditDraft:g,onDeleteDraft:v}){const y=b.useRef(null),x=b.useRef(null),E=b.useRef(0),w=b.useRef(0),N=b.useRef(null),[_,T]=b.useState("general"),[k,C]=b.useState(""),[I,O]=b.useState([]),[M,G]=b.useState(""),[D,F]=b.useState(!0),[A,j]=b.useState(""),[P,$]=b.useState([]),[R,Y]=b.useState(!1),[Z,B]=b.useState(""),[te,z]=b.useState(""),[q,W]=b.useState(null),K=b.useMemo(()=>f.map(z_e),[f]),ue=b.useMemo(()=>{const Ne=new Map,Pe=new Map;for(const Fe of h){if(Fe.status!=="running"||(Ne.set(Fe.id,Fe),!Fe.runtimeId))continue;const qe=Pe.get(Fe.runtimeId);(!qe||Fe.startedAt>qe.startedAt)&&Pe.set(Fe.runtimeId,Fe)}return{byId:Ne,byRuntimeId:Pe}},[h]),pe=b.useCallback(Ne=>{var Fe;if(Ne.draft){const qe=p[Ne.draft.id];return qe?ue.byId.get(qe):void 0}const Pe=(Fe=Ne.runtime)==null?void 0:Fe.runtimeId;return Pe?ue.byRuntimeId.get(Pe):void 0},[ue,p]),_e=b.useCallback((Ne,Pe)=>{const Fe=++E.current;return F(!0),j(""),V_e(t,Ne,qe=>{E.current===Fe&&O(Q=>Pe?qe:[...Q,...qe])}).then(qe=>{E.current===Fe&&G(qe)}).catch(qe=>{E.current===Fe&&j(Rd(qe,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{E.current===Fe&&F(!1)})},[t]);b.useEffect(()=>{if(_==="general")return O([]),G(""),_e("",!0),()=>{E.current+=1}},[_,_e]);const fe=b.useCallback(async Ne=>{var qe,Q;(qe=N.current)==null||qe.abort();const Pe=new AbortController;N.current=Pe;const Fe=++w.current;Y(!0),B(""),$([]);try{const ae=Ne==="codex"?await nn.listSessions({signal:Pe.signal}):await nn.listAgentSessions(Ne,{signal:Pe.signal});if(w.current!==Fe)return;$(ae.map(H_e))}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||w.current!==Fe)return;B(Rd(ae,`加载 ${((Q=sw.find(ie=>ie.id===Ne))==null?void 0:Q.label)??Ne}`,`GET /web/${Ne==="codex"?"sandbox":Ne}/sessions`))}finally{N.current===Pe&&(N.current=null),w.current===Fe&&Y(!1)}},[]);function me(Ne){var Pe;Ne!==_&&(Ne==="general"?(E.current+=1,O([]),G(""),j(""),F(!0)):((Pe=N.current)==null||Pe.abort(),N.current=null,w.current+=1,$([]),B(""),Y(!0)),T(Ne))}b.useEffect(()=>{var Ne;if(_==="general"){(Ne=N.current)==null||Ne.abort(),N.current=null,w.current+=1;return}return fe(_),()=>{var Pe;(Pe=N.current)==null||Pe.abort(),N.current=null,w.current+=1}},[_,fe,c]),b.useEffect(()=>{const Ne=x.current,Pe=y.current;if(!Ne||!Pe||_!=="general"||!M||D)return;const Fe=new IntersectionObserver(([qe])=>{qe.isIntersecting&&_e(M,!1)},{root:Pe,rootMargin:"240px 0px",threshold:.01});return Fe.observe(Ne),()=>Fe.disconnect()},[_,_e,D,M]);const Re=b.useCallback(async Ne=>{if(!te){z(Ne.id);try{await new Promise(Pe=>requestAnimationFrame(()=>Pe())),Ne.sandbox?await a(Ne.sandbox):await i(Ne)}finally{z("")}}},[te,i,a]),ge=b.useMemo(()=>{const Ne=k.trim().toLocaleLowerCase(),Pe=_==="general"?[...K,...I]:P,Fe=Ne?Pe.filter(ae=>ae.name.toLocaleLowerCase().includes(Ne)):Pe;if(_!=="general")return Fe;const qe=d.size>0?Fe.filter(ae=>!ae.runtime||!d.has(ae.runtime.runtimeId)):Fe,Q=qe.findIndex(ae=>{var ie;return((ie=ae.runtime)==null?void 0:ie.runtimeId)===u});return Q<=0?qe:[qe[Q],...qe.slice(0,Q),...qe.slice(Q+1)]},[_,u,K,d,k,I,P]),oe=sw.find(Ne=>Ne.id===_),Te=(oe==null?void 0:oe.label)??"智能体",ve=_==="general"?D&&I.length===0&&K.length===0:R&&P.length===0,Xe=!ve&&ge.length===0,De=e?_==="general"?()=>n(ML):()=>r(_):void 0,ze=e?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:t==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(U_e,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:k,onChange:Ne=>C(Ne.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:sw.map(Ne=>o.jsx("button",{type:"button",className:`my-agent-type-pill${_===Ne.id?" is-active":""}`,"aria-pressed":_===Ne.id,onClick:()=>me(Ne.id),children:Ne.label},Ne.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!De,title:ze,onClick:()=>De==null?void 0:De(),children:[o.jsx(rw,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:y,"aria-label":`${Te}列表`,children:[ve?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:"正在加载智能体"})]}):(_==="general"?A:Z)&&ge.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:_==="general"?A:Z}),o.jsx("button",{type:"button",onClick:()=>{_==="general"?_e("",!0):fe(_)},children:"重新加载"})]}):Xe?k.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(qn,{fill:"none",children:[o.jsx(qn.Icon,{children:o.jsx(m_e,{})}),o.jsx(qn.Title,{children:"没有匹配的智能体"}),o.jsx(qn.Description,{children:"请尝试搜索其他名称"})]})}):_!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(qn,{fill:"none",children:[o.jsx(qn.Icon,{children:o.jsx(F_e,{type:_})}),o.jsxs(qn.Title,{children:["暂无 ",Te]}),e?o.jsx(qn.ActionRow,{children:o.jsxs(AL,{color:"primary",size:"lg",onClick:()=>r(_),children:[o.jsx(rw,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(qn,{fill:"none",children:[o.jsx(qn.Icon,{children:o.jsx(Kc,{})}),o.jsx(qn.Title,{children:"暂无通用智能体"}),o.jsx(qn.Description,{children:"创建一个通用智能体,开始构建和对话"}),e?o.jsx(qn.ActionRow,{children:o.jsxs(AL,{color:"primary",size:"lg",onClick:()=>n(ML),children:[o.jsx(rw,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[_==="general"&&A?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:A}),o.jsx("button",{type:"button",onClick:()=>void _e("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ge.map(Ne=>{var Pe;return o.jsx(G_e,{agent:Ne,deploymentTask:pe(Ne),onViewDeploymentTask:m,onUse:Re,onViewDetails:Fe=>{Fe.sandbox?l(Fe.sandbox):s(Fe)},connecting:Ne.id===te,connected:((Pe=Ne.runtime)==null?void 0:Pe.runtimeId)===u,showOwnership:t==="all",onEditDraft:g,onDeleteDraft:W},Ne.id)})})]}),_==="general"&&!A&&!ve&&(ge.length>0||!!M)&&o.jsx("div",{className:"my-agent-load-more",ref:x,"aria-live":"polite",children:D?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):M?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),q?o.jsx(NA,{title:"删除草稿?",description:`删除后将无法恢复“${q.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>W(null),onConfirm:()=>{v==null||v(q),W(null)}}):null]})}const q_e={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},Y_e="https://api.github.com",W_e=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,DL=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,X_e=/^[A-Za-z0-9._/-]+$/;function Q_e(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 xc(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 i;try{i=await fetch(`${Y_e}${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 s=await i.json().catch(()=>null);if(!t.expected.includes(i.status))throw new Error(Q_e(i.status,s,t.token));return{status:i.status,payload:s}}function aw(e){return e.split("/").map(encodeURIComponent).join("/")}function Z_e(e){const t=new TextEncoder().encode(e);let n="";const i=32768;for(let s=0;s({...h,path:kA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await xc(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await xc(`${a}/git/ref/heads/${aw(i)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=J_e(e.branchPrefix);await xc(`${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 s){const m=aw(p.path),g=await xc(`${a}/contents/${m}?ref=${encodeURIComponent(i)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&g.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(g.status===200&&!g.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await xc(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:Z_e(p.content),branch:u,...g.payload.sha?{sha:g.payload.sha}:{}}})}const h=await xc(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:i,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 xc(`${a}/git/refs/heads/${aw(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const CA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},IA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},g$={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},b$={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function RA(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 jA(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const eSe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,tSe=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function nSe(e){if(!eSe.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!tSe.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 iSe(e){nSe(e);const t=String.raw`name: PR Automated Review +`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(b.useEffect(()=>{t&&r(i)},[e.id,t==null?void 0:t.status,i]),b.useEffect(()=>{if(!s||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[s,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=Gwe(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",g=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",g,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}${s?"":" 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:s?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(Aa,{"aria-hidden":!0}):o.jsx(Y1,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),s&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function qwe({task:e}){const t=m$(e),n=g$(e),i=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),s=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(mn,{className:"spin"}):e.status==="success"?o.jsx(xJ,{}):e.status==="error"?o.jsx(pk,{}):o.jsx(nj,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:s}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(i)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i),children:o.jsx("span",{style:{width:`${i}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[Rn,Bt]=b.useState(()=>new Set),[Ze,cn]=b.useState(!1),[un,Et]=b.useState(""),[nn,Ci]=b.useState(null),[ii,Dn]=b.useState([]),[Pn,gn]=b.useState([]),[_n,Bn]=b.useState(!1),[$i,gs]=b.useState(""),[Ii,Ri]=b.useState(0),[Un,vi]=b.useState([]),[Sn,si]=b.useState(!1),[ji,Oi]=b.useState(""),[bn,jn]=b.useState(0),[Fn,$n]=b.useState(!1),[yn,_t]=b.useState(()=>new Set),[ue,fe]=b.useState(!1),[De,We]=b.useState(""),[rt,at]=b.useState(""),[sn,rn]=b.useState(()=>new Set),fi=b.useRef(!1),Zi=b.useRef(""),dn=b.useRef(null),Hn=b.useRef(0),Ut=b.useRef(0),[vt,wi]=b.useState(Cwe),[bs,lo]=b.useState("");b.useEffect(()=>{e.length!==0&&wi(H=>H.map((ne,pe)=>pe===0&&ne.agentIds.length===0?{...ne,agentIds:e.slice(0,2).map(Ae=>Ae.id)}:ne))},[e]);const rs=b.useMemo(()=>{const H=new Map;for(const ne of e)ne.runtimeId&&H.set(ne.runtimeId,ne);return H},[e]),Us=b.useMemo(()=>{var ne;const H=new Map;for(const pe of t){const Ae=(ne=pe.deploymentTarget)==null?void 0:ne.runtimeId;if(!Ae||!rs.has(Ae))continue;const tt=H.get(Ae);(!tt||pe.updatedAt>tt.updatedAt)&&H.set(Ae,pe)}return H},[rs,t]),Or=b.useMemo(()=>{const H=new Map;for(const ne of d){if(!ne.runtimeId)continue;const pe=H.get(ne.runtimeId);(!pe||ne.startedAt>pe.startedAt)&&H.set(ne.runtimeId,ne)}return H},[d]),tl=b.useMemo(()=>{const H=Le.trim().toLowerCase();return H?e.filter(ne=>{const pe=ne.runtimeId?Us.get(ne.runtimeId):void 0,Ae=ne.runtimeId?Or.get(ne.runtimeId):void 0;return[ne.label,ne.app,ne.host??"",(pe==null?void 0:pe.draft.name)??"",(pe==null?void 0:pe.draft.description)??"",(Ae==null?void 0:Ae.runtimeName)??""].join(" ").toLowerCase().includes(H)}):e},[e,Or,Le,Us]),Ve=b.useMemo(()=>{const H=Le.trim().toLowerCase();return t.filter(ne=>{var Ae;const pe=(Ae=ne.deploymentTarget)==null?void 0:Ae.runtimeId;return pe&&rs.has(pe)?!1:H?`${ne.draft.name} ${ne.draft.description}`.toLowerCase().includes(H):!0})},[rs,t,Le]),co=b.useMemo(()=>t.filter(H=>{var pe;const ne=(pe=H.deploymentTarget)==null?void 0:pe.runtimeId;return!ne||!rs.has(ne)}).length,[rs,t]),uo=b.useMemo(()=>{const H=Le.trim().toLowerCase();return H?vt.filter(ne=>ne.name.toLowerCase().includes(H)):vt},[vt,Le]),re=e.find(H=>H.id===A),ct=t.find(H=>H.id===P),fn=f?d.find(H=>H.id===f):void 0,hi=re!=null&&re.runtimeId?Us.get(re.runtimeId):void 0,Zt=v?Q:A&&s===A?i:null,_i=(Zt==null?void 0:Zt.appName)||(re==null?void 0:re.runtimeApp)||(re==null?void 0:re.app)||"",se=`${(re==null?void 0:re.region)??"cn-beijing"}:${(re==null?void 0:re.runtimeId)??""}`,Te=(de==null?void 0:de.requestKey)===se?de.value:"",Fe=(Z==null?void 0:Z.requestKey)===se?Z:null,et=!!((hc=Fe==null?void 0:Fe.apiApps)!=null&&hc.length),Nn=!!(Fe!=null&&Fe.a2a),pi=((mi=Fe==null?void 0:Fe.apiApps)==null?void 0:mi[0])??_i,qn=(R==null?void 0:R.endpoint)??"",as=Iwe(((Fs=Fe==null?void 0:Fe.a2a)==null?void 0:Fs.endpoint)??"",qn),Yn=JSON.stringify([(re==null?void 0:re.runtimeId)??"",(re==null?void 0:re.region)??""]),qt=(Me==null?void 0:Me.requestKey)===Yn?Me.value:null;b.useEffect(()=>{const H=Hn.current+1;Hn.current=H,ze(null),Ke("");const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"";if(!l||!ne||!pe){Ue(!1);return}const Ae=new AbortController;return Ue(!0),FB({runtimeId:ne,region:pe,signal:Ae.signal}).then(tt=>{var Nt;if(H===Hn.current){if(tt.runtime.runtimeId!==ne||tt.runtime.region!==pe||tt.canUpdate&&!((Nt=tt.agent)!=null&&Nt.appName)){Ke("Runtime 更新能力响应与当前选择不匹配。");return}ze({requestKey:Yn,value:tt})}}).catch(tt=>{H!==Hn.current||Ae.signal.aborted||Ke(tt instanceof Error?tt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{H===Hn.current&&!Ae.signal.aborted&&Ue(!1)}),()=>Ae.abort()},[l,re==null?void 0:re.region,re==null?void 0:re.runtimeId,Yn]);const an=b.useMemo(()=>{const H=new Map(e.map((pe,Ae)=>[pe.id,Ae])),ne=new Map(n.map((pe,Ae)=>[pe,Ae]));return[...tl].sort((pe,Ae)=>{const tt=pe.runtimeId?Or.get(pe.runtimeId):void 0,Nt=Ae.runtimeId?Or.get(Ae.runtimeId):void 0,Ni=(tt==null?void 0:tt.status)==="running"?tt.startedAt:0,ho=(Nt==null?void 0:Nt.status)==="running"?Nt.startedAt:0;if(Ni!==ho)return ho-Ni;const xn=ne.get(pe.id),Ba=ne.get(Ae.id);return xn!=null&&Ba!=null?xn-Ba:xn!=null?-1:Ba!=null?1:(H.get(pe.id)??0)-(H.get(Ae.id)??0)})},[n,e,tl,Or]),Hi=(re==null?void 0:re.label)||(Zt==null?void 0:Zt.name)||(ct==null?void 0:ct.draft.name)||(fn==null?void 0:fn.runtimeName)||"未选择智能体",Qs=vt.find(H=>H.id===bs),ia=an.filter(H=>H.canDelete===!0),Ou=an.filter(H=>St.has(H.id)&&H.canDelete===!0),fc=Ve.filter(H=>Rn.has(H.id)),Fg=ia.length+Ve.length,sa=Ou.length+fc.length,ys=b.useMemo(()=>(fn==null?void 0:fn.agentDraft)??(ct==null?void 0:ct.draft)??(hi==null?void 0:hi.draft)??Mwe(Zt,(re==null?void 0:re.label)??"agent"),[Zt,re==null?void 0:re.label,hi==null?void 0:hi.draft,ct==null?void 0:ct.draft,fn==null?void 0:fn.agentDraft]),Oa=ct?a?"":"当前账号没有新建 Agent 的权限。":l?re!=null&&re.runtimeId?re.region?Se?"正在检查 Runtime 更新能力…":Pe||(qt?qt.canUpdate?(Cs=qt.agent)!=null&&Cs.appName?"":"Runtime 更新能力响应缺少智能体信息。":qt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",nl="aw-update-disabled-reason",sE=qt!=null&&qt.agent?{runtimeId:qt.runtime.runtimeId,name:qt.runtime.name,region:qt.runtime.region,appName:qt.agent.appName,currentVersion:qt.runtime.currentVersion}:hi==null?void 0:hi.deploymentTarget,fo=b.useMemo(()=>{if(Zt)return Zt.tools;const H=(ys.builtinTools??[]).map(ne=>{var pe;return((pe=Su.find(Ae=>Ae.id===ne))==null?void 0:pe.label)??ne});return Array.from(new Set([...ys.tools,...H,...(ys.customTools??[]).map(ne=>ne.name),...(ys.mcpTools??[]).map(ne=>ne.name)].filter(Boolean)))},[ys,Zt]),mh=b.useMemo(()=>Zt?Zt.skillsPreviewSupported?Zt.skills.map(H=>H.name):null:Array.from(new Set([...(ys.selectedSkills??[]).map(H=>H.name),...ys.skills].filter(Boolean))),[ys,Zt]),Lt=b.useMemo(()=>{if(fn)return fn;if(ct)return d.filter(H=>{var ne,pe;return((ne=H.agentDraft)==null?void 0:ne.name)===ct.draft.name||H.runtimeName===ct.draft.name||!!((pe=ct.deploymentTarget)!=null&&pe.runtimeId)&&H.runtimeId===ct.deploymentTarget.runtimeId}).sort((H,ne)=>ne.startedAt-H.startedAt)[0];if(re)return d.filter(H=>!!re.runtimeId&&H.runtimeId===re.runtimeId||H.runtimeName===re.label).sort((H,ne)=>ne.startedAt-H.startedAt)[0]},[d,re,ct,fn]),rE=!!(f&&Lt&&Lt.id===f),aE=!!(Lt&&(Lt.status!=="success"||rE)),$g=b.useMemo(()=>$we(ys),[ys]),Ji=(re==null?void 0:re.currentVersion)??(R==null?void 0:R.currentVersion)??null,Hg=Ji??(fn==null?void 0:fn.startedAt)??"unknown",gh=Zt?`runtime:${(re==null?void 0:re.runtimeId)??Zt.name}:v${Hg}:${$g}`:`draft:${(fn==null?void 0:fn.id)??(ct==null?void 0:ct.id)??(re==null?void 0:re.id)??Hi}:${$g}`;b.useEffect(()=>{if(!f)return;const H=d.find(pe=>pe.id===f),ne=H!=null&&H.runtimeId?rs.get(H.runtimeId):void 0;if(ne){$(""),j(ne.id),F("basic");return}j(""),$(""),F("basic")},[rs,d,f]),b.useEffect(()=>{if(!h){Zi.current="";return}const H=`${h}:${p}:${m}`;Zi.current!==H&&e.some(ne=>ne.id===h)&&(Zi.current=H,$(""),j(h),F(p),p==="evaluations"&&(lt(m),Mt("")))},[e,h,p,m]),b.useEffect(()=>{for(const H of an.slice(0,8)){if(!H.runtimeId)continue;const ne=H.region??"cn-beijing";HB(H.runtimeId,ne),kB(H.runtimeId,ne,H.runtimeApp??""),Fy(H.runtimeId,ne,H.runtimeApp??"").then(pe=>{const Ae=pe.appName||H.app;Ae&&sS({runtimeId:H.runtimeId??"",region:ne,appName:Ae,pageSize:100})}).catch(()=>{})}},[an]),b.useEffect(()=>{!(re!=null&&re.runtimeId)||!_i||sS({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:_i,pageSize:100})},[_i,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"cn-beijing",Ae=(re==null?void 0:re.runtimeApp)??"",tt=ne?TB(ne,pe,Ae):null;if(oe(tt),be(!!tt||!v||!ne),!(!v||!ne))return Fy(ne,pe,Ae,{force:!0}).then(Nt=>{H||oe(Nt)}).catch(()=>{!H&&!tt&&oe(null)}).finally(()=>{H||be(!0)}),()=>{H=!0}},[v,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeApp,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"cn-beijing";if(vi([]),Oi(""),D!=="optimizations"||!ne){si(!1);return}if(v&&!_i){si(!ie);return}return si(!0),dB({runtimeId:ne,region:pe,appName:_i}).then(Ae=>{H||vi(Ae.groups)}).catch(Ae=>{H||Oi(Ae instanceof Error?Ae.message:String(Ae))}).finally(()=>{H||si(!1)}),()=>{H=!0}},[ie,v,bn,D,_i,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{Ut.current+=1,ge(null),Ee(!1),Ne(!1),Qe(""),_e("api-server")},[se,D]);function zg(){Ut.current+=1,ge(null),Ee(!1),Ne(!1),Qe("")}function Vg(H){H!==me&&(zg(),_e(H))}async function Mu(){if(Oe){zg();return}const H=(re==null?void 0:re.runtimeId)??"",ne=(re==null?void 0:re.region)??"cn-beijing";if(!H)return;const pe=Ut.current+1;Ut.current=pe,Ne(!0),Qe("");try{const Ae=await BB(H,ne);if(pe!==Ut.current)return;ge({requestKey:se,value:Ae}),Ee(!0)}catch(Ae){if(pe!==Ut.current)return;ge(null),Ee(!1),Qe(Ae instanceof Error?Ae.message:"读取 Runtime API Key 失败。")}finally{pe===Ut.current&&Ne(!1)}}b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"cn-beijing",Ae=ne?$B(ne,pe):null;if(Y(Ae),!!ne)return jk(ne,pe,{force:!0}).then(tt=>{H||Y(tt)}).catch(()=>{!H&&!Ae&&Y(null)}),()=>{H=!0}},[re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"cn-beijing",Ae=`${pe}:${ne}`;if(W(""),D!=="integrations"||!ne){K(!1),ne||B(null);return}K(!0);const tt=Rk(ne,pe,{retryProbe:!0}).catch(Nt=>{if(Nt instanceof wr&&Nt.unsupported)return null;throw Nt});return Promise.all([tt,PB(ne,pe,{retryProbe:!0})]).then(([Nt,Ni])=>{H||B({requestKey:Ae,apiApps:Nt,a2a:Ni})}).catch(Nt=>{H||(B(null),W(Nt instanceof Error?Nt.message:"探测集成方式失败。"))}).finally(()=>{H||K(!1)}),()=>{H=!0}},[q,D,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{let H=!1;const ne=(re==null?void 0:re.runtimeId)??"",pe=(re==null?void 0:re.region)??"cn-beijing",Ae=ne&&_i?fB({runtimeId:ne,region:pe,appName:_i,pageSize:100}):null;if(Dn(Ae?jL(Ae):[]),gn((Ae==null?void 0:Ae.sets)??[]),gs(""),D!=="evaluations"||!ne){Bn(!1);return}if(v&&!_i){Bn(!ie);return}return Bn(!Ae),tx({runtimeId:ne,region:pe,appName:_i,pageSize:100},{force:!0}).then(tt=>{H||(gn(tt.sets),Dn(jL(tt)))}).catch(tt=>{H||gs(tt instanceof Error?tt.message:String(tt))}).finally(()=>{H||Bn(!1)}),()=>{H=!0}},[ie,v,Ii,D,_i,Zt==null?void 0:Zt.appName,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),b.useEffect(()=>{const H=new Set(ii.map(ne=>ne.id));_t(ne=>{const pe=new Set([...ne].filter(Ae=>H.has(Ae)));return pe.size===ne.size?ne:pe}),rn(ne=>{const pe=new Set([...ne].filter(Ae=>H.has(Ae)));return pe.size===ne.size?ne:pe}),rt&&!H.has(rt)&&at("")},[ii,rt]),b.useEffect(()=>{$n(!1),_t(new Set),rn(new Set),We(""),at("")},[re==null?void 0:re.runtimeId]),b.useEffect(()=>{const H=new Set(an.filter(ne=>ne.canDelete===!0).map(ne=>ne.id));Qt(ne=>{const pe=new Set([...ne].filter(Ae=>H.has(Ae)));return pe.size===ne.size?ne:pe})},[an]),b.useEffect(()=>{const H=new Set(Ve.map(ne=>ne.id));Bt(ne=>{const pe=new Set([...ne].filter(Ae=>H.has(Ae)));return pe.size===ne.size?ne:pe})},[Ve]);const Ma=b.useMemo(()=>!g||!(re!=null&&re.runtimeId)||g.runtimeId!==re.runtimeId||_i&&g.agentName&&g.agentName!==_i?null:{...g,tag:g.kind==="good"?"Good case":"Bad case"},[g,re==null?void 0:re.runtimeId,_i]),il=b.useMemo(()=>re!=null&&re.runtimeId?Ma?[Ma,...ii.filter(H=>H.id!==Ma.id&&(!H.messageId||H.messageId!==Ma.messageId))]:ii:Awe,[ii,Ma,re==null?void 0:re.runtimeId]),sl=il.filter(H=>{if(H.kind!==gt||(H.source==="auto"?"auto":"user")!==kt)return!1;const pe=ln.trim().toLowerCase();return pe?[H.input,H.output,H.referenceOutput,H.comment,H.tag??"",H.sessionId,H.messageId,H.userId,H.evaluationSetName].join(" ").toLowerCase().includes(pe):!0}),Lu=sl.filter(H=>yn.has(H.id)),La=!!(re!=null&&re.runtimeId),Dt=H=>{lt(H),Mt(""),We("");const ne=il.find(pe=>pe.kind===H);at((ne==null?void 0:ne.id)??""),window.setTimeout(()=>{var pe;(pe=dn.current)==null||pe.scrollIntoView({behavior:"smooth",block:"start"})},0)},Gg=H=>{We(""),_t(ne=>{const pe=new Set(ne);return pe.has(H.id)?pe.delete(H.id):pe.add(H.id),pe})},Kg=()=>{We(""),_t(new Set(sl.map(H=>H.id)))},oE=()=>{We(""),_t(new Set),$n(!1)},bh=H=>{rn(ne=>{const pe=new Set(ne);return pe.has(H)?pe.delete(H):pe.add(H),pe})},yh=H=>{at(H.id),We(""),!(!H.sessionId||!H.messageId)&&(T==null||T(H))},qg=async H=>{if(!(re!=null&&re.runtimeId)||!_i||ue||H.length===0)return;const ne=H.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${H.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(ne))return;const pe=H.map(tt=>tt.id),Ae=new Set(pe);fe(!0),We("");try{await mB({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:_i,itemIds:pe});const tt=new Map;for(const Nt of H)tt.set(Nt.kind,(tt.get(Nt.kind)??0)+1);Dn(Nt=>Nt.filter(Ni=>!Ae.has(Ni.id))),gn(Nt=>Nt.map(Ni=>({...Ni,itemCount:Math.max(0,Ni.itemCount-(tt.get(Ni.kind)??0))}))),_t(Nt=>new Set([...Nt].filter(Ni=>!Ae.has(Ni)))),rn(Nt=>new Set([...Nt].filter(Ni=>!Ae.has(Ni)))),rt&&Ae.has(rt)&&at(""),H.length>1&&$n(!1),k==null||k(H)}catch(tt){We(tt instanceof Error?tt.message:String(tt))}finally{fe(!1)}},Yg=H=>{wi(ne=>ne.map(pe=>pe.id===H.id?H:pe))},Du=()=>{const H=new Set(e.map(Ae=>Ae.id)),ne=n.filter(Ae=>H.has(Ae)),pe=new Set(ne);return[...ne,...e.filter(Ae=>!pe.has(Ae.id)).map(Ae=>Ae.id)]},os=(H,ne,pe)=>{if(!x||H===ne)return;const Ae=Du().filter(Ni=>Ni!==H),tt=Ae.indexOf(ne),Nt=tt<0?Ae.length:pe==="after"?tt+1:tt;Ae.splice(Nt,0,H),x(Ae)},xh=(H,ne)=>{if(!He||He===ne)return;const pe=H.currentTarget.getBoundingClientRect();yt(ne),ot(H.clientY>pe.top+pe.height/2?"after":"before")},Si=(H,ne)=>{if(!x)return;const pe=Du(),Ae=pe.indexOf(H),tt=Math.max(0,Math.min(pe.length-1,Ae+ne));Ae<0||Ae===tt||(pe.splice(Ae,1),pe.splice(tt,0,H),x(pe))},Wg=H=>{H.canDelete===!0&&(Et(""),Qt(ne=>{const pe=new Set(ne);return pe.has(H.id)?pe.delete(H.id):pe.add(H.id),pe}))},zn=H=>{Et(""),Bt(ne=>{const pe=new Set(ne);return pe.has(H.id)?pe.delete(H.id):pe.add(H.id),pe})},lE=()=>{Et(""),Qt(new Set(ia.map(H=>H.id))),Bt(new Set(Ve.map(H=>H.id)))},ls=()=>{Et(""),Qt(new Set),Bt(new Set),Xe(!1)},Eh=()=>{if(sa===0||Ze)return;const H=Ou.length,ne=fc.length;Et(""),Ci({kind:"selection",title:H===1&&ne===0?"删除 Agent?":H===0&&ne===1?"删除草稿?":"删除所选项目?",description:H===1&&ne===0?`"${Ou[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:H===0&&ne===1?`"${fc[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${sa} 个项目。${H>0?`${H} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:H===0&&ne===1?"删除草稿":"删除所选",agents:Ou,drafts:fc})},vh=async()=>{if(!(!nn||Ze)){cn(!0),Et("");try{if(nn.kind==="selection"){const{agents:H,drafts:ne}=nn;if(H.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E(H)}ne.length>0&&(w==null||w(ne)),Qt(new Set),Bt(new Set),Xe(!1),H.some(pe=>pe.id===A)&&j(""),ne.some(pe=>pe.id===P)&&$("")}else if(nn.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([nn.agent]),A===nn.agent.id&&j("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([nn.draft]),P===nn.draft.id&&$("")}Ci(null)}catch(H){Et(H instanceof Error?H.message:String(H))}finally{cn(!1)}}},Da=H=>{!E||H.canDelete!==!0||Ze||(Et(""),Ci({kind:"agent",title:"删除 Agent?",description:`"${H.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:H}))},Pa=H=>{if(!w||Ze)return;const ne=H.draft.name||"未命名 Agent";Et(""),Ci({kind:"draft",title:"删除草稿?",description:`"${ne}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:H})},rl=()=>{const H=`eval-${Date.now()}`,ne={id:H,name:`新评测组 ${vt.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};wi(pe=>[ne,...pe]),lo(H)},Xg=H=>{Yg({...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:L==="library"?"is-active":"","aria-pressed":L==="library",onClick:()=>{G("library"),qe("")},children:"智能体库"}),o.jsx("button",{type:"button",className:L==="evaluation"?"is-active":"","aria-pressed":L==="evaluation",onClick:()=>{G("evaluation"),qe("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":L==="evaluation"||void 0,ref:H=>{H==null||H.toggleAttribute("inert",L==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":L==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(Ly,{"aria-hidden":!0}),o.jsx("input",{value:Le,onChange:H=>qe(H.currentTarget.value),placeholder:L==="library"?"搜索智能体":"搜索评测组","aria-label":L==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:L==="library"?C:rl,disabled:L==="library"&&!a,children:[o.jsx(Ns,{"aria-hidden":!0}),o.jsx("span",{children:L==="library"?"新建 Agent":"新建评测组"})]}),L==="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:["已选 ",sa," 个"]}),o.jsx("button",{type:"button",onClick:lE,disabled:Fg===0||Ze,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Eh(),disabled:sa===0||Ze,children:Ze?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:ls,disabled:Ze,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Et(""),Xe(!0)},disabled:Fg===0,children:"选择"})}),L==="library"&&un&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:un}),o.jsx("div",{className:"aw-agent-list",children:L==="evaluation"?uo.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):uo.map(H=>o.jsxs("button",{type:"button",className:`aw-agent-item${H.id===bs?" is-active":""}`,onClick:()=>lo(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(Lp,{"aria-hidden":!0})]},H.id)):c&&an.length===0&&Ve.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&an.length===0&&Ve.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:"重试"})]}):an.length===0&&Ve.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Ve.map(H=>{const ne=d.filter(Ae=>{var tt,Nt;return((tt=Ae.agentDraft)==null?void 0:tt.name)===H.draft.name||Ae.runtimeName===H.draft.name||!!((Nt=H.deploymentTarget)!=null&&Nt.runtimeId)&&Ae.runtimeId===H.deploymentTarget.runtimeId}).sort((Ae,tt)=>tt.startedAt-Ae.startedAt)[0],pe=Rn.has(H.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",ye?"is-selecting":"",pe?"is-selected-for-delete":"",H.id===P?"is-active":""].filter(Boolean).join(" "),"aria-pressed":ye?pe:void 0,onClick:()=>{if(ye){zn(H);return}j(""),$(H.id),F("basic")},children:[ye&&o.jsx("span",{className:`aw-select-marker${pe?" 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${(ne==null?void 0:ne.status)==="running"?" is-deploying":""}`,children:(ne==null?void 0:ne.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:H.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Lp,{"aria-hidden":!0})]},H.id)}),an.map(H=>{const ne=H.runtimeId?Or.get(H.runtimeId):void 0,pe=H.runtimeId?Us.get(H.runtimeId):void 0,Ae=St.has(H.id),tt=H.canDelete===!0,Nt=(ne==null?void 0:ne.status)==="running"?{label:"部署中",className:" is-deploying"}:(ne==null?void 0:ne.status)==="error"?{label:"失败",className:" is-error"}:(ne==null?void 0:ne.status)==="cancelled"?{label:"已取消",className:" is-muted"}:pe?{label:"待更新",className:""}:null,Ni=(ne==null?void 0:ne.status)==="running"?"正在更新部署":pe?"待更新":H.remote?H.host||"远程智能体":"本地智能体",ho=["aw-agent-item","aw-agent-item--sortable",H.id===A?"is-active":"",ye?"is-selecting":"",Ae?"is-selected-for-delete":"",ye&&!tt?"is-selection-disabled":"",H.id===He?"is-dragging":"",H.id===nt&&H.id!==He?`is-drop-target is-drop-${Je}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!ye,className:ho,"aria-pressed":ye?Ae:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:xn=>{x&&(fi.current=!0,Xt(H.id),xn.dataTransfer.effectAllowed="move",xn.dataTransfer.setData("text/plain",H.id))},onDragEnter:xn=>{xh(xn,H.id)},onDragOver:xn=>{!He||He===H.id||(xn.preventDefault(),xn.dataTransfer.dropEffect="move",xh(xn,H.id))},onDragLeave:xn=>{const Ba=xn.relatedTarget;Ba instanceof Node&&xn.currentTarget.contains(Ba)||nt===H.id&&yt("")},onDrop:xn=>{xn.preventDefault();const Ba=xn.dataTransfer.getData("text/plain")||He;os(Ba,H.id,Je),Xt(""),yt(""),ot("before")},onDragEnd:()=>{Xt(""),yt(""),ot("before"),window.setTimeout(()=>{fi.current=!1},0)},onKeyDown:xn=>{xn.altKey&&(xn.key==="ArrowUp"?(xn.preventDefault(),Si(H.id,-1)):xn.key==="ArrowDown"&&(xn.preventDefault(),Si(H.id,1)))},onClick:xn=>{if(ye){xn.preventDefault(),Wg(H);return}if(fi.current){xn.preventDefault(),fi.current=!1;return}$(""),j(H.id),F("basic"),N(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]}),Nt&&o.jsx("span",{className:`aw-draft-badge${Nt.className}`,children:Nt.label})]}),o.jsx("small",{children:Ni})]}),o.jsx(Lp,{"aria-hidden":!0})]},H.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",L==="library"?e.length+co:vt.length," 个"]})]}),L==="evaluation"&&Qs?o.jsx(Zwe,{group:Qs,agents:e,cases:il,onChange:Yg,onRun:Xg}):L==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!re&&!ct&&!fn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[re&&!Zt&&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:"正在读取配置与运行信息…"})]})]})}),D==="integrations"&&te&&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:Hi}),Ji!=null&&o.jsxs("span",{children:["v",Ji]}),ct&&o.jsx("span",{children:"草稿"}),hi&&o.jsx("span",{children:"待更新"}),!re&&!ct&&fn&&o.jsx("span",{children:fn.label})]}),o.jsx("p",{children:ys.description||(r||v&&!ie?"正在读取智能体信息…":"暂无描述")})]}),(ct||hi||(re==null?void 0:re.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(ct||hi)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const H=ct??hi;H&&Pa(H)},disabled:Ze,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(ic,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(re==null?void 0:re.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void Da(re),disabled:Ze,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(ic,{"aria-hidden":!0}),o.jsx("span",{children:Ze?"删除中…":"删除 Agent"})]})]})]}),Lt&&aE&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(qwe,{task:Lt})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:Yu.map(H=>o.jsx("button",{type:"button",id:`agent-${H.id}-tab`,className:D===H.id?"is-active":"",role:"tab","aria-selected":D===H.id,"aria-controls":`agent-${H.id}-panel`,tabIndex:D===H.id?0:-1,onClick:()=>F(H.id),onKeyDown:ne=>{var Nt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(ne.key))return;ne.preventDefault();const pe=Yu.findIndex(Ni=>Ni.id===H.id),Ae=ne.key==="Home"?0:ne.key==="End"?Yu.length-1:(pe+(ne.key==="ArrowRight"?1:-1)+Yu.length)%Yu.length,tt=Yu[Ae];F(tt.id),(Nt=document.getElementById(`agent-${tt.id}-tab`))==null||Nt.focus()},children:H.label},H.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${D}-panel`,role:"tabpanel","aria-labelledby":`agent-${D}-tab`,children:[D==="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:(R==null?void 0:R.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(R==null?void 0:R.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(R==null?void 0:R.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(R==null?void 0:R.region)||(re==null?void 0:re.region)||(Lt==null?void 0:Lt.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:R!=null&&R.networkTypes.length?R.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(jm,{draft:ys,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},gh)})]}),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:(Zt==null?void 0:Zt.model)||ys.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:Zt!=null&&Zt.graph?h$(Zt.graph):p$(ys)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:fo.length?fo.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:mh===null?"暂不支持预览":mh.length?mh.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Ji!=null?`v${Ji}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:ct?"草稿":(Lt==null?void 0:Lt.status)==="error"?"部署失败":(Lt==null?void 0:Lt.status)==="cancelled"?"已取消":hi?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),D==="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 可确认的公开协议与地址。"})]}),z&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:z}),o.jsx("button",{type:"button",onClick:()=>ce(H=>H+1),children:"重试"})]}),!z&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${me==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),qh.map((H,ne)=>o.jsx("button",{type:"button",id:`integration-${H.id}-tab`,role:"tab","aria-selected":me===H.id,"aria-controls":`integration-${H.id}-panel`,tabIndex:me===H.id?0:-1,onClick:()=>Vg(H.id),onKeyDown:pe=>{var Nt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(pe.key))return;pe.preventDefault();const Ae=pe.key==="Home"?0:pe.key==="End"?qh.length-1:(ne+(pe.key==="ArrowRight"?1:-1)+qh.length)%qh.length,tt=qh[Ae];Vg(tt.id),(Nt=document.getElementById(`integration-${tt.id}-tab`))==null||Nt.focus()},children:H.label},H.id))]}),me==="api-server"?o.jsx(RL,{protocol:"api-server",title:"API Server",available:et,fields:[{label:"Agent",value:et?((Pu=Fe==null?void 0:Fe.apiApps)==null?void 0:Pu.join("、"))??"":""},{label:"发现接口",value:et?lw(qn,"/list-apps"):""},{label:"调用接口",value:et?lw(qn,"/run_sse"):""},{label:"鉴权方式",value:et?CL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(IL,{available:et,authType:R==null?void 0:R.authType,value:Te,visible:Oe&&!!Te,loading:ae,error:ve,onToggle:()=>void Mu()})}],example:et?Rwe(qn,pi,R==null?void 0:R.authType):""}):o.jsx(RL,{protocol:"a2a",title:"A2A",available:Nn,fields:[{label:"Agent",value:((zi=Fe==null?void 0:Fe.a2a)==null?void 0:zi.name)??""},{label:"Agent Card",value:Nn?lw(qn,"/.well-known/agent-card.json"):""},{label:"调用地址",value:as},{label:"鉴权方式",value:Nn?CL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(IL,{available:Nn,authType:R==null?void 0:R.authType,value:Te,visible:Oe&&!!Te,loading:ae,error:ve,onToggle:()=>void Mu()})}],example:Nn?jwe(as,R==null?void 0:R.authType):""})]})]}),D==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(re==null?void 0:re.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(H=>{const ne=Fwe(Pn,H),pe=il.filter(tt=>tt.kind===H).length,Ae=Ma?pe:(ne==null?void 0:ne.itemCount)??pe;return o.jsxs("button",{type:"button",onClick:()=>Dt(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:gt===H?"is-active":"","aria-pressed":gt===H,onClick:()=>lt(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:kt===H?"is-active":"","aria-pressed":kt===H,onClick:()=>Vt(H),children:H==="auto"?"自动回流":"手动回流"},H))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(Ly,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:ln,onChange:H=>Mt(H.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),La&&o.jsx("div",{className:`aw-case-toolbar${Fn?" is-active":""}`,children:Fn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Lu.length," 条"]}),o.jsx("button",{type:"button",onClick:Kg,disabled:sl.length===0||ue,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void qg(Lu),disabled:Lu.length===0||ue,children:ue?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:oE,disabled:ue,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{We(""),$n(!0)},disabled:sl.length===0||ue,children:"选择案例"})}),De&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:De}),o.jsx("div",{ref:dn,children:o.jsx(Qwe,{cases:sl,loading:_n&&sl.length===0,error:$i,runtimeBacked:!!(re!=null&&re.runtimeId),selectionMode:Fn,selectedCaseIds:yn,focusedCaseId:rt,expandedCaseIds:sn,deleting:ue,canDelete:La,onOpenCase:yh,onToggleCase:Gg,onToggleExpanded:bh,onDeleteCase:H=>void qg([H]),onRetry:()=>Ri(H=>H+1)})})]}),D==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),Sn?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):ji?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:ji}),o.jsx("button",{type:"button",onClick:()=>jn(H=>H+1),children:"重试"})]}):Un.length>0?o.jsx(Wwe,{groups:Un}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),D==="basic"&&(re||ct)&&o.jsxs("div",{className:"aw-basic-actions",children:[re&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(re),children:[o.jsx(UJ,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${Oa?" is-disabled":""}`,tabIndex:Oa?0:void 0,"aria-describedby":Oa?nl:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!Oa,"aria-busy":Se||void 0,"aria-describedby":Oa?nl:void 0,onClick:()=>{var H;return ct?O==null?void 0:O(ct):hi?O==null?void 0:O({...hi,deploymentTarget:sE}):qt?I(((H=qt.agent)==null?void 0:H.draft)??ys,qt):void 0},children:Se?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):ct||hi?"继续编辑":"更新"}),Oa&&o.jsx("span",{id:nl,className:"aw-update-disabled-reason",role:"tooltip",children:Oa})]})]})]})]}),L==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),nn&&o.jsx(OA,{variant:"danger",title:nn.title,description:nn.description,confirmLabel:Ze?"删除中...":nn.confirmLabel,closeLabel:"关闭删除确认",busy:Ze,onCancel:()=>Ci(null),onConfirm:()=>void vh()})]})}function Wwe({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:Pwe(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Uwe(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 Xwe(){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 Qwe({cases:e,loading:t=!1,error:n="",runtimeBacked:i=!1,selectionMode:s=!1,selectedCaseIds:r,focusedCaseId:a="",expandedCaseIds:l,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){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}),m&&o.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(g=>{var T;const v=g.id.startsWith("local:"),y=(r==null?void 0:r.has(g.id))??!1,x=(l==null?void 0:l.has(g.id))??!1,w=g.output.length+g.referenceOutput.length>220||(((T=g.reason)==null?void 0:T.length)??0)>120,N=u&&!v,_=g.source==="auto";return o.jsxs("div",{className:["aw-case-row",a===g.id?"is-focused":"",s?"is-selecting":"",y?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?y:void 0,onClick:()=>{if(s){N&&(f==null||f(g));return}d==null||d(g)},onKeyDown:k=>{k.target===k.currentTarget&&(k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),s?N&&(f==null||f(g)):d==null||d(g)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&N&&o.jsx("span",{className:`aw-select-marker${y?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:g.input,children:g.input||"无用户输入"})]}),g.comment&&o.jsxs("small",{title:g.comment,children:["备注:",g.comment]}),o.jsx("small",{className:"aw-case-time",children:Lwe(g.createdAt)}),(g.userId||g.sessionId)&&o.jsx("small",{title:[g.userId,g.sessionId].filter(Boolean).join(" · "),children:[g.userId,g.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:g.output,children:g.output||"无可见回复"}),g.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:g.referenceOutput,children:["Reference: ",g.referenceOutput]}),w&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:k=>{k.stopPropagation(),h==null||h(g.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:Dwe(g)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:_?g.reason:void 0,children:_?g.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:N&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:k=>{k.stopPropagation(),p==null||p(g)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(Xwe,{})})})]},g.id)})]})}function Zwe({group:e,agents:t,cases:n,onChange:i,onRun:s}){const[r,a]=b.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];b.useEffect(()=>a("config"),[e.id]);const u=f=>{i({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{i({...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:()=>s(e),disabled:!0,children:[o.jsx(CJ,{"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=>i({...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=>i({...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=>i({...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(Aa,{}),"已完成"]}),o.jsx(Lp,{"aria-hidden":!0})]},f.id))})]})})]})}function b$(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let i=.985;n<=80?i=.96:n<=150?i=.97:n<=220?i=.98:n>600&&(i=.995),t.style.setProperty("--scale",i.toString())},nN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!i_e||typeof window.requestAnimationFrame!="function"||x$&&document.visibilityState==="hidden")return n();let s=2,r=window.requestAnimationFrame(function a(){s-=1,s===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},s_e=e=>Object.keys(e).reduce((n,i)=>{const s=e[i];if(s||s===0){const r=i.startsWith("--")?"":"--",a=typeof s=="number"?`${s}px`:s;n[`${r}${i}`]=a}return n},{}),r_e=e=>{const t=b.Children.toArray(e),n=[];let i="";const s=()=>{i!==""&&(n.push(i),i="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){i+=String(r);continue}s(),n.push(r)}return s(),n},v$=e=>{const t=r_e(e),n=b.Children.count(t);return b.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:o.jsx("span",{children:i});if(b.isValidElement(i)){const s=i,{children:r,...a}=s.props;return r!=null?b.cloneElement(s,a,v$(r)):s}return i})};b.createContext(null);var a_e=typeof Il=="object"&&Il&&Il.Object===Object&&Il,o_e=typeof self=="object"&&self&&self.Object===Object&&self;a_e||o_e||Function("return this")();var l_e=typeof window<"u"?b.useLayoutEffect:b.useEffect;function c_e(){const e=b.useRef(!1);return b.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),b.useCallback(()=>e.current,[])}var OL={width:void 0,height:void 0};function u_e(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:s},r]=b.useState(OL),a=c_e(),l=b.useRef({...OL}),c=b.useRef(void 0);return c.current=e.onResize,b.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=ML(d,f,"inlineSize"),p=ML(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const g={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(g):a()&&r(g)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:i,height:s}}function ML(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 d_e(e,t){const n=b.useRef(e);l_e(()=>{n.current=e},[e]),b.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const f_e="_LoadingIndicator_7yl6f_1",h_e={LoadingIndicator:f_e},p_e=({className:e,size:t,strokeWidth:n,style:i,...s})=>o.jsx("div",{...s,className:na(h_e.LoadingIndicator,e),style:i||s_e({"indicator-size":t,"indicator-stroke":n})});function m_e(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const g_e=()=>y$,LL=(e,t=!1,n="TransitionGroup")=>{const i=[];return b.Children.forEach(e,s=>{if(s&&typeof s=="object"&&"key"in s&&s.key)i.push(s);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),i},Wu=()=>{},Xu=e=>{const t=b.useRef(e);return t.current=e,b.useCallback(n=>t.current(n),[])};function b_e(e,t,n,i){const s=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:!!s[c.component.key]}));return i==="append"?l.concat(a):a.concat(l)}function y_e(e,t,n){if((y$||e_e)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const x_e="_TransitionGroupChild_1hv1z_1",E_e={TransitionGroupChild:x_e},w$={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},v_e=e=>({...w$,enter:!e}),w_e=(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 w$}},__e=({ref:e,as:t,children:n,className:i,transitionId:s,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:g,onExitComplete:v})=>{const[y,x]=b.useReducer(w_e,v_e(a||!1)),E=b.useRef(!1),w=b.useRef(null),N=b.useRef(c);N.current=c;const _=b.useRef(u);_.current=u;const T=b.useRef(null),k=b.useCallback(C=>{const I=w.current;if(!(!I||C===T.current))switch(T.current=C,C){case"enter":f(I);break;case"enter-active":h(I);break;case"enter-complete":p(I);break;case"exit":m(I);break;case"exit-active":g(I);break;case"exit-complete":v(I);break}},[f,h,p,m,g,v]);return jt.useLayoutEffect(()=>{if(!l){let O;x({type:"exit-before"}),k("exit");const L=nN(()=>{x({type:"exit-active"}),k("exit-active"),O=window.setTimeout(()=>{k("exit-complete"),d()},_.current)});return()=>{L(),O!==void 0&&clearTimeout(O)}}if(a&&!E.current){E.current=!0;return}let C;x({type:"enter-before"}),k("enter");const I=nN(()=>{x({type:"enter-active"}),k("enter-active"),C=window.setTimeout(()=>{x({type:"done"}),k("enter-complete")},N.current)});return()=>{I(),C!==void 0&&clearTimeout(C)}},[l,a,d,k]),b.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:m_e([w,e]),className:na(i,E_e.TransitionGroupChild),"data-transition-id":s,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})},S_e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[s,r]=b.useState(i==null);return d_e(()=>r(!0),s?null:i),s?o.jsx(__e,{...e}):null},N_e=e=>{const{ref:t,as:n="span",children:i,className:s,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=g_e()}=e,p=Xu(e.onEnter??Wu),m=Xu(e.onEnterActive??Wu),g=Xu(e.onEnterComplete??Wu),v=Xu(e.onExit??Wu),y=Xu(e.onExitActive??Wu),x=Xu(e.onExitComplete??Wu);b.Children.forEach(i,_=>{if(_&&!_.key)throw new Error("Child elements of must include a `key`")});const E=b.useCallback(_=>({component:_,shouldRender:!0,removeChild:()=>{N(T=>T.filter(k=>_.key!==k.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:g,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,g,v,y,x]),[w,N]=b.useState(()=>LL(i).map(_=>({...E(_),preventMountTransition:u})));return b.useLayoutEffect(()=>{N(_=>{const T=LL(i);return b_e(T,_,E,f)})},[i,f,E]),y_e("TransitionGroup",t,b.Children.count(i)),h?o.jsx(o.Fragment,{children:b.Children.map(i,_=>o.jsx(n,{ref:t,className:s,style:a,"data-transition-id":r,children:_}))}):o.jsx(o.Fragment,{children:w.map(({component:_,...T})=>o.jsx(S_e,{...T,as:n,className:s,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:_},_.key))})},T_e="_Button_1864l_1",k_e="_ButtonInner_1864l_4",A_e="_ButtonLoader_1864l_749",cw={Button:T_e,ButtonInner:k_e,ButtonLoader:A_e},DL=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:s=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:g,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,N=b.useCallback(_=>{v||g==null||g(_)},[g,v]);return o.jsxs("button",{type:t,className:na(cw.Button,m),"data-color":n,"data-variant":i,"data-pill":s?"":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:E$,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:N,...E,children:[o.jsx(N_e,{className:cw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(p_e,{},"loader")}),o.jsx("span",{className:cw.ButtonInner,children:v$(p)})]})},C_e=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"})}),I_e="_EmptyMessage_1r5gu_1",R_e="_IconBadge_1r5gu_16",j_e="_Title_1r5gu_54",O_e="_Description_1r5gu_69",M_e="_ActionRow_1r5gu_77",kg={EmptyMessage:I_e,IconBadge:R_e,Title:j_e,Description:O_e,ActionRow:M_e},Qn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:na(kg.EmptyMessage,t),"data-fill":n,children:e}),L_e=({size:e="md",color:t="secondary",children:n,className:i})=>o.jsx("div",{className:na(kg.IconBadge,i),"data-size":e,"data-color":t,children:n}),D_e=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:na(kg.Title,t),"data-color":n,children:e}),P_e=({children:e,className:t})=>o.jsx("div",{className:na(kg.Description,t),children:e}),B_e=({children:e,className:t})=>o.jsx("div",{className:na(kg.ActionRow,t),children:e});Qn.Icon=L_e;Qn.Title=D_e;Qn.Description=P_e;Qn.ActionRow=B_e;const sr="/web/sandbox/sessions",PL=3e4,BL=33e4,U_e=6e4,F_e=6e5,uw=15e3,So=6e4,$_e=33e4,UL=40;function Mx(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 es(e){const t=Q1(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function ts(e,t){const n=await e.text().catch(()=>"");let i={};try{i=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const s=i.detail,r=s&&typeof s=="object"&&"message"in s?s.message:s??i.error??i.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function Qu(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:Lx(e.permissions)}}const Yh={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function Lx(e){if(!e||typeof e!="object")return{...Yh};const t=e,n=t.approvalPolicy,i=t.approvalsReviewer,s=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Yh.approvalPolicy,approvalsReviewer:i==="user"||i==="auto_review"?i:Yh.approvalsReviewer,sandboxMode:s==="read-only"||s==="workspace-write"||s==="danger-full-access"?s:Yh.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Yh.networkAccess}}function FL(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:Lx(t.permissions)}}function ba(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function H_e(e){const t=ba(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 z_e(e){const t=ba(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 _$(e){const t=ba(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 Y0(e){const t=ba(e),n=_$(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const i=t.messages.flatMap(s=>{const r=ba(s);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:i,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:Lx(t.permissions)}}function iN(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(i=>typeof i!="number"||!Number.isFinite(i)||i<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 V_e(e){const t=iN(e.usage);if(!t||typeof e.turnId!="string")return;const n=iN(e.threadTotal),i=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof i=="number"&&Number.isFinite(i)&&i>=0?{modelContextWindow:Math.trunc(i)}:{}}}function G_e(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 K_e(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),i=new TextDecoder;let s="",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 g;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;g={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;g={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(g)):a[v]=g,u()}function h(p){var y,x,E;let m="message";const g=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&g.push(w.slice(5).trimStart());if(g.length===0)return;let v;try{v=JSON.parse(g.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=G_e(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=V_e(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();s+=i.decode(m,{stream:!p});const g=s.split(/\r?\n\r?\n/);if(s=g.pop()??"",g.forEach(h),p)break}if(s.trim()&&h(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function Ha(e,t,{method:n="GET",body:i,options:s={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(An(`${sr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:es(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:On(s.signal,So)});if(!a.ok)throw await ts(a,r);return a.json()}const tn={async listSessions(e={}){const t=await fetch(An(sr),{method:"GET",headers:es(),signal:On(e.signal,PL)});if(!t.ok)throw await ts(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(i=>Qu(i))},async startSession(e={}){var n;const t=await fetch(An(sr),{method:"POST",headers:es({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:On(e.signal,BL)});if(!t.ok)throw await ts(t,"无法启动 AgentKit 沙箱,请稍后重试。");return Qu(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(An(`/web/${e}/sessions`),{method:"GET",headers:es(),signal:On(t.signal,PL)});if(!n.ok)throw await ts(n,`无法读取 ${e} 智能体,请稍后重试。`);const i=await n.json();if(!Array.isArray(i.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return i.sessions.map(s=>Qu(s,e))},async startAgentSession(e,t={}){var i;const n=await fetch(An(`/web/${e}/sessions`),{method:"POST",headers:es({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=t.displayName)==null?void 0:i.trim())??""}),signal:On(t.signal,BL)});if(!n.ok)throw await ts(n,`无法创建 ${e} 智能体,请稍后重试。`);return Qu(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const i=await fetch(An(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:es(),signal:On(n.signal,So)});if(!i.ok)throw await ts(i,`无法打开 ${e} 智能体。`);const s=await i.json();if(typeof s.webuiUrl!="string"||!s.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:Qu(s,e),kind:e,webuiUrl:An(s.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const i=await fetch(An(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:es(),signal:On(n.signal,So)});if(!i.ok)throw await ts(i,`无法打开 ${e} Terminal。`);const s=await i.json();return{url:S$(s.url,`${e} Terminal`),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const i=await fetch(An(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:es(),signal:On(n.signal,uw)});if(!i.ok&&i.status!==404)throw await ts(i,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(An(`${sr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:es({"Content-Type":"application/json"}),signal:On(t.signal,U_e)});if(!n.ok)throw await ts(n,"无法连接 Codex 智能体,请稍后重试。");const i=Qu(await n.json());if(i.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${i.status}。`);return i},async sendMessage(e,t={}){var i;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(An(`${sr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:es({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(i=e.skillIds)!=null&&i.length?{skillIds:e.skillIds}:{}}),signal:On(t.signal,F_e)});if(!n.ok)throw await ts(n,"沙箱对话失败,请稍后重试。");return K_e(n,t)},async getStatus(e,t={}){const n=await Ha(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),i=FL(n),s=ba(n),r=iN(s==null?void 0:s.threadTotal),a=s==null?void 0:s.modelContextWindow;return{...i,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=ba(await Ha(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(i=>{const s=H_e(i);return s?[s]:[]})},async setModel(e,t,n={}){const i=ba(await Ha(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(i==null?void 0:i.model)!="string"||!i.model)throw new Error("Sandbox 返回了无效模型。");return i.model},async listSkills(e,t=!1,n={}){const s=ba(await Ha(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(s==null?void 0:s.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return s.skills.flatMap(r=>{const a=z_e(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const i=new URLSearchParams;t.cursor&&i.set("cursor",t.cursor),t.search&&i.set("search",t.search),t.archived&&i.set("archived","true");const s=i.size?`?${i}`:"",r=ba(await Ha(e,`threads${s}`,{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=_$(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return Y0(await Ha(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return Y0(await Ha(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return Y0(await Ha(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const i=ba(await Ha(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((i==null?void 0:i.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...i.thread?{snapshot:Y0(i)}:{}}},async compactThread(e,t={}){await Ha(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(An(`${sr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:es(),signal:On(t.signal,So)});if(!n.ok)throw await ts(n,"无法读取 Codex 权限与工作空间。");return FL(await n.json())},async updatePermissions(e,t,n={}){const i=await fetch(An(`${sr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:es({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:On(n.signal,So)});if(!i.ok)throw await ts(i,"无法更新 Codex 权限。");const s=await i.json();return Lx(s.permissions)},async updateWorkspace(e,t,n={}){const i=await fetch(An(`${sr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:es({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:On(n.signal,So)});if(!i.ok)throw await ts(i,"无法更新 Codex 工作空间。");const s=await i.json();if(typeof s.cwd!="string"||!s.cwd)throw new Error("Sandbox 返回了无效工作目录。");return s.cwd},async listDirectories(e,t,n={}){const i=new URLSearchParams({path:t}),s=await fetch(An(`${sr}/${encodeURIComponent(e)}/directories?${i}`),{method:"GET",headers:es(),signal:On(n.signal,So)});if(!s.ok)throw await ts(s,"无法读取 Sandbox 目录。");const r=await s.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,i={}){const s=await fetch(An(`${sr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:es({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:On(i.signal,So)});if(!s.ok)throw await ts(s,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return $L(e,"terminal",t)},async launchBrowser(e,t={}){return $L(e,"browser",t)},async uploadFile(e,t,n={}){const i=new FormData;i.set("file",t,t.name);const s=await fetch(An(`${sr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:es(),body:i,signal:On(n.signal,$_e)});if(!s.ok)throw await ts(s,"无法上传文件到 Sandbox。");const r=await s.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(An(`${sr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:es(),signal:On(t.signal,uw)});if(!n.ok&&n.status!==404)throw await ts(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(An(`${sr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:es(),signal:On(t.signal,uw)});if(!n.ok&&n.status!==404)throw await ts(n,"无法删除 Codex 智能体。")}};async function $L(e,t,n){const i=await fetch(An(`${sr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:es(),signal:On(n.signal,So)});if(!i.ok)throw await ts(i,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:S$(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function S$(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return An(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const i=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!i)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function Od(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${i}`,n?`请求:${n}`:""].filter(Boolean).join(` +`)}function q_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:"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 Y_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:"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 W_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:"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 Um({kind:e,...t}){return e==="codex"?o.jsx(q_e,{...t}):e==="openclaw"?o.jsx(Y_e,{...t}):o.jsx(W_e,{...t})}const HL="cn-beijing",dw=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],X_e=24,Q_e=3e4,Md=new Map,Qd=new Map,Z_e=new Set;function W0(e){if(!e){Md.clear(),Qd.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of Qd)i.page.runtimes.some(s=>t.has(s.runtimeId))&&Qd.delete(n);Md.clear()}}function J_e(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 fw(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 eSe({type:e}){return e==="general"?o.jsx(qc,{}):o.jsx(Um,{kind:e})}function MA(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 tSe(e){return e==="cn-shanghai"?"上海":e==="cn-beijing"?"北京":e||"—"}function zL(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:MA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function nSe(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:Mx(e.status),createdAt:MA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function iSe(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:MA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function sSe(e,t,n){const i=`${e}:all:${t}`,s=Qd.get(i);if(s&&s.expiresAt>Date.now())return n(s.page.runtimes.map(zL)),s.page.nextToken;s&&Qd.delete(i);let r=Md.get(i);r||(r=nx({scope:e,region:"all",pageSize:X_e,nextToken:t}),Md.set(i,r),r.then(()=>Md.delete(i),()=>Md.delete(i)));const a=await r;return Qd.set(i,{page:a,expiresAt:Date.now()+Q_e}),n(a.runtimes.map(zL)),a.nextToken}function rSe({agent:e,onUse:t,onViewDetails:n,connecting:i,connected:s,showOwnership:r,deploymentTask:a,onViewDeploymentTask:l,onEditDraft:c,onDeleteDraft:u}){const d=!!(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:a?"部署中":"草稿"}):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:[a?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:tSe(e.runtime.region)}),r&&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":a?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>a?l==null?void 0:l(a):c==null?void 0:c(e.draft),children:a?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>u==null?void 0:u(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!d,"aria-label":a?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>a?l==null?void 0:l(a):n==null?void 0:n(e),children:a?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!d||i||s,"aria-busy":i||void 0,"aria-label":s?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(t==null?void 0:t(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):s?"已连接":"使用"})]})})]})}function aSe({canCreate:e,runtimeScope:t,onCreateAgent:n,onUseAgent:i,onViewAgentDetails:s,onCreateSandboxAgent:r,onUseSandboxAgent:a,onViewSandboxAgentDetails:l,sandboxRefreshKey:c=0,connectedRuntimeId:u="",hiddenRuntimeIds:d=Z_e,drafts:f=[],deploymentTasks:h=[],draftDeploymentTaskIds:p={},onViewDeploymentTask:m,onEditDraft:g,onDeleteDraft:v}){const y=b.useRef(null),x=b.useRef(null),E=b.useRef(0),w=b.useRef(0),N=b.useRef(null),[_,T]=b.useState("general"),[k,C]=b.useState(""),[I,O]=b.useState([]),[L,G]=b.useState(""),[D,F]=b.useState(!0),[A,j]=b.useState(""),[P,$]=b.useState([]),[R,Y]=b.useState(!1),[Z,B]=b.useState(""),[te,K]=b.useState(""),[z,W]=b.useState(null),q=b.useMemo(()=>f.map(iSe),[f]),ce=b.useMemo(()=>{const Se=new Map,Ue=new Map;for(const Pe of h){if(Pe.status!=="running"||(Se.set(Pe.id,Pe),!Pe.runtimeId))continue;const Ke=Ue.get(Pe.runtimeId);(!Ke||Pe.startedAt>Ke.startedAt)&&Ue.set(Pe.runtimeId,Pe)}return{byId:Se,byRuntimeId:Ue}},[h]),me=b.useCallback(Se=>{var Pe;if(Se.draft){const Ke=p[Se.draft.id];return Ke?ce.byId.get(Ke):void 0}const Ue=(Pe=Se.runtime)==null?void 0:Pe.runtimeId;return Ue?ce.byRuntimeId.get(Ue):void 0},[ce,p]),_e=b.useCallback((Se,Ue)=>{const Pe=++E.current;return F(!0),j(""),sSe(t,Se,Ke=>{E.current===Pe&&O(Q=>Ue?Ke:[...Q,...Ke])}).then(Ke=>{E.current===Pe&&G(Ke)}).catch(Ke=>{E.current===Pe&&j(Od(Ke,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{E.current===Pe&&F(!1)})},[t]);b.useEffect(()=>{if(_==="general")return O([]),G(""),_e("",!0),()=>{E.current+=1}},[_,_e]);const de=b.useCallback(async Se=>{var Ke,Q;(Ke=N.current)==null||Ke.abort();const Ue=new AbortController;N.current=Ue;const Pe=++w.current;Y(!0),B(""),$([]);try{const oe=Se==="codex"?await tn.listSessions({signal:Ue.signal}):await tn.listAgentSessions(Se,{signal:Ue.signal});if(w.current!==Pe)return;$(oe.map(nSe))}catch(oe){if((oe==null?void 0:oe.name)==="AbortError"||w.current!==Pe)return;B(Od(oe,`加载 ${((Q=dw.find(ie=>ie.id===Se))==null?void 0:Q.label)??Se}`,`GET /web/${Se==="codex"?"sandbox":Se}/sessions`))}finally{N.current===Ue&&(N.current=null),w.current===Pe&&Y(!1)}},[]);function ge(Se){var Ue;Se!==_&&(Se==="general"?(E.current+=1,O([]),G(""),j(""),F(!0)):((Ue=N.current)==null||Ue.abort(),N.current=null,w.current+=1,$([]),B(""),Y(!0)),T(Se))}b.useEffect(()=>{var Se;if(_==="general"){(Se=N.current)==null||Se.abort(),N.current=null,w.current+=1;return}return de(_),()=>{var Ue;(Ue=N.current)==null||Ue.abort(),N.current=null,w.current+=1}},[_,de,c]),b.useEffect(()=>{const Se=x.current,Ue=y.current;if(!Se||!Ue||_!=="general"||!L||D)return;const Pe=new IntersectionObserver(([Ke])=>{Ke.isIntersecting&&_e(L,!1)},{root:Ue,rootMargin:"240px 0px",threshold:.01});return Pe.observe(Se),()=>Pe.disconnect()},[_,_e,D,L]);const Oe=b.useCallback(async Se=>{if(!te){K(Se.id);try{await new Promise(Ue=>requestAnimationFrame(()=>Ue())),Se.sandbox?await a(Se.sandbox):await i(Se)}finally{K("")}}},[te,i,a]),Ee=b.useMemo(()=>{const Se=k.trim().toLocaleLowerCase(),Ue=_==="general"?[...q,...I]:P,Pe=Se?Ue.filter(oe=>oe.name.toLocaleLowerCase().includes(Se)):Ue;if(_!=="general")return Pe;const Ke=d.size>0?Pe.filter(oe=>!oe.runtime||!d.has(oe.runtime.runtimeId)):Pe,Q=Ke.findIndex(oe=>{var ie;return((ie=oe.runtime)==null?void 0:ie.runtimeId)===u});return Q<=0?Ke:[Ke[Q],...Ke.slice(0,Q),...Ke.slice(Q+1)]},[_,u,q,d,k,I,P]),ae=dw.find(Se=>Se.id===_),Ne=(ae==null?void 0:ae.label)??"智能体",ve=_==="general"?D&&I.length===0&&q.length===0:R&&P.length===0,Qe=!ve&&Ee.length===0,Me=e?_==="general"?()=>n(HL):()=>r(_):void 0,ze=e?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:t==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(J_e,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:k,onChange:Se=>C(Se.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:dw.map(Se=>o.jsx("button",{type:"button",className:`my-agent-type-pill${_===Se.id?" is-active":""}`,"aria-pressed":_===Se.id,onClick:()=>ge(Se.id),children:Se.label},Se.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!Me,title:ze,onClick:()=>Me==null?void 0:Me(),children:[o.jsx(fw,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:y,"aria-label":`${Ne}列表`,children:[ve?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:"正在加载智能体"})]}):(_==="general"?A:Z)&&Ee.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:_==="general"?A:Z}),o.jsx("button",{type:"button",onClick:()=>{_==="general"?_e("",!0):de(_)},children:"重新加载"})]}):Qe?k.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(C_e,{})}),o.jsx(Qn.Title,{children:"没有匹配的智能体"}),o.jsx(Qn.Description,{children:"请尝试搜索其他名称"})]})}):_!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(eSe,{type:_})}),o.jsxs(Qn.Title,{children:["暂无 ",Ne]}),e?o.jsx(Qn.ActionRow,{children:o.jsxs(DL,{color:"primary",size:"lg",onClick:()=>r(_),children:[o.jsx(fw,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(qc,{})}),o.jsx(Qn.Title,{children:"暂无通用智能体"}),o.jsx(Qn.Description,{children:"创建一个通用智能体,开始构建和对话"}),e?o.jsx(Qn.ActionRow,{children:o.jsxs(DL,{color:"primary",size:"lg",onClick:()=>n(HL),children:[o.jsx(fw,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[_==="general"&&A?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:A}),o.jsx("button",{type:"button",onClick:()=>void _e("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:Ee.map(Se=>{var Ue;return o.jsx(rSe,{agent:Se,deploymentTask:me(Se),onViewDeploymentTask:m,onUse:Oe,onViewDetails:Pe=>{Pe.sandbox?l(Pe.sandbox):s(Pe)},connecting:Se.id===te,connected:((Ue=Se.runtime)==null?void 0:Ue.runtimeId)===u,showOwnership:t==="all",onEditDraft:g,onDeleteDraft:W},Se.id)})})]}),_==="general"&&!A&&!ve&&(Ee.length>0||!!L)&&o.jsx("div",{className:"my-agent-load-more",ref:x,"aria-live":"polite",children:D?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):L?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),z?o.jsx(OA,{title:"删除草稿?",description:`删除后将无法恢复“${z.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>W(null),onConfirm:()=>{v==null||v(z),W(null)}}):null]})}const oSe={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},lSe="https://api.github.com",cSe=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,VL=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,uSe=/^[A-Za-z0-9._/-]+$/;function dSe(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 Ec(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 i;try{i=await fetch(`${lSe}${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 s=await i.json().catch(()=>null);if(!t.expected.includes(i.status))throw new Error(dSe(i.status,s,t.token));return{status:i.status,payload:s}}function hw(e){return e.split("/").map(encodeURIComponent).join("/")}function fSe(e){const t=new TextEncoder().encode(e);let n="";const i=32768;for(let s=0;s({...h,path:LA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Ec(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await Ec(`${a}/git/ref/heads/${hw(i)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=hSe(e.branchPrefix);await Ec(`${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 s){const m=hw(p.path),g=await Ec(`${a}/contents/${m}?ref=${encodeURIComponent(i)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&g.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(g.status===200&&!g.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await Ec(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:fSe(p.content),branch:u,...g.payload.sha?{sha:g.payload.sha}:{}}})}const h=await Ec(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:i,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 Ec(`${a}/git/refs/heads/${hw(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const PA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},BA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},T$={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},k$={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function UA(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 FA(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const pSe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,mSe=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function gSe(e){if(!pSe.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!mSe.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 bSe(e){gSe(e);const t=String.raw`name: PR Automated Review "on": pull_request: @@ -735,7 +735,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((i,[s,r])=>i.split(s).join(r),t)}const sSe={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:[CA,IA,{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:RA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=jA(e);return AA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:iSe({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)}},rSe=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,aSe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function oSe(e){if(!rSe.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!aSe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function y$(e){oSe(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((i,[s,r])=>i.split(s).join(r),t)}const ySe={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:[PA,BA,{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:UA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=FA(e);return DA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:bSe({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)}},xSe=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,ESe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function vSe(e){if(!xSe.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!ESe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function A$(e){vSe(e);const t=`name: Publish to AgentKit Runtime on: push: @@ -831,7 +831,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((i,[s,r])=>i.split(s).join(r),t)}const lSe={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:[CA,IA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},g$,b$],initialValues:RA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=jA(e),i=kA(e.projectPath,".");return AA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:y$({baseBranch:n.baseBranch,projectPath:i,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 cSe(e,t){return e==="."?t:`${e}/${t}`}function uSe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function dSe(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((i,[s,r])=>i.split(s).join(r),t)}const wSe={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:[PA,BA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},T$,k$],initialValues:UA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=FA(e),i=LA(e.projectPath,".");return DA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:A$({baseBranch:n.baseBranch,projectPath:i,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 _Se(e,t){return e==="."?t:`${e}/${t}`}function SSe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function NSe(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 @@ -939,78 +939,78 @@ __pycache__/ Dockerfile .dockerignore README.md -`}).map(([n,i])=>[n,i.split("__PROJECT_NAME__").join(e)]))}const fSe={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:[CA,IA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},g$,b$],initialValues:RA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=jA(e),i=m$(n.repository),s=kA(e.projectPath,"agentkit-basic-agent"),r=s==="."?i.split("/").slice(-1)[0]||"agentkit-basic-agent":s.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(dSe(r)).map(([l,c])=>({path:cSe(s,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:uSe(s),content:y$({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),AA({...n,repository:i,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 VeADK Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},PL=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],x$=[fSe,lSe,sSe,q_e],hSe=new Map(x$.map(e=>[e.id,e]));function pSe(e){const t=hSe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function mSe(e){const t=pSe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const OA="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 E$(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 BL(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 gSe({onOpen:e}){var c;const[t,n]=b.useState("development"),[i,s]=b.useState(""),r=b.useDeferredValue(i),a=b.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return x$.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=PL.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(BL,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:i,onChange:u=>s(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:PL.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:OA,alt:"","aria-hidden":"true"}):o.jsx(E$,{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",children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(BL,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function bSe(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 ySe({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 UL(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 xSe(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 ESe(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 ow(e,t,n){const i=t.trim();if(!i)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(i))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(i)||i.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(i.startsWith("/")||i.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(i))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(i))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(i))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(i))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const s=new URL(i);if(s.protocol!=="https:"||s.username||s.password||s.search||s.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function vSe({automation:e,onBack:t}){const n=mSe(e),[i,s]=b.useState(()=>({...n.initialValues})),[r,a]=b.useState({}),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(null),y=b.useRef(null);b.useEffect(()=>()=>{var T;return(T=y.current)==null?void 0:T.abort()},[]);const x=(T,k)=>{s(C=>({...C,[T]:k})),r[T]&&a(C=>({...C,[T]:""}))},E=T=>{var I;const k=T==="token"||((I=n.fields.find(O=>O.name===T))==null?void 0:I.required)===!0,C=ow(T,i[T],k);a(O=>({...O,[T]:C}))},w=async T=>{var O;T.preventDefault();const k={};for(const M of n.fields){const G=ow(M.name,i[M.name],M.required);G&&(k[M.name]=G)}const C=ow("token",i.token,!0);if(C&&(k.token=C),a(k),Object.keys(k).length)return;(O=y.current)==null||O.abort();const I=new AbortController;y.current=I,d(!0),c(""),v(null);try{const M=await n.submit(i,I.signal);if(y.current!==I)return;v(M),s(G=>({...G,token:""}))}catch(M){if(I.signal.aborted||y.current!==I)return;c(M instanceof Error?M.message:String(M))}finally{y.current===I&&(y.current=null,d(!1))}},N=T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)&&T.preventDefault()},_=T=>{const{name:k,label:C,placeholder:I,help:O,required:M}=T;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${k}`,children:[o.jsx("span",{children:C}),o.jsx("span",{className:`github-field-requirement${M?" is-required":""}`,children:M?"必填":"可选"})]}),o.jsx("input",{id:`github-${k}`,value:i[k],onChange:G=>x(k,G.target.value),onBlur:()=>E(k),placeholder:I,required:M,"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:O}),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(bSe,{})}),o.jsx(E$,{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:N,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:i.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(xSe,{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===i.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(ESe,{}):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(UL,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:i.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(ySe,{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,g?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",g.number," 已创建"]}),o.jsxs("a",{href:g.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(UL,{})]})]}):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})]})]})]})})]})}const wSe=/^[A-Za-z_][A-Za-z0-9_]*$/;function Kl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":wSe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function v$(e){const t=new Set,n=new Set,i=s=>{Kl(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(i)};return i(e),n}function _Se(e){return{...Es(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function SSe(e){const t=_Se(e.agentName),n=await X1(t);return rg(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 oa=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],w$=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function NSe(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 TSe(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 FL(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 kSe(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 ASe(e){if(!e||e==="upload")return 0;const t=w$.findIndex(n=>n.phase===e);return t<0?0:t}function CSe({onBack:e}){var q;const[t,n]=b.useState("feishu_assistant"),[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState("cn-beijing"),[f,h]=b.useState(!1),[p,m]=b.useState(""),[g,v]=b.useState(""),[y,x]=b.useState(""),[E,w]=b.useState("idle"),[N,_]=b.useState(null),[T,k]=b.useState(""),[C,I]=b.useState(null),O=b.useRef(null),M=b.useRef(null),G=b.useRef([]),D=b.useRef(0),F=b.useRef(null),A=b.useRef(!1),j=b.useRef(!0),P=["preparing","running","cancelling"].includes(E);b.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]),b.useEffect(()=>{var ue;if(!f)return;(ue=G.current[D.current])==null||ue.focus();const W=pe=>{pe.target instanceof Node&&O.current&&!O.current.contains(pe.target)&&h(!1)},K=pe=>{var _e;pe.key==="Escape"&&(h(!1),(_e=M.current)==null||_e.focus())};return window.addEventListener("pointerdown",W),window.addEventListener("keydown",K),()=>{window.removeEventListener("pointerdown",W),window.removeEventListener("keydown",K)}},[f]);const $=W=>{W.key==="Enter"&&(W.nativeEvent.isComposing||W.nativeEvent.keyCode===229)&&W.preventDefault()},R=()=>{const W=Kl(t.trim())??"",K=i.trim()?"":"请输入飞书 App ID",ue=r.trim()?"":"请输入飞书 App Secret";return m(W),v(K),x(ue),!W&&!K&&!ue},Y=async W=>{if(W.preventDefault(),!R()||P)return;const K=crypto.randomUUID();F.current=K,A.current=!1,w("preparing"),_(null),k(""),I(null);try{const ue=await SSe({agentName:t.trim(),appId:i.trim(),appSecret:r.trim(),region:u,taskId:K,onStage:pe=>{!j.current||A.current||(w("running"),_(pe))}});if(!j.current||A.current)return;I(ue),a(""),c(!1),w("succeeded")}catch(ue){if(!j.current||A.current)return;w("failed"),k(ue instanceof Error?ue.message:String(ue))}finally{F.current===K&&(F.current=null)}},Z=async()=>{const W=F.current;if(!(!W||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){A.current=!0,w("cancelling"),k("");try{await vB(W),j.current&&w("cancelled")}catch(K){if(A.current=!1,!j.current)return;w("failed"),k(K instanceof Error?K.message:String(K))}}},B=ASe((N==null?void 0:N.phase)??null),te=!!(t.trim()&&i.trim()&&r.trim()&&!P),z=oa.find(W=>W.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:P,children:o.jsx(NSe,{})}),o.jsx("img",{className:"feishu-integration-logo",src:OA,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:Y,onKeyDown:$,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:P,onChange:W=>{n(W.target.value),p&&m("")},onBlur:()=>m(Kl(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:O,children:[o.jsxs("button",{ref:M,type:"button",className:"feishu-region-trigger",disabled:P,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{D.current=oa.findIndex(W=>W.value===u),h(W=>!W)},onKeyDown:W=>{W.key!=="ArrowDown"&&W.key!=="ArrowUp"||(W.preventDefault(),D.current=W.key==="ArrowUp"?oa.length-1:oa.findIndex(K=>K.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:z.label}),o.jsx(TSe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:W=>{var pe;const K=G.current.findIndex(_e=>_e===document.activeElement);let ue=null;W.key==="ArrowDown"?ue=(K+1)%oa.length:W.key==="ArrowUp"?ue=(K-1+oa.length)%oa.length:W.key==="Home"?ue=0:W.key==="End"?ue=oa.length-1:W.key==="Tab"&&h(!1),ue!==null&&(W.preventDefault(),(pe=G.current[ue])==null||pe.focus())},children:oa.map(W=>o.jsx("button",{ref:K=>{const ue=oa.findIndex(pe=>pe.value===W.value);G.current[ue]=K},type:"button",role:"option","aria-selected":u===W.value,className:`feishu-region-option${u===W.value?" is-selected":""}`,onClick:()=>{var K;d(W.value),h(!1),(K=M.current)==null||K.focus()},children:W.label},W.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:i,maxLength:128,autoComplete:"off",disabled:P,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:W=>{s(W.target.value),g&&v("")},onBlur:()=>v(i.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!g,"aria-describedby":`feishu-app-id-help${g?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),g?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:g}):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:P,placeholder:"请输入 App Secret",onChange:W=>{a(W.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:P,onClick:()=>c(W=>!W),"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(wa,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(wa,{as:"strong",children:(N==null?void 0:N.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(wa,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(FL,{}),"飞书机器人 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:w$.map((W,K)=>{const ue=E==="running"&&KW.value===(C.region||u)))==null?void 0:q.label)||C.region}),C.consoleUrl?o.jsxs("a",{href:C.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(kSe,{})]}):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 Z(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!te,children:P?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}const ISe={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 RSe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(const s of n){if(i==null||typeof i!="object")return;i=i[s]}return i}function jSe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function OSe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function MA(e,t){if(jSe(e))return RSe(t,e.path);if(OSe(e)){const n=ISe[e.call],i={};for(const[s,r]of Object.entries(e.args??{}))i[s]=MA(r,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function MSe(e,t){const n=MA(e,t);return n==null?"":typeof n=="string"?n:String(n)}const _$=new Map;function ku(e,t){_$.set(e,t)}function LSe(e){return _$.get(e)}function DSe(e,t,n){const i=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let r=0;rMA(i,e.dataModel),resolveString:i=>MSe(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const s=e.components[i];if(!s)return null;const r=LSe(s.component)??PSe;return o.jsx(r,{node:s,ctx:n},i)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function USe(e){const t=b.useRef(null),n=b.useRef(!0),i=28,s=b.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:s}}function Cx({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(s=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[o.jsx(iu,{"aria-hidden":!0}),o.jsxs("span",{children:[t,s.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":`移除技能 ${s.name}`,children:o.jsx(Ns,{})}):null]},s.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(OP,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),i?o.jsx("button",{type:"button",onClick:i,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Ns,{})}):null]}):null]})}function LA(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function N$(e){var n,i,s,r;const t=LA(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((i=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:i.toUpperCase())??"VIDEO":t==="image"?((r=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function T$(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function k$(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?dB(t,e.uri):""}function FSe({kind:e}){return e==="image"?o.jsx(uk,{}):e==="video"?o.jsx(DP,{}):e==="pdf"?o.jsx(pJ,{}):o.jsx(lk,{})}function Ix({appName:e,items:t,compact:n=!1,onRemove:i}){const[s,r]=b.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=LA(a.mimeType),c=k$(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>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(LJ,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(FSe,{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:N$(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(mn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":T$(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(Gc,{className:"media-card-open"}):null]});return o.jsxs(Wn.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(CP,{src:c,children:d}):d,i?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>i(a.id),children:o.jsx(Ns,{})}):null]},a.id)})}),o.jsx(Co,{children:s?o.jsx($Se,{appName:e,item:s,onClose:()=>r(null)}):null})]})}function $Se({appName:e,item:t,onClose:n}){const i=b.useMemo(()=>k$(t,e),[e,t]),s=LA(t.mimeType),[r,a]=b.useState(""),[l,c]=b.useState(s==="text"||s==="markdown"),[u,d]=b.useState("");return b.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),b.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(i,{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()},[s,i]),o.jsx(Wn.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(Wn.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:[N$(t),t.sizeBytes?` · ${T$(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:i,download:t.name,"aria-label":"下载",children:o.jsx(H1,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Ns,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?o.jsx("img",{src:i,alt:t.name??"图片"}):null,s==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:i,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?o.jsx("iframe",{src:i,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(mn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&s==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(nh,{text:r})}):null,!l&&s==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function HSe(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 zSe(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 A$(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 VSe(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 GSe(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 KSe(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 qSe(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 YSe(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 C$(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 WSe({definition:e,label:t,done:n,open:i,onToggle:s}){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:s,"aria-expanded":i,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(wa,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(C$,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}const XSe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:HSe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:YSe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:zSe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:A$},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:VSe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:GSe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:KSe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:qSe}};function QSe(e){return XSe[e]}const I$="send_a2ui_json_to_client",ZSe=28;function JSe(e,t,n){let i=t;for(let s=0;s65535?2:1}return i}function eNe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function R$(e,t,n){const[i,s]=b.useState(()=>t?"":e),r=b.useRef(i),a=b.useRef(e),l=b.useRef(null),c=b.useRef(0),u=b.useRef(n);return a.current=e,u.current=n,b.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,s(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,g=r.current;if(!m.startsWith(g)){r.current=m,s(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[i]),b.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),i}function tNe({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 nNe(){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 iNe(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 j$({text:e,done:t,answerStarted:n=!1,streaming:i=!1,onStreamFrame:s}){const[r,a]=b.useState(!(t||n)),l=b.useRef(!1);b.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=R$(u,!t||i,s),{ref:f,onScroll:h}=USe(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(tNe,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(wa,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(ec,{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 O$(){return o.jsx(j$,{text:"",done:!1})}const sNe=b.memo(function({text:t,streaming:n,onStreamFrame:i}){const s=R$(t,n,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(nh,{text:s})}):null});function rNe({name:e,args:t,response:n,done:i}){const[s,r]=b.useState(!1),a=e===I$?"渲染 UI":e,l=QSe(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(Wn.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(WSe,{definition:l,label:iNe(e,t),done:i,open:s,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":s,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(nNe,{})}),i?o.jsx("span",{className:"tool-name",children:a}):o.jsx(wa,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(C$,{className:`tool-chevron${s?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${s?"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 aNe({block:e,onDownload:t,onPreview:n}){const[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState(null);b.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){s(`download:${p}`),a("");try{await t(p,m)}catch(g){a(g instanceof Error?g.message:String(g))}finally{s("")}}},f=async(p,m,g)=>{if(n){s(`preview:${g}`),a("");try{const v=await n(p,m);c({name:g,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{s("")}}},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`,g=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(lk,{})}),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:[g&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||i!=="",onClick:()=>void f(g.filename,g.version,p.filename),children:[i===`preview:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(LP,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||i!=="",onClick:()=>void d(p.filename,p.version),children:[i===`download:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(H1,{}),"下载"]})]})]},`${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(Ns,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function oNe({block:e,onAuth:t}){const[n,i]=b.useState(e.done?"done":"idle"),[s,r]=b.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),i("authorizing");try{await t(e),i("done")}catch(d){r(d instanceof Error?d.message:String(d)),i("idle")}}};return e.done||n==="done"?o.jsxs(Wn.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(XR,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(Wn.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(XR,{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(mn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&o.jsx("div",{className:"auth-card-err",children:s})]})}function DA({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:i,onAction:s,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(j$,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:i},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(sNe,{text:d,streaming:n,onStreamFrame:i},u):null}case"attachment":return o.jsx(Ix,{appName:t,items:c.files},u);case"artifact":return o.jsx(aNe,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(Cx,{value:c.value},u);case"tool":return c.name===I$&&c.done?null:o.jsx(rNe,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(oNe,{block:c,onAuth:r},u);case"a2ui":return S$(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(Wn.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(BSe,{surface:d,onAction:s})},`${u}-${d.surfaceId}`));default:return null}})})}function PA(e){return e.isComposing||e.keyCode===229}function lNe({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 la=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],cNe=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function $L({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(lNe,{className:"new-chat-mode__agent-icon"})}function uNe(){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 dNe({value:e,onChange:t,disabled:n=!1,temporaryEnabled:i,skillCreateEnabled:s}){const[r,a]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(()=>la.findIndex(N=>N.value===e)),f=b.useRef(null),h=b.useRef(null),p=la.find(N=>N.value===e)??la[0],m=p.value==="temporary"?"Codex 智能体":p.label;function g(N){return N.value==="temporary"?i:N.value==="skill-create"?s:!0}function v(N){return g(N)!==!0}function y(N){const _=g(N);return _===void 0?"正在检查配置":_?N.description:"管理员未配置"}b.useEffect(()=>{if(!r)return;const N=_=>{var T;(T=f.current)!=null&&T.contains(_.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[r]);function x(N){let _=u;do _=(_+N+la.length)%la.length;while(v(la[_]));d(_),c(la[_].value==="temporary")}function E(N){var _;if(!v(N)){if(N.value==="temporary"){c(!0);return}t(N.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(la.findIndex(N=>N.value===e)),a(N=>(N&&c(!1),!N))},onKeyDown:N=>{N.key==="ArrowDown"||N.key==="ArrowUp"?(N.preventDefault(),r?x(N.key==="ArrowDown"?1:-1):a(!0)):r&&(N.key==="Enter"||N.key===" ")?(N.preventDefault(),E(la[u])):r&&N.key==="Escape"&&(N.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx($L,{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:N=>{var _;N.key==="ArrowDown"||N.key==="ArrowUp"?(N.preventDefault(),x(N.key==="ArrowDown"?1:-1)):N.key==="Enter"?(N.preventDefault(),E(la[u])):N.key==="Escape"&&(N.preventDefault(),a(!1),c(!1),(_=h.current)==null||_.focus())},children:la.map((N,_)=>{const T=N.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===N.value,"aria-haspopup":T?"menu":void 0,"aria-expanded":T?l:void 0,"aria-disabled":v(N),disabled:v(N),className:`new-chat-mode__option${_===u?" is-active":""}`,onMouseEnter:()=>{d(_),c(N.value==="temporary")},onClick:()=>E(N),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx($L,{mode:N.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[N.label,N.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(N)})]}),T?o.jsx(uNe,{}):e===N.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]},N.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(Lm,{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:"在沙箱中执行任务"})]})]}),cNe.map(({label:N,kind:_})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx(Lm,{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:N}),o.jsx("span",{children:"暂不可用"})]})]},N))]}):null]}):null]})}const Xu=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],fNe=15,hNe=15e3,pNe=120,mNe=180;function HL(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 gNe(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 lw({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(Kc,{className:t}):o.jsx(Lm,{kind:e,className:t})}function bNe({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:i=!1,onSelectRuntime:s,onSelectSandboxSession:r}){var ge;const[a,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(0),[h,p]=b.useState(0),[m,g]=b.useState("types"),[v,y]=b.useState(!1),[x,E]=b.useState([]),[w,N]=b.useState([]),[_,T]=b.useState(null),[k,C]=b.useState(""),[I,O]=b.useState(!1),[M,G]=b.useState(""),[D,F]=b.useState(""),A=b.useRef(null),j=b.useRef(null),P=b.useRef(null),$=b.useRef(0),R=b.useRef(null),Y=b.useRef(null),Z=b.useRef(null),B=((ge=Xu.find(oe=>oe.id===c))==null?void 0:ge.label)??"智能体",te=b.useCallback((oe=!1)=>{var Te;Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),l(!1),u(null),g("types"),y(!1),oe&&((Te=j.current)==null||Te.focus())},[]),z=b.useCallback(async(oe="",Te=!1)=>{const ve=++$.current;let Xe;O(!0),G("");try{const De=await Promise.race([W1({scope:n,region:"all",pageSize:fNe,nextToken:oe}),new Promise((ze,Ne)=>{Xe=window.setTimeout(()=>{Ne(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},hNe)})]);if($.current!==ve)return;E(ze=>{const Ne=Te?De.runtimes:[...ze,...De.runtimes];return Ne.filter((Pe,Fe)=>Ne.findIndex(qe=>qe.runtimeId===Pe.runtimeId)===Fe)}),C(De.nextToken),p(0)}catch(De){if($.current!==ve)return;G(Rd(De,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(Xe),$.current===ve&&O(!1)}},[n]),q=b.useCallback(async oe=>{var Xe,De;(Xe=R.current)==null||Xe.abort();const Te=new AbortController;R.current=Te;const ve=++$.current;O(!0),G(""),N([]);try{const ze=oe==="codex"?await nn.listSessions({signal:Te.signal}):await nn.listAgentSessions(oe,{signal:Te.signal});if($.current!==ve)return;N(ze),T(oe),p(0)}catch(ze){if((ze==null?void 0:ze.name)==="AbortError"||$.current!==ve)return;G(Rd(ze,`加载 ${((De=Xu.find(Ne=>Ne.id===oe))==null?void 0:De.label)??oe}`,`GET /web/${oe==="codex"?"sandbox":oe}/sessions`)),T(oe)}finally{R.current===Te&&(R.current=null),$.current===ve&&O(!1)}},[]);b.useEffect(()=>{!a||c!=="general"||x.length>0||I||M||z("",!0)},[c,M,z,I,a,x.length]),b.useEffect(()=>{!a||c===null||c==="general"||_===c||q(c)},[c,q,_,a]),b.useEffect(()=>{if(!a)return;const oe=Te=>{var ve;(ve=A.current)!=null&&ve.contains(Te.target)||te()};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[te,a]),b.useEffect(()=>()=>{var oe;$.current+=1,(oe=R.current)==null||oe.abort(),Y.current!==null&&window.clearTimeout(Y.current),Z.current!==null&&window.clearTimeout(Z.current)},[]);function W(oe,Te=!1){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),l(!0),u(Te?"general":null),f(0),g("types"),y(Te),oe&&requestAnimationFrame(()=>{var ve;return(ve=P.current)==null?void 0:ve.focus()})}function K(){i||a||Y.current!==null||(Y.current=window.setTimeout(()=>{Y.current=null,W(!1)},pNe))}function ue(){Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)}function pe(){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),!(!a||Z.current!==null)&&(Z.current=window.setTimeout(()=>{Z.current=null,te()},mNe))}function _e(oe){var Xe;const Te=(oe+Xu.length)%Xu.length,ve=Xu[Te].id;ve!==c&&($.current+=1,(Xe=R.current)==null||Xe.abort(),R.current=null,O(!1),G("")),f(Te),u(ve),p(0)}async function fe(oe){if(!D){F(oe.runtimeId),G("");try{await s(oe),te(!0)}catch(Te){G(Rd(Te,"连接通用智能体"))}finally{F("")}}}async function me(oe){if(!D){F(oe.id),G("");try{await r(oe),te(!0)}catch(Te){G(Rd(Te,`打开 ${B}`))}finally{F("")}}}function Re(oe){if(oe.key==="Escape"){oe.preventDefault(),te(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(oe.key)&&y(!0),m==="types"){oe.key==="ArrowDown"||oe.key==="ArrowUp"?(oe.preventDefault(),_e(d+(oe.key==="ArrowDown"?1:-1))):(oe.key==="ArrowRight"||oe.key==="Enter")&&(oe.preventDefault(),c===null&&_e(d),g("runtimes"));return}if(oe.key==="ArrowLeft")oe.preventDefault(),g("types");else if((c==="general"?x:w).length>0&&(oe.key==="ArrowDown"||oe.key==="ArrowUp")){oe.preventDefault();const Te=oe.key==="ArrowDown"?1:-1,ve=c==="general"?x.length:w.length;p(Xe=>(Xe+Te+ve)%ve)}else oe.key==="Enter"&&c==="general"&&x[h]?(oe.preventDefault(),fe(x[h])):oe.key==="Enter"&&c!=="general"&&w[h]&&(oe.preventDefault(),me(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:A,onPointerEnter:oe=>{oe.pointerType==="mouse"&&ue()},onPointerLeave:oe=>{oe.pointerType==="mouse"&&pe()},children:[o.jsxs("button",{ref:j,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:i,onPointerEnter:oe=>{oe.pointerType==="mouse"&&K()},onClick:()=>a?te():W(!0),onKeyDown:oe=>{oe.key==="ArrowDown"||oe.key==="ArrowUp"?(oe.preventDefault(),a||W(!0,!0)):oe.key==="Escape"&&a&&(oe.preventDefault(),te(!0))},children:[o.jsx(Kc,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(HL,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:P,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Re,onPointerMove:oe=>{oe.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:Xu.map((oe,Te)=>o.jsxs("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":c===oe.id,className:`new-chat-agent-picker__type${v&&m==="types"&&d===Te?" is-keyboard-active":""}`,onMouseEnter:()=>_e(Te),onClick:()=>{_e(Te),g("runtimes")},children:[o.jsx(lw,{type:oe.id}),o.jsx("span",{children:oe.label}),o.jsx(HL,{className:"new-chat-agent-picker__nested-chevron"})]},oe.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${B}列表`,children:c!=="general"&&I&&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"&&M&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:M}),o.jsx("button",{type:"button",onClick:()=>void q(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(qn.Icon,{size:"sm",children:o.jsx(lw,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(qn.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",B]})}),o.jsx(qn.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((oe,Te)=>{const ve=D===oe.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Te?" is-keyboard-active":""}`,disabled:!!D,title:`${oe.displayName||B} · ${oe.id}`,onMouseEnter:()=>p(Te),onClick:()=>void me(oe),children:[o.jsx(lw,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:oe.displayName||B}),o.jsx("small",{children:ve?"正在打开":kx(oe.status)})]},oe.id)})}):I&&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"}),"正在加载智能体"]}):M&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:M}),o.jsx("button",{type:"button",onClick:()=>void z("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(qn.Icon,{size:"sm",children:o.jsx(Kc,{})}),o.jsx(qn.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(qn.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((oe,Te)=>{const ve=D===oe.runtimeId,Xe=oe.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":Xe,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Te?" is-keyboard-active":""}`,disabled:!!D,title:oe.name,onMouseEnter:()=>p(Te),onClick:()=>void fe(oe),children:[o.jsx(Kc,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:oe.name}),ve?o.jsx("small",{children:"正在连接"}):Xe?o.jsx(gNe,{className:"new-chat-agent-picker__check"}):null]},oe.runtimeId)})}),M?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:M}):null,k?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:I||!!D,onClick:()=>void z(k),children:I?"加载中":"加载更多"}):null]})}):null]}):null]})}const M$={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},yNe={ppt:[],image:[],video:["video_task_query"]},BA=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function zL(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 VL=[{value:"ppt",label:"PPT",icon:IJ,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:uk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:A$,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function xNe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:i,value:s,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:g=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:N=!1,showModeSelector:_=!1,onModeChange:T,onTaskChange:k,temporaryEnabled:C,skillCreateEnabled:I,harnessEnabled:O=!1,builtinTools:M=[],showAgentPicker:G=!1,agentPickerDisabled:D=!1,selectedRuntimeId:F="",runtimeScope:A="mine",onSelectRuntime:j,onSelectSandboxSession:P}){const $=b.useRef(null),R=b.useRef(null),Y=b.useRef(null),Z=b.useRef(null),[B,te]=b.useState(!1),[z,q]=b.useState(null),[W,K]=b.useState(0),[ue,pe]=b.useState(!1);async function _e(){if(e)try{await navigator.clipboard.writeText(e),pe(!0),setTimeout(()=>pe(!1),1500)}catch{pe(!1)}}b.useLayoutEffect(()=>{const ie=$.current;ie&&(ie.style.height="auto",ie.style.height=`${Math.min(ie.scrollHeight,200)}px`)},[s]);const fe=E==="skill-create";b.useEffect(()=>{fe&&(te(!1),q(null))},[fe]);const me=!fe&&d.some(ie=>ie.status!=="ready"),Re=!l&&!c&&!me&&(s.trim().length>0||!fe&&d.length>0),ge=fe?`描述你想创建的 Skill,将使用 ${BA.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${i} 发消息…`,oe=(z==null?void 0:z.query.toLocaleLowerCase())??"",Te=(z==null?void 0:z.kind)==="skill"?f.filter(ie=>!p.skills.some(be=>be.name===ie.name)).filter(ie=>`${ie.name} ${ie.description}`.toLocaleLowerCase().includes(oe)).map(ie=>({kind:"skill",value:ie})):(z==null?void 0:z.kind)==="agent"?h.filter(ie=>`${ie.name} ${ie.description}`.toLocaleLowerCase().includes(oe)).map(ie=>({kind:"agent",value:ie})):[];function ve(ie){var be;te(!1),q(null),(be=ie.current)==null||be.click()}function Xe(ie){k==null||k(ie.value),te(!1),q(null),requestAnimationFrame(()=>{var be,Ue;(be=$.current)==null||be.focus(),(Ue=$.current)==null||Ue.setSelectionRange(s.length,s.length)})}function De(ie){r(ie),te(!1),q(null),requestAnimationFrame(()=>{var Ye,yt,lt;(Ye=$.current)==null||Ye.focus();const be=ie.indexOf("【"),Ue=ie.indexOf("】",be+1);be>=0&&Ue>be?(yt=$.current)==null||yt.setSelectionRange(be+1,Ue):(lt=$.current)==null||lt.setSelectionRange(ie.length,ie.length)})}function ze(){k==null||k(null),r(""),te(!1),q(null),requestAnimationFrame(()=>{var ie,be;(ie=$.current)==null||ie.focus(),(be=$.current)==null||be.setSelectionRange(0,0)})}const Ne=VL.find(ie=>ie.value===w),Pe=VL.filter(ie=>M$[ie.value].every(be=>M.includes(be)));function Fe(ie,be){const Ue=ie.slice(0,be),Ye=/(^|\s)([/@])([^\s/@]*)$/.exec(Ue);if(!Ye){q(null);return}const yt=Ye[2].length+Ye[3].length,lt={kind:Ye[2]==="/"?"skill":"agent",query:Ye[3],start:be-yt,end:be},ln=!z||z.kind!==lt.kind||z.query!==lt.query||z.start!==lt.start||z.end!==lt.end;q(lt),ln&&K(0),te(!1)}function qe(ie){if(!z)return;const be=s.slice(0,z.start)+s.slice(z.end);r(be),ie.kind==="skill"?v({...p,skills:[...p.skills,ie.value]}):v({skills:[],targetAgent:ie.value});const Ue=z.start;q(null),requestAnimationFrame(()=>{var Ye,yt;(Ye=$.current)==null||Ye.focus(),(yt=$.current)==null||yt.setSelectionRange(Ue,Ue)})}function Q(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function ae(ie){const be=ie.target.files?Array.from(ie.target.files):[];be.length&&y(be),ie.target.value=""}return o.jsxs("div",{className:`composer${N?" composer--new-chat":""}${fe?" composer--skill-mode":""}${Ne?` composer--has-task composer--task-${Ne.value}`:""}`,children:[fe?null:o.jsx(Cx,{value:p,onRemoveSkill:ie=>v({...p,skills:p.skills.filter(be=>be.name!==ie)}),onRemoveAgent:()=>v({skills:[]})}),!fe&&d.length>0&&o.jsx(Ix,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[z?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":z.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[z.kind==="skill"?o.jsx(iu,{}):o.jsx(OP,{}),o.jsx("span",{children:z.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:z.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(mn,{className:"spin"})," 正在读取 Agent 能力…"]}):Te.length===0?o.jsx("div",{className:"composer-command-empty",children:z.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:Te.map((ie,be)=>o.jsxs("button",{type:"button",role:"option","aria-selected":be===W,className:`composer-command-item${be===W?" is-active":""}`,onMouseDown:Ue=>{Ue.preventDefault(),qe(ie)},onMouseEnter:()=>K(be),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${ie.kind}`,children:ie.kind==="skill"?o.jsx(iu,{}):o.jsx(nu,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[ie.kind==="skill"?"/":"@",ie.value.name]}),o.jsx("span",{children:ie.value.description||(ie.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:be===W?"↵":ie.kind==="skill"?"技能":"Agent"})]},`${ie.kind}-${ie.value.name}`))})]}):null,fe?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!g,onClick:()=>{q(null),te(ie=>!ie)},children:o.jsx(ws,{className:"icon"})}),B&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>te(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(R),children:[o.jsx(uk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(Y),children:[o.jsx(lk,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(Z),children:[o.jsx(DP,{className:"icon"}),"上传视频"]})]})]})]}),G&&j&&P?o.jsx(bNe,{selectedAgentName:n?i:"",selectedRuntimeId:F,runtimeScope:A,disabled:D,onSelectRuntime:j,onSelectSandboxSession:P}):null,_&&T?o.jsx(dNe,{value:E,onChange:T,disabled:c,temporaryEnabled:C,skillCreateEnabled:I}):null,N&&E==="agent"&&Ne&&k?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${Ne.value}`,"aria-label":`取消${Ne.label}任务`,disabled:c,onClick:ze,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(Ne.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ns,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:Ne.label})]}):null,N&&fe&&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(zL,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ns,{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:N?4:1,value:s,disabled:l,placeholder:ge,"aria-expanded":!!z,onChange:ie=>{r(ie.target.value),fe||Fe(ie.target.value,ie.target.selectionStart)},onSelect:ie=>{fe||Fe(ie.currentTarget.value,ie.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>q(null),0),onKeyDown:ie=>{if(!PA(ie.nativeEvent)){if(z){if(ie.key==="ArrowDown"&&Te.length>0){ie.preventDefault(),K(be=>(be+1)%Te.length);return}if(ie.key==="ArrowUp"&&Te.length>0){ie.preventDefault(),K(be=>(be-1+Te.length)%Te.length);return}if((ie.key==="Enter"||ie.key==="Tab")&&Te[W]){ie.preventDefault(),qe(Te[W]);return}if(ie.key==="Escape"){ie.preventDefault(),q(null);return}}if(ie.key==="Backspace"&&!s&&ie.currentTarget.selectionStart===0&&ie.currentTarget.selectionEnd===0){Q();return}ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Re&&a())}}}),N&&s.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:ge},ge):null]}),o.jsx(Wn.button,{type:"button",className:"comp-send",disabled:!Re,onClick:a,"aria-label":"发送",whileTap:Re?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(mn,{className:"icon spin"}):o.jsx(jP,{className:"icon"})})]}),N&&E==="agent"&&O&&!Ne?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[Pe.map(ie=>{const be=ie.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>Xe(ie),children:[o.jsx(be,{}),o.jsx("span",{children:ie.label})]},ie.value)}),I===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>T==null?void 0:T("skill-create"),children:[o.jsx(zL,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,N&&E==="agent"&&Ne?o.jsx("div",{className:"prompt-suggestions","aria-label":`${Ne.label}企业提示词`,children:Ne.prompts.map(ie=>{const be=Ne.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>De(ie),children:[o.jsx(be,{}),o.jsx("span",{children:ie})]},ie)})}):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:ue?"已复制":"复制会话 ID","aria-label":ue?"已复制会话 ID":"复制会话 ID",onClick:()=>void _e(),children:ue?o.jsx(ka,{}):o.jsx($1,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:Y,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:Z,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:ae})]})}function L$({title:e,sub:t,cards:n,footer:i}){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((s,r)=>o.jsxs(Wn.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.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(s.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:s.title}),o.jsx("span",{className:"stk-card-desc",children:s.desc})]}),s.status&&o.jsx("span",{className:"stk-card-status",children:s.status}),o.jsx(ec,{className:"stk-card-arrow"})]},s.key))}),i&&o.jsx("div",{className:"stk-footer",children:i})]})}const UA=Symbol.for("yaml.alias"),QS=Symbol.for("yaml.document"),ql=Symbol.for("yaml.map"),D$=Symbol.for("yaml.pair"),to=Symbol.for("yaml.scalar"),sh=Symbol.for("yaml.seq"),Qr=Symbol.for("yaml.node.type"),rh=e=>!!e&&typeof e=="object"&&e[Qr]===UA,_g=e=>!!e&&typeof e=="object"&&e[Qr]===QS,Sg=e=>!!e&&typeof e=="object"&&e[Qr]===ql,Pi=e=>!!e&&typeof e=="object"&&e[Qr]===D$,Fn=e=>!!e&&typeof e=="object"&&e[Qr]===to,Ng=e=>!!e&&typeof e=="object"&&e[Qr]===sh;function Mi(e){if(e&&typeof e=="object")switch(e[Qr]){case ql:case sh:return!0}return!1}function Di(e){if(e&&typeof e=="object")switch(e[Qr]){case UA:case ql:case to:case sh:return!0}return!1}const P$=e=>(Fn(e)||Mi(e))&&!!e.anchor,Ic=Symbol("break visit"),ENe=Symbol("skip children"),Gp=Symbol("remove node");function ah(e,t){const n=vNe(t);_g(e)?Od(null,e.contents,n,Object.freeze([e]))===Gp&&(e.contents=null):Od(null,e,n,Object.freeze([]))}ah.BREAK=Ic;ah.SKIP=ENe;ah.REMOVE=Gp;function Od(e,t,n,i){const s=wNe(e,t,n,i);if(Di(s)||Pi(s))return _Ne(e,i,s),Od(e,s,n,i);if(typeof s!="symbol"){if(Mi(t)){i=Object.freeze(i.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>SNe[t]);class zs{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},zs.defaultYaml,t),this.tags=Object.assign({},zs.defaultTags,n)}clone(){const t=new zs(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new zs(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:zs.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},zs.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:zs.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},zs.defaultTags),this.atNextDocument=!1);const i=t.trim().split(/[ \t]+/),s=i.shift();switch(s){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;const[r,a]=i;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=i;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 ${s}`,!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[,i,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const r=this.tags[i];if(r)try{return r+decodeURIComponent(s)}catch(a){return n(String(a)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+NNe(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags);let s;if(t&&i.length>0&&Di(t.contents)){const r={};ah(t.contents,(a,l)=>{Di(l)&&l.tag&&(r[l.tag]=!0)}),s=Object.keys(r)}else s=[];for(const[r,a]of i)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` -`)}}zs.defaultYaml={explicit:!1,version:"1.2"};zs.defaultTags={"!!":"tag:yaml.org,2002:"};function B$(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 U$(e){const t=new Set;return ah(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function F$(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function TNe(e,t){const n=[],i=new Map;let s=null;return{onAnchor:r=>{n.push(r),s??(s=U$(e));const a=F$(t,s);return s.add(a),a},setAnchors:()=>{for(const r of n){const a=i.get(r);if(typeof a=="object"&&a.anchor&&(Fn(a.node)||Mi(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:i}}function Md(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let s=0,r=i.length;sWr(i,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!P$(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=r=>{i.res=r,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class FA{constructor(t){Object.defineProperty(this,Qr,{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:i,onAnchor:s,reviver:r}={}){if(!_g(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 i=="number"?i:100},l=Wr(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof r=="function"?Md(r,{"":l},"",l):l}}class $A extends FA{constructor(t){super(UA),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 i;n!=null&&n.aliasResolveCache?i=n.aliasResolveCache:(i=[],ah(t,{Node:(r,a)=>{(rh(a)||P$(a))&&i.push(a)}}),n&&(n.aliasResolveCache=i));let s;for(const r of i){if(r===this)break;r.anchor===this.source&&(s=r)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:i,doc:s,maxAliasCount:r}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=i.get(a);if(l||(Wr(a,null,n),l=i.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=Ub(s,a,i)),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,i){const s=`*${this.source}`;if(t){if(B$(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`${s} `}return s}}function Ub(e,t,n){if(rh(t)){const i=t.resolve(e),s=n&&i&&n.get(i);return s?s.count*s.aliasCount:0}else if(Mi(t)){let i=0;for(const s of t.items){const r=Ub(e,s,n);r>i&&(i=r)}return i}else if(Pi(t)){const i=Ub(e,t.key,n),s=Ub(e,t.value,n);return Math.max(i,s)}return 1}const $$=e=>!e||typeof e!="function"&&typeof e!="object";class Ct extends FA{constructor(t){super(to),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Wr(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 kNe="tag:yaml.org,2002:";function ANe(e,t,n){if(t){const i=n.filter(r=>r.tag===t),s=i.find(r=>!r.format)??i[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(i=>{var s;return((s=i.identify)==null?void 0:s.call(i,e))&&!i.format})}function Dm(e,t,n){var f,h,p;if(_g(e)&&(e=e.contents),Di(e))return e;if(Pi(e)){const m=(h=(f=n.schema[ql]).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:i,onAnchor:s,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(i&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=s(e)),new $A(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=kNe+t.slice(2));let u=ANe(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[ql]:Symbol.iterator in Object(e)?a[sh]:a[ql]}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 r1(e,t,n){let i=n;for(let s=t.length-1;s>=0;--s){const r=t[s];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=i,i=a}else i=new Map([[r,i]])}return Dm(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const cp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let H$=class extends FA{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(i=>Di(i)||Pi(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(cp(t))this.add(n);else{const[i,...s]=t,r=this.get(i,!0);if(Mi(r))r.addIn(s,n);else if(r===void 0&&this.schema)this.set(i,r1(this.schema,s,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}deleteIn(t){const[n,...i]=t;if(i.length===0)return this.delete(n);const s=this.get(n,!0);if(Mi(s))return s.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){const[i,...s]=t,r=this.get(i,!0);return s.length===0?!n&&Fn(r)?r.value:r:Mi(r)?r.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Pi(n))return!1;const i=n.value;return i==null||t&&Fn(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){const[n,...i]=t;if(i.length===0)return this.has(n);const s=this.get(n,!0);return Mi(s)?s.hasIn(i):!1}setIn(t,n){const[i,...s]=t;if(s.length===0)this.set(i,n);else{const r=this.get(i,!0);if(Mi(r))r.setIn(s,n);else if(r===void 0&&this.schema)this.set(i,r1(this.schema,s,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}};const CNe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ro(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Dc=(e,t,n)=>e.endsWith(` -`)?Ro(n,t):n.includes(` +`}).map(([n,i])=>[n,i.split("__PROJECT_NAME__").join(e)]))}const TSe={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:[PA,BA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},T$,k$],initialValues:UA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=FA(e),i=N$(n.repository),s=LA(e.projectPath,"agentkit-basic-agent"),r=s==="."?i.split("/").slice(-1)[0]||"agentkit-basic-agent":s.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(NSe(r)).map(([l,c])=>({path:_Se(s,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:SSe(s),content:A$({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),DA({...n,repository:i,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 VeADK Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},GL=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],C$=[TSe,wSe,ySe,oSe],kSe=new Map(C$.map(e=>[e.id,e]));function ASe(e){const t=kSe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function CSe(e){const t=ASe(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 I$(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 KL(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 ISe({onOpen:e}){var c;const[t,n]=b.useState("development"),[i,s]=b.useState(""),r=b.useDeferredValue(i),a=b.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return C$.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=GL.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(KL,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:i,onChange:u=>s(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:GL.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"}):o.jsx(I$,{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",children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(KL,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function RSe(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 jSe({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 qL(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 OSe(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 MSe(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 pw(e,t,n){const i=t.trim();if(!i)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(i))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(i)||i.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(i.startsWith("/")||i.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(i))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(i))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(i))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(i))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const s=new URL(i);if(s.protocol!=="https:"||s.username||s.password||s.search||s.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function LSe({automation:e,onBack:t}){const n=CSe(e),[i,s]=b.useState(()=>({...n.initialValues})),[r,a]=b.useState({}),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(null),y=b.useRef(null);b.useEffect(()=>()=>{var T;return(T=y.current)==null?void 0:T.abort()},[]);const x=(T,k)=>{s(C=>({...C,[T]:k})),r[T]&&a(C=>({...C,[T]:""}))},E=T=>{var I;const k=T==="token"||((I=n.fields.find(O=>O.name===T))==null?void 0:I.required)===!0,C=pw(T,i[T],k);a(O=>({...O,[T]:C}))},w=async T=>{var O;T.preventDefault();const k={};for(const L of n.fields){const G=pw(L.name,i[L.name],L.required);G&&(k[L.name]=G)}const C=pw("token",i.token,!0);if(C&&(k.token=C),a(k),Object.keys(k).length)return;(O=y.current)==null||O.abort();const I=new AbortController;y.current=I,d(!0),c(""),v(null);try{const L=await n.submit(i,I.signal);if(y.current!==I)return;v(L),s(G=>({...G,token:""}))}catch(L){if(I.signal.aborted||y.current!==I)return;c(L instanceof Error?L.message:String(L))}finally{y.current===I&&(y.current=null,d(!1))}},N=T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)&&T.preventDefault()},_=T=>{const{name:k,label:C,placeholder:I,help:O,required:L}=T;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${k}`,children:[o.jsx("span",{children:C}),o.jsx("span",{className:`github-field-requirement${L?" is-required":""}`,children:L?"必填":"可选"})]}),o.jsx("input",{id:`github-${k}`,value:i[k],onChange:G=>x(k,G.target.value),onBlur:()=>E(k),placeholder:I,required:L,"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:O}),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(RSe,{})}),o.jsx(I$,{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:N,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:i.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(OSe,{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===i.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(MSe,{}):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(qL,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:i.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(jSe,{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,g?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",g.number," 已创建"]}),o.jsxs("a",{href:g.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(qL,{})]})]}):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})]})]})]})})]})}const DSe=/^[A-Za-z_][A-Za-z0-9_]*$/;function Yl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":DSe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function R$(e){const t=new Set,n=new Set,i=s=>{Yl(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(i)};return i(e),n}function PSe(e){return{..._s(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function BSe(e){const t=PSe(e.agentName),n=await ix(t);return ug(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 la=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],j$=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function USe(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 FSe(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 YL(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 $Se(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 HSe(e){if(!e||e==="upload")return 0;const t=j$.findIndex(n=>n.phase===e);return t<0?0:t}function zSe({onBack:e}){var z;const[t,n]=b.useState("feishu_assistant"),[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState("cn-beijing"),[f,h]=b.useState(!1),[p,m]=b.useState(""),[g,v]=b.useState(""),[y,x]=b.useState(""),[E,w]=b.useState("idle"),[N,_]=b.useState(null),[T,k]=b.useState(""),[C,I]=b.useState(null),O=b.useRef(null),L=b.useRef(null),G=b.useRef([]),D=b.useRef(0),F=b.useRef(null),A=b.useRef(!1),j=b.useRef(!0),P=["preparing","running","cancelling"].includes(E);b.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]),b.useEffect(()=>{var ce;if(!f)return;(ce=G.current[D.current])==null||ce.focus();const W=me=>{me.target instanceof Node&&O.current&&!O.current.contains(me.target)&&h(!1)},q=me=>{var _e;me.key==="Escape"&&(h(!1),(_e=L.current)==null||_e.focus())};return window.addEventListener("pointerdown",W),window.addEventListener("keydown",q),()=>{window.removeEventListener("pointerdown",W),window.removeEventListener("keydown",q)}},[f]);const $=W=>{W.key==="Enter"&&(W.nativeEvent.isComposing||W.nativeEvent.keyCode===229)&&W.preventDefault()},R=()=>{const W=Yl(t.trim())??"",q=i.trim()?"":"请输入飞书 App ID",ce=r.trim()?"":"请输入飞书 App Secret";return m(W),v(q),x(ce),!W&&!q&&!ce},Y=async W=>{if(W.preventDefault(),!R()||P)return;const q=crypto.randomUUID();F.current=q,A.current=!1,w("preparing"),_(null),k(""),I(null);try{const ce=await BSe({agentName:t.trim(),appId:i.trim(),appSecret:r.trim(),region:u,taskId:q,onStage:me=>{!j.current||A.current||(w("running"),_(me))}});if(!j.current||A.current)return;I(ce),a(""),c(!1),w("succeeded")}catch(ce){if(!j.current||A.current)return;w("failed"),k(ce instanceof Error?ce.message:String(ce))}finally{F.current===q&&(F.current=null)}},Z=async()=>{const W=F.current;if(!(!W||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){A.current=!0,w("cancelling"),k("");try{await RB(W),j.current&&w("cancelled")}catch(q){if(A.current=!1,!j.current)return;w("failed"),k(q instanceof Error?q.message:String(q))}}},B=HSe((N==null?void 0:N.phase)??null),te=!!(t.trim()&&i.trim()&&r.trim()&&!P),K=la.find(W=>W.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:P,children:o.jsx(USe,{})}),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:Y,onKeyDown:$,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:P,onChange:W=>{n(W.target.value),p&&m("")},onBlur:()=>m(Yl(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:O,children:[o.jsxs("button",{ref:L,type:"button",className:"feishu-region-trigger",disabled:P,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{D.current=la.findIndex(W=>W.value===u),h(W=>!W)},onKeyDown:W=>{W.key!=="ArrowDown"&&W.key!=="ArrowUp"||(W.preventDefault(),D.current=W.key==="ArrowUp"?la.length-1:la.findIndex(q=>q.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:K.label}),o.jsx(FSe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:W=>{var me;const q=G.current.findIndex(_e=>_e===document.activeElement);let ce=null;W.key==="ArrowDown"?ce=(q+1)%la.length:W.key==="ArrowUp"?ce=(q-1+la.length)%la.length:W.key==="Home"?ce=0:W.key==="End"?ce=la.length-1:W.key==="Tab"&&h(!1),ce!==null&&(W.preventDefault(),(me=G.current[ce])==null||me.focus())},children:la.map(W=>o.jsx("button",{ref:q=>{const ce=la.findIndex(me=>me.value===W.value);G.current[ce]=q},type:"button",role:"option","aria-selected":u===W.value,className:`feishu-region-option${u===W.value?" is-selected":""}`,onClick:()=>{var q;d(W.value),h(!1),(q=L.current)==null||q.focus()},children:W.label},W.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:i,maxLength:128,autoComplete:"off",disabled:P,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:W=>{s(W.target.value),g&&v("")},onBlur:()=>v(i.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!g,"aria-describedby":`feishu-app-id-help${g?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),g?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:g}):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:P,placeholder:"请输入 App Secret",onChange:W=>{a(W.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:P,onClick:()=>c(W=>!W),"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(_a,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(_a,{as:"strong",children:(N==null?void 0:N.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(_a,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(YL,{}),"飞书机器人 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:j$.map((W,q)=>{const ce=E==="running"&&qW.value===(C.region||u)))==null?void 0:z.label)||C.region}),C.consoleUrl?o.jsxs("a",{href:C.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx($Se,{})]}):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 Z(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!te,children:P?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}const VSe={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 GSe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(const s of n){if(i==null||typeof i!="object")return;i=i[s]}return i}function KSe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function qSe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function HA(e,t){if(KSe(e))return GSe(t,e.path);if(qSe(e)){const n=VSe[e.call],i={};for(const[s,r]of Object.entries(e.args??{}))i[s]=HA(r,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function YSe(e,t){const n=HA(e,t);return n==null?"":typeof n=="string"?n:String(n)}const O$=new Map;function Cu(e,t){O$.set(e,t)}function WSe(e){return O$.get(e)}function XSe(e,t,n){const i=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let r=0;rHA(i,e.dataModel),resolveString:i=>YSe(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const s=e.components[i];if(!s)return null;const r=WSe(s.component)??QSe;return o.jsx(r,{node:s,ctx:n},i)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function JSe(e){const t=b.useRef(null),n=b.useRef(!0),i=28,s=b.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:s}}function Dx({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(s=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[o.jsx(ru,{"aria-hidden":!0}),o.jsxs("span",{children:[t,s.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":`移除技能 ${s.name}`,children:o.jsx(As,{})}):null]},s.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(zP,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),i?o.jsx("button",{type:"button",onClick:i,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(As,{})}):null]}):null]})}function zA(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function L$(e){var n,i,s,r;const t=zA(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((i=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:i.toUpperCase())??"VIDEO":t==="image"?((r=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function D$(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function P$(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?vB(t,e.uri):""}function eNe({kind:e}){return e==="image"?o.jsx(yk,{}):e==="video"?o.jsx(KP,{}):e==="pdf"?o.jsx(kJ,{}):o.jsx(gk,{})}function Px({appName:e,items:t,compact:n=!1,onRemove:i}){const[s,r]=b.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=zA(a.mimeType),c=P$(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>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(YJ,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(eNe,{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:L$(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(mn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":D$(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(Kc,{className:"media-card-open"}):null]});return o.jsxs(Jn.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(UP,{src:c,children:d}):d,i?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>i(a.id),children:o.jsx(As,{})}):null]},a.id)})}),o.jsx(Ro,{children:s?o.jsx(tNe,{appName:e,item:s,onClose:()=>r(null)}):null})]})}function tNe({appName:e,item:t,onClose:n}){const i=b.useMemo(()=>P$(t,e),[e,t]),s=zA(t.mimeType),[r,a]=b.useState(""),[l,c]=b.useState(s==="text"||s==="markdown"),[u,d]=b.useState("");return b.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),b.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(i,{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()},[s,i]),o.jsx(Jn.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(Jn.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:[L$(t),t.sizeBytes?` · ${D$(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:i,download:t.name,"aria-label":"下载",children:o.jsx(W1,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(As,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?o.jsx("img",{src:i,alt:t.name??"图片"}):null,s==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:i,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?o.jsx("iframe",{src:i,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(mn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&s==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(rh,{text:r})}):null,!l&&s==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function nNe(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 iNe(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 B$(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 sNe(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 rNe(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 aNe(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 oNe(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 lNe(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 U$(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 cNe({definition:e,label:t,done:n,open:i,onToggle:s}){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:s,"aria-expanded":i,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(_a,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(U$,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}const uNe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:nNe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:lNe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:iNe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:B$},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:sNe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:rNe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:aNe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:oNe}};function dNe(e){return uNe[e]}const F$="send_a2ui_json_to_client",fNe=28;function hNe(e,t,n){let i=t;for(let s=0;s65535?2:1}return i}function pNe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function $$(e,t,n){const[i,s]=b.useState(()=>t?"":e),r=b.useRef(i),a=b.useRef(e),l=b.useRef(null),c=b.useRef(0),u=b.useRef(n);return a.current=e,u.current=n,b.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,s(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,g=r.current;if(!m.startsWith(g)){r.current=m,s(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[i]),b.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),i}function mNe({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 gNe(){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 bNe(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 H$({text:e,done:t,answerStarted:n=!1,streaming:i=!1,onStreamFrame:s}){const[r,a]=b.useState(!(t||n)),l=b.useRef(!1);b.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=$$(u,!t||i,s),{ref:f,onScroll:h}=JSe(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(mNe,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(_a,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(nc,{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 z$(){return o.jsx(H$,{text:"",done:!1})}const yNe=b.memo(function({text:t,streaming:n,onStreamFrame:i}){const s=$$(t,n,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(rh,{text:s})}):null});function xNe({name:e,args:t,response:n,done:i}){const[s,r]=b.useState(!1),a=e===F$?"渲染 UI":e,l=dNe(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(Jn.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(cNe,{definition:l,label:bNe(e,t),done:i,open:s,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":s,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(gNe,{})}),i?o.jsx("span",{className:"tool-name",children:a}):o.jsx(_a,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(U$,{className:`tool-chevron${s?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${s?"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 ENe({block:e,onDownload:t,onPreview:n}){const[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState(null);b.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){s(`download:${p}`),a("");try{await t(p,m)}catch(g){a(g instanceof Error?g.message:String(g))}finally{s("")}}},f=async(p,m,g)=>{if(n){s(`preview:${g}`),a("");try{const v=await n(p,m);c({name:g,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{s("")}}},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`,g=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(gk,{})}),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:[g&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||i!=="",onClick:()=>void f(g.filename,g.version,p.filename),children:[i===`preview:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(GP,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||i!=="",onClick:()=>void d(p.filename,p.version),children:[i===`download:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(W1,{}),"下载"]})]})]},`${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(As,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function vNe({block:e,onAuth:t}){const[n,i]=b.useState(e.done?"done":"idle"),[s,r]=b.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),i("authorizing");try{await t(e),i("done")}catch(d){r(d instanceof Error?d.message:String(d)),i("idle")}}};return e.done||n==="done"?o.jsxs(Jn.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(sj,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(Jn.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(sj,{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(mn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&o.jsx("div",{className:"auth-card-err",children:s})]})}function VA({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:i,onAction:s,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(H$,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:i},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(yNe,{text:d,streaming:n,onStreamFrame:i},u):null}case"attachment":return o.jsx(Px,{appName:t,items:c.files},u);case"artifact":return o.jsx(ENe,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(Dx,{value:c.value},u);case"tool":return c.name===F$&&c.done?null:o.jsx(xNe,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(vNe,{block:c,onAuth:r},u);case"a2ui":return M$(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(Jn.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(ZSe,{surface:d,onAction:s})},`${u}-${d.surfaceId}`));default:return null}})})}function GA(e){return e.isComposing||e.keyCode===229}function wNe({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 ca=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],_Ne=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function WL({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(wNe,{className:"new-chat-mode__agent-icon"})}function SNe(){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 NNe({value:e,onChange:t,disabled:n=!1,temporaryEnabled:i,skillCreateEnabled:s}){const[r,a]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(()=>ca.findIndex(N=>N.value===e)),f=b.useRef(null),h=b.useRef(null),p=ca.find(N=>N.value===e)??ca[0],m=p.value==="temporary"?"Codex 智能体":p.label;function g(N){return N.value==="temporary"?i:N.value==="skill-create"?s:!0}function v(N){return g(N)!==!0}function y(N){const _=g(N);return _===void 0?"正在检查配置":_?N.description:"管理员未配置"}b.useEffect(()=>{if(!r)return;const N=_=>{var T;(T=f.current)!=null&&T.contains(_.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[r]);function x(N){let _=u;do _=(_+N+ca.length)%ca.length;while(v(ca[_]));d(_),c(ca[_].value==="temporary")}function E(N){var _;if(!v(N)){if(N.value==="temporary"){c(!0);return}t(N.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(ca.findIndex(N=>N.value===e)),a(N=>(N&&c(!1),!N))},onKeyDown:N=>{N.key==="ArrowDown"||N.key==="ArrowUp"?(N.preventDefault(),r?x(N.key==="ArrowDown"?1:-1):a(!0)):r&&(N.key==="Enter"||N.key===" ")?(N.preventDefault(),E(ca[u])):r&&N.key==="Escape"&&(N.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx(WL,{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:N=>{var _;N.key==="ArrowDown"||N.key==="ArrowUp"?(N.preventDefault(),x(N.key==="ArrowDown"?1:-1)):N.key==="Enter"?(N.preventDefault(),E(ca[u])):N.key==="Escape"&&(N.preventDefault(),a(!1),c(!1),(_=h.current)==null||_.focus())},children:ca.map((N,_)=>{const T=N.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===N.value,"aria-haspopup":T?"menu":void 0,"aria-expanded":T?l:void 0,"aria-disabled":v(N),disabled:v(N),className:`new-chat-mode__option${_===u?" is-active":""}`,onMouseEnter:()=>{d(_),c(N.value==="temporary")},onClick:()=>E(N),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx(WL,{mode:N.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[N.label,N.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(N)})]}),T?o.jsx(SNe,{}):e===N.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]},N.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(Um,{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:"在沙箱中执行任务"})]})]}),_Ne.map(({label:N,kind:_})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx(Um,{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:N}),o.jsx("span",{children:"暂不可用"})]})]},N))]}):null]}):null]})}const Zu=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],TNe=15,kNe=15e3,ANe=120,CNe=180;function XL(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 INe(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 mw({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(qc,{className:t}):o.jsx(Um,{kind:e,className:t})}function RNe({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:i=!1,onSelectRuntime:s,onSelectSandboxSession:r}){var Ee;const[a,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(0),[h,p]=b.useState(0),[m,g]=b.useState("types"),[v,y]=b.useState(!1),[x,E]=b.useState([]),[w,N]=b.useState([]),[_,T]=b.useState(null),[k,C]=b.useState(""),[I,O]=b.useState(!1),[L,G]=b.useState(""),[D,F]=b.useState(""),A=b.useRef(null),j=b.useRef(null),P=b.useRef(null),$=b.useRef(0),R=b.useRef(null),Y=b.useRef(null),Z=b.useRef(null),B=((Ee=Zu.find(ae=>ae.id===c))==null?void 0:Ee.label)??"智能体",te=b.useCallback((ae=!1)=>{var Ne;Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),l(!1),u(null),g("types"),y(!1),ae&&((Ne=j.current)==null||Ne.focus())},[]),K=b.useCallback(async(ae="",Ne=!1)=>{const ve=++$.current;let Qe;O(!0),G("");try{const Me=await Promise.race([nx({scope:n,region:"all",pageSize:TNe,nextToken:ae}),new Promise((ze,Se)=>{Qe=window.setTimeout(()=>{Se(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},kNe)})]);if($.current!==ve)return;E(ze=>{const Se=Ne?Me.runtimes:[...ze,...Me.runtimes];return Se.filter((Ue,Pe)=>Se.findIndex(Ke=>Ke.runtimeId===Ue.runtimeId)===Pe)}),C(Me.nextToken),p(0)}catch(Me){if($.current!==ve)return;G(Od(Me,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(Qe),$.current===ve&&O(!1)}},[n]),z=b.useCallback(async ae=>{var Qe,Me;(Qe=R.current)==null||Qe.abort();const Ne=new AbortController;R.current=Ne;const ve=++$.current;O(!0),G(""),N([]);try{const ze=ae==="codex"?await tn.listSessions({signal:Ne.signal}):await tn.listAgentSessions(ae,{signal:Ne.signal});if($.current!==ve)return;N(ze),T(ae),p(0)}catch(ze){if((ze==null?void 0:ze.name)==="AbortError"||$.current!==ve)return;G(Od(ze,`加载 ${((Me=Zu.find(Se=>Se.id===ae))==null?void 0:Me.label)??ae}`,`GET /web/${ae==="codex"?"sandbox":ae}/sessions`)),T(ae)}finally{R.current===Ne&&(R.current=null),$.current===ve&&O(!1)}},[]);b.useEffect(()=>{!a||c!=="general"||x.length>0||I||L||K("",!0)},[c,L,K,I,a,x.length]),b.useEffect(()=>{!a||c===null||c==="general"||_===c||z(c)},[c,z,_,a]),b.useEffect(()=>{if(!a)return;const ae=Ne=>{var ve;(ve=A.current)!=null&&ve.contains(Ne.target)||te()};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[te,a]),b.useEffect(()=>()=>{var ae;$.current+=1,(ae=R.current)==null||ae.abort(),Y.current!==null&&window.clearTimeout(Y.current),Z.current!==null&&window.clearTimeout(Z.current)},[]);function W(ae,Ne=!1){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),l(!0),u(Ne?"general":null),f(0),g("types"),y(Ne),ae&&requestAnimationFrame(()=>{var ve;return(ve=P.current)==null?void 0:ve.focus()})}function q(){i||a||Y.current!==null||(Y.current=window.setTimeout(()=>{Y.current=null,W(!1)},ANe))}function ce(){Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)}function me(){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),!(!a||Z.current!==null)&&(Z.current=window.setTimeout(()=>{Z.current=null,te()},CNe))}function _e(ae){var Qe;const Ne=(ae+Zu.length)%Zu.length,ve=Zu[Ne].id;ve!==c&&($.current+=1,(Qe=R.current)==null||Qe.abort(),R.current=null,O(!1),G("")),f(Ne),u(ve),p(0)}async function de(ae){if(!D){F(ae.runtimeId),G("");try{await s(ae),te(!0)}catch(Ne){G(Od(Ne,"连接通用智能体"))}finally{F("")}}}async function ge(ae){if(!D){F(ae.id),G("");try{await r(ae),te(!0)}catch(Ne){G(Od(Ne,`打开 ${B}`))}finally{F("")}}}function Oe(ae){if(ae.key==="Escape"){ae.preventDefault(),te(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(ae.key)&&y(!0),m==="types"){ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),_e(d+(ae.key==="ArrowDown"?1:-1))):(ae.key==="ArrowRight"||ae.key==="Enter")&&(ae.preventDefault(),c===null&&_e(d),g("runtimes"));return}if(ae.key==="ArrowLeft")ae.preventDefault(),g("types");else if((c==="general"?x:w).length>0&&(ae.key==="ArrowDown"||ae.key==="ArrowUp")){ae.preventDefault();const Ne=ae.key==="ArrowDown"?1:-1,ve=c==="general"?x.length:w.length;p(Qe=>(Qe+Ne+ve)%ve)}else ae.key==="Enter"&&c==="general"&&x[h]?(ae.preventDefault(),de(x[h])):ae.key==="Enter"&&c!=="general"&&w[h]&&(ae.preventDefault(),ge(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:A,onPointerEnter:ae=>{ae.pointerType==="mouse"&&ce()},onPointerLeave:ae=>{ae.pointerType==="mouse"&&me()},children:[o.jsxs("button",{ref:j,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:i,onPointerEnter:ae=>{ae.pointerType==="mouse"&&q()},onClick:()=>a?te():W(!0),onKeyDown:ae=>{ae.key==="ArrowDown"||ae.key==="ArrowUp"?(ae.preventDefault(),a||W(!0,!0)):ae.key==="Escape"&&a&&(ae.preventDefault(),te(!0))},children:[o.jsx(qc,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(XL,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:P,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Oe,onPointerMove:ae=>{ae.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:Zu.map((ae,Ne)=>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===Ne?" is-keyboard-active":""}`,onMouseEnter:()=>_e(Ne),onClick:()=>{_e(Ne),g("runtimes")},children:[o.jsx(mw,{type:ae.id}),o.jsx("span",{children:ae.label}),o.jsx(XL,{className:"new-chat-agent-picker__nested-chevron"})]},ae.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${B}列表`,children:c!=="general"&&I&&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"&&L&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void z(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(Qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Qn.Icon,{size:"sm",children:o.jsx(mw,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(Qn.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",B]})}),o.jsx(Qn.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((ae,Ne)=>{const ve=D===ae.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Ne?" is-keyboard-active":""}`,disabled:!!D,title:`${ae.displayName||B} · ${ae.id}`,onMouseEnter:()=>p(Ne),onClick:()=>void ge(ae),children:[o.jsx(mw,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.displayName||B}),o.jsx("small",{children:ve?"正在打开":Mx(ae.status)})]},ae.id)})}):I&&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"}),"正在加载智能体"]}):L&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void K("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(Qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Qn.Icon,{size:"sm",children:o.jsx(qc,{})}),o.jsx(Qn.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(Qn.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((ae,Ne)=>{const ve=D===ae.runtimeId,Qe=ae.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":Qe,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Ne?" is-keyboard-active":""}`,disabled:!!D,title:ae.name,onMouseEnter:()=>p(Ne),onClick:()=>void de(ae),children:[o.jsx(qc,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ae.name}),ve?o.jsx("small",{children:"正在连接"}):Qe?o.jsx(INe,{className:"new-chat-agent-picker__check"}):null]},ae.runtimeId)})}),L?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:L}):null,k?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:I||!!D,onClick:()=>void K(k),children:I?"加载中":"加载更多"}):null]})}):null]}):null]})}const V$={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},jNe={ppt:[],image:[],video:["video_task_query"]},KA=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function QL(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 ZL=[{value:"ppt",label:"PPT",icon:zJ,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:yk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:B$,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function ONe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:i,value:s,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:g=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:N=!1,showModeSelector:_=!1,onModeChange:T,onTaskChange:k,temporaryEnabled:C,skillCreateEnabled:I,harnessEnabled:O=!1,builtinTools:L=[],showAgentPicker:G=!1,agentPickerDisabled:D=!1,selectedRuntimeId:F="",runtimeScope:A="mine",onSelectRuntime:j,onSelectSandboxSession:P}){const $=b.useRef(null),R=b.useRef(null),Y=b.useRef(null),Z=b.useRef(null),[B,te]=b.useState(!1),[K,z]=b.useState(null),[W,q]=b.useState(0),[ce,me]=b.useState(!1);async function _e(){if(e)try{await navigator.clipboard.writeText(e),me(!0),setTimeout(()=>me(!1),1500)}catch{me(!1)}}b.useLayoutEffect(()=>{const ie=$.current;ie&&(ie.style.height="auto",ie.style.height=`${Math.min(ie.scrollHeight,200)}px`)},[s]);const de=E==="skill-create";b.useEffect(()=>{de&&(te(!1),z(null))},[de]);const ge=!de&&d.some(ie=>ie.status!=="ready"),Oe=!l&&!c&&!ge&&(s.trim().length>0||!de&&d.length>0),Ee=de?`描述你想创建的 Skill,将使用 ${KA.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${i} 发消息…`,ae=(K==null?void 0:K.query.toLocaleLowerCase())??"",Ne=(K==null?void 0:K.kind)==="skill"?f.filter(ie=>!p.skills.some(be=>be.name===ie.name)).filter(ie=>`${ie.name} ${ie.description}`.toLocaleLowerCase().includes(ae)).map(ie=>({kind:"skill",value:ie})):(K==null?void 0:K.kind)==="agent"?h.filter(ie=>`${ie.name} ${ie.description}`.toLocaleLowerCase().includes(ae)).map(ie=>({kind:"agent",value:ie})):[];function ve(ie){var be;te(!1),z(null),(be=ie.current)==null||be.click()}function Qe(ie){k==null||k(ie.value),te(!1),z(null),requestAnimationFrame(()=>{var be,Le;(be=$.current)==null||be.focus(),(Le=$.current)==null||Le.setSelectionRange(s.length,s.length)})}function Me(ie){r(ie),te(!1),z(null),requestAnimationFrame(()=>{var qe,gt,lt;(qe=$.current)==null||qe.focus();const be=ie.indexOf("【"),Le=ie.indexOf("】",be+1);be>=0&&Le>be?(gt=$.current)==null||gt.setSelectionRange(be+1,Le):(lt=$.current)==null||lt.setSelectionRange(ie.length,ie.length)})}function ze(){k==null||k(null),r(""),te(!1),z(null),requestAnimationFrame(()=>{var ie,be;(ie=$.current)==null||ie.focus(),(be=$.current)==null||be.setSelectionRange(0,0)})}const Se=ZL.find(ie=>ie.value===w),Ue=ZL.filter(ie=>V$[ie.value].every(be=>L.includes(be)));function Pe(ie,be){const Le=ie.slice(0,be),qe=/(^|\s)([/@])([^\s/@]*)$/.exec(Le);if(!qe){z(null);return}const gt=qe[2].length+qe[3].length,lt={kind:qe[2]==="/"?"skill":"agent",query:qe[3],start:be-gt,end:be},ln=!K||K.kind!==lt.kind||K.query!==lt.query||K.start!==lt.start||K.end!==lt.end;z(lt),ln&&q(0),te(!1)}function Ke(ie){if(!K)return;const be=s.slice(0,K.start)+s.slice(K.end);r(be),ie.kind==="skill"?v({...p,skills:[...p.skills,ie.value]}):v({skills:[],targetAgent:ie.value});const Le=K.start;z(null),requestAnimationFrame(()=>{var qe,gt;(qe=$.current)==null||qe.focus(),(gt=$.current)==null||gt.setSelectionRange(Le,Le)})}function Q(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function oe(ie){const be=ie.target.files?Array.from(ie.target.files):[];be.length&&y(be),ie.target.value=""}return o.jsxs("div",{className:`composer${N?" composer--new-chat":""}${de?" composer--skill-mode":""}${Se?` composer--has-task composer--task-${Se.value}`:""}`,children:[de?null:o.jsx(Dx,{value:p,onRemoveSkill:ie=>v({...p,skills:p.skills.filter(be=>be.name!==ie)}),onRemoveAgent:()=>v({skills:[]})}),!de&&d.length>0&&o.jsx(Px,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[K?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[K.kind==="skill"?o.jsx(ru,{}):o.jsx(zP,{}),o.jsx("span",{children:K.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:K.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(mn,{className:"spin"})," 正在读取 Agent 能力…"]}):Ne.length===0?o.jsx("div",{className:"composer-command-empty",children:K.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:Ne.map((ie,be)=>o.jsxs("button",{type:"button",role:"option","aria-selected":be===W,className:`composer-command-item${be===W?" is-active":""}`,onMouseDown:Le=>{Le.preventDefault(),Ke(ie)},onMouseEnter:()=>q(be),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${ie.kind}`,children:ie.kind==="skill"?o.jsx(ru,{}):o.jsx(su,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[ie.kind==="skill"?"/":"@",ie.value.name]}),o.jsx("span",{children:ie.value.description||(ie.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:be===W?"↵":ie.kind==="skill"?"技能":"Agent"})]},`${ie.kind}-${ie.value.name}`))})]}):null,de?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!g,onClick:()=>{z(null),te(ie=>!ie)},children:o.jsx(Ns,{className:"icon"})}),B&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>te(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(R),children:[o.jsx(yk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(Y),children:[o.jsx(gk,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(Z),children:[o.jsx(KP,{className:"icon"}),"上传视频"]})]})]})]}),G&&j&&P?o.jsx(RNe,{selectedAgentName:n?i:"",selectedRuntimeId:F,runtimeScope:A,disabled:D,onSelectRuntime:j,onSelectSandboxSession:P}):null,_&&T?o.jsx(NNe,{value:E,onChange:T,disabled:c,temporaryEnabled:C,skillCreateEnabled:I}):null,N&&E==="agent"&&Se&&k?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${Se.value}`,"aria-label":`取消${Se.label}任务`,disabled:c,onClick:ze,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(Se.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(As,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:Se.label})]}):null,N&&de&&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(QL,{className:"new-chat-task-chip__task-icon"}),o.jsx(As,{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:N?4:1,value:s,disabled:l,placeholder:Ee,"aria-expanded":!!K,onChange:ie=>{r(ie.target.value),de||Pe(ie.target.value,ie.target.selectionStart)},onSelect:ie=>{de||Pe(ie.currentTarget.value,ie.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>z(null),0),onKeyDown:ie=>{if(!GA(ie.nativeEvent)){if(K){if(ie.key==="ArrowDown"&&Ne.length>0){ie.preventDefault(),q(be=>(be+1)%Ne.length);return}if(ie.key==="ArrowUp"&&Ne.length>0){ie.preventDefault(),q(be=>(be-1+Ne.length)%Ne.length);return}if((ie.key==="Enter"||ie.key==="Tab")&&Ne[W]){ie.preventDefault(),Ke(Ne[W]);return}if(ie.key==="Escape"){ie.preventDefault(),z(null);return}}if(ie.key==="Backspace"&&!s&&ie.currentTarget.selectionStart===0&&ie.currentTarget.selectionEnd===0){Q();return}ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Oe&&a())}}}),N&&s.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:Ee},Ee):null]}),o.jsx(Jn.button,{type:"button",className:"comp-send",disabled:!Oe,onClick:a,"aria-label":"发送",whileTap:Oe?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(mn,{className:"icon spin"}):o.jsx(HP,{className:"icon"})})]}),N&&E==="agent"&&O&&!Se?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[Ue.map(ie=>{const be=ie.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>Qe(ie),children:[o.jsx(be,{}),o.jsx("span",{children:ie.label})]},ie.value)}),I===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>T==null?void 0:T("skill-create"),children:[o.jsx(QL,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,N&&E==="agent"&&Se?o.jsx("div",{className:"prompt-suggestions","aria-label":`${Se.label}企业提示词`,children:Se.prompts.map(ie=>{const be=Se.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>Me(ie),children:[o.jsx(be,{}),o.jsx("span",{children:ie})]},ie)})}):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 _e(),children:ce?o.jsx(Aa,{}):o.jsx(Y1,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:Y,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:oe}),o.jsx("input",{ref:Z,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:oe})]})}function G$({title:e,sub:t,cards:n,footer:i}){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((s,r)=>o.jsxs(Jn.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.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(s.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:s.title}),o.jsx("span",{className:"stk-card-desc",children:s.desc})]}),s.status&&o.jsx("span",{className:"stk-card-status",children:s.status}),o.jsx(nc,{className:"stk-card-arrow"})]},s.key))}),i&&o.jsx("div",{className:"stk-footer",children:i})]})}const qA=Symbol.for("yaml.alias"),sN=Symbol.for("yaml.document"),Wl=Symbol.for("yaml.map"),K$=Symbol.for("yaml.pair"),no=Symbol.for("yaml.scalar"),oh=Symbol.for("yaml.seq"),Jr=Symbol.for("yaml.node.type"),lh=e=>!!e&&typeof e=="object"&&e[Jr]===qA,Ag=e=>!!e&&typeof e=="object"&&e[Jr]===sN,Cg=e=>!!e&&typeof e=="object"&&e[Jr]===Wl,Fi=e=>!!e&&typeof e=="object"&&e[Jr]===K$,Kn=e=>!!e&&typeof e=="object"&&e[Jr]===no,Ig=e=>!!e&&typeof e=="object"&&e[Jr]===oh;function Pi(e){if(e&&typeof e=="object")switch(e[Jr]){case Wl:case oh:return!0}return!1}function Ui(e){if(e&&typeof e=="object")switch(e[Jr]){case qA:case Wl:case no:case oh:return!0}return!1}const q$=e=>(Kn(e)||Pi(e))&&!!e.anchor,Rc=Symbol("break visit"),MNe=Symbol("skip children"),Wp=Symbol("remove node");function ch(e,t){const n=LNe(t);Ag(e)?Ld(null,e.contents,n,Object.freeze([e]))===Wp&&(e.contents=null):Ld(null,e,n,Object.freeze([]))}ch.BREAK=Rc;ch.SKIP=MNe;ch.REMOVE=Wp;function Ld(e,t,n,i){const s=DNe(e,t,n,i);if(Ui(s)||Fi(s))return PNe(e,i,s),Ld(e,s,n,i);if(typeof s!="symbol"){if(Pi(t)){i=Object.freeze(i.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>BNe[t]);class Gs{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Gs.defaultYaml,t),this.tags=Object.assign({},Gs.defaultTags,n)}clone(){const t=new Gs(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Gs(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Gs.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Gs.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Gs.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Gs.defaultTags),this.atNextDocument=!1);const i=t.trim().split(/[ \t]+/),s=i.shift();switch(s){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;const[r,a]=i;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=i;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 ${s}`,!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[,i,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const r=this.tags[i];if(r)try{return r+decodeURIComponent(s)}catch(a){return n(String(a)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+UNe(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags);let s;if(t&&i.length>0&&Ui(t.contents)){const r={};ch(t.contents,(a,l)=>{Ui(l)&&l.tag&&(r[l.tag]=!0)}),s=Object.keys(r)}else s=[];for(const[r,a]of i)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` +`)}}Gs.defaultYaml={explicit:!1,version:"1.2"};Gs.defaultTags={"!!":"tag:yaml.org,2002:"};function Y$(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 W$(e){const t=new Set;return ch(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function X$(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function FNe(e,t){const n=[],i=new Map;let s=null;return{onAnchor:r=>{n.push(r),s??(s=W$(e));const a=X$(t,s);return s.add(a),a},setAnchors:()=>{for(const r of n){const a=i.get(r);if(typeof a=="object"&&a.anchor&&(Kn(a.node)||Pi(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:i}}function Dd(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let s=0,r=i.length;sQr(i,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!q$(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=r=>{i.res=r,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class YA{constructor(t){Object.defineProperty(this,Jr,{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:i,onAnchor:s,reviver:r}={}){if(!Ag(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 i=="number"?i:100},l=Qr(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof r=="function"?Dd(r,{"":l},"",l):l}}class WA extends YA{constructor(t){super(qA),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 i;n!=null&&n.aliasResolveCache?i=n.aliasResolveCache:(i=[],ch(t,{Node:(r,a)=>{(lh(a)||q$(a))&&i.push(a)}}),n&&(n.aliasResolveCache=i));let s;for(const r of i){if(r===this)break;r.anchor===this.source&&(s=r)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:i,doc:s,maxAliasCount:r}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=i.get(a);if(l||(Qr(a,null,n),l=i.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=Gb(s,a,i)),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,i){const s=`*${this.source}`;if(t){if(Y$(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`${s} `}return s}}function Gb(e,t,n){if(lh(t)){const i=t.resolve(e),s=n&&i&&n.get(i);return s?s.count*s.aliasCount:0}else if(Pi(t)){let i=0;for(const s of t.items){const r=Gb(e,s,n);r>i&&(i=r)}return i}else if(Fi(t)){const i=Gb(e,t.key,n),s=Gb(e,t.value,n);return Math.max(i,s)}return 1}const Q$=e=>!e||typeof e!="function"&&typeof e!="object";class At extends YA{constructor(t){super(no),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Qr(this.value,t,n)}toString(){return String(this.value)}}At.BLOCK_FOLDED="BLOCK_FOLDED";At.BLOCK_LITERAL="BLOCK_LITERAL";At.PLAIN="PLAIN";At.QUOTE_DOUBLE="QUOTE_DOUBLE";At.QUOTE_SINGLE="QUOTE_SINGLE";const $Ne="tag:yaml.org,2002:";function HNe(e,t,n){if(t){const i=n.filter(r=>r.tag===t),s=i.find(r=>!r.format)??i[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(i=>{var s;return((s=i.identify)==null?void 0:s.call(i,e))&&!i.format})}function Fm(e,t,n){var f,h,p;if(Ag(e)&&(e=e.contents),Ui(e))return e;if(Fi(e)){const m=(h=(f=n.schema[Wl]).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:i,onAnchor:s,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(i&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=s(e)),new WA(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=$Ne+t.slice(2));let u=HNe(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new At(e);return c&&(c.node=m),m}u=e instanceof Map?a[Wl]:Symbol.iterator in Object(e)?a[oh]:a[Wl]}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 At(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function d1(e,t,n){let i=n;for(let s=t.length-1;s>=0;--s){const r=t[s];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=i,i=a}else i=new Map([[r,i]])}return Fm(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const hp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let Z$=class extends YA{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(i=>Ui(i)||Fi(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(hp(t))this.add(n);else{const[i,...s]=t,r=this.get(i,!0);if(Pi(r))r.addIn(s,n);else if(r===void 0&&this.schema)this.set(i,d1(this.schema,s,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}deleteIn(t){const[n,...i]=t;if(i.length===0)return this.delete(n);const s=this.get(n,!0);if(Pi(s))return s.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){const[i,...s]=t,r=this.get(i,!0);return s.length===0?!n&&Kn(r)?r.value:r:Pi(r)?r.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Fi(n))return!1;const i=n.value;return i==null||t&&Kn(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){const[n,...i]=t;if(i.length===0)return this.has(n);const s=this.get(n,!0);return Pi(s)?s.hasIn(i):!1}setIn(t,n){const[i,...s]=t;if(s.length===0)this.set(i,n);else{const r=this.get(i,!0);if(Pi(r))r.setIn(s,n);else if(r===void 0&&this.schema)this.set(i,d1(this.schema,s,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}};const zNe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Oo(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Pc=(e,t,n)=>e.endsWith(` +`)?Oo(n,t):n.includes(` `)?` -`+Ro(n,t):(e.endsWith(" ")?"":" ")+n,z$="flow",ZS="block",Fb="quoted";function Rx(e,t,n="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!s||s<0)return e;ss-Math.max(2,r)?u.push(0):f=s-i);let h,p,m=!1,g=-1,v=-1,y=-1;n===ZS&&(g=GL(e,g,t.length),g!==-1&&(f=g+c));for(let E;E=e[g+=1];){if(n===Fb&&E==="\\"){switch(v=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(E===` -`)n===ZS&&(g=GL(e,g,t.length)),f=g+t.length+c,h=void 0;else{if(E===" "&&p&&p!==" "&&p!==` +`+Oo(n,t):(e.endsWith(" ")?"":" ")+n,J$="flow",rN="block",Kb="quoted";function Bx(e,t,n="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!s||s<0)return e;ss-Math.max(2,r)?u.push(0):f=s-i);let h,p,m=!1,g=-1,v=-1,y=-1;n===rN&&(g=JL(e,g,t.length),g!==-1&&(f=g+c));for(let E;E=e[g+=1];){if(n===Kb&&E==="\\"){switch(v=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(E===` +`)n===rN&&(g=JL(e,g,t.length)),f=g+t.length+c,h=void 0;else{if(E===" "&&p&&p!==" "&&p!==` `&&p!==" "){const w=e[g+1];w&&w!==" "&&w!==` -`&&w!==" "&&(h=g)}if(g>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Fb){for(;p===" "||p===" ";)p=E,E=e[g+=1],m=!0;const w=g>y+1?g-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}),Ox=e=>/^(%|---|\.\.\.)/m.test(e);function INe(e,t,n){if(!t||t<0)return!1;const i=t-n,s=e.length;if(s<=i)return!1;for(let r=0,a=0;ri)return!0;if(a=r+1,s-a<=i)return!1}return!0}function Kp(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=t,s=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Ox(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(i||n[c+2]==='"'||n.length=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Kb){for(;p===" "||p===" ";)p=E,E=e[g+=1],m=!0;const w=g>y+1?g-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}),Fx=e=>/^(%|---|\.\.\.)/m.test(e);function VNe(e,t,n){if(!t||t<0)return!1;const i=t-n,s=e.length;if(s<=i)return!1;for(let r=0,a=0;ri)return!0;if(a=r+1,s-a<=i)return!1}return!0}function Xp(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=t,s=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Fx(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(i||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const N=n[h-1];if(N!==` `&&N!==" "&&N!==" ")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(eN,`$&${u}`));let g=!1,v,y=-1;for(v=0;v{_=!0});const k=Rx(`${x}${N}${p}`,u,ZS,T);if(!_)return`>${w} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let _=!1;const T=Ux(i,!0);a!=="folded"&&t!==At.BLOCK_FOLDED&&(T.onOverflow=()=>{_=!0});const k=Bx(`${x}${N}${p}`,u,rN,T);if(!_)return`>${w} ${u}${k}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} -${u}${x}${n}${p}`}function RNe(e,t,n,i){const{type:s,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` -`)||d&&/[[\]{},]/.test(r))return Ld(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` -`)?Ld(r,t):$b(e,t,n,i);if(!l&&!d&&s!==Ct.PLAIN&&r.includes(` -`))return $b(e,t,n,i);if(Ox(r)){if(c==="")return t.forceBlockIndent=!0,$b(e,t,n,i);if(l&&c===u)return Ld(r,t)}const f=r.replace(/\n+/g,`$& -${c}`);if(a){const h=g=>{var v;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((v=g.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Ld(r,t)}return l?f:Rx(f,c,z$,jx(t,!1))}function HA(e,t,n,i){const{implicitKey:s,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 s||r?Ld(a.value,t):$b(a,t,n,i);case Ct.QUOTE_DOUBLE:return Kp(a.value,t);case Ct.QUOTE_SINGLE:return JS(a.value,t);case Ct.PLAIN:return RNe(a,t,n,i);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function V$(e,t){const n=Object.assign({blockQuote:!0,commentString:CNe,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 i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function jNe(e,t){var s;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,i;if(Fn(t)){i=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,i)});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 i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){const r=((s=i==null?void 0:i.constructor)==null?void 0:s.name)??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function ONe(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const s=[],r=(Fn(e)||Mi(e))&&e.anchor;r&&B$(r)&&(n.add(r),s.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(i.directives.tagString(a)),s.join(" ")}function If(e,t,n,i){var c;if(Pi(e))return e.toString(t,n,i);if(rh(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 s;const r=Di(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=jNe(t.doc.schema.tags,r));const a=ONe(r,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof s.stringify=="function"?s.stringify(r,t,n,i):Fn(r)?HA(r,t,n,i):r.toString(t,n,i);return a?Fn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} -${t.indent}${l}`:l}function MNe({key:e,value:t},n,i,s){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Di(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Mi(e)||!Di(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||Mi(e)||(Fn(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,g=!1,v=If(e,n,()=>m=!0,()=>g=!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&&i&&i(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=Dc(v,n.indent,u(h)):g&&s&&s(),v;m&&(h=null),p?(h&&(v+=Dc(v,n.indent,u(h))),v=`? ${v} -${l}:`):(v=`${v}:`,h&&(v+=Dc(v,n.indent,u(h))));let y,x,E;Di(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&&Fn(t)&&(n.indentAtStart=v.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Ng(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const N=If(t,n,()=>w=!0,()=>g=!0);let _=" ";if(h||y||x){if(_=y?` +${u}${x}${n}${p}`}function GNe(e,t,n,i){const{type:s,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` +`)||d&&/[[\]{},]/.test(r))return Pd(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` +`)?Pd(r,t):qb(e,t,n,i);if(!l&&!d&&s!==At.PLAIN&&r.includes(` +`))return qb(e,t,n,i);if(Fx(r)){if(c==="")return t.forceBlockIndent=!0,qb(e,t,n,i);if(l&&c===u)return Pd(r,t)}const f=r.replace(/\n+/g,`$& +${c}`);if(a){const h=g=>{var v;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((v=g.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Pd(r,t)}return l?f:Bx(f,c,J$,Ux(t,!1))}function XA(e,t,n,i){const{implicitKey:s,inFlow:r}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==At.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=At.QUOTE_DOUBLE);const c=d=>{switch(d){case At.BLOCK_FOLDED:case At.BLOCK_LITERAL:return s||r?Pd(a.value,t):qb(a,t,n,i);case At.QUOTE_DOUBLE:return Xp(a.value,t);case At.QUOTE_SINGLE:return aN(a.value,t);case At.PLAIN:return GNe(a,t,n,i);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function eH(e,t){const n=Object.assign({blockQuote:!0,commentString:zNe,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 i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function KNe(e,t){var s;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,i;if(Kn(t)){i=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,i)});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 i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){const r=((s=i==null?void 0:i.constructor)==null?void 0:s.name)??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function qNe(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const s=[],r=(Kn(e)||Pi(e))&&e.anchor;r&&Y$(r)&&(n.add(r),s.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(i.directives.tagString(a)),s.join(" ")}function jf(e,t,n,i){var c;if(Fi(e))return e.toString(t,n,i);if(lh(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 s;const r=Ui(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=KNe(t.doc.schema.tags,r));const a=qNe(r,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof s.stringify=="function"?s.stringify(r,t,n,i):Kn(r)?XA(r,t,n,i):r.toString(t,n,i);return a?Kn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} +${t.indent}${l}`:l}function YNe({key:e,value:t},n,i,s){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Ui(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Pi(e)||!Ui(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||Pi(e)||(Kn(e)?e.type===At.BLOCK_FOLDED||e.type===At.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+c});let m=!1,g=!1,v=jf(e,n,()=>m=!0,()=>g=!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&&i&&i(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=Pc(v,n.indent,u(h)):g&&s&&s(),v;m&&(h=null),p?(h&&(v+=Pc(v,n.indent,u(h))),v=`? ${v} +${l}:`):(v=`${v}:`,h&&(v+=Pc(v,n.indent,u(h))));let y,x,E;Ui(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&&Kn(t)&&(n.indentAtStart=v.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Ig(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const N=jf(t,n,()=>w=!0,()=>g=!0);let _=" ";if(h||y||x){if(_=y?` `:"",x){const T=u(x);_+=` -${Ro(T,n.indent)}`}N===""&&!n.inFlow?_===` +${Oo(T,n.indent)}`}N===""&&!n.inFlow?_===` `&&E&&(_=` `):_+=` -${n.indent}`}else if(!p&&Mi(t)){const T=N[0],k=N.indexOf(` -`),C=k!==-1,I=n.inFlow??t.flow??t.items.length===0;if(C||!I){let O=!1;if(C&&(T==="&"||T==="!")){let M=N.indexOf(" ");T==="&"&&M!==-1&&Me===G0||typeof e=="symbol"&&e.description===G0,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ct(Symbol(G0)),{addToJSMap:K$}),stringify:()=>G0},LNe=(e,t)=>(Po.identify(t)||Fn(t)&&(!t.type||t.type===Ct.PLAIN)&&Po.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Po.tag&&n.default));function K$(e,t,n){const i=q$(e,n);if(Ng(i))for(const s of i.items)cw(e,t,s);else if(Array.isArray(i))for(const s of i)cw(e,t,s);else cw(e,t,i)}function cw(e,t,n){const i=q$(e,n);if(!Sg(i))throw new Error("Merge sources must be maps or map aliases");const s=i.toJSON(null,e,Map);for(const[r,a]of s)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 q$(e,t){return e&&rh(t)?t.resolve(e.doc,e):t}function Y$(e,t,{key:n,value:i}){if(Di(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(LNe(e,n))K$(e,t,i);else{const s=Wr(n,"",e);if(t instanceof Map)t.set(s,Wr(i,s,e));else if(t instanceof Set)t.add(s);else{const r=DNe(n,s,e),a=Wr(i,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function DNe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Di(e)&&(n!=null&&n.doc)){const i=V$(n.doc,{});i.anchors=new Set;for(const r of n.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;const s=e.toString(i);if(!n.mapKeyWarned){let r=JSON.stringify(s);r.length>40&&(r=r.substring(0,36)+'..."'),G$(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 s}return JSON.stringify(t)}function zA(e,t,n){const i=Dm(e,void 0,n),s=Dm(t,void 0,n);return new Ks(i,s)}class Ks{constructor(t,n=null){Object.defineProperty(this,Qr,{value:D$}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return Di(n)&&(n=n.clone(t)),Di(i)&&(i=i.clone(t)),new Ks(n,i)}toJSON(t,n){const i=n!=null&&n.mapAsMap?new Map:{};return Y$(n,i,this)}toString(t,n,i){return t!=null&&t.doc?MNe(this,t,n,i):JSON.stringify(this)}}function W$(e,t,n){return(t.inFlow??e.flow?BNe:PNe)(e,t,n)}function PNe({comment:e,items:t},n,{blockItemPrefix:i,flowChars:s,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+=Dc(y,r,u(v))),f&&v&&(f=!1),h.push(i+y)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;me===X0||typeof e=="symbol"&&e.description===X0,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new At(Symbol(X0)),{addToJSMap:nH}),stringify:()=>X0},WNe=(e,t)=>(Uo.identify(t)||Kn(t)&&(!t.type||t.type===At.PLAIN)&&Uo.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Uo.tag&&n.default));function nH(e,t,n){const i=iH(e,n);if(Ig(i))for(const s of i.items)gw(e,t,s);else if(Array.isArray(i))for(const s of i)gw(e,t,s);else gw(e,t,i)}function gw(e,t,n){const i=iH(e,n);if(!Cg(i))throw new Error("Merge sources must be maps or map aliases");const s=i.toJSON(null,e,Map);for(const[r,a]of s)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 iH(e,t){return e&&lh(t)?t.resolve(e.doc,e):t}function sH(e,t,{key:n,value:i}){if(Ui(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(WNe(e,n))nH(e,t,i);else{const s=Qr(n,"",e);if(t instanceof Map)t.set(s,Qr(i,s,e));else if(t instanceof Set)t.add(s);else{const r=XNe(n,s,e),a=Qr(i,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function XNe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Ui(e)&&(n!=null&&n.doc)){const i=eH(n.doc,{});i.anchors=new Set;for(const r of n.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;const s=e.toString(i);if(!n.mapKeyWarned){let r=JSON.stringify(s);r.length>40&&(r=r.substring(0,36)+'..."'),tH(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 s}return JSON.stringify(t)}function QA(e,t,n){const i=Fm(e,void 0,n),s=Fm(t,void 0,n);return new Ys(i,s)}class Ys{constructor(t,n=null){Object.defineProperty(this,Jr,{value:K$}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return Ui(n)&&(n=n.clone(t)),Ui(i)&&(i=i.clone(t)),new Ys(n,i)}toJSON(t,n){const i=n!=null&&n.mapAsMap?new Map:{};return sH(n,i,this)}toString(t,n,i){return t!=null&&t.doc?YNe(this,t,n,i):JSON.stringify(this)}}function rH(e,t,n){return(t.inFlow??e.flow?ZNe:QNe)(e,t,n)}function QNe({comment:e,items:t},n,{blockItemPrefix:i,flowChars:s,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+=Pc(y,r,u(v))),f&&v&&(f=!1),h.push(i+y)}let p;if(h.length===0)p=s.start+s.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+=Dc(y,i,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((g,v)=>g+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const g of f)m+=g?` +`+Oo(u(e),c),l&&l()):f&&a&&a(),p}function ZNe({items:e},t,{flowChars:n,itemIndent:i}){const{indent:s,indentStep:r,flowCollectionPadding:a,options:{commentString:l}}=t;i+=r;const c=Object.assign({},t,{indent:i,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+=Pc(y,i,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((g,v)=>g+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const g of f)m+=g?` ${r}${s}${g}`:` `;return`${m} -${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function a1({indent:e,options:{commentString:t}},n,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){const r=Ro(t(i),e);n.push(r.trimStart())}}function Pc(e,t){const n=Fn(t)?t.value:t;for(const i of e)if(Pi(i)&&(i.key===t||i.key===n||Fn(i.key)&&i.key.value===n))return i}class Gr extends H${static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ql,t),this.items=[]}static from(t,n,i){const{keepUndefined:s,replacer:r}=i,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||s)&&a.items.push(zA(c,u,i))};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 i;Pi(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Ks(t,t==null?void 0:t.value):i=new Ks(t.key,t.value);const s=Pc(this.items,i.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${i.key} already set`);Fn(s.value)&&$$(i.value)?s.value.value=i.value:s.value=i.value}else if(r){const l=this.items.findIndex(c=>r(i,c)<0);l===-1?this.items.push(i):this.items.splice(l,0,i)}else this.items.push(i)}delete(t){const n=Pc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const i=Pc(this.items,t),s=i==null?void 0:i.value;return(!n&&Fn(s)?s.value:s)??void 0}has(t){return!!Pc(this.items,t)}set(t,n){this.add(new Ks(t,n),!0)}toJSON(t,n,i){const s=i?new i:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const r of this.items)Y$(n,s,r);return s}toString(t,n,i){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Pi(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),W$(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}}const oh={collection:"map",default:!0,nodeClass:Gr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Sg(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Gr.from(e,t,n)};class du extends H${static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(sh,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=K0(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const i=K0(t);if(typeof i!="number")return;const s=this.items[i];return!n&&Fn(s)?s.value:s}has(t){const n=K0(t);return typeof n=="number"&&n=0?t:null}const lh={collection:"seq",default:!0,nodeClass:du,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ng(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>du.from(e,t,n)},Mx={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),HA(e,t,n,i)}},Lx={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"&&Lx.test.test(e)?e:t.options.nullStr},VA={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&&VA.test.test(e)){const i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};function Ia({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);const s=typeof i=="number"?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);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 X$={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:Ia},Q$={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():Ia(e)}},Z$={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:Ia},Dx=e=>typeof e=="bigint"||Number.isInteger(e),GA=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function J$(e,t,n){const{value:i}=e;return Dx(i)&&i>=0?n+i.toString(t):Ia(e)}const eH={identify:e=>Dx(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>GA(e,2,8,n),stringify:e=>J$(e,8,"0o")},tH={identify:Dx,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>GA(e,0,10,n),stringify:Ia},nH={identify:e=>Dx(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>GA(e,2,16,n),stringify:e=>J$(e,16,"0x")},UNe=[oh,lh,Mx,Lx,VA,eH,tH,nH,X$,Q$,Z$];function KL(e){return typeof e=="bigint"||Number.isInteger(e)}const q0=({value:e})=>JSON.stringify(e),FNe=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:q0},{identify:e=>e==null,createNode:()=>new Ct(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:q0},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:q0},{identify:KL,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})=>KL(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:q0}],$Ne={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},HNe=[oh,lh].concat(FNe,$Ne),KA={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,"")),i=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=i.items[0]||new Ks(new Ct(null));if(i.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${i.commentBefore} +${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function f1({indent:e,options:{commentString:t}},n,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){const r=Oo(t(i),e);n.push(r.trimStart())}}function Bc(e,t){const n=Kn(t)?t.value:t;for(const i of e)if(Fi(i)&&(i.key===t||i.key===n||Kn(i.key)&&i.key.value===n))return i}class qr extends Z${static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Wl,t),this.items=[]}static from(t,n,i){const{keepUndefined:s,replacer:r}=i,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||s)&&a.items.push(QA(c,u,i))};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 i;Fi(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Ys(t,t==null?void 0:t.value):i=new Ys(t.key,t.value);const s=Bc(this.items,i.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${i.key} already set`);Kn(s.value)&&Q$(i.value)?s.value.value=i.value:s.value=i.value}else if(r){const l=this.items.findIndex(c=>r(i,c)<0);l===-1?this.items.push(i):this.items.splice(l,0,i)}else this.items.push(i)}delete(t){const n=Bc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const i=Bc(this.items,t),s=i==null?void 0:i.value;return(!n&&Kn(s)?s.value:s)??void 0}has(t){return!!Bc(this.items,t)}set(t,n){this.add(new Ys(t,n),!0)}toJSON(t,n,i){const s=i?new i:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const r of this.items)sH(n,s,r);return s}toString(t,n,i){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Fi(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),rH(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}}const uh={collection:"map",default:!0,nodeClass:qr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Cg(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>qr.from(e,t,n)};class hu extends Z${static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(oh,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=Q0(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const i=Q0(t);if(typeof i!="number")return;const s=this.items[i];return!n&&Kn(s)?s.value:s}has(t){const n=Q0(t);return typeof n=="number"&&n=0?t:null}const dh={collection:"seq",default:!0,nodeClass:hu,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ig(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>hu.from(e,t,n)},$x={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),XA(e,t,n,i)}},Hx={identify:e=>e==null,createNode:()=>new At(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new At(null),stringify:({source:e},t)=>typeof e=="string"&&Hx.test.test(e)?e:t.options.nullStr},ZA={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new At(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&ZA.test.test(e)){const i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};function Ra({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);const s=typeof i=="number"?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);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 aH={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:Ra},oH={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():Ra(e)}},lH={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 At(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ra},zx=e=>typeof e=="bigint"||Number.isInteger(e),JA=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function cH(e,t,n){const{value:i}=e;return zx(i)&&i>=0?n+i.toString(t):Ra(e)}const uH={identify:e=>zx(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>JA(e,2,8,n),stringify:e=>cH(e,8,"0o")},dH={identify:zx,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>JA(e,0,10,n),stringify:Ra},fH={identify:e=>zx(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>JA(e,2,16,n),stringify:e=>cH(e,16,"0x")},JNe=[uh,dh,$x,Hx,ZA,uH,dH,fH,aH,oH,lH];function eD(e){return typeof e=="bigint"||Number.isInteger(e)}const Z0=({value:e})=>JSON.stringify(e),eTe=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Z0},{identify:e=>e==null,createNode:()=>new At(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Z0},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Z0},{identify:eD,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})=>eD(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:Z0}],tTe={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},nTe=[uh,dh].concat(eTe,tTe),e2={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,"")),i=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=i.items[0]||new Ys(new At(null));if(i.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${i.commentBefore} ${s.key.commentBefore}`:i.commentBefore),i.comment){const r=s.value??s.key;r.comment=r.comment?`${i.comment} -${r.comment}`:i.comment}i=s}e.items[n]=Pi(i)?i:new Ks(i)}}else t("Expected a sequence for this tag");return e}function sH(e,t,n){const{replacer:i}=n,s=new du(e);s.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof i=="function"&&(a=i.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;s.items.push(zA(l,c,n))}return s}const qA={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iH,createNode:sH};class Wd extends du{constructor(){super(),this.add=Gr.prototype.add.bind(this),this.delete=Gr.prototype.delete.bind(this),this.get=Gr.prototype.get.bind(this),this.has=Gr.prototype.has.bind(this),this.set=Gr.prototype.set.bind(this),this.tag=Wd.tag}toJSON(t,n){if(!n)return super.toJSON(t);const i=new Map;n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items){let r,a;if(Pi(s)?(r=Wr(s.key,"",n),a=Wr(s.value,r,n)):r=Wr(s,"",n),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,a)}return i}static from(t,n,i){const s=sH(t,n,i),r=new this;return r.items=s.items,r}}Wd.tag="tag:yaml.org,2002:omap";const YA={collection:"seq",identify:e=>e instanceof Map,nodeClass:Wd,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=iH(e,t),i=[];for(const{key:s}of n.items)Fn(s)&&(i.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):i.push(s.value));return Object.assign(new Wd,n)},createNode:(e,t,n)=>Wd.from(e,t,n)};function rH({value:e,source:t},n){return t&&(e?aH:oH).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const aH={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:rH},oH={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:rH},zNe={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:Ia},VNe={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():Ia(e)}},GNe={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 i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Ia},Tg=e=>typeof e=="bigint"||Number.isInteger(e);function Px(e,t,n,{intAsBigInt:i}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){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 s==="-"?BigInt(-1)*a:a}const r=parseInt(e,n);return s==="-"?-1*r:r}function WA(e,t,n){const{value:i}=e;if(Tg(i)){const s=i.toString(t);return i<0?"-"+n+s.substr(1):n+s}return Ia(e)}const KNe={identify:Tg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Px(e,2,2,n),stringify:e=>WA(e,2,"0b")},qNe={identify:Tg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Px(e,1,8,n),stringify:e=>WA(e,8,"0")},YNe={identify:Tg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Px(e,0,10,n),stringify:Ia},WNe={identify:Tg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Px(e,2,16,n),stringify:e=>WA(e,16,"0x")};class Xd extends Gr{constructor(t){super(t),this.tag=Xd.tag}add(t){let n;Pi(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ks(t.key,null):n=new Ks(t,null),Pc(this.items,n.key)||this.items.push(n)}get(t,n){const i=Pc(this.items,t);return!n&&Pi(i)?Fn(i.key)?i.key.value:i.key:i}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 i=Pc(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Ks(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){const{replacer:s}=i,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),r.items.push(zA(a,null,i));return r}}Xd.tag="tag:yaml.org,2002:set";const XA={collection:"map",identify:e=>e instanceof Set,nodeClass:Xd,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Xd.from(e,t,n),resolve(e,t){if(Sg(e)){if(e.hasAllNullValues(!0))return Object.assign(new Xd,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function QA(e,t){const n=e[0],i=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),r=i.replace(/_/g,"").split(":").reduce((a,l)=>a*s(60)+s(l),s(0));return n==="-"?s(-1)*r:r}function lH(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Ia(e);let i="";t<0&&(i="-",t*=n(-1));const s=n(60),r=[t%s];return t<60?r.unshift(0):(t=(t-r[0])/s,r.unshift(t%s),t>=60&&(t=(t-r[0])/s,r.unshift(t))),i+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const cH={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})=>QA(e,n),stringify:lH},uH={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=>QA(e,!1),stringify:lH},Bx={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(Bx.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,s,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,i-1,s,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=QA(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$/,""))??""},qL=[oh,lh,Mx,Lx,aH,oH,KNe,qNe,YNe,WNe,zNe,VNe,GNe,KA,Po,YA,qA,XA,cH,uH,Bx],YL=new Map([["core",UNe],["failsafe",[oh,lh,Mx]],["json",HNe],["yaml11",qL],["yaml-1.1",qL]]),WL={binary:KA,bool:VA,float:Z$,floatExp:Q$,floatNaN:X$,floatTime:uH,int:tH,intHex:nH,intOct:eH,intTime:cH,map:oh,merge:Po,null:Lx,omap:YA,pairs:qA,seq:lh,set:XA,timestamp:Bx},XNe={"tag:yaml.org,2002:binary":KA,"tag:yaml.org,2002:merge":Po,"tag:yaml.org,2002:omap":YA,"tag:yaml.org,2002:pairs":qA,"tag:yaml.org,2002:set":XA,"tag:yaml.org,2002:timestamp":Bx};function uw(e,t,n){const i=YL.get(t);if(i&&!e)return n&&!i.includes(Po)?i.concat(Po):i.slice();let s=i;if(!s)if(Array.isArray(e))s=[];else{const r=Array.from(YL.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)s=s.concat(r);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(Po)),s.reduce((r,a)=>{const l=typeof a=="string"?WL[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(WL).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 QNe=(e,t)=>e.keyt.key?1:0;class ZA{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:s,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?uw(t,"compat"):t?uw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=s?XNe:{},this.tags=uw(n,this.name,i),this.toStringOptions=l??null,Object.defineProperty(this,ql,{value:oh}),Object.defineProperty(this,to,{value:Mx}),Object.defineProperty(this,sh,{value:lh}),this.sortMapEntries=typeof a=="function"?a:a===!0?QNe:null}clone(){const t=Object.create(ZA.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function ZNe(e,t){var c;const n=[];let i=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const s=V$(e,t),{commentString:r}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Ro(u,""))}let a=!1,l=null;if(e.contents){if(Di(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Ro(f,""))}s.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=If(e.contents,s,()=>l=null,u);l&&(d+=Dc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(If(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` -`)?(n.push("..."),n.push(Ro(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(Ro(r(u),"")))}return n.join(` +${r.comment}`:i.comment}i=s}e.items[n]=Fi(i)?i:new Ys(i)}}else t("Expected a sequence for this tag");return e}function pH(e,t,n){const{replacer:i}=n,s=new hu(e);s.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof i=="function"&&(a=i.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;s.items.push(QA(l,c,n))}return s}const t2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:hH,createNode:pH};class Zd extends hu{constructor(){super(),this.add=qr.prototype.add.bind(this),this.delete=qr.prototype.delete.bind(this),this.get=qr.prototype.get.bind(this),this.has=qr.prototype.has.bind(this),this.set=qr.prototype.set.bind(this),this.tag=Zd.tag}toJSON(t,n){if(!n)return super.toJSON(t);const i=new Map;n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items){let r,a;if(Fi(s)?(r=Qr(s.key,"",n),a=Qr(s.value,r,n)):r=Qr(s,"",n),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,a)}return i}static from(t,n,i){const s=pH(t,n,i),r=new this;return r.items=s.items,r}}Zd.tag="tag:yaml.org,2002:omap";const n2={collection:"seq",identify:e=>e instanceof Map,nodeClass:Zd,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=hH(e,t),i=[];for(const{key:s}of n.items)Kn(s)&&(i.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):i.push(s.value));return Object.assign(new Zd,n)},createNode:(e,t,n)=>Zd.from(e,t,n)};function mH({value:e,source:t},n){return t&&(e?gH:bH).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const gH={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 At(!0),stringify:mH},bH={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 At(!1),stringify:mH},iTe={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:Ra},sTe={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():Ra(e)}},rTe={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 At(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Ra},Rg=e=>typeof e=="bigint"||Number.isInteger(e);function Vx(e,t,n,{intAsBigInt:i}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){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 s==="-"?BigInt(-1)*a:a}const r=parseInt(e,n);return s==="-"?-1*r:r}function i2(e,t,n){const{value:i}=e;if(Rg(i)){const s=i.toString(t);return i<0?"-"+n+s.substr(1):n+s}return Ra(e)}const aTe={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Vx(e,2,2,n),stringify:e=>i2(e,2,"0b")},oTe={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Vx(e,1,8,n),stringify:e=>i2(e,8,"0")},lTe={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Vx(e,0,10,n),stringify:Ra},cTe={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Vx(e,2,16,n),stringify:e=>i2(e,16,"0x")};class Jd extends qr{constructor(t){super(t),this.tag=Jd.tag}add(t){let n;Fi(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ys(t.key,null):n=new Ys(t,null),Bc(this.items,n.key)||this.items.push(n)}get(t,n){const i=Bc(this.items,t);return!n&&Fi(i)?Kn(i.key)?i.key.value:i.key:i}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 i=Bc(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Ys(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){const{replacer:s}=i,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),r.items.push(QA(a,null,i));return r}}Jd.tag="tag:yaml.org,2002:set";const s2={collection:"map",identify:e=>e instanceof Set,nodeClass:Jd,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Jd.from(e,t,n),resolve(e,t){if(Cg(e)){if(e.hasAllNullValues(!0))return Object.assign(new Jd,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function r2(e,t){const n=e[0],i=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),r=i.replace(/_/g,"").split(":").reduce((a,l)=>a*s(60)+s(l),s(0));return n==="-"?s(-1)*r:r}function yH(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Ra(e);let i="";t<0&&(i="-",t*=n(-1));const s=n(60),r=[t%s];return t<60?r.unshift(0):(t=(t-r[0])/s,r.unshift(t%s),t>=60&&(t=(t-r[0])/s,r.unshift(t))),i+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const xH={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})=>r2(e,n),stringify:yH},EH={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=>r2(e,!1),stringify:yH},Gx={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(Gx.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,s,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,i-1,s,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=r2(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$/,""))??""},tD=[uh,dh,$x,Hx,gH,bH,aTe,oTe,lTe,cTe,iTe,sTe,rTe,e2,Uo,n2,t2,s2,xH,EH,Gx],nD=new Map([["core",JNe],["failsafe",[uh,dh,$x]],["json",nTe],["yaml11",tD],["yaml-1.1",tD]]),iD={binary:e2,bool:ZA,float:lH,floatExp:oH,floatNaN:aH,floatTime:EH,int:dH,intHex:fH,intOct:uH,intTime:xH,map:uh,merge:Uo,null:Hx,omap:n2,pairs:t2,seq:dh,set:s2,timestamp:Gx},uTe={"tag:yaml.org,2002:binary":e2,"tag:yaml.org,2002:merge":Uo,"tag:yaml.org,2002:omap":n2,"tag:yaml.org,2002:pairs":t2,"tag:yaml.org,2002:set":s2,"tag:yaml.org,2002:timestamp":Gx};function bw(e,t,n){const i=nD.get(t);if(i&&!e)return n&&!i.includes(Uo)?i.concat(Uo):i.slice();let s=i;if(!s)if(Array.isArray(e))s=[];else{const r=Array.from(nD.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)s=s.concat(r);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(Uo)),s.reduce((r,a)=>{const l=typeof a=="string"?iD[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(iD).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 dTe=(e,t)=>e.keyt.key?1:0;class a2{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:s,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?bw(t,"compat"):t?bw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=s?uTe:{},this.tags=bw(n,this.name,i),this.toStringOptions=l??null,Object.defineProperty(this,Wl,{value:uh}),Object.defineProperty(this,no,{value:$x}),Object.defineProperty(this,oh,{value:dh}),this.sortMapEntries=typeof a=="function"?a:a===!0?dTe:null}clone(){const t=Object.create(a2.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function fTe(e,t){var c;const n=[];let i=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const s=eH(e,t),{commentString:r}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Oo(u,""))}let a=!1,l=null;if(e.contents){if(Ui(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Oo(f,""))}s.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=jf(e.contents,s,()=>l=null,u);l&&(d+=Pc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(jf(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` +`)?(n.push("..."),n.push(Oo(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(Oo(r(u),"")))}return n.join(` `)+` -`}class kg{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Qr,{value:QS});let s=null;typeof n=="function"||Array.isArray(n)?s=n:i===void 0&&n&&(i=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"},i);this.options=r;let{version:a}=r;i!=null&&i._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new zs({version:a}),this.setSchema(a,i),this.contents=t===void 0?null:this.createNode(t,s,i)}clone(){const t=Object.create(kg.prototype,{[Qr]:{value:QS}});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=Di(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Qu(this.contents)&&this.contents.add(t)}addIn(t,n){Qu(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const i=U$(this);t.anchor=!n||i.has(n)?F$(n||"a",i):n}return new $A(t.anchor)}createNode(t,n,i){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=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)),s=n}else i===void 0&&n&&(i=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=i??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=TNe(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},g=Dm(t,d,m);return l&&Mi(g)&&(g.flow=!0),h(),g}createPair(t,n,i={}){const s=this.createNode(t,null,i),r=this.createNode(n,null,i);return new Ks(s,r)}delete(t){return Qu(this.contents)?this.contents.delete(t):!1}deleteIn(t){return cp(t)?this.contents==null?!1:(this.contents=null,!0):Qu(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Mi(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return cp(t)?!n&&Fn(this.contents)?this.contents.value:this.contents:Mi(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Mi(this.contents)?this.contents.has(t):!1}hasIn(t){return cp(t)?this.contents!==void 0:Mi(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=r1(this.schema,[t],n):Qu(this.contents)&&this.contents.set(t,n)}setIn(t,n){cp(t)?this.contents=n:this.contents==null?this.contents=r1(this.schema,Array.from(t),n):Qu(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new zs({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new zs({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new ZA(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:s,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=Wr(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"?Md(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 ZNe(this,t)}}function Qu(e){if(Mi(e))return!0;throw new Error("Expected a YAML collection as document contents")}class dH extends Error{constructor(t,n,i,s){super(),this.name=t,this.code=i,this.message=s,this.pos=n}}class up extends dH{constructor(t,n,i){super("YAMLParseError",t,n,i)}}class JNe extends dH{constructor(t,n,i){super("YAMLWarning",t,n,i)}}const XL=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:i,col:s}=n.linePos[0];n.message+=` at line ${i}, column ${s}`;let r=s-1,a=e.substring(t.lineStarts[i-1],t.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);l.length>80&&(l=l.substring(0,79)+`… +`}class jg{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jr,{value:sN});let s=null;typeof n=="function"||Array.isArray(n)?s=n:i===void 0&&n&&(i=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"},i);this.options=r;let{version:a}=r;i!=null&&i._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Gs({version:a}),this.setSchema(a,i),this.contents=t===void 0?null:this.createNode(t,s,i)}clone(){const t=Object.create(jg.prototype,{[Jr]:{value:sN}});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=Ui(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ju(this.contents)&&this.contents.add(t)}addIn(t,n){Ju(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const i=W$(this);t.anchor=!n||i.has(n)?X$(n||"a",i):n}return new WA(t.anchor)}createNode(t,n,i){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=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)),s=n}else i===void 0&&n&&(i=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=i??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=FNe(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},g=Fm(t,d,m);return l&&Pi(g)&&(g.flow=!0),h(),g}createPair(t,n,i={}){const s=this.createNode(t,null,i),r=this.createNode(n,null,i);return new Ys(s,r)}delete(t){return Ju(this.contents)?this.contents.delete(t):!1}deleteIn(t){return hp(t)?this.contents==null?!1:(this.contents=null,!0):Ju(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Pi(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return hp(t)?!n&&Kn(this.contents)?this.contents.value:this.contents:Pi(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Pi(this.contents)?this.contents.has(t):!1}hasIn(t){return hp(t)?this.contents!==void 0:Pi(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=d1(this.schema,[t],n):Ju(this.contents)&&this.contents.set(t,n)}setIn(t,n){hp(t)?this.contents=n:this.contents==null?this.contents=d1(this.schema,Array.from(t),n):Ju(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Gs({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Gs({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new a2(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:s,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=Qr(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"?Dd(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 fTe(this,t)}}function Ju(e){if(Pi(e))return!0;throw new Error("Expected a YAML collection as document contents")}class vH extends Error{constructor(t,n,i,s){super(),this.name=t,this.code=i,this.message=s,this.pos=n}}class pp extends vH{constructor(t,n,i){super("YAMLParseError",t,n,i)}}class hTe extends vH{constructor(t,n,i){super("YAMLWarning",t,n,i)}}const sD=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:i,col:s}=n.linePos[0];n.message+=` at line ${i}, column ${s}`;let r=s-1,a=e.substring(t.lineStarts[i-1],t.lineStarts[i]).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)+"…"),i>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[i-2],t.lineStarts[i-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)===i&&c.col>s&&(l=Math.max(1,Math.min(c.col-s,80-r)));const u=" ".repeat(r)+"^".repeat(l);n.message+=`: ${a} ${u} -`}};function Rf(e,{flow:t,indicator:n,next:i,offset:s,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,g=null,v=null,y=null,x=null,E=null,w=null,N=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),g&&(u&&k.type!=="comment"&&k.type!=="newline"&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),k.type){case"space":!t&&(n!=="doc-start"||(i==null?void 0:i.type)!=="flow-collection")&&k.source.includes(" ")&&(g=k),d=!0;break;case"comment":{d||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=k.source.substring(1)||" ";f?f+=h+C:f=C,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,N??(N=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,N??(N=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:s;return m&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(u&&g.indent<=a||(i==null?void 0:i.type)==="block-map"||(i==null?void 0:i.type)==="block-seq")&&r(g,"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:N??T}}function Pm(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(Pm(t.key)||Pm(t.value))return!0}return!1;default:return!0}}function tN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Pm(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function fH(e,t,n){const{uniqueKeys:i}=e.options;if(i===!1)return!1;const s=typeof i=="function"?i:(r,a)=>r===a||Fn(r)&&Fn(a)&&r.value===a.value;return t.some(r=>s(r.key,n))}const QL="All mapping items must start at the same column";function eTe({composeNode:e,composeEmptyNode:t},n,i,s,r){var d;const a=(r==null?void 0:r.nodeClass)??Gr,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,u=null;for(const f of i.items){const{start:h,key:p,sep:m,value:g}=f,v=Rf(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:i.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==i.indent&&s(c,"BAD_INDENT",QL)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` -`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||Pm(p))&&s(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)!==i.indent&&s(c,"BAD_INDENT",QL);n.atKey=!0;const x=v.end,E=p?e(n,p,v,s):t(n,x,h,null,v,s);n.schema.compat&&tN(i.indent,p,s),n.atKey=!1,fH(n,l.items,E)&&s(x,"DUPLICATE_KEY","Map keys must be unique");const w=Rf(m??[],{indicator:"map-value-ind",next:g,offset:E.range[2],onError:s,parentIndent:i.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((g==null?void 0:g.type)==="block-map"&&!w.hasNewline&&s(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 nTe({composeNode:e,composeEmptyNode:t},n,i,s,r){var v;const a=i.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?Gr:du),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;y0){const y=Ag(m,g,n.options.strict,s);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[i.offset,g,y.offset]}else u.range=[i.offset,g,g];return u}function hw(e,t,n,i,s,r){const a=n.type==="block-map"?eTe(e,t,n,i,r):n.type==="block-seq"?tTe(e,t,n,i,r):nTe(e,t,n,i,r),l=a.constructor;return s==="!"||s===l.tagName?(a.tag=l.tagName,a):(s&&(a.tag=s),a)}function iTe(e,t,n,i,s){var h;const r=i.tag,a=r?t.directives.tagName(r.source,p=>s(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=i,g=p&&r?p.offset>r.offset?p:r:p??r;g&&(!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?s(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),hw(e,t,n,s,a)}const u=hw(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Di(d)?d:new Ct(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function sTe(e,t,n){const i=t.offset,s=rTe(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};const r=s.mode===">"?Ct.BLOCK_FOLDED:Ct.BLOCK_LITERAL,a=t.source?aTe(t.source):[];let l=a.length;for(let g=a.length-1;g>=0;--g){const v=a[g][1];if(v===""||v==="\r")l=g;else break}if(l===0){const g=s.chomp==="+"&&a.length>0?` +`}};function Of(e,{flow:t,indicator:n,next:i,offset:s,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,g=null,v=null,y=null,x=null,E=null,w=null,N=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),g&&(u&&k.type!=="comment"&&k.type!=="newline"&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),k.type){case"space":!t&&(n!=="doc-start"||(i==null?void 0:i.type)!=="flow-collection")&&k.source.includes(" ")&&(g=k),d=!0;break;case"comment":{d||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=k.source.substring(1)||" ";f?f+=h+C:f=C,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,N??(N=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,N??(N=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:s;return m&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(u&&g.indent<=a||(i==null?void 0:i.type)==="block-map"||(i==null?void 0:i.type)==="block-seq")&&r(g,"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:N??T}}function $m(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($m(t.key)||$m(t.value))return!0}return!1;default:return!0}}function lN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&$m(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function wH(e,t,n){const{uniqueKeys:i}=e.options;if(i===!1)return!1;const s=typeof i=="function"?i:(r,a)=>r===a||Kn(r)&&Kn(a)&&r.value===a.value;return t.some(r=>s(r.key,n))}const rD="All mapping items must start at the same column";function pTe({composeNode:e,composeEmptyNode:t},n,i,s,r){var d;const a=(r==null?void 0:r.nodeClass)??qr,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,u=null;for(const f of i.items){const{start:h,key:p,sep:m,value:g}=f,v=Of(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:i.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==i.indent&&s(c,"BAD_INDENT",rD)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` +`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||$m(p))&&s(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)!==i.indent&&s(c,"BAD_INDENT",rD);n.atKey=!0;const x=v.end,E=p?e(n,p,v,s):t(n,x,h,null,v,s);n.schema.compat&&lN(i.indent,p,s),n.atKey=!1,wH(n,l.items,E)&&s(x,"DUPLICATE_KEY","Map keys must be unique");const w=Of(m??[],{indicator:"map-value-ind",next:g,offset:E.range[2],onError:s,parentIndent:i.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((g==null?void 0:g.type)==="block-map"&&!w.hasNewline&&s(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 gTe({composeNode:e,composeEmptyNode:t},n,i,s,r){var v;const a=i.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?qr:hu),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;y0){const y=Og(m,g,n.options.strict,s);y.comment&&(u.comment?u.comment+=` +`+y.comment:u.comment=y.comment),u.range=[i.offset,g,y.offset]}else u.range=[i.offset,g,g];return u}function Ew(e,t,n,i,s,r){const a=n.type==="block-map"?pTe(e,t,n,i,r):n.type==="block-seq"?mTe(e,t,n,i,r):gTe(e,t,n,i,r),l=a.constructor;return s==="!"||s===l.tagName?(a.tag=l.tagName,a):(s&&(a.tag=s),a)}function bTe(e,t,n,i,s){var h;const r=i.tag,a=r?t.directives.tagName(r.source,p=>s(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=i,g=p&&r?p.offset>r.offset?p:r:p??r;g&&(!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?s(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Ew(e,t,n,s,a)}const u=Ew(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Ui(d)?d:new At(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function yTe(e,t,n){const i=t.offset,s=xTe(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};const r=s.mode===">"?At.BLOCK_FOLDED:At.BLOCK_LITERAL,a=t.source?ETe(t.source):[];let l=a.length;for(let g=a.length-1;g>=0;--g){const v=a[g][1];if(v===""||v==="\r")l=g;else break}if(l===0){const g=s.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let v=i+s.length;return t.source&&(v+=t.source.length),{value:g,type:r,comment:s.comment,range:[i,v,v]}}let c=t.indent+s.indent,u=t.offset+s.length,d=0;for(let g=0;gc&&(c=v.length);else{v.length=l;--g)a[g][0].length>c&&(l=g+1);let f="",h="",p=!1;for(let g=0;gc||y[0]===" "?(h===" "?h=` `:!p&&h===` `&&(h=` @@ -1023,73 +1023,73 @@ ${u} `+a[g][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const m=i+s.length+t.source.length;return{value:f,type:r,comment:s.comment,range:[i,m,m]}}function rTe({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=t[0],r=s[0];let a=0,l="",c=-1;for(let h=1;hn(i+h,p,m);switch(s){case"scalar":l=Ct.PLAIN,c=lTe(r,u);break;case"single-quoted-scalar":l=Ct.QUOTE_SINGLE,c=cTe(r,u);break;case"double-quoted-scalar":l=Ct.QUOTE_DOUBLE,c=uTe(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}const d=i+r.length,f=Ag(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[i,d,f.offset]}}function lTe(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}`),hH(e)}function cTe(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),hH(e.slice(1,-1)).replace(/''/g,"'")}function hH(e){let t,n;try{t=new RegExp(`(.*?)(?n(i+h,p,m);switch(s){case"scalar":l=At.PLAIN,c=wTe(r,u);break;case"single-quoted-scalar":l=At.QUOTE_SINGLE,c=_Te(r,u);break;case"double-quoted-scalar":l=At.QUOTE_DOUBLE,c=STe(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}const d=i+r.length,f=Og(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[i,d,f.offset]}}function wTe(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}`),_H(e)}function _Te(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),_H(e.slice(1,-1)).replace(/''/g,"'")}function _H(e){let t,n;try{t=new RegExp(`(.*?)(?r?e.slice(r,i+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function dTe(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===` +`)&&(n+=i>r?e.slice(r,i+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function NTe(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===` `||i==="\r")&&!(i==="\r"&&e[t+2]!==` `);)i===` `&&(n+=` -`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}const fTe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function hTe(e,t,n,i){const s=e.substr(t,n),a=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(a)}catch{const l=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function pH(e,t,n,i){const{value:s,type:r,comment:a,range:l}=t.type==="block-scalar"?sTe(e,t,i):oTe(t,e.options.strict,i),c=n?e.directives.tagName(n.source,f=>i(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[to]:c?u=pTe(e.schema,s,c,n,i):t.type==="scalar"?u=mTe(e,s,t,i):u=e.schema[to];let d;try{const f=u.resolve(s,h=>i(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Fn(f)?f:new Ct(f)}catch(f){const h=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",h),d=new Ct(s)}return d.range=l,d.source=s,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function pTe(e,t,n,i,s){var l;if(n==="!")return e[to];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):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[to])}function mTe({atKey:e,directives:t,schema:n},i,s,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(i))})||n[to];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(i))})??n[to];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(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function gTe(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let s=t[i];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++i];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++i];break}}return e}const bTe={composeNode:mH,composeEmptyNode:JA};function mH(e,t,n,i){const s=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=yTe(e,t,i),(l||c)&&i(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=pH(e,t,c,i),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=iTe(bTe,e,t,n,i),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=JA(e,t.offset,void 0,null,n,i)),l&&u.anchor===""&&i(l,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!Fn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(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 JA(e,t,n,i,{spaceBefore:s,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:gTe(t,n,i),indent:-1,source:""},f=pH(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=c),f}function yTe({options:e},{offset:t,source:n,end:i},s){const r=new $A(n.substring(1));r.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Ag(i,a,e.strict,s);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function xTe(e,t,{offset:n,start:i,value:s,end:r},a){const l=Object.assign({_directives:t},e),c=new kg(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Rf(i,{indicator:"doc-start",next:s??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?mH(u,s,d,a):JA(u,d.end,i,null,d,a);const f=c.contents.range[2],h=Ag(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Gh(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 ZL(e){var s;let t="",n=!1,i=!1;for(let r=0;ri(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[no]:c?u=ATe(e.schema,s,c,n,i):t.type==="scalar"?u=CTe(e,s,t,i):u=e.schema[no];let d;try{const f=u.resolve(s,h=>i(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Kn(f)?f:new At(f)}catch(f){const h=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",h),d=new At(s)}return d.range=l,d.source=s,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function ATe(e,t,n,i,s){var l;if(n==="!")return e[no];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):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[no])}function CTe({atKey:e,directives:t,schema:n},i,s,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(i))})||n[no];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(i))})??n[no];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(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function ITe(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let s=t[i];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++i];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++i];break}}return e}const RTe={composeNode:NH,composeEmptyNode:o2};function NH(e,t,n,i){const s=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=jTe(e,t,i),(l||c)&&i(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=SH(e,t,c,i),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=bTe(RTe,e,t,n,i),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=o2(e,t.offset,void 0,null,n,i)),l&&u.anchor===""&&i(l,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!Kn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(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 o2(e,t,n,i,{spaceBefore:s,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:ITe(t,n,i),indent:-1,source:""},f=SH(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=c),f}function jTe({options:e},{offset:t,source:n,end:i},s){const r=new WA(n.substring(1));r.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Og(i,a,e.strict,s);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function OTe(e,t,{offset:n,start:i,value:s,end:r},a){const l=Object.assign({_directives:t},e),c=new jg(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Of(i,{indicator:"doc-start",next:s??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?NH(u,s,d,a):o2(u,d.end,i,null,d,a);const f=c.contents.range[2],h=Og(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Wh(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 aD(e){var s;let t="",n=!1,i=!1;for(let r=0;r{const a=Gh(n);r?this.warnings.push(new JNe(a,i,s)):this.errors.push(new up(a,i,s))},this.directives=new zs({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:i,afterEmptyLine:s}=ZL(this.prelude);if(i){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} -${i}`:i;else if(s||t.directives.docStart||!r)t.commentBefore=i;else if(Mi(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Pi(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${i} +`)+(a.substring(1)||" "),n=!0,i=!1;break;case"%":((s=e[r+1])==null?void 0:s[0])!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}class MTe{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,s,r)=>{const a=Wh(n);r?this.warnings.push(new hTe(a,i,s)):this.errors.push(new pp(a,i,s))},this.directives=new Gs({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:i,afterEmptyLine:s}=aD(this.prelude);if(i){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} +${i}`:i;else if(s||t.directives.docStart||!r)t.commentBefore=i;else if(Pi(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Fi(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${i} ${l}`:i}else{const a=r.commentBefore;r.commentBefore=a?`${i} -${a}`:i}}if(n){for(let r=0;r{const r=Gh(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",i,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=xTe(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,i=new up(Gh(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){const i="Unexpected doc-end without preceding document";this.errors.push(new up(Gh(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;const n=Ag(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const i=this.doc.comment;this.doc.comment=i?`${i} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new up(Gh(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 i=Object.assign({_directives:this.directives},this.options),s=new kg(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const gH="\uFEFF",bH="",yH="",nN="";function vTe(e){switch(e){case gH:return"byte-order-mark";case bH:return"doc-mode";case yH:return"flow-error-end";case nN:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:i}}if(n){for(let r=0;r{const r=Wh(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",i,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=OTe(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,i=new pp(Wh(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){const i="Unexpected doc-end without preceding document";this.errors.push(new pp(Wh(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;const n=Og(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const i=this.doc.comment;this.doc.comment=i?`${i} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new pp(Wh(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 i=Object.assign({_directives:this.directives},this.options),s=new jg(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const TH="\uFEFF",kH="",AH="",cN="";function LTe(e){switch(e){case TH:return"byte-order-mark";case kH:return"doc-mode";case AH:return"flow-error-end";case cN: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 ca(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const JL=new Set("0123456789ABCDEFabcdef"),wTe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Y0=new Set(",[]{}"),_Te=new Set(` ,[]{} -\r `),pw=e=>!e||_Te.has(e);class STe{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 i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}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 ua(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}const oD=new Set("0123456789ABCDEFabcdef"),DTe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),J0=new Set(",[]{}"),PTe=new Set(` ,[]{} +\r `),vw=e=>!e||PTe.has(e);class BTe{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 i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}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 i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){const s=this.buffer[i+t+1];if(s===` `||!s&&!this.atEnd)return t+i+1}return n===` -`||i>=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){const i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ca(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!ca(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===":")&&ca(n)){const i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"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(pw),"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,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((i!==-1&&i=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){const i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ua(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!ua(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===":")&&ua(n)){const i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"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(vw),"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,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((i!==-1&&i"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ca(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":n+=1;break;case` +`,r)}s!==-1&&(n=s-(i[s-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=>ua(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){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(!i&&!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 s=t+1;for(i=this.buffer[s];i===" ";)i=this.buffer[++s];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===` `;)i=this.buffer[++s];t=s-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 nN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,i=this.pos-1,s;for(;s=this.buffer[++i];)if(s===":"){const r=this.buffer[i+1];if(ca(r)||t&&Y0.has(r))break;n=i}else if(ca(s)){let r=this.buffer[i+1];if(s==="\r"&&(r===` +`&&r>=this.pos&&r+1+n>l)t=r;else break}while(!0);return yield cN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,i=this.pos-1,s;for(;s=this.buffer[++i];)if(s===":"){const r=this.buffer[i+1];if(ua(r)||t&&J0.has(r))break;n=i}else if(ua(s)){let r=this.buffer[i+1];if(s==="\r"&&(r===` `?(i+=1,s=` -`,r=this.buffer[i+1]):n=i),r==="#"||t&&Y0.has(r))break;if(s===` -`){const a=this.continueScalar(i+1);if(a===-1)break;i=Math.max(i,a-2)}}else{if(t&&Y0.has(s))break;n=i}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield nN,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 i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.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(pw),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,i=this.charAt(1);if(ca(i)||n&&Y0.has(i)){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(;!ca(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(wTe.has(n))n=this.buffer[++t];else if(n==="%"&&JL.has(this.buffer[t+1])&&JL.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===` +`,r=this.buffer[i+1]):n=i),r==="#"||t&&J0.has(r))break;if(s===` +`){const a=this.continueScalar(i+1);if(a===-1)break;i=Math.max(i,a-2)}}else{if(t&&J0.has(s))break;n=i}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield cN,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 i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.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(vw),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,i=this.charAt(1);if(ua(i)||n&&J0.has(i)){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(;!ua(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(DTe.has(n))n=this.buffer[++t];else if(n==="%"&&oD.has(this.buffer[t+1])&&oD.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,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class NTe{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=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 o1(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 i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&tD(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{const s=i.items[i.items.length-1];if(s.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=i.items[i.items.length-1];s.value?i.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=i.items[i.items.length-1];!s||s.value?i.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&eD(s.start)===-1&&(n.indent===0||s.start.every(r=>r.type!=="comment"||r.indent0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class UTe{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=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 h1(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 i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&cD(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{const s=i.items[i.items.length-1];if(s.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=i.items[i.items.length-1];s.value?i.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=i.items[i.items.length-1];!s||s.value?i.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&lD(s.start)===-1&&(n.indent===0||s.start.every(r=>r.type!=="comment"||r.indent=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,r=s&&(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(wl(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(xH(n.key)&&!wl(n.sep,"newline")){const l=Zu(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(wl(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=Zu(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]}):wl(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&&!wl(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 s&&t.items.push({start:a});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,r=Array.isArray(s)?s[s.length-1]:void 0;(r==null?void 0:r.type)==="comment"?s==null||s.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 s=t.items[t.items.length-2],r=(i=s==null?void 0:s.value)==null?void 0:i.end;if(Array.isArray(r)){o1(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||wl(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while((i==null?void 0:i.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 s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{const i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){const s=W0(i),r=Zu(s);tD(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 i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const s="end"in n.value?n.value.end:void 0,r=Array.isArray(s)?s[s.length-1]:void 0;(r==null?void 0:r.type)==="comment"?s==null||s.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 s=t.items[t.items.length-2],r=(i=s==null?void 0:s.value)==null?void 0:i.end;if(Array.isArray(r)){h1(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,r=s&&(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(Sl(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(CH(n.key)&&!Sl(n.sep,"newline")){const l=ed(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(Sl(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=ed(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]}):Sl(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&&!Sl(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 s&&t.items.push({start:a});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,r=Array.isArray(s)?s[s.length-1]:void 0;(r==null?void 0:r.type)==="comment"?s==null||s.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 s=t.items[t.items.length-2],r=(i=s==null?void 0:s.value)==null?void 0:i.end;if(Array.isArray(r)){h1(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||Sl(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while((i==null?void 0:i.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 s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{const i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){const s=eb(i),r=ed(s);cD(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=W0(t),i=Zu(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=W0(t),i=Zu(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.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 kTe(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new NTe||null,prettyErrors:t}}function ATe(e,t={}){const{lineCounter:n,prettyErrors:i}=kTe(t),s=new TTe(n==null?void 0:n.addNewLine),r=new ETe(t);let a=null;for(const l of r.compose(s.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new up(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(XL(e,n)),a.warnings.forEach(XL(e,n))),a}function CTe(e,t,n){let i;const s=ATe(e,n);if(!s)return null;if(s.warnings.forEach(r=>G$(s.options.logLevel,r)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:i},n))}function ITe(e,t,n){let i=null;if(Array.isArray(t)&&(i=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return _g(e)&&!i?e.toString(n):new kg(e,i,n).toString(n)}const EH=new Set(["local","sqlite","mysql","postgresql"]),vH=new Set(["local","opensearch","redis","viking","openviking","mem0"]),wH=new Set(["opensearch","viking","context_search"]),_H=new Set(["apmplus","cozeloop","tls"]),SH=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),RTe=new Set(cU.map(e=>e.id)),jTe=new Set(["llm","sequential","parallel","loop","a2a"]);function Lt(e,t=""){return typeof e=="string"?e:t}function $r(e){return e===!0}function qp(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function NH(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Lt(t.name),description:Lt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function Qd(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function TH(e){return typeof e=="string"&&jTe.has(e)?e:"llm"}function kH(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function AH(e){const t=e&&typeof e=="object"?e:{};return{enabled:$r(t.enabled),registrySpaceId:Lt(t.registrySpaceId),registryTopK:Lt(t.registryTopK),registryRegion:Lt(t.registryRegion),registryEndpoint:Lt(t.registryEndpoint)}}function CH(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},i=n.memory&&typeof n.memory=="object"?n.memory:{},s=AH(n.a2aRegistry),r=TH(n.agentType),a=s.enabled&&r==="llm"?"a2a":r;return{...Es(),name:Lt(n.name),description:Lt(n.description),instruction:Lt(n.instruction),agentType:a,maxIterations:kH(n.maxIterations),a2aUrl:Lt(n.a2aUrl),modelName:Lt(n.modelName),modelProvider:Lt(n.modelProvider),modelApiBase:Lt(n.modelApiBase),builtinTools:qp(n.builtinTools).filter(l=>SH.has(l)),customTools:NH(n.customTools),memory:{shortTerm:$r(i.shortTerm),longTerm:$r(i.longTerm)},shortTermBackend:Qd(n.shortTermBackend,EH,"local"),longTermBackend:Qd(n.longTermBackend,vH,"local"),autoSaveSession:$r(n.autoSaveSession),knowledgebase:$r(n.knowledgebase),knowledgebaseBackend:Qd(n.knowledgebaseBackend,wH,cu),knowledgebaseIndex:Lt(n.knowledgebaseIndex),tracing:$r(n.tracing),tracingExporters:qp(n.tracingExporters).filter(l=>_H.has(l)),a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,subAgents:CH(n.subAgents),selectedSkills:IH(n)}}):[]}function IH(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const i=n&&typeof n=="object"?n:{},s=Lt(i.source),r=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=Lt(i.name)||Lt(i.slug)||Lt(i.skillName)||Lt(i.skillId)||"skill",l=Lt(i.folder)||a,c=Lt(i.description);if(r==="skillhub"){const f=Lt(i.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:Lt(i.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(i.localFiles)?i.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},g=Lt(m.path),v=Lt(m.content);return g?{path:g,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=Lt(i.skillSpaceId),d=Lt(i.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:Lt(i.skillSpaceName),skillId:d,version:Lt(i.version)})}return t}function e2(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},i=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=AH(t.a2aRegistry),r=TH(t.agentType),a=s.enabled&&r==="llm"?"a2a":r,l=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:Lt(u.name),transport:d,url:Lt(u.url),authToken:Lt(u.authToken),command:Lt(u.command),args:qp(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{...Es(),name:Lt(t.name)||"my_agent",description:Lt(t.description),instruction:Lt(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:kH(t.maxIterations),a2aUrl:Lt(t.a2aUrl),modelName:Lt(t.modelName),modelProvider:Lt(t.modelProvider),modelApiBase:Lt(t.modelApiBase),builtinTools:qp(t.builtinTools).filter(c=>SH.has(c)),customTools:NH(t.customTools),mcpTools:l,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:$r(n.shortTerm),longTerm:$r(n.longTerm)},shortTermBackend:Qd(t.shortTermBackend,EH,"local"),longTermBackend:Qd(t.longTermBackend,vH,"local"),autoSaveSession:$r(t.autoSaveSession),knowledgebase:$r(t.knowledgebase),knowledgebaseBackend:Qd(t.knowledgebaseBackend,wH,cu),knowledgebaseIndex:Lt(t.knowledgebaseIndex),tracing:$r(t.tracing),tracingExporters:qp(t.tracingExporters).filter(c=>_H.has(c)),deployment:{feishuEnabled:$r(i.feishuEnabled)},subAgents:CH(t.subAgents),selectedSkills:IH(t)}}function RH(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>RTe.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:cu,knowledgebaseIndex:"",subAgents:e.subAgents.map(RH)}}function jH(e){var n,i,s,r,a,l,c,u,d,f,h,p,m,g,v,y,x,E;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const w={enabled:!0};(i=e.a2aRegistry.registrySpaceId)!=null&&i.trim()&&(w.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),w.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||va.topK,w.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||va.region,w.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||va.endpoint,t.a2aRegistry=w}return t}return 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(w=>({name:w.name,description:w.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(w=>{var _,T,k,C;const N={name:w.name,transport:w.transport};return(_=w.url)!=null&&_.trim()&&(N.url=w.url.trim()),(T=w.authToken)!=null&&T.trim()&&(N.authToken=w.authToken.trim()),(k=w.command)!=null&&k.trim()&&(N.command=w.command.trim()),(C=w.args)!=null&&C.length&&(N.args=w.args),N})),((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",(g=e.knowledgebaseIndex)!=null&&g.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&&(t.deployment={feishuEnabled:!0}),(x=e.selectedSkills)!=null&&x.length&&(t.selectedSkills=e.selectedSkills.map(w=>{const N={source:w.source,name:w.name,folder:w.folder};return w.description&&(N.description=w.description),w.source==="skillhub"?(N.slug=w.slug,N.namespace=w.namespace??"public"):w.source==="local"?N.localFiles=w.localFiles??[]:(N.skillSpaceId=w.skillSpaceId,N.skillSpaceName=w.skillSpaceName,N.skillId=w.skillId,w.version&&(N.version=w.version)),N})),(E=e.subAgents)!=null&&E.length&&(t.subAgents=e.subAgents.map(jH)),t}function OTe(e){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),i=ed(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=eb(t),i=ed(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.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 $Te(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new UTe||null,prettyErrors:t}}function HTe(e,t={}){const{lineCounter:n,prettyErrors:i}=$Te(t),s=new FTe(n==null?void 0:n.addNewLine),r=new MTe(t);let a=null;for(const l of r.compose(s.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new pp(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(sD(e,n)),a.warnings.forEach(sD(e,n))),a}function zTe(e,t,n){let i;const s=HTe(e,n);if(!s)return null;if(s.warnings.forEach(r=>tH(s.options.logLevel,r)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:i},n))}function VTe(e,t,n){let i=null;if(Array.isArray(t)&&(i=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return Ag(e)&&!i?e.toString(n):new jg(e,i,n).toString(n)}const IH=new Set(["local","sqlite","mysql","postgresql"]),RH=new Set(["local","opensearch","redis","viking","openviking","mem0"]),jH=new Set(["opensearch","viking","context_search"]),OH=new Set(["apmplus","cozeloop","tls"]),MH=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),GTe=new Set(xU.map(e=>e.id)),KTe=new Set(["llm","sequential","parallel","loop","a2a"]);function Ot(e,t=""){return typeof e=="string"?e:t}function zr(e){return e===!0}function Qp(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function LH(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Ot(t.name),description:Ot(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function ef(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function DH(e){return typeof e=="string"&&KTe.has(e)?e:"llm"}function PH(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function BH(e){const t=e&&typeof e=="object"?e:{};return{enabled:zr(t.enabled),registrySpaceId:Ot(t.registrySpaceId),registryTopK:Ot(t.registryTopK),registryRegion:Ot(t.registryRegion),registryEndpoint:Ot(t.registryEndpoint)}}function UH(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},i=n.memory&&typeof n.memory=="object"?n.memory:{},s=BH(n.a2aRegistry),r=DH(n.agentType),a=s.enabled&&r==="llm"?"a2a":r;return{..._s(),name:Ot(n.name),description:Ot(n.description),instruction:Ot(n.instruction),agentType:a,maxIterations:PH(n.maxIterations),a2aUrl:Ot(n.a2aUrl),modelName:Ot(n.modelName),modelProvider:Ot(n.modelProvider),modelApiBase:Ot(n.modelApiBase),builtinTools:Qp(n.builtinTools).filter(l=>MH.has(l)),customTools:LH(n.customTools),memory:{shortTerm:zr(i.shortTerm),longTerm:zr(i.longTerm)},shortTermBackend:ef(n.shortTermBackend,IH,"local"),longTermBackend:ef(n.longTermBackend,RH,"local"),autoSaveSession:zr(n.autoSaveSession),knowledgebase:zr(n.knowledgebase),knowledgebaseBackend:ef(n.knowledgebaseBackend,jH,du),knowledgebaseIndex:Ot(n.knowledgebaseIndex),tracing:zr(n.tracing),tracingExporters:Qp(n.tracingExporters).filter(l=>OH.has(l)),a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,subAgents:UH(n.subAgents),selectedSkills:FH(n)}}):[]}function FH(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const i=n&&typeof n=="object"?n:{},s=Ot(i.source),r=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=Ot(i.name)||Ot(i.slug)||Ot(i.skillName)||Ot(i.skillId)||"skill",l=Ot(i.folder)||a,c=Ot(i.description);if(r==="skillhub"){const f=Ot(i.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:Ot(i.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(i.localFiles)?i.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},g=Ot(m.path),v=Ot(m.content);return g?{path:g,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=Ot(i.skillSpaceId),d=Ot(i.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:Ot(i.skillSpaceName),skillId:d,version:Ot(i.version)})}return t}function l2(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},i=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=BH(t.a2aRegistry),r=DH(t.agentType),a=s.enabled&&r==="llm"?"a2a":r,l=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:Ot(u.name),transport:d,url:Ot(u.url),authToken:Ot(u.authToken),command:Ot(u.command),args:Qp(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{..._s(),name:Ot(t.name)||"my_agent",description:Ot(t.description),instruction:Ot(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:PH(t.maxIterations),a2aUrl:Ot(t.a2aUrl),modelName:Ot(t.modelName),modelProvider:Ot(t.modelProvider),modelApiBase:Ot(t.modelApiBase),builtinTools:Qp(t.builtinTools).filter(c=>MH.has(c)),customTools:LH(t.customTools),mcpTools:l,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:zr(n.shortTerm),longTerm:zr(n.longTerm)},shortTermBackend:ef(t.shortTermBackend,IH,"local"),longTermBackend:ef(t.longTermBackend,RH,"local"),autoSaveSession:zr(t.autoSaveSession),knowledgebase:zr(t.knowledgebase),knowledgebaseBackend:ef(t.knowledgebaseBackend,jH,du),knowledgebaseIndex:Ot(t.knowledgebaseIndex),tracing:zr(t.tracing),tracingExporters:Qp(t.tracingExporters).filter(c=>OH.has(c)),deployment:{feishuEnabled:zr(i.feishuEnabled)},subAgents:UH(t.subAgents),selectedSkills:FH(t)}}function $H(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>GTe.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:du,knowledgebaseIndex:"",subAgents:e.subAgents.map($H)}}function HH(e){var n,i,s,r,a,l,c,u,d,f,h,p,m,g,v,y,x,E;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const w={enabled:!0};(i=e.a2aRegistry.registrySpaceId)!=null&&i.trim()&&(w.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),w.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||wa.topK,w.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||wa.region,w.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||wa.endpoint,t.a2aRegistry=w}return t}return 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(w=>({name:w.name,description:w.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(w=>{var _,T,k,C;const N={name:w.name,transport:w.transport};return(_=w.url)!=null&&_.trim()&&(N.url=w.url.trim()),(T=w.authToken)!=null&&T.trim()&&(N.authToken=w.authToken.trim()),(k=w.command)!=null&&k.trim()&&(N.command=w.command.trim()),(C=w.args)!=null&&C.length&&(N.args=w.args),N})),((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",(g=e.knowledgebaseIndex)!=null&&g.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&&(t.deployment={feishuEnabled:!0}),(x=e.selectedSkills)!=null&&x.length&&(t.selectedSkills=e.selectedSkills.map(w=>{const N={source:w.source,name:w.name,folder:w.folder};return w.description&&(N.description=w.description),w.source==="skillhub"?(N.slug=w.slug,N.namespace=w.namespace??"public"):w.source==="local"?N.localFiles=w.localFiles??[]:(N.skillSpaceId=w.skillSpaceId,N.skillSpaceName=w.skillSpaceName,N.skillId=w.skillId,w.version&&(N.version=w.version)),N})),(E=e.subAgents)!=null&&E.length&&(t.subAgents=e.subAgents.map(HH)),t}function qTe(e){return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+ITe(jH(e))}function MTe(e){const t=CTe(e);return e2(t)}const LTe=[{kind:"custom",icon:GJ,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:kJ,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:_J,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:KJ,title:"工作流",desc:"敬请期待",disabled:!0}];function DTe({onSelect:e,onImport:t}){const n=b.useRef(null),[i,s]=b.useState(""),r=LTe.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(MTe(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(L$,{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(zJ,{}),"导入 YAML 配置"]}),i&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:i}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const PTe="modulepreload",BTe=function(e){return"/"+e},nD={},Zd=function(t,n,i){let s=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"));s=Promise.allSettled(n.map(c=>{if(c=BTe(c),c in nD)return;nD[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":PTe,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 s.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function Ux(e,t){return t[e.key]??e.defaultValue??""}function OH(e){const t=new Map,n={};for(const i of e){for(const s of i.env){const r=t.get(s.key);(!r||s.required&&!r.required)&&t.set(s.key,s)}i.enableFlag&&(t.set(i.enableFlag,{key:i.enableFlag,required:!0}),n[i.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function UTe(e,t){return OH([{env:e}]).specs.map(i=>({...i,value:Ux(i,t)}))}function MH(e,t){const n=new Map;for(const i of e){const s=Ux(i,t);s.trim()&&n.set(i.key,s)}return[...n].map(([i,s])=>({key:i,value:s}))}function iD(e,t){return e.find(n=>n.required&&!Ux(n,t).trim())}function t2(e,t){if(e.format!=="json")return;const n=Ux(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function LH(e,t){for(const n of e){const i=t2(n,t);if(i)return{spec:n,error:i}}}const FTe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function $Te(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function pi(e,t){e.push(t&255,t>>>8&255)}function fr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const sD=2048,mw=20,rD=0;function HTe(e){const t=new TextEncoder,n=[],i=[];let s=0;for(const p of e){const m=t.encode(p.path),g=t.encode(p.content),v=$Te(g),y=g.length,x=[];fr(x,67324752),pi(x,mw),pi(x,sD),pi(x,rD),pi(x,0),pi(x,0),fr(x,v),fr(x,y),fr(x,y),pi(x,m.length),pi(x,0);const E=Uint8Array.from(x);n.push(E,m,g),i.push({nameBytes:m,dataBytes:g,crc:v,size:y,offset:s}),s+=E.length+m.length+g.length}const r=s,a=[];let l=0;for(const p of i){const m=[];fr(m,33639248),pi(m,mw),pi(m,mw),pi(m,sD),pi(m,rD),pi(m,0),pi(m,0),fr(m,p.crc),fr(m,p.size),fr(m,p.size),pi(m,p.nameBytes.length),pi(m,0),pi(m,0),pi(m,0),pi(m,0),fr(m,0),fr(m,p.offset);const g=Uint8Array.from(m);a.push(g,p.nameBytes),l+=g.length+p.nameBytes.length}const c=[];fr(c,101010256),pi(c,0),pi(c,0),pi(c,i.length),pi(c,i.length),fr(c,l),fr(c,r),pi(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 zTe=b.lazy(()=>Zd(()=>import("./CodeEditor-5JK9IWJx.js"),[]));function VTe(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let s=t;i.forEach((r,a)=>{let l=s.children.get(r);l||(l={name:r,children:new Map},s.children.set(r,l)),a===i.length-1&&(l.path=n.path),s=l})}return t}function GTe(e){return[...e.children.values()].sort((t,n)=>{const i=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return i!==s?i?-1:1:t.name.localeCompare(n.name)})}function DH({project:e,open:t,onClose:n,onChange:i}){var m;const[s,r]=b.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=b.useState(new Set),c=b.useRef(null),u=b.useMemo(()=>VTe(e.files),[e.files]),d=e.files.find(g=>g.path===s)??null;if(b.useEffect(()=>{var y;if(!t)return;const g=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=g,window.removeEventListener("keydown",v)}},[n,t]),b.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(g){l(v=>{const y=new Set(v);return y.has(g)?y.delete(g):y.add(g),y})}function h(g,v,y){return GTe(g).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${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(WR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const N=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":!N,children:[o.jsx(ec,{className:N?"":"is-open","aria-hidden":"true"}),o.jsx(PP,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!N&&h(x,v+1,E)]},E)})}function p(g){d&&i({...e,files:e.files.map(v=>v.path===d.path?{...v,content:g}:v)})}return Ss.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:g=>{g.target===g.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(ok,{})}),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(Ns,{"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(WR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(b.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(zTe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function KTe({project:e,onChange:t,className:n="",label:i="查看源码"}){const[s,r]=b.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:i,children:[o.jsx(ok,{"aria-hidden":"true"}),o.jsx("span",{children:i})]}),o.jsx(DH,{project:e,open:s,onClose:()=>r(!1),onChange:t})]})}function l1({message:e,className:t="",onRetry:n,retryLabel:i="重试部署",defaultExpanded:s=!0}){const[r,a]=b.useState(s),[l,c]=b.useState(!1),[u,d]=b.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(mn,{className:"spin"}):o.jsx(BJ,{}),u?"重试中…":i]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(CJ,{}):o.jsx(Gc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(ka,{}):o.jsx($1,{})})]})]})}const qTe=5e4;function YTe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` +`+VTe(HH(e))}function YTe(e){const t=zTe(e);return l2(t)}const WTe=[{kind:"custom",icon:see,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:FJ,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:DJ,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:ree,title:"工作流",desc:"敬请期待",disabled:!0}];function XTe({onSelect:e,onImport:t}){const n=b.useRef(null),[i,s]=b.useState(""),r=WTe.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(YTe(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(G$,{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(nee,{}),"导入 YAML 配置"]}),i&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:i}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const QTe="modulepreload",ZTe=function(e){return"/"+e},uD={},Zc=function(t,n,i){let s=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"));s=Promise.allSettled(n.map(c=>{if(c=ZTe(c),c in uD)return;uD[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":QTe,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 s.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function Kx(e,t){return t[e.key]??e.defaultValue??""}function zH(e){const t=new Map,n={};for(const i of e){for(const s of i.env){const r=t.get(s.key);(!r||s.required&&!r.required)&&t.set(s.key,s)}i.enableFlag&&(t.set(i.enableFlag,{key:i.enableFlag,required:!0}),n[i.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function JTe(e,t){return zH([{env:e}]).specs.map(i=>({...i,value:Kx(i,t)}))}function VH(e,t){const n=new Map;for(const i of e){const s=Kx(i,t);s.trim()&&n.set(i.key,s)}return[...n].map(([i,s])=>({key:i,value:s}))}function dD(e,t){return e.find(n=>n.required&&!Kx(n,t).trim())}function c2(e,t){if(e.format!=="json")return;const n=Kx(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function GH(e,t){for(const n of e){const i=c2(n,t);if(i)return{spec:n,error:i}}}function eke(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function tke(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"}const fD=new Set;let p1={enabled:!1},Xn,Mf=null,hD=null,Bd="",uN="unknown",KH="unknown",Hm=[];function nke(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function ike(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,nke(n)]))}function ske(e){return{}}function rke(){return new Date().toISOString().slice(0,10)}function ake(e){if(!e)return!0;if(e.dedupeKey){if(fD.has(e.dedupeKey))return!1;fD.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${rke()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function qH(e){if(Mf){try{Mf("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Hm=[...Hm.slice(-49),e]}function oke(){if(!Mf)return;const e=Hm;Hm=[];for(const t of e)qH(t)}function lke(e){if(p1=e,Xn=e.studio,!e.enabled||!e.apmplus||hD)return;const t=e.apmplus;hD=Zc(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var s;const i=n.default;i("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(s=e.studio)==null?void 0:s.version,userId:Bd||void 0}),i("start"),Mf=i,oke()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),p1={enabled:!1},Hm=[]})}function fh(e,t={},n,i){if(!p1.enabled||!p1.apmplus||!ake(i))return;const s=e!=="studio_instance_loaded"?{user_id:Bd,user_role:uN,user_source:KH}:{};qH({name:e,categories:ike({studio_deploy_id:Xn==null?void 0:Xn.deployId,user_pool_id:Xn==null?void 0:Xn.userPoolId,vefaas_application_id:Xn==null?void 0:Xn.applicationId,vefaas_function_id:Xn==null?void 0:Xn.functionId,studio_region:Xn==null?void 0:Xn.region,studio_project:Xn==null?void 0:Xn.project,studio_version:Xn==null?void 0:Xn.version,...s,...t}),metrics:ske()})}function cke(e){if(Bd=e.userId.trim(),!!Bd){if(uN=e.role??"unknown",KH=e.local?"local":"sso",Mf)try{Mf("config",{userId:Bd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}fh("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(Xn==null?void 0:Xn.deployId)??"",Bd,uN].join(":")})}}function YH(e){return{deploy_source:e.source,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function uke(e){fh("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function dke(e){fh("studio_agent_deploy_succeeded",{...YH(e),runtime_id:e.runtimeId})}function fke(e){fh("studio_agent_deploy_failed",{...YH(e),failed_phase:e.phase,error_kind:tke(e.error,e.phase)})}function hke(e){fh("studio_sandbox_create_succeeded",{sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function pke(e){fh("studio_sandbox_create_failed",{sandbox_kind:e.kind,sandbox_source:e.source,error_kind:eke(e.error)})}const mke=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function gke(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function yi(e,t){e.push(t&255,t>>>8&255)}function pr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const pD=2048,ww=20,mD=0;function bke(e){const t=new TextEncoder,n=[],i=[];let s=0;for(const p of e){const m=t.encode(p.path),g=t.encode(p.content),v=gke(g),y=g.length,x=[];pr(x,67324752),yi(x,ww),yi(x,pD),yi(x,mD),yi(x,0),yi(x,0),pr(x,v),pr(x,y),pr(x,y),yi(x,m.length),yi(x,0);const E=Uint8Array.from(x);n.push(E,m,g),i.push({nameBytes:m,dataBytes:g,crc:v,size:y,offset:s}),s+=E.length+m.length+g.length}const r=s,a=[];let l=0;for(const p of i){const m=[];pr(m,33639248),yi(m,ww),yi(m,ww),yi(m,pD),yi(m,mD),yi(m,0),yi(m,0),pr(m,p.crc),pr(m,p.size),pr(m,p.size),yi(m,p.nameBytes.length),yi(m,0),yi(m,0),yi(m,0),yi(m,0),pr(m,0),pr(m,p.offset);const g=Uint8Array.from(m);a.push(g,p.nameBytes),l+=g.length+p.nameBytes.length}const c=[];pr(c,101010256),yi(c,0),yi(c,0),yi(c,i.length),yi(c,i.length),pr(c,l),pr(c,r),yi(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 yke=b.lazy(()=>Zc(()=>import("./CodeEditor-Bb0D1gBv.js"),[]));function xke(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let s=t;i.forEach((r,a)=>{let l=s.children.get(r);l||(l={name:r,children:new Map},s.children.set(r,l)),a===i.length-1&&(l.path=n.path),s=l})}return t}function Eke(e){return[...e.children.values()].sort((t,n)=>{const i=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return i!==s?i?-1:1:t.name.localeCompare(n.name)})}function WH({project:e,open:t,onClose:n,onChange:i}){var m;const[s,r]=b.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=b.useState(new Set),c=b.useRef(null),u=b.useMemo(()=>xke(e.files),[e.files]),d=e.files.find(g=>g.path===s)??null;if(b.useEffect(()=>{var y;if(!t)return;const g=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=g,window.removeEventListener("keydown",v)}},[n,t]),b.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(g){l(v=>{const y=new Set(v);return y.has(g)?y.delete(g):y.add(g),y})}function h(g,v,y){return Eke(g).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${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(ij,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const N=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":!N,children:[o.jsx(nc,{className:N?"":"is-open","aria-hidden":"true"}),o.jsx(qP,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!N&&h(x,v+1,E)]},E)})}function p(g){d&&i({...e,files:e.files.map(v=>v.path===d.path?{...v,content:g}:v)})}return ks.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:g=>{g.target===g.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(mk,{})}),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(As,{"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(ij,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(b.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(yke,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function vke({project:e,onChange:t,className:n="",label:i="查看源码"}){const[s,r]=b.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:i,children:[o.jsx(mk,{"aria-hidden":"true"}),o.jsx("span",{children:i})]}),o.jsx(WH,{project:e,open:s,onClose:()=>r(!1),onChange:t})]})}function m1({message:e,className:t="",onRetry:n,retryLabel:i="重试部署",defaultExpanded:s=!0}){const[r,a]=b.useState(s),[l,c]=b.useState(!1),[u,d]=b.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(mn,{className:"spin"}):o.jsx(QJ,{}),u?"重试中…":i]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(HJ,{}):o.jsx(Kc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(Aa,{}):o.jsx(Y1,{})})]})]})}const wke=5e4;function _ke(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` `),i=t.split(` `),s=Math.min(n.length,i.length,260);for(let r=s;r>0;r-=1){const a=n.slice(-r).join(` `),l=i.slice(0,r).join(` `);if(a===l){const c=i.slice(r).join(` `);return c?`${e} ${c}`:e}}return`${e} -${t}`}function WTe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const i=n.indexOf(` -`);return i>=0&&(n=n.slice(i+1)),{text:n,omitted:!0}}function aD(e,t,n=qTe){const i=YTe((e==null?void 0:e.text)??"",t.text??""),s=WTe(i,n),r=s.text?s.text.split(` -`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||s.omitted);return{...t,text:s.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}or.registerLanguage("python",$7);or.registerLanguage("typescript",J7);or.registerLanguage("javascript",L7);or.registerLanguage("json",D7);or.registerLanguage("yaml",eF);or.registerLanguage("markdown",F7);or.registerLanguage("bash",C7);or.registerLanguage("ini",I7);or.registerLanguage("dockerfile",Ibe);or.registerLanguage("makefile",U7);const XTe=b.lazy(()=>Zd(()=>import("./CodeEditor-5JK9IWJx.js"),[])),ml=()=>{};function QTe({open:e,isUpdate:t,onCancel:n,onConfirm:i}){const s=b.useRef(null);return b.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=s.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?Ss.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(HJ,{})}),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(Ns,{"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:s,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:i,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function PH({ariaLabel:e,value:t,placeholder:n,options:i,disabled:s=!1,onChange:r}){const a=b.useId(),l=b.useRef(null),c=b.useRef(null),u=b.useRef([]),[d,f]=b.useState(!1),[h,p]=b.useState(0),m=i.find(x=>x.value===t);b.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]),b.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const g=(x=1)=>{const E=i.findIndex(N=>N.value===t),w=E>=0?E:x===1?0:Math.max(0,i.length-1);p(w),f(!0)},v=x=>{i.length!==0&&p((x+i.length)%i.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):g(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):g(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,i.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:s||i.length===0,onClick:()=>{d?f(!1):g()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(MP,{"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:i.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:N=>{u.current[E]=N},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(ka,{"aria-hidden":"true"})]},x.value)})})]})}function ZTe({value:e,disabled:t,onChange:n}){const[i,s]=b.useState([]),[r,a]=b.useState(!0),[l,c]=b.useState(null),[u,d]=b.useState(0);b.useEffect(()=>{const p=new AbortController;return a(!0),c(null),EB(p.signal).then(m=>s(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(s([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=b.useMemo(()=>[...i].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})),[i]),h=i.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(PH,{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(mn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):i.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 JTe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],eke={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"},oD={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function lD(e){return e.replace(/&/g,"&").replace(//g,">")}function tke(e){const n=(e.split("/").pop()??e).toLowerCase();if(oD[n])return oD[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const i=n.lastIndexOf(".");if(i===-1)return null;const s=n.slice(i+1);return eke[s]??null}function nke(e,t){try{const n=tke(t);return n&&or.getLanguage(n)?or.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?or.highlightAuto(e).value:lD(e)}catch{return lD(e)}}const ike=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],ske=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],rke={phase:"update",label:"更新实例配置"},ake={phase:"evaluation",label:"创建评测集"};function oke(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function lke(e,t){const n=Number(e),i=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(i)||n<1||i<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>i?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:i}}function cke(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let s=t;i.forEach((r,a)=>{let l=s.children.get(r);l||(l={name:r,children:new Map},s.children.set(r,l)),a===i.length-1&&(l.path=n.path),s=l})}return t}function uke(e){return[...e.children.values()].sort((t,n)=>{const i=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return i!==s?i?-1:1:t.name.localeCompare(n.name)})}function dke(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function fke({left:e,right:t}){const[n,i]=b.useState(null);return b.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");s&&r&&i({left:s,right:r})},[]),n?o.jsxs(o.Fragment,{children:[Ss.createPortal(e,n.left),Ss.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function Fx({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:i,agentName:s,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:g,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:N,onNetworkChange:_,deployRegion:T="cn-beijing",onDeployRegionChange:k,onBack:C,backLabel:I="返回配置",onExportYaml:O,deploymentPrimaryPane:M,deployDisabled:G=!1}){var An,Mn,Ln;const D=typeof l=="function",F=f.includes("更新"),A=oke(i),[j,P]=b.useState(((Mn=(An=e==null?void 0:e.files)==null?void 0:An[0])==null?void 0:Mn.path)??null),[$,R]=b.useState(new Set),[Y,Z]=b.useState(!1),[B,te]=b.useState(""),[z,q]=b.useState(!1),[W,K]=b.useState(!1),[ue,pe]=b.useState(!1),[_e,fe]=b.useState(!1),[me,Re]=b.useState(null),[ge,oe]=b.useState(null),[Te,ve]=b.useState({}),[Xe,De]=b.useState(null),[ze,Ne]=b.useState(!1),[Pe,Fe]=b.useState([]),[qe,Q]=b.useState(!1),[ae,ie]=b.useState(!1),[be,Ue]=b.useState("api_key"),[Ye,yt]=b.useState(""),[lt,ln]=b.useState("1"),[Dt,kt]=b.useState(A?"1":"5"),[$t,Ge]=b.useState(!0),[Kt,nt]=b.useState(null),at=b.useRef(!0),Qe=lke(lt,Dt),Nt=!F&&Qe.valid&&(Qe.min!==1||Qe.max!==5),ye=M?ske:ike,Ze=Nt?[...ye,rke]:ye,Et=$t?[...Ze,ake]:Ze;b.useEffect(()=>{if(!h){nt(null);return}nt(document.getElementById(h))},[h]);const sn=ce=>o.jsxs("div",{className:"pp-network-region",onKeyDown:Se=>{Se.key==="Escape"&&ie(!1)},children:[ce&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":ae,disabled:z||F||!k,onClick:()=>ie(Se=>!Se),children:[o.jsx("span",{children:T==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(MP,{className:`pp-region-chevron${ae?" is-open":""}`})]}),ae&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>ie(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(Se=>{const Le=Se.value===T;return o.jsxs("button",{type:"button",role:"option","aria-selected":Le,className:`pp-region-option${Le?" is-selected":""}`,onClick:()=>{k==null||k(Se.value),ie(!1)},children:[o.jsx("span",{children:Se.label}),Le&&o.jsx(ka,{"aria-hidden":"true"})]},Se.value)})})]})]});b.useEffect(()=>(at.current=!0,()=>{at.current=!1}),[]),b.useEffect(()=>{ln("1"),kt(A?"1":"5")},[A]),b.useEffect(()=>{if(!ue)return;const ce=document.body.style.overflow;document.body.style.overflow="hidden";const Se=Le=>{Le.key==="Escape"&&pe(!1)};return window.addEventListener("keydown",Se),()=>{document.body.style.overflow=ce,window.removeEventListener("keydown",Se)}},[ue]);const jn=b.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:cke(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(ce=>ce.path===j)??null,mt=(N==null?void 0:N.mode)??"public",rn=UTe(v?[...x,...Ph]:x,E),fn=rn.length+Pe.length;function At(ce){R(Se=>{const Le=new Set(Se);return Le.has(ce)?Le.delete(ce):Le.add(ce),Le})}function Wt(ce,Se){l&&(l({...e,files:ce}),Se!==void 0&&P(Se))}function Ti(ce){ot&&Wt(e.files.map(Se=>Se.path===ot.path?{...Se,content:ce}:Se))}function bi(){const ce=B.trim();if(Z(!1),te(""),!!ce){if(e.files.some(Se=>Se.path===ce)){P(ce);return}Wt([...e.files,{path:ce,content:""}],ce)}}function On(){if(!ot)return;const ce=window.prompt("重命名文件",ot.path),Se=ce==null?void 0:ce.trim();!Se||Se===ot.path||e.files.some(Le=>Le.path===Se)||Wt(e.files.map(Le=>Le.path===ot.path?{...Le,path:Se}:Le),Se)}function $n(){var Se;if(!ot)return;const ce=e.files.filter(Le=>Le.path!==ot.path);Wt(ce,((Se=ce[0])==null?void 0:Se.path)??null)}function hn(ce,Se){Fe(Le=>Le.map(Ee=>Ee.id===ce?{...Ee,...Se}:Ee))}function vn(ce){Fe(Se=>Se.filter(Le=>Le.id!==ce))}function Hn(){Fe(ce=>[...ce,dke()])}function Bi(ce){_&&_(ce==="public"?void 0:{...N??{mode:ce},mode:ce})}function Xi(ce){_==null||_({...N??{mode:"private"},...ce})}function ki(){const ce=new Map(Pe.map(Le=>({key:Le.key.trim(),value:Le.value})).filter(Le=>Le.key.length>0).map(Le=>[Le.key,Le.value])),Se=v?[...x,...Ph]:x;for(const Le of MH(Se,E))ce.set(Le.key,Le.value);return[...ce].map(([Le,Ee])=>({key:Le,value:Ee}))}async function Ui(){if(!(!y||z||_e)){Re(null),fe(!0);try{await y(!v)}catch(ce){at.current&&Re(`更新飞书配置失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{at.current&&fe(!1)}}}async function gn(){var Le;if(!c||z||G)return;if(!Qe.valid){Re(Qe.error);return}if(!F&&be==="user_pool"&&!Ye){Re("请选择用于 Runtime 鉴权的用户池。");return}if(mt!=="public"&&!((Le=N==null?void 0:N.vpcId)!=null&&Le.trim())){Re("使用 VPC 网络时,请填写 VPC ID。");return}const ce=iD(x,E);if(ce){const Ee=x.find(rt=>rt.key===ce.key);Re(`请返回配置页填写 ${(Ee==null?void 0:Ee.comment)||(Ee==null?void 0:Ee.key)}(${Ee==null?void 0:Ee.key})。`);return}const Se=LH(x,E);if(Se){Re(`${Se.spec.comment||Se.spec.key}:${Se.error}`);return}if(v){const Ee=iD(Ph,E);if(Ee){const rt=Ph.find(it=>it.key===Ee.key);Re(`启用飞书后,请填写${(rt==null?void 0:rt.comment)||(rt==null?void 0:rt.key)}。`);return}}K(!0)}async function Ai(){var xi;if(!c||z)return;if(!Qe.valid){K(!1),Re(Qe.error);return}K(!1);const ce=ki();at.current&&(Re(null),oe(null),ve({}),De(null),q(!0));const Se=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let Le=(s==null?void 0:s.trim())||e.name||"生成中…";const Ee=Date.now(),rt={id:Se,runtimeName:Le,runtimeId:p,region:T,startedAt:Ee,status:"running",phase:"prepare",label:"准备部署",agentDraft:i,instanceRange:Nt?{min:Qe.min,max:Qe.max}:void 0,createEvaluationSets:$t};g==null||g(rt),m==null||m(rt);let it,jt=rt.phase??"prepare";const Pt=wt=>it?{...it,status:wt,updatedAt:Date.now()}:void 0,oi=wt=>{const Tt=Pt(wt);return Tt?{buildLog:Tt}:{}},Dn=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),ps=wt=>{if(jt!=="build")return;const Tt=["","----- 构建失败 -----",wt].join(` -`);return it=aD(it,{source:"code-pipeline",status:"error",text:Tt,lineCount:Tt.split(` -`).length,truncated:!1,updatedAt:Date.now()}),it};try{const wt=await c(e,Tt=>{var Ii;Tt.runtimeName&&(Le=Tt.runtimeName),jt=Tt.phase,Tt.buildLog?it=aD(it,Tt.buildLog):Tt.phase==="build"&&!it&&(it=Dn()),at.current&&(ve(Vn=>({...Vn,[Tt.phase]:Tt})),De(Tt.phase)),g==null||g({id:Se,runtimeName:Le,runtimeId:p,region:T,startedAt:Ee,status:"running",phase:Tt.phase,label:((Ii=Et.find(Vn=>Vn.phase===Tt.phase))==null?void 0:Ii.label)??Tt.phase,message:Tt.message,pct:Tt.pct,...it?{buildLog:it}:{}})},{taskId:Se,sessionStorage:A?"in-memory":"persistent",minInstance:Qe.min,maxInstance:Qe.max,...F?{}:{authentication:be==="user_pool"?{type:"user_pool",userPoolUid:Ye}:{type:"api_key"}},createEvaluationSets:$t,...v?{im:{feishu:{enabled:!0}}}:{},envs:ce});at.current&&(oe(wt),De(null)),g==null||g({id:Se,runtimeName:wt.agentName||Le,runtimeId:wt.runtimeId||p,region:wt.region||T,startedAt:Ee,status:"success",phase:"complete",label:"部署完成",message:(xi=wt.warnings)==null?void 0:xi.join(";"),...oi("complete")});try{await(d==null?void 0:d(wt))}catch(Tt){if(!(Tt instanceof Er))throw Tt;g==null||g({id:Se,runtimeName:wt.agentName||Le,runtimeId:wt.runtimeId||p,region:wt.region||T,startedAt:Ee,status:"success",phase:"complete",label:"部署完成,暂未连接",message:Tt.message,...oi("complete")})}}catch(wt){const Tt=wt instanceof Error?wt.message:String(wt);if(wt instanceof DOMException&&wt.name==="AbortError"){at.current&&(Re(null),De(null)),g==null||g({id:Se,runtimeName:Le,runtimeId:p,region:T,startedAt:Ee,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...oi("complete")});return}at.current&&Re(Tt);const Ii=ps(Tt),Vn=!!Ii;g==null||g({id:Se,runtimeName:Le,runtimeId:p,region:T,startedAt:Ee,status:"error",phase:jt,label:"部署失败",message:Vn?"构建镜像失败,详见构建日志。":Tt,...Ii?{buildLog:Ii}:oi("complete"),retry:gn})}finally{at.current&&q(!1)}}function zn(){K(!1)}async function Jn(){if(!(!ge||ze)){Ne(!0),Re(null);try{const{addConnection:ce,addRuntimeConnection:Se,remoteAppId:Le,loadConnections:Ee}=await Zd(async()=>{const{addConnection:jt,addRuntimeConnection:Pt,remoteAppId:oi,loadConnections:Dn}=await Promise.resolve().then(()=>EL);return{addConnection:jt,addRuntimeConnection:Pt,remoteAppId:oi,loadConnections:Dn}},void 0),{probeRuntimeApps:rt}=await Zd(async()=>{const{probeRuntimeApps:jt}=await Promise.resolve().then(()=>Nee);return{probeRuntimeApps:jt}},void 0);let it;if(ge.runtimeId){const jt=ge.region??T,Pt=await rt(ge.runtimeId,jt,{retryProbe:!0})??[];it=Se(ge.runtimeId,ge.agentName,jt,Pt,Pt.length>0?{[Pt[0]]:ge.agentName}:void 0,ge.version)}else it=await ce(ge.agentName,ge.url,ge.apikey,"");if(it.apps.length===0)Re("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const jt={[it.apps[0]]:ge.agentName},Pt={...it,appLabels:{...it.appLabels??{},...jt}},Dn=Ee().map(xi=>xi.id===it.id?Pt:xi);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Dn));const{registerConnections:ps}=await Zd(async()=>{const{registerConnections:xi}=await Promise.resolve().then(()=>EL);return{registerConnections:xi}},void 0);if(ps(Dn),u){const xi=Le(it.id,it.apps[0]);u(xi,ge.agentName)}else alert(`🎉 Agent "${ge.agentName}" 已添加到左上角下拉列表!`)}}catch(ce){Re(`添加 Agent 失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{Ne(!1)}}}function Ci(){const ce=HTe(e.files),Se=URL.createObjectURL(ce),Le=document.createElement("a");Le.href=Se,Le.download=`${e.name||"project"}.zip`,document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),URL.revokeObjectURL(Se)}const yi=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[O&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:O,children:[o.jsx(fJ,{className:"pp-ic"}),"导出 YAML"]}),D&&l&&o.jsx(KTe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:Ci,children:[o.jsx(H1,{className:"pp-ic"}),"下载源代码"]})]});function pn(ce,Se,Le){return uke(ce).map(Ee=>{const rt=Le?`${Le}/${Ee.name}`:Ee.name,it=Ee.path!==void 0,jt={paddingLeft:8+Se*14};if(it){const oi=Ee.path===j;return o.jsxs("button",{type:"button",className:`pp-row pp-file${oi?" pp-active":""}`,style:jt,onClick:()=>P(Ee.path),title:Ee.path,children:[o.jsx(mJ,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:Ee.name})]},rt)}const Pt=$.has(rt);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:jt,onClick:()=>At(rt),children:[o.jsx(ec,{className:`pp-ic pp-chevron${Pt?"":" pp-open"}`}),o.jsx(PP,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:Ee.name})]}),!Pt&&pn(Ee,Se+1,rt)]},rt)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${M?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(fke,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[C&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:C,children:[o.jsx(rk,{className:"pp-ic"}),I]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!M&&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:[i&&o.jsx(Am,{draft:i,direction:"horizontal",selectedPath:[],onSelect:ml,onAdd:ml,onInsert:ml,onDelete:ml,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>pe(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(Gc,{"aria-hidden":!0})})]}),t&&yi,!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:s||e.name||"未命名 Agent"}),(i==null?void 0:i.description)&&o.jsx("p",{className:"pp-release-description",title:i.description,children:i.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("、"):"未启用"})]})]})]})]}),yi]})]})]})}),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:"文件预览"}),D&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{Z(!0),te("")},children:o.jsx(hJ,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[Y&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:B,onChange:ce=>te(ce.target.value),onBlur:bi,onKeyDown:ce=>{ce.key==="Enter"&&bi(),ce.key==="Escape"&&(Z(!1),te(""))}}),e.files.length===0&&!Y?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):pn(jn,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:D&&ot&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:On,children:o.jsx(MJ,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:$n,children:o.jsx(tc,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:ot==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):D?o.jsx("div",{className:"pp-codemirror",children:o.jsx(b.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(XTe,{value:ot.content,path:ot.path,onChange:Ti})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:nke(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:[M,!M&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),sn(!1)]}),!M&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),F?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(PH,{ariaLabel:"部署鉴权方式",value:be,placeholder:"请选择鉴权方式",options:JTe,disabled:z,onChange:ce=>{Re(null),Ue(ce)}})]}),be==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(ZTe,{value:Ye,disabled:z,onChange:ce=>{Re(null),yt(ce)}})]})]})]}),!M&&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 Ui(),disabled:v||z||_e||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:OA,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:_e?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),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 Ui(),disabled:!v||z||_e||!y,children:_e?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:Ph.map(ce=>o.jsxs("label",{children:[o.jsxs("span",{children:[ce.comment||ce.key,ce.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:ce.key.includes("SECRET")?"password":"text",value:E[ce.key]??"",placeholder:ce.placeholder,tabIndex:v?0:-1,disabled:!v||z||!w,autoComplete:"off",onChange:Se=>w==null?void 0:w(ce.key,Se.currentTarget.value)})]},ce.key))})]})]})})]}),!F&&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:lt,disabled:z,"aria-invalid":!Qe.valid,onChange:ce=>ln(ce.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:Dt,disabled:z,"aria-invalid":!Qe.valid,onChange:ce=>kt(ce.currentTarget.value)})]})]}),A&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!Qe.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:Qe.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),M&&sn(!0),F&&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(ce=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:ce,checked:mt===ce,onChange:()=>Bi(ce),disabled:z||F||!_}),o.jsx("span",{children:ce==="public"?"公网":ce==="private"?"VPC":"公网 + VPC"})]},ce))}),mt!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(N==null?void 0:N.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:z||F,onChange:ce=>Xi({vpcId:ce.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(N==null?void 0:N.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:z||F,onChange:ce=>Xi({subnetIds:ce.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(N!=null&&N.enableSharedInternetAccess),disabled:z||F,onChange:ce=>Xi({enableSharedInternetAccess:ce.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),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:$t,disabled:z,onChange:ce=>Ge(ce.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.jsxs("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:[fn," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),o.jsx("button",{type:"button",className:"pp-icon-btn",title:qe?"隐藏值":"显示值",onClick:()=>Q(ce=>!ce),children:qe?o.jsx(dJ,{className:"pp-ic"}):o.jsx(LP,{className:"pp-ic"})})]}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:Hn,disabled:z,children:[o.jsx(ws,{className:"pp-ic"}),"添加变量"]}),(rn.length>0||Pe.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[rn.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:[rn.length," 项"]})]}),rn.map(ce=>{const Se=ce.key.startsWith("ENABLE_"),Le=t2(ce,E),Ee=ce.multiline||ce.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${Ee?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${ce.key} 环境变量名`,"aria-disabled":z,children:[o.jsx("span",{title:ce.key,children:ce.key}),(ce.help||ce.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":ce.help||ce.comment,"aria-label":`${ce.key}说明:${ce.help||ce.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:ce.help||ce.comment})]}),ce.link&&o.jsx("a",{className:"pp-env-link",href:ce.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${ce.link.label}`,"aria-label":`${ce.key}:打开 OpenViking ${ce.link.label}`,children:o.jsx(mm,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[Ee?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Se,disabled:z||!Se&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!Le,"aria-label":`${ce.key} 环境变量值`,onChange:rt=>w==null?void 0:w(ce.key,rt.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:Se||qe?"text":"password",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Se,disabled:z||!Se&&!w,autoComplete:"off","aria-invalid":!!Le,"aria-label":`${ce.key} 环境变量值`,onChange:rt=>w==null?void 0:w(ce.key,rt.currentTarget.value)}),Le&&o.jsx("span",{className:"pp-env-error",children:Le})]}),o.jsx("span",{className:"pp-env-source",children:Se?"自动":"同步"})]},ce.key)})]}),Pe.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Pe.length," 项"]})]}),Pe.map(ce=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:ce.key,placeholder:"名称",disabled:z,autoComplete:"off",onChange:Se=>hn(ce.id,{key:Se.currentTarget.value})}),o.jsx("input",{type:qe?"text":"password",value:ce.value,placeholder:"值",disabled:z,autoComplete:"off",onChange:Se=>hn(ce.id,{value:Se.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:z,onClick:()=>vn(ce.id),children:o.jsx(Ns,{className:"pp-ic"})})]},ce.id))]})]}),(z||ge||Object.keys(Te).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:Et.map((ce,Se)=>{const Le=Xe?Et.findIndex(jt=>jt.phase===Xe):-1,Ee=!!me&&(Le===-1?Se===0:Se===Le);let rt;ge?rt="done":Ee?rt="failed":Le===-1?rt=z?"active":"pending":Sece.phase===Xe))==null?void 0:Ln.label)??Xe}阶段):`:""}${me}`,onRetry:gn,retryLabel:F?"重试更新":"重试部署"}),ge&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:F?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[ge.warnings&&ge.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:ge.warnings.map(ce=>o.jsx("span",{children:ce},ce))}),ge.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:ge.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:ge.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:ge.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Jn,disabled:ze,children:[ze?o.jsx(mn,{className:"pp-ic spin"}):o.jsx(FP,{className:"pp-ic"}),ze?"连接中…":"立即对话"]}),ge.consoleUrl&&o.jsxs("a",{href:ge.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(mm,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${Kt?" is-external":""}`,children:Kt?Ss.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:gn,disabled:z||_e||G||!!n,title:n,children:z?`${f}中…`:me?`重试${f}`:f}),Kt):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:gn,disabled:z||_e||G||!!n,title:n,children:z?`${f}中…`:me?`重试${f}`:f})})]})]}),ue&&i&&Ss.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ce=>{ce.target===ce.currentTarget&&pe(!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:()=>pe(!1),"aria-label":"关闭执行流程预览",children:o.jsx(Ns,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(Am,{draft:i,direction:"horizontal",selectedPath:[],onSelect:ml,onAdd:ml,onInsert:ml,onDelete:ml,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(QTe,{open:W,isUpdate:F,onCancel:zn,onConfirm:()=>void Ai()})]})}const cD="dogfooding",gw="dogfooding",bw="dogfooding_b";let hke=0;const yw=()=>++hke;function uD(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function pke(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function dD(e){const t=[],n=pke(e);t.push(n);const i=n.indexOf("{"),s=n.lastIndexOf("}");i>=0&&s>i&&t.push(n.slice(i,s+1));for(const r of t)try{const a=JSON.parse(r);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await X1(e2(a))}catch{}return null}function mke({userId:e,onBack:t,onCreate:n,onAgentAdded:i,onDeploymentTaskChange:s}){const[r,a]=b.useState([{id:yw(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(null),[p,m]=b.useState(null),[g,v]=b.useState(!1),[y,x]=b.useState(null),[E,w]=b.useState(null),[N,_]=b.useState(!1),[T,k]=b.useState(!1),[C,I]=b.useState({}),O=b.useRef(null),M=b.useRef(null),G=b.useRef(null),D=b.useRef(null),F=b.useRef(null);b.useEffect(()=>{const z=D.current;z&&z.scrollTo({top:z.scrollHeight,behavior:"smooth"})},[r,u]),b.useEffect(()=>{const z=F.current;z&&(z.style.height="auto",z.style.height=Math.min(z.scrollHeight,160)+"px")},[l]);const A=z=>a(q=>[...q,{id:yw(),role:"assistant",text:z}]);async function j(){if(O.current)return O.current;const z=await jy(cD,e);return O.current=z,z}async function P(z,q){if(q.current)return q.current;const W=await jy(z,e);return q.current=W,W}async function $(z,q){if(!C[z])try{const W=await wk(q);I(K=>({...K,[z]:W.model||q}))}catch{I(W=>({...W,[z]:q}))}}async function R(z,q,W){const K=await P(z,q);let ue=ya();for await(const _e of gm({appName:z,userId:e,sessionId:K,text:W}))ue=pf(ue,_e);const pe=uD(ue).trim();return{project:await dD(pe),finalText:pe}}const Y=async(z,q,W)=>rg(z.name,z.files,{region:"cn-beijing",projectName:"default"},{...W,onStage:q}),Z=async()=>{const z=l.trim();if(!(!z||u)){if(a(q=>[...q,{id:yw(),role:"user",text:z}]),c(""),h(null),d(!0),g){x(null),w(null),_(!0),k(!0),$("a",gw),$("b",bw);const q=R(gw,M,z).then(({project:K})=>(x(K),K)).catch(K=>{const ue=K instanceof Error?K.message:String(K);return h(ue),null}).finally(()=>_(!1)),W=R(bw,G,z).then(({project:K})=>(w(K),K)).catch(K=>{const ue=K instanceof Error?K.message:String(K);return h(ue),null}).finally(()=>k(!1));try{const[K,ue]=await Promise.all([q,W]),pe=[K?`方案 A:${K.name}`:null,ue?`方案 B:${ue.name}`:null].filter(Boolean);pe.length?A(`已生成两个方案(${pe.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const q=await j();let W=ya();for await(const pe of gm({appName:cD,userId:e,sessionId:q,text:z}))W=pf(W,pe);const K=uD(W).trim(),ue=await dD(K);ue?(m(ue),A(`已生成项目:${ue.name}(${ue.files.length} 个文件),可在右侧预览和编辑。`)):A(K||"(助手没有返回内容,请再描述一下你的需求。)")}catch(q){const W=q instanceof Error?q.message:String(q);h(W),A(`抱歉,调用智能构建助手失败:${W}`)}finally{d(!1)}}},B=z=>{const q=z==="a"?y:E;if(!q)return;m(q),v(!1),x(null),w(null),_(!1),k(!1);const W=z==="a"?"A":"B",K=z==="a"?C.a:C.b;A(`已采用方案 ${W}(${K??(z==="a"?gw:bw)}),可继续编辑。`)},te=z=>{z.key==="Enter"&&!z.shiftKey&&!z.nativeEvent.isComposing&&(z.preventDefault(),Z())};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:D,children:[o.jsx(Co,{initial:!1,children:r.map(z=>o.jsxs(Wn.div,{className:`ic-turn ic-turn--${z.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[z.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(nu,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:z.role==="assistant"?o.jsx(nh,{text:z.text}):z.text})]},z.id))}),u&&o.jsxs(Wn.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(nu,{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"})]})]})]}),f&&o.jsxs("div",{className:"ic-error",children:[o.jsx(ak,{className:"ic-error-icon"}),f]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:F,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:l,onChange:z=>c(z.target.value),onKeyDown:te,disabled:u}),o.jsx("button",{className:"ic-send",onClick:()=>void Z(),disabled:!l.trim()||u,title:"发送 (Enter)",children:o.jsx(UJ,{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:g,disabled:u,onChange:z=>v(z.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:g?o.jsxs("div",{className:"ic-compare",children:[o.jsx(fD,{side:"a",project:y,loading:N,model:C.a,onAdopt:()=>B("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(fD,{side:"b",project:E,loading:T,model:C.b,onAdopt:()=>B("b")})]}):p?o.jsx(Fx,{project:p,onChange:m,onDeploy:Y,onAgentAdded:i,onDeploymentTaskChange:s}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(bJ,{className:"ic-preview-empty-glyph"}),o.jsx(iu,{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 fD({side:e,project:t,loading:n,model:i,onAdopt:s}){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}),i&&o.jsx("span",{className:"ic-pane-model",children:i})]}),o.jsxs("button",{className:"ic-adopt",onClick:s,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(mn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(Fx,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var gke=Object.defineProperty,n2=(e,t)=>gke(e,"name",{value:t,configurable:!0});function iN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}n2(iN,"setRef");function BH(...e){return t=>{let n=!1;const i=e.map(s=>{const r=iN(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;sbke(e,"name",{value:t,configurable:!0});function jf(e){const t=b.forwardRef((n,i)=>{let{children:s,...r}=n,a=null,l=!1;const c=[];sN(s)&&typeof X0=="function"&&(s=X0(s._payload)),b.Children.forEach(s,h=>{var p;if(HH(h)){l=!0;const m=h;let g="child"in m.props?m.props.child:m.props.children;sN(g)&&typeof X0=="function"&&(g=X0(g._payload)),a=xke(m,g),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=b.cloneElement(a,void 0,c):!l&&b.Children.count(s)===1&&b.isValidElement(s)&&(a=s);const u=a?$H(a):void 0,d=lr(i,u);if(!a){if(s||s===0)throw new Error(l?wke(e):vke(e));return s}const f=FH(r,a.props??{});return a.type!==b.Fragment&&(f.ref=i?d:u),b.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Ra(jf,"createSlot");var UH=Symbol.for("radix.slottable");function yke(e){const t=Ra(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=UH,t}Ra(yke,"createSlottable");var xke=Ra((e,t)=>{if("child"in e.props){const n=e.props.child;return b.isValidElement(n)?b.cloneElement(n,void 0,e.props.children(n.props.children)):null}return b.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function FH(e,t){const n={...t};for(const i in t){const s=e[i],r=t[i];/^on[A-Z]/.test(i)?s&&r?n[i]=(...l)=>{const c=r(...l);return s(...l),c}:s&&(n[i]=s):i==="style"?n[i]={...s,...r}:i==="className"&&(n[i]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}Ra(FH,"mergeProps");function $H(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ra($H,"getElementRef");function HH(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UH}Ra(HH,"isSlottable");var Eke=Symbol.for("react.lazy");function sN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Eke&&"_payload"in e&&zH(e._payload)}Ra(sN,"isLazyComponent");function zH(e){return typeof e=="object"&&e!==null&&"then"in e}Ra(zH,"isPromiseLike");var vke=Ra(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),wke=Ra(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),X0=Lf[" use ".trim().toString()],_ke=Object.defineProperty,Ske=(e,t)=>_ke(e,"name",{value:t,configurable:!0}),Nke=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Zr=Nke.reduce((e,t)=>{const n=jf(`Primitive.${t}`),i=b.forwardRef((s,r)=>{const{asChild:a,...l}=s,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function Tke(e,t){e&&Ss.flushSync(()=>e.dispatchEvent(t))}Ske(Tke,"dispatchDiscreteCustomEvent");var kke=Object.defineProperty,Kr=(e,t)=>kke(e,"name",{value:t,configurable:!0});function Ake(e,t){const n=b.createContext(t);n.displayName=e+"Context";const i=Kr(r=>{const{children:a,...l}=r,c=b.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");i.displayName=e+"Provider";function s(r,a={}){const{optional:l=!1}=a,c=b.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return Kr(s,"useContext"),[i,s]}Kr(Ake,"createContext");function cc(e,t=[]){let n=[];function i(r,a){const l=b.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=Kr(f=>{var y;const{scope:h,children:p,...m}=f,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=b.useMemo(()=>m,Object.values(m));return o.jsx(g.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=b.useContext(g);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return Kr(d,"useContext"),[u,d]}Kr(i,"createContext");const s=Kr(()=>{const r=n.map(a=>b.createContext(a));return Kr(function(l){const c=(l==null?void 0:l[e])||r;return b.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return s.scopeName=e,[i,VH(s,...t)]}Kr(cc,"createContextScope");function VH(...e){const t=e[0];if(e.length===1)return t;const n=Kr(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Kr(function(r){const a=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Kr(VH,"composeContextScopes");var Cke=Object.defineProperty,ds=(e,t)=>Cke(e,"name",{value:t,configurable:!0});function GH(e){const t=e+"CollectionProvider",[n,i]=cc(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ds(g=>{const{scope:v,children:y}=g,x=b.useRef(null),E=b.useRef(new Map).current;return o.jsx(s,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=jf(l),u=b.forwardRef((g,v)=>{const{scope:y,children:x}=g,E=r(l,y),w=lr(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=jf(d),p=b.forwardRef((g,v)=>{const{scope:y,children:x,...E}=g,w=b.useRef(null),N=lr(v,w),_=r(d,y);return b.useEffect(()=>(_.itemMap.set(w,{ref:w,...E}),()=>void _.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:N,children:x})});p.displayName=d;function m(g){const v=r(e+"CollectionConsumer",g);return b.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 ds(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,i]}ds(GH,"createCollection");var hD=new WeakMap,Hi,mr,xw=(mr=class extends Map{constructor(n){super(n);eC(this,Hi);gE(this,Hi,[...super.keys()]),hD.set(this,!0)}set(n,i){return hD.get(this)&&(this.has(n)?As(this,Hi)[As(this,Hi).indexOf(n)]=n:As(this,Hi).push(n)),super.set(n,i),this}insert(n,i,s){const r=this.has(i),a=As(this,Hi).length,l=i2(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(i,s),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...As(this,Hi)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,i){const s=this.indexOf(n);if(s===-1)return;let r=s+i;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return r;s++}}findIndex(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return s;s++}return-1}filter(n,i){const s=[];let r=0;for(const a of this)Reflect.apply(n,i,[a,r,this])&&s.push(a),r++;return new mr(s)}map(n,i){const s=[];let r=0;for(const a of this)s.push([a[0],Reflect.apply(n,i,[a,r,this])]),r++;return new mr(s)}reduce(...n){const[i,s]=n;let r=0,a=s??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[i,s]=n;let r=s??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(i,this,[r,l,a,this])}return r}toSorted(n){const i=[...this.entries()].sort(n);return new mr(i)}toReversed(){const n=new mr;for(let i=this.size-1;i>=0;i--){const s=this.keyAt(i),r=this.get(s);n.set(s,r)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new mr(i)}slice(n,i){const s=new mr;let r=this.size-1;if(n===void 0)return s;n<0&&(n=n+this.size),i!==void 0&&i>0&&(r=i-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);s.set(l,c)}return s}every(n,i){let s=0;for(const r of this){if(!Reflect.apply(n,i,[r,s,this]))return!1;s++}return!0}some(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return!0;s++}return!1}},Hi=new WeakMap,ds(mr,"OrderedDict"),mr);function Hb(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=KH(e,t);return n===-1?void 0:e[n]}ds(Hb,"at");function KH(e,t){const n=e.length,i=i2(t),s=i>=0?i:n+i;return s<0||s>=n?-1:s}ds(KH,"toSafeIndex");function i2(e){return e!==e||e===0?0:Math.trunc(e)}ds(i2,"toSafeInteger");function Ike(e){const t=e+"CollectionProvider",[n,i]=cc(t),[s,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new xw,setItemMap:ds(()=>{},"setItemMap")}),a=ds(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ds(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=ds(E=>{const{scope:w,children:N,state:_}=E,T=b.useRef(null),[k,C]=b.useState(null),I=lr(T,C),[O,M]=_;return b.useEffect(()=>{if(!k)return;const G=WH(()=>{});return G.observe(k,{childList:!0,subtree:!0}),()=>{G.disconnect()}},[k]),o.jsx(s,{scope:w,itemMap:O,setItemMap:M,collectionRef:I,collectionRefObject:T,collectionElement:k,children:N})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=jf(u),f=b.forwardRef((E,w)=>{const{scope:N,children:_}=E,T=r(u,N),k=lr(w,T.collectionRef);return o.jsx(d,{ref:k,children:_})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=jf(h),g=b.forwardRef((E,w)=>{const{scope:N,children:_,...T}=E,k=b.useRef(null),[C,I]=b.useState(null),O=lr(w,k,I),M=r(h,N),{setItemMap:G}=M,D=b.useRef(T);qH(D.current,T)||(D.current=T);const F=D.current;return b.useEffect(()=>{const A=F;return G(j=>C?j.has(C)?j.set(C,{...A,element:C}).toSorted(rN):(j.set(C,{...A,element:C}),j.toSorted(rN)):j),()=>{G(j=>!C||!j.has(C)?j:(j.delete(C),new xw(j)))}},[C,F,G]),o.jsx(m,{[p]:"",ref:O,children:_})});g.displayName=h;function v(){return b.useState(new xw)}ds(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return ds(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:g},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}ds(Ike,"createCollection");function qH(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),i=Object.keys(t);if(n.length!==i.length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1;return!0}ds(qH,"shallowEqual");function YH(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ds(YH,"isElementPreceding");function rN(e,t){return!e[1].element||!t[1].element?0:YH(e[1].element,t[1].element)?-1:1}ds(rN,"sortByDocumentPosition");function WH(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}ds(WH,"getChildListObserver");var Rke=Object.defineProperty,ch=(e,t)=>Rke(e,"name",{value:t,configurable:!0}),XH=!!(typeof window<"u"&&window.document&&window.document.createElement);function qs(e,t,{checkForDefaultPrevented:n=!0}={}){return ch(function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}ch(qs,"composeEventHandlers");function jke(e){var t;if(!XH)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}ch(jke,"getOwnerWindow");function aN(e){if(!XH)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}ch(aN,"getOwnerDocument");function QH(e,t=!1){const{activeElement:n}=aN(e);if(!(n!=null&&n.nodeName))return null;if(ZH(n)&&n.contentDocument)return QH(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const s=aN(n).getElementById(i);if(s)return s}}return n}ch(QH,"getActiveElement");function ZH(e){return e.tagName==="IFRAME"}ch(ZH,"isFrame");var fu=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},Oke=Object.defineProperty,Mke=(e,t)=>Oke(e,"name",{value:t,configurable:!0}),pD=Lf[" useEffectEvent ".trim().toString()],mD=Lf[" useInsertionEffect ".trim().toString()];function JH(e){if(typeof pD=="function")return pD(e);const t=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof mD=="function"?mD(()=>{t.current=e}):fu(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Mke(JH,"useEffectEvent");var Lke=Object.defineProperty,Cg=(e,t)=>Lke(e,"name",{value:t,configurable:!0}),Dke=Lf[" useInsertionEffect ".trim().toString()]||fu;function Au({prop:e,defaultProp:t,onChange:n=Cg(()=>{},"onChange"),caller:i}){const[s,r,a]=ez({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s,u=b.useCallback(d=>{var f;if(l){const h=tz(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Cg(Au,"useControllableState");function ez({defaultProp:e,onChange:t}){const[n,i]=b.useState(e),s=b.useRef(n),r=b.useRef(t);return Dke(()=>{r.current=t},[t]),b.useEffect(()=>{var a;s.current!==n&&((a=r.current)==null||a.call(r,n),s.current=n)},[n,s]),[n,i,r]}Cg(ez,"useUncontrolledState");function tz(e){return typeof e=="function"}Cg(tz,"isFunction");var gD=Symbol("RADIX:SYNC_STATE");function Pke(e,t,n,i){const{prop:s,defaultProp:r,onChange:a,caller:l}=t,c=s!==void 0,u=JH(a),d=[{...n,state:r}];i&&d.push(i);const[f,h]=b.useReducer((v,y)=>{if(y.type===gD)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=b.useRef(p);b.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const g=b.useMemo(()=>s!==void 0?{...f,state:s}:f,[f,s]);return b.useEffect(()=>{c&&!Object.is(s,f.state)&&h({type:gD,state:s})},[s,f.state,c]),[g,h]}Cg(Pke,"useControllableStateReducer");var Bke=Object.defineProperty,Yo=(e,t)=>Bke(e,"name",{value:t,configurable:!0});function nz(e,t){return b.useReducer((n,i)=>t[n][i]??n,e)}Yo(nz,"useStateMachine");var iz=Yo(e=>{const{present:t,children:n}=e,i=sz(t),s=typeof n=="function"?n({present:i.isPresent}):b.Children.only(n),r=rz(i.ref,az(s));return typeof n=="function"||i.isPresent?b.cloneElement(s,{ref:r}):null},"Presence");function sz(e){const[t,n]=b.useState(),i=b.useRef(null),s=b.useRef(e),r=b.useRef("none"),a=b.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=nz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{c==="mounted"?(r.current=a.current??ld(i.current),a.current=void 0):r.current="none"},[c]),fu(()=>{const d=i.current,f=s.current;if(f!==e){const p=r.current,m=ld(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"),s.current=e}},[e,u]),fu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Yo(m=>{const v=ld(i.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Yo(m=>{m.target===t&&(r.current=ld(i.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:b.useCallback(d=>{if(d){const f=getComputedStyle(d);i.current=f,a.current=ld(f)}else i.current=null;n(d)},[])}}Yo(sz,"usePresence");function oN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Yo(oN,"setRef");function rz(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const i=t.current;let s=!1;const r=i.map(a=>{const l=oN(a,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let a=0;aUke(e,"name",{value:t,configurable:!0}),$ke=Lf[" useId ".trim().toString()]||(()=>{}),Hke=0;function oz(e){const[t,n]=b.useState($ke());return fu(()=>{e||n(i=>i??String(Hke++))},[e]),e||(t?`radix-${t}`:"")}Fke(oz,"useId");var zke=Object.defineProperty,Vke=(e,t)=>zke(e,"name",{value:t,configurable:!0}),Gke=b.createContext(void 0);function $x(e){const t=b.useContext(Gke);return e||t||"ltr"}Vke($x,"useDirection");var Kke=Object.defineProperty,qke=(e,t)=>Kke(e,"name",{value:t,configurable:!0});function lz(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}qke(lz,"useCallbackRef");var Yke=Object.defineProperty,Wke=(e,t)=>Yke(e,"name",{value:t,configurable:!0});function s2(e){const[t,n]=b.useState(void 0);return fu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const r=s[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 i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}Wke(s2,"useSize");var Xke=Object.defineProperty,Wo=(e,t)=>Xke(e,"name",{value:t,configurable:!0}),r2="Checkbox",[Qke,kje]=cc(r2),[Zke,a2]=Qke(r2);function cz(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:s,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Au({prop:n,defaultProp:s??!1,onChange:c,caller:r2}),[m,g]=b.useState(null),[v,y]=b.useState(null),x=b.useRef(!1),[E,w]=b.useReducer(T=>T+1,0),N=m?!!a||!!m.closest("form"):!0,_={checked:h,disabled:r,setChecked:p,control:m,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:Bo(s)?!1:s,isFormControl:N,bubbleInput:v,setBubbleInput:y};return o.jsx(Zke,{scope:t,..._,children:uz(f)?f(_):i})}Wo(cz,"CheckboxProvider");var Jke="CheckboxTrigger",eAe=b.forwardRef(Wo(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...s},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:g,bubbleInput:v}=a2(Jke,t),y=lr(r,f),x=b.useRef(u);return b.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=Wo(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(Zr.button,{type:"button",role:"checkbox","aria-checked":Bo(u)?"mixed":u,"aria-required":d,"data-state":o2(u),"data-disabled":c?"":void 0,disabled:c,value:l,...s,ref:y,onKeyDown:qs(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:qs(i,E=>{m(),h(w=>Bo(w)?!0:!w),v&&g&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),tAe=b.forwardRef(Wo(function(t,n){const{__scopeCheckbox:i,name:s,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(cz,{__scopeCheckbox:i,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:s,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(eAe,{...h,ref:n,__scopeCheckbox:i}),p&&o.jsx(rAe,{__scopeCheckbox:i})]})})},"Checkbox")),nAe="CheckboxIndicator",iAe=b.forwardRef(Wo(function(t,n){const{__scopeCheckbox:i,forceMount:s,...r}=t,a=a2(nAe,i);return o.jsx(iz,{present:s||Bo(a.checked)||a.checked===!0,children:o.jsx(Zr.span,{"data-state":o2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),sAe="CheckboxBubbleInput",rAe=b.forwardRef(Wo(function({__scopeCheckbox:t,onClick:n,...i},s){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:g,setBubbleInput:v}=a2(sAe,t),y=lr(s,v),x=s2(r),E=b.useRef(!1),w=b.useRef(c),N=b.useRef(l);b.useEffect(()=>{const T=g;if(!T)return;const k=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(k,"checked").set,O=l!==N.current;N.current=l;const M=w.current!==c;w.current=c;const G=!(O&&a.current);if(M&&I){E.current=!O;const D=new Event("click",{bubbles:G});T.indeterminate=Bo(c),I.call(T,Bo(c)?!1:c),T.dispatchEvent(D),E.current=!1}},[g,c,a,l]);const _=b.useRef(Bo(c)?!1:c);return o.jsx(Zr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??_.current,required:d,disabled:f,name:h,value:p,form:m,...i,tabIndex:-1,ref:y,onClick:qs(n,T=>{E.current&&T.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function uz(e){return typeof e=="function"}Wo(uz,"isFunction");function Bo(e){return e==="indeterminate"}Wo(Bo,"isIndeterminate");function o2(e){return Bo(e)?"indeterminate":e?"checked":"unchecked"}Wo(o2,"getState");var aAe=Object.defineProperty,l2=(e,t)=>aAe(e,"name",{value:t,configurable:!0}),Ew=!1;function dz(){const[e,t]=b.useState(Ew);return b.useEffect(()=>{Ew||(Ew=!0,t(!0))},[]),e}l2(dz,"useIsHydrated");var fz=Lf[" useSyncExternalStore ".trim().toString()];function hz(){return()=>{}}l2(hz,"subscribe");function pz(){return fz(hz,()=>!0,()=>!1)}l2(pz,"useIsHydratedModern");var oAe=typeof fz=="function"?pz:dz,lAe=Object.defineProperty,Cu=(e,t)=>lAe(e,"name",{value:t,configurable:!0}),vw="rovingFocusGroup.onEntryFocus",cAe={bubbles:!1,cancelable:!0},Hx="RovingFocusGroup",[lN,mz,uAe]=GH(Hx),[dAe,zx]=cc(Hx,[uAe]),[fAe,hAe]=dAe(Hx),pAe=b.forwardRef(Cu(function(t,n){return o.jsx(lN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(lN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(mAe,{...t,ref:n})})})},"RovingFocusGroup")),mAe=b.forwardRef(Cu(function(t,n){const{__scopeRovingFocusGroup:i,orientation:s,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=b.useRef(null),m=lr(n,p),g=$x(a),[v,y]=Au({prop:l,defaultProp:c??null,onChange:u,caller:Hx}),[x,E]=b.useState(!1),w=lz(d),N=mz(i),_=b.useRef(!1),[T,k]=b.useState(0);return b.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(vw,w),()=>C.removeEventListener(vw,w)},[w]),o.jsx(fAe,{scope:i,orientation:s,dir:g,loop:r,currentTabStopId:v,onItemFocus:b.useCallback(C=>y(C),[y]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:b.useCallback(()=>k(C=>C-1),[]),children:o.jsx(Zr.div,{tabIndex:x||T===0?-1:0,"data-orientation":s,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:qs(t.onMouseDown,()=>{_.current=!0}),onFocus:qs(t.onFocus,C=>{const I=!_.current;if(C.target===C.currentTarget&&I&&!x){const O=new CustomEvent(vw,cAe);if(C.currentTarget.dispatchEvent(O),!O.defaultPrevented){const M=N().filter(j=>j.focusable),G=M.find(j=>j.active),D=M.find(j=>j.id===v),A=[G,D,...M].filter(Boolean).map(j=>j.ref.current);c2(A,f)}}_.current=!1}),onBlur:qs(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),gAe="RovingFocusGroupItem",bAe=b.forwardRef(Cu(function(t,n){const{__scopeRovingFocusGroup:i,focusable:s=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=oz(),d=a||u,f=hAe(gAe,i),h=f.currentTabStopId===d,p=mz(i),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=f,y=oAe();return fu(()=>{if(!(!y||!s))return m(),()=>g()},[y,s,m,g]),b.useEffect(()=>{if(!(y||!s))return m(),()=>g()},[y,s,m,g]),o.jsx(lN.ItemSlot,{scope:i,id:d,focusable:s,active:r,children:o.jsx(Zr.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:qs(t.onMouseDown,x=>{s?f.onItemFocus(d):x.preventDefault()}),onFocus:qs(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:qs(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=bz(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let N=p().filter(_=>_.focusable).map(_=>_.ref.current);if(E==="last")N.reverse();else if(E==="prev"||E==="next"){E==="prev"&&N.reverse();const _=N.indexOf(x.currentTarget);N=f.loop?yz(N,_+1):N.slice(_+1)}setTimeout(()=>c2(N))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),yAe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Cu(gz,"getDirectionAwareKey");function bz(e,t,n){const i=gz(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return yAe[i]}Cu(bz,"getFocusIntent");function c2(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Cu(c2,"focusFirst");function yz(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Cu(yz,"wrapArray");var xz=pAe,Ez=bAe,xAe=Object.defineProperty,Os=(e,t)=>xAe(e,"name",{value:t,configurable:!0}),vz="Radio",[EAe,wz]=cc(vz),[vAe,Vx]=EAe(vz);function _z(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:s,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=b.useState(null),[p,m]=b.useState(null),g=b.useRef(!1),[v,y]=b.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:s,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:g,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Os(()=>l==null?void 0:l(),"onCheck")};return o.jsx(vAe,{scope:t,...E,children:Sz(d)?d(E):i})}Os(_z,"RadioProvider");var wAe="RadioTrigger",_Ae=b.forwardRef(Os(function({__scopeRadio:t,onClick:n,...i},s){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=Vx(wAe,t),m=lr(s,c);return o.jsx(Zr.button,{type:"button",role:"radio","aria-checked":r,"data-state":u2(r),"data-disabled":a?"":void 0,disabled:a,value:l,...i,ref:m,onClick:qs(n,g=>{r||(f(),u()),p&&h&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"RadioTrigger")),SAe="RadioIndicator",NAe=b.forwardRef(Os(function(t,n){const{__scopeRadio:i,forceMount:s,...r}=t,a=Vx(SAe,i);return o.jsx(iz,{present:s||a.checked,children:o.jsx(Zr.span,{"data-state":u2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),TAe="RadioBubbleInput",kAe=b.forwardRef(Os(function({__scopeRadio:t,onClick:n,...i},s){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:g}=Vx(TAe,t),v=lr(s,p),y=s2(r),x=b.useRef(!1),E=b.useRef(a),w=b.useRef(g);b.useEffect(()=>{const _=h;if(!_)return;const T=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(T,"checked").set,I=g!==w.current;w.current=g;const O=E.current!==a;E.current=a;const M=!(I&&m.current);if(O&&C){x.current=!I;const G=new Event("click",{bubbles:M});C.call(_,a),_.dispatchEvent(G),x.current=!1}},[h,a,m,g]);const N=b.useRef(a);return o.jsx(Zr.input,{type:"radio","aria-hidden":!0,defaultChecked:N.current,required:l,disabled:c,name:u,value:d,form:f,...i,tabIndex:-1,ref:v,onClick:qs(n,_=>{x.current&&_.stopPropagation()}),style:{...i.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function Sz(e){return typeof e=="function"}Os(Sz,"isFunction");function u2(e){return e?"checked":"unchecked"}Os(u2,"getState");var AAe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],d2="RadioGroup",[CAe,Aje]=cc(d2,[zx,wz]),Nz=zx(),Gx=wz(),[IAe,RAe]=CAe(d2),jAe=b.forwardRef(Os(function(t,n){const{__scopeRadioGroup:i,name:s,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,g=Nz(i),v=$x(f),[y,x]=Au({prop:l,defaultProp:a??null,onChange:p,caller:d2}),[E,w]=b.useState(null),N=lr(n,w),_=b.useRef(y);return b.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=Os(()=>x(_.current),"reset");return T.addEventListener("reset",k),()=>T.removeEventListener("reset",k)}},[E,r,x]),o.jsx(IAe,{scope:i,name:s,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(xz,{asChild:!0,...g,orientation:d,dir:v,loop:h,children:o.jsx(Zr.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:N})})})},"RadioGroup")),OAe="RadioGroupItemProvider",MAe="RadioGroupItemTrigger";function Tz(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:s,internal_do_not_use_render:r}=e,a=RAe(OAe,t),l=Gx(t),c=a.disabled||i;return o.jsx(_z,{...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:s})}Os(Tz,"RadioGroupItemProvider");var LAe=b.forwardRef(Os(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Nz(i),a=Gx(i),{checked:l,disabled:c}=Vx(MAe,a.__scopeRadio),u=b.useRef(null),d=lr(n,u),f=b.useRef(!1);return b.useEffect(()=>{const h=Os(m=>{AAe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Os(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(Ez,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(_Ae,{...a,...s,ref:d,onKeyDown:qs(s.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:qs(s.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),DAe=b.forwardRef(Os(function(t,n){const{__scopeRadioGroup:i,value:s,disabled:r,...a}=t;return o.jsx(Tz,{__scopeRadioGroup:i,value:s,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(LAe,{...a,ref:n,__scopeRadioGroup:i}),l&&o.jsx(PAe,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),PAe=b.forwardRef(Os(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Gx(i);return o.jsx(kAe,{...r,...s,ref:n})},"RadioGroupItemBubbleInput")),BAe=b.forwardRef(Os(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Gx(i);return o.jsx(NAe,{...r,...s,ref:n})},"RadioGroupIndicator")),UAe=Object.defineProperty,FAe=(e,t)=>UAe(e,"name",{value:t,configurable:!0}),$Ae="Toggle",HAe=b.forwardRef(FAe(function(t,n){const{pressed:i,defaultPressed:s,onPressedChange:r,...a}=t,[l,c]=Au({prop:i,onChange:r,defaultProp:s??!1,caller:$Ae});return o.jsx(Zr.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:qs(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),zAe=Object.defineProperty,nc=(e,t)=>zAe(e,"name",{value:t,configurable:!0}),uh="ToggleGroup",[kz,Cje]=cc(uh,[zx]),Az=zx(),VAe=b.forwardRef(nc(function(t,n){const{type:i,...s}=t;if(i==="single"){const r=s;return o.jsx(GAe,{role:"radiogroup",...r,ref:n})}if(i==="multiple"){const r=s;return o.jsx(KAe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${uh}\``)},"ToggleGroup")),[Cz,Iz]=kz(uh),GAe=b.forwardRef(nc(function(t,n){const{value:i,defaultValue:s,onValueChange:r=nc(()=>{},"onValueChange"),...a}=t,[l,c]=Au({prop:i,defaultProp:s??"",onChange:r,caller:uh});return o.jsx(Cz,{scope:t.__scopeToggleGroup,type:"single",value:b.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:b.useCallback(()=>c(""),[c]),children:o.jsx(Rz,{...a,ref:n})})},"ToggleGroupImplSingle")),KAe=b.forwardRef(nc(function(t,n){const{value:i,defaultValue:s,onValueChange:r=nc(()=>{},"onValueChange"),...a}=t,[l,c]=Au({prop:i,defaultProp:s??[],onChange:r,caller:uh}),u=b.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=b.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(Cz,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Rz,{...a,ref:n})})},"ToggleGroupImplMultiple")),[qAe,YAe]=kz(uh),Rz=b.forwardRef(nc(function(t,n){const{__scopeToggleGroup:i,disabled:s=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=Az(i),f=$x(l),h={dir:f,...u};return o.jsx(qAe,{scope:i,rovingFocus:r,disabled:s,children:r?o.jsx(xz,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(Zr.div,{...h,ref:n})}):o.jsx(Zr.div,{...h,ref:n})})},"ToggleGroupImpl")),cN="ToggleGroupItem",WAe=b.forwardRef(nc(function(t,n){const i=Iz(cN,t.__scopeToggleGroup),s=YAe(cN,t.__scopeToggleGroup),r=Az(t.__scopeToggleGroup),a=i.value.includes(t.value),l=s.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=b.useRef(null);return s.rovingFocus?o.jsx(Ez,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(bD,{...c,ref:n})}):o.jsx(bD,{...c,ref:n})},"ToggleGroupItem")),bD=b.forwardRef(nc(function(t,n){const{__scopeToggleGroup:i,value:s,...r}=t,a=Iz(cN,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(HAe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(s):a.onItemDeactivate(s)}})},"ToggleGroupItemImpl"));const XAe="_Container_1tuad_1",QAe="_Checkbox_1tuad_22",ZAe="_CheckMark_1tuad_92",JAe="_Label_1tuad_162",Q0={Container:XAe,Checkbox:QAe,CheckMark:ZAe,Label:JAe},jz=({className:e,label:t,id:n,disabled:i,orientation:s="left",...r})=>{const a=b.useId(),l=n??a;return o.jsxs("div",{"data-disabled":i?"":void 0,"data-has-label":t?"":void 0,"data-orientation":s,className:ea(e,Q0.Container),children:[o.jsx(tAe,{className:Q0.Checkbox,id:l,disabled:i,...r,children:o.jsx(iAe,{className:Q0.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:Q0.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},e2e="_RadioGroup_onrfm_1",t2e="_RadioLabel_onrfm_9",n2e="_RadioIndicatorWrapper_onrfm_26",i2e="_RadioItem_onrfm_43",s2e="_RadioIndicator_onrfm_26",dp={RadioGroup:e2e,RadioLabel:t2e,RadioIndicatorWrapper:n2e,RadioItem:i2e,RadioIndicator:s2e},Oz=b.createContext(null),r2e=()=>{const e=b.use(Oz);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},uN=({onChange:e,children:t,className:n,direction:i="row",disabled:s=!1,...r})=>{const a=b.useMemo(()=>({disabled:s,direction:i}),[s,i]);return o.jsx(Oz,{value:a,children:o.jsx(jAe,{className:ea(dp.RadioGroup,n),"data-direction":i,onValueChange:e,disabled:s,...r,children:t})})},a2e=({value:e,disabled:t=!1,required:n,children:i,className:s,block:r=!1,...a})=>{const{disabled:l}=r2e(),c=l||t,u=b.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ea(dp.RadioLabel,s),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:dp.RadioIndicatorWrapper,children:o.jsx(DAe,{id:d,value:e,disabled:c,required:n,className:dp.RadioItem,children:o.jsx(BAe,{className:dp.RadioIndicator})})}),i]})})};uN.Item=a2e;function o2e({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 cd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:o2e},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:yJ},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:$J},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:dk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:z1}},l2e=[cd.llm,cd.sequential,cd.parallel,cd.loop,cd.a2a];function Mz(e){return cd[e??"llm"]}const Lz=e=>e==="sequential"||e==="parallel"||e==="loop",Kx=e=>e==="a2a";function ic(e){return e.trimEnd().replace(/[。.]+$/,"")}function c1(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(i=>i==null?void 0:i.toLocaleLowerCase().includes(n)):!0}function Ec(e,t){return e[t]|e[t+1]<<8}function Ju(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function c2e(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 Dz(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(Ju(e,u)===101010256){i=u;break}if(i<0)throw new Error("无效的 zip:找不到 EOCD");const s=Ec(e,i+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=Ju(e,i+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=Ec(e,v+26),E=Ec(e,v+28),w=v+30+x+E,N=e.subarray(w,w+f);let _;if(d===0)_=N;else if(d===8)_=await c2e(N);else{r+=46+p+m+g;continue}l.push({name:y,text:a.decode(_)}),r+=46+p+m+g}return l}const u2e="/skillhub/v1/skills";async function d2e(e,t="public"){const n=e.trim(),i=`${u2e}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(i,{headers:{accept:"application/json"},signal:Cn(void 0,Gf)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var l;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((l=a.Metadata)==null?void 0:l.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function f2e({selected:e,onChange:t}){const[n,i]=b.useState(""),[s,r]=b.useState([]),[a,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(!1),h=g=>e.some(v=>v.source==="skillhub"&&v.slug===g),p=g=>{g.slug&&(h(g.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.slug===g.slug))):t([...e,{source:"skillhub",slug:g.slug,name:g.name,folder:g.slug.split("/").pop()||g.name,namespace:g.namespace||"public",description:g.description}]))},m=async g=>{l(!0),u(null),f(!0);try{const v=await d2e(g);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return b.useEffect(()=>{const g=n.trim();if(!g){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(g),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(Cy,{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:g=>i(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.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(mn,{className:"cw-i cw-spin"}):o.jsx(Cy,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(Eu,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&s.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在搜索…"]}):s.length>0?o.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const v=h(g.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(g),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(ka,{className:"cw-i cw-i-sm"}):o.jsx(ws,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:g.name}),g.description&&o.jsx("span",{className:"cw-skill-result-desc",children:ic(g.description)}),g.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:g.sourceRepo})]})]},g.id||g.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const dN=/(^|\/)skill\.md$/i;function h2e(e){const t=(e??"").replace(/\r\n?/g,` +${t}`}function Ske(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const i=n.indexOf(` +`);return i>=0&&(n=n.slice(i+1)),{text:n,omitted:!0}}function gD(e,t,n=wke){const i=_ke((e==null?void 0:e.text)??"",t.text??""),s=Ske(i,n),r=s.text?s.text.split(` +`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||s.omitted);return{...t,text:s.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}cr.registerLanguage("python",Q7);cr.registerLanguage("typescript",cF);cr.registerLanguage("javascript",G7);cr.registerLanguage("json",K7);cr.registerLanguage("yaml",uF);cr.registerLanguage("markdown",X7);cr.registerLanguage("bash",U7);cr.registerLanguage("ini",F7);cr.registerLanguage("dockerfile",Vbe);cr.registerLanguage("makefile",W7);const Nke=b.lazy(()=>Zc(()=>import("./CodeEditor-Bb0D1gBv.js"),[])),bl=()=>{};function Tke({open:e,isUpdate:t,onCancel:n,onConfirm:i}){const s=b.useRef(null);return b.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=s.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?ks.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(tee,{})}),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(As,{"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:s,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:i,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function XH({ariaLabel:e,value:t,placeholder:n,options:i,disabled:s=!1,onChange:r}){const a=b.useId(),l=b.useRef(null),c=b.useRef(null),u=b.useRef([]),[d,f]=b.useState(!1),[h,p]=b.useState(0),m=i.find(x=>x.value===t);b.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]),b.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const g=(x=1)=>{const E=i.findIndex(N=>N.value===t),w=E>=0?E:x===1?0:Math.max(0,i.length-1);p(w),f(!0)},v=x=>{i.length!==0&&p((x+i.length)%i.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):g(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):g(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,i.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:s||i.length===0,onClick:()=>{d?f(!1):g()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(VP,{"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:i.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:N=>{u.current[E]=N},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(Aa,{"aria-hidden":"true"})]},x.value)})})]})}function kke({value:e,disabled:t,onChange:n}){const[i,s]=b.useState([]),[r,a]=b.useState(!0),[l,c]=b.useState(null),[u,d]=b.useState(0);b.useEffect(()=>{const p=new AbortController;return a(!0),c(null),IB(p.signal).then(m=>s(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(s([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=b.useMemo(()=>[...i].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})),[i]),h=i.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(XH,{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(mn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):i.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 Ake=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],Cke={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"},bD={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function yD(e){return e.replace(/&/g,"&").replace(//g,">")}function Ike(e){const n=(e.split("/").pop()??e).toLowerCase();if(bD[n])return bD[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const i=n.lastIndexOf(".");if(i===-1)return null;const s=n.slice(i+1);return Cke[s]??null}function Rke(e,t){try{const n=Ike(t);return n&&cr.getLanguage(n)?cr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?cr.highlightAuto(e).value:yD(e)}catch{return yD(e)}}const jke=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],Oke=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],Mke={phase:"update",label:"更新实例配置"},Lke={phase:"evaluation",label:"创建评测集"};function Dke(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function Pke(e,t){const n=Number(e),i=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(i)||n<1||i<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>i?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:i}}function Bke(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let s=t;i.forEach((r,a)=>{let l=s.children.get(r);l||(l={name:r,children:new Map},s.children.set(r,l)),a===i.length-1&&(l.path=n.path),s=l})}return t}function Uke(e){return[...e.children.values()].sort((t,n)=>{const i=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return i!==s?i?-1:1:t.name.localeCompare(n.name)})}function Fke(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function $ke({left:e,right:t}){const[n,i]=b.useState(null);return b.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");s&&r&&i({left:s,right:r})},[]),n?o.jsxs(o.Fragment,{children:[ks.createPortal(e,n.left),ks.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function qx({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:i,agentName:s,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:g,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:N,onNetworkChange:_,deployRegion:T="cn-beijing",onDeployRegionChange:k,deploymentTelemetrySource:C="unknown",onBack:I,backLabel:O="返回配置",onExportYaml:L,deploymentPrimaryPane:G,deployDisabled:D=!1}){var $n,yn,_t;const F=typeof l=="function",A=f.includes("更新"),j=Dke(i),[P,$]=b.useState(((yn=($n=e==null?void 0:e.files)==null?void 0:$n[0])==null?void 0:yn.path)??null),[R,Y]=b.useState(new Set),[Z,B]=b.useState(!1),[te,K]=b.useState(""),[z,W]=b.useState(!1),[q,ce]=b.useState(!1),[me,_e]=b.useState(!1),[de,ge]=b.useState(!1),[Oe,Ee]=b.useState(null),[ae,Ne]=b.useState(null),[ve,Qe]=b.useState({}),[Me,ze]=b.useState(null),[Se,Ue]=b.useState(!1),[Pe,Ke]=b.useState([]),[Q,oe]=b.useState(!1),[ie,be]=b.useState(!1),[Le,qe]=b.useState("api_key"),[gt,lt]=b.useState(""),[ln,Mt]=b.useState("1"),[kt,Vt]=b.useState(j?"1":"5"),[He,Xt]=b.useState(!0),[nt,yt]=b.useState(null),Je=b.useRef(!0),ot=Pke(ln,kt),ye=!A&&ot.valid&&(ot.min!==1||ot.max!==5),Xe=G?Oke:jke,St=ye?[...Xe,Mke]:Xe,Qt=He?[...St,Lke]:St;b.useEffect(()=>{if(!h){yt(null);return}yt(document.getElementById(h))},[h]);const Rn=ue=>o.jsxs("div",{className:"pp-network-region",onKeyDown:fe=>{fe.key==="Escape"&&be(!1)},children:[ue&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":ie,disabled:z||A||!k,onClick:()=>be(fe=>!fe),children:[o.jsx("span",{children:T==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(VP,{className:`pp-region-chevron${ie?" is-open":""}`})]}),ie&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>be(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(fe=>{const De=fe.value===T;return o.jsxs("button",{type:"button",role:"option","aria-selected":De,className:`pp-region-option${De?" is-selected":""}`,onClick:()=>{k==null||k(fe.value),be(!1)},children:[o.jsx("span",{children:fe.label}),De&&o.jsx(Aa,{"aria-hidden":"true"})]},fe.value)})})]})]});b.useEffect(()=>(Je.current=!0,()=>{Je.current=!1}),[]),b.useEffect(()=>{Mt("1"),Vt(j?"1":"5")},[j]),b.useEffect(()=>{if(!me)return;const ue=document.body.style.overflow;document.body.style.overflow="hidden";const fe=De=>{De.key==="Escape"&&_e(!1)};return window.addEventListener("keydown",fe),()=>{document.body.style.overflow=ue,window.removeEventListener("keydown",fe)}},[me]);const Bt=b.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:Bke(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const Ze=e.files.find(ue=>ue.path===P)??null,cn=(N==null?void 0:N.mode)??"public",un=()=>({source:C,action:p?"update":"create",region:T,networkType:cn,feishuEnabled:v}),Et=JTe(v?[...x,...$h]:x,E),nn=Et.length+Pe.length;function Ci(ue){Y(fe=>{const De=new Set(fe);return De.has(ue)?De.delete(ue):De.add(ue),De})}function ii(ue,fe){l&&(l({...e,files:ue}),fe!==void 0&&$(fe))}function Dn(ue){Ze&&ii(e.files.map(fe=>fe.path===Ze.path?{...fe,content:ue}:fe))}function Pn(){const ue=te.trim();if(B(!1),K(""),!!ue){if(e.files.some(fe=>fe.path===ue)){$(ue);return}ii([...e.files,{path:ue,content:""}],ue)}}function gn(){if(!Ze)return;const ue=window.prompt("重命名文件",Ze.path),fe=ue==null?void 0:ue.trim();!fe||fe===Ze.path||e.files.some(De=>De.path===fe)||ii(e.files.map(De=>De.path===Ze.path?{...De,path:fe}:De),fe)}function _n(){var fe;if(!Ze)return;const ue=e.files.filter(De=>De.path!==Ze.path);ii(ue,((fe=ue[0])==null?void 0:fe.path)??null)}function Bn(ue,fe){Ke(De=>De.map(We=>We.id===ue?{...We,...fe}:We))}function $i(ue){Ke(fe=>fe.filter(De=>De.id!==ue))}function gs(){Ke(ue=>[...ue,Fke()])}function Ii(ue){_&&_(ue==="public"?void 0:{...N??{mode:ue},mode:ue})}function Ri(ue){_==null||_({...N??{mode:"private"},...ue})}function Un(){const ue=new Map(Pe.map(De=>({key:De.key.trim(),value:De.value})).filter(De=>De.key.length>0).map(De=>[De.key,De.value])),fe=v?[...x,...$h]:x;for(const De of VH(fe,E))ue.set(De.key,De.value);return[...ue].map(([De,We])=>({key:De,value:We}))}async function vi(){if(!(!y||z||de)){Ee(null),ge(!0);try{await y(!v)}catch(ue){Je.current&&Ee(`更新飞书配置失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{Je.current&&ge(!1)}}}async function Sn(){var De;if(!c||z||D)return;if(!ot.valid){Ee(ot.error);return}if(!A&&Le==="user_pool"&&!gt){Ee("请选择用于 Runtime 鉴权的用户池。");return}if(cn!=="public"&&!((De=N==null?void 0:N.vpcId)!=null&&De.trim())){Ee("使用 VPC 网络时,请填写 VPC ID。");return}const ue=dD(x,E);if(ue){const We=x.find(rt=>rt.key===ue.key);Ee(`请返回配置页填写 ${(We==null?void 0:We.comment)||(We==null?void 0:We.key)}(${We==null?void 0:We.key})。`);return}const fe=GH(x,E);if(fe){Ee(`${fe.spec.comment||fe.spec.key}:${fe.error}`);return}if(v){const We=dD($h,E);if(We){const rt=$h.find(at=>at.key===We.key);Ee(`启用飞书后,请填写${(rt==null?void 0:rt.comment)||(rt==null?void 0:rt.key)}。`);return}}ce(!0)}async function si(){var Hn;if(!c||z)return;if(!ot.valid){ce(!1),Ee(ot.error);return}ce(!1);const ue=Un();Je.current&&(Ee(null),Ne(null),Qe({}),ze(null),W(!0));const fe=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let De=(s==null?void 0:s.trim())||e.name||"生成中…";const We=Date.now(),rt={id:fe,runtimeName:De,runtimeId:p,region:T,startedAt:We,status:"running",phase:"prepare",label:"准备部署",agentDraft:i,instanceRange:ye?{min:ot.min,max:ot.max}:void 0,createEvaluationSets:He};g==null||g(rt),m==null||m(rt);let at,sn=rt.phase??"prepare";const rn=Ut=>at?{...at,status:Ut,updatedAt:Date.now()}:void 0,fi=Ut=>{const vt=rn(Ut);return vt?{buildLog:vt}:{}},Zi=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),dn=Ut=>{if(sn!=="build")return;const vt=["","----- 构建失败 -----",Ut].join(` +`);return at=gD(at,{source:"code-pipeline",status:"error",text:vt,lineCount:vt.split(` +`).length,truncated:!1,updatedAt:Date.now()}),at};try{const Ut=await c(e,vt=>{var wi;vt.runtimeName&&(De=vt.runtimeName),sn=vt.phase,vt.buildLog?at=gD(at,vt.buildLog):vt.phase==="build"&&!at&&(at=Zi()),Je.current&&(Qe(bs=>({...bs,[vt.phase]:vt})),ze(vt.phase)),g==null||g({id:fe,runtimeName:De,runtimeId:p,region:T,startedAt:We,status:"running",phase:vt.phase,label:((wi=Qt.find(bs=>bs.phase===vt.phase))==null?void 0:wi.label)??vt.phase,message:vt.message,pct:vt.pct,...at?{buildLog:at}:{}})},{taskId:fe,sessionStorage:j?"in-memory":"persistent",minInstance:ot.min,maxInstance:ot.max,...A?{}:{authentication:Le==="user_pool"?{type:"user_pool",userPoolUid:gt}:{type:"api_key"}},createEvaluationSets:He,...v?{im:{feishu:{enabled:!0}}}:{},envs:ue});Je.current&&(Ne(Ut),ze(null)),dke({...un(),runtimeId:Ut.runtimeId||p||""}),g==null||g({id:fe,runtimeName:Ut.agentName||De,runtimeId:Ut.runtimeId||p,region:Ut.region||T,startedAt:We,status:"success",phase:"complete",label:"部署完成",message:(Hn=Ut.warnings)==null?void 0:Hn.join(";"),...fi("complete")});try{await(d==null?void 0:d(Ut))}catch(vt){if(!(vt instanceof wr))throw vt;g==null||g({id:fe,runtimeName:Ut.agentName||De,runtimeId:Ut.runtimeId||p,region:Ut.region||T,startedAt:We,status:"success",phase:"complete",label:"部署完成,暂未连接",message:vt.message,...fi("complete")})}}catch(Ut){const vt=Ut instanceof Error?Ut.message:String(Ut);if(Ut instanceof DOMException&&Ut.name==="AbortError"){Je.current&&(Ee(null),ze(null)),g==null||g({id:fe,runtimeName:De,runtimeId:p,region:T,startedAt:We,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...fi("complete")});return}Je.current&&Ee(vt);const wi=dn(vt),bs=!!wi;fke({...un(),phase:sn,error:Ut}),g==null||g({id:fe,runtimeName:De,runtimeId:p,region:T,startedAt:We,status:"error",phase:sn,label:"部署失败",message:bs?"构建镜像失败,详见构建日志。":vt,...wi?{buildLog:wi}:fi("complete"),retry:Sn})}finally{Je.current&&W(!1)}}function ji(){ce(!1)}async function Oi(){if(!(!ae||Se)){Ue(!0),Ee(null);try{const{addConnection:ue,addRuntimeConnection:fe,remoteAppId:De,loadConnections:We}=await Zc(async()=>{const{addConnection:sn,addRuntimeConnection:rn,remoteAppId:fi,loadConnections:Zi}=await Promise.resolve().then(()=>AL);return{addConnection:sn,addRuntimeConnection:rn,remoteAppId:fi,loadConnections:Zi}},void 0),{probeRuntimeApps:rt}=await Zc(async()=>{const{probeRuntimeApps:sn}=await Promise.resolve().then(()=>Uee);return{probeRuntimeApps:sn}},void 0);let at;if(ae.runtimeId){const sn=ae.region??T,rn=await rt(ae.runtimeId,sn,{retryProbe:!0})??[];at=fe(ae.runtimeId,ae.agentName,sn,rn,rn.length>0?{[rn[0]]:ae.agentName}:void 0,ae.version)}else at=await ue(ae.agentName,ae.url,ae.apikey,"");if(at.apps.length===0)Ee("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const sn={[at.apps[0]]:ae.agentName},rn={...at,appLabels:{...at.appLabels??{},...sn}},Zi=We().map(Hn=>Hn.id===at.id?rn:Hn);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Zi));const{registerConnections:dn}=await Zc(async()=>{const{registerConnections:Hn}=await Promise.resolve().then(()=>AL);return{registerConnections:Hn}},void 0);if(dn(Zi),u){const Hn=De(at.id,at.apps[0]);u(Hn,ae.agentName)}else alert(`🎉 Agent "${ae.agentName}" 已添加到左上角下拉列表!`)}}catch(ue){Ee(`添加 Agent 失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{Ue(!1)}}}function bn(){const ue=bke(e.files),fe=URL.createObjectURL(ue),De=document.createElement("a");De.href=fe,De.download=`${e.name||"project"}.zip`,document.body.appendChild(De),De.click(),document.body.removeChild(De),URL.revokeObjectURL(fe)}const jn=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[L&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:L,children:[o.jsx(NJ,{className:"pp-ic"}),"导出 YAML"]}),F&&l&&o.jsx(vke,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:bn,children:[o.jsx(W1,{className:"pp-ic"}),"下载源代码"]})]});function Fn(ue,fe,De){return Uke(ue).map(We=>{const rt=De?`${De}/${We.name}`:We.name,at=We.path!==void 0,sn={paddingLeft:8+fe*14};if(at){const fi=We.path===P;return o.jsxs("button",{type:"button",className:`pp-row pp-file${fi?" pp-active":""}`,style:sn,onClick:()=>$(We.path),title:We.path,children:[o.jsx(AJ,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:We.name})]},rt)}const rn=R.has(rt);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:sn,onClick:()=>Ci(rt),children:[o.jsx(nc,{className:`pp-ic pp-chevron${rn?"":" pp-open"}`}),o.jsx(qP,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:We.name})]}),!rn&&Fn(We,fe+1,rt)]},rt)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${G?" has-primary-pane":""}`,children:[c&&!t&&o.jsx($ke,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[I&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:I,children:[o.jsx(hk,{className:"pp-ic"}),O]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!G&&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:[i&&o.jsx(jm,{draft:i,direction:"horizontal",selectedPath:[],onSelect:bl,onAdd:bl,onInsert:bl,onDelete:bl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>_e(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(Kc,{"aria-hidden":!0})})]}),t&&jn,!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:s||e.name||"未命名 Agent"}),(i==null?void 0:i.description)&&o.jsx("p",{className:"pp-release-description",title:i.description,children:i.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("、"):"未启用"})]})]})]})]}),jn]})]})]})}),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:"文件预览"}),F&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{B(!0),K("")},children:o.jsx(TJ,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[Z&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:te,onChange:ue=>K(ue.target.value),onBlur:Pn,onKeyDown:ue=>{ue.key==="Enter"&&Pn(),ue.key==="Escape"&&(B(!1),K(""))}}),e.files.length===0&&!Z?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):Fn(Bt,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:Ze==null?void 0:Ze.path,children:(Ze==null?void 0:Ze.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:F&&Ze&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:gn,children:o.jsx(qJ,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:_n,children:o.jsx(ic,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:Ze==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):F?o.jsx("div",{className:"pp-codemirror",children:o.jsx(b.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(Nke,{value:Ze.content,path:Ze.path,onChange:Dn})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:Rke(Ze.content,Ze.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:[G,!G&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),Rn(!1)]}),!G&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),A?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(XH,{ariaLabel:"部署鉴权方式",value:Le,placeholder:"请选择鉴权方式",options:Ake,disabled:z,onChange:ue=>{Ee(null),qe(ue)}})]}),Le==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(kke,{value:gt,disabled:z,onChange:ue=>{Ee(null),lt(ue)}})]})]})]}),!G&&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 vi(),disabled:v||z||de||!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:de?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),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 vi(),disabled:!v||z||de||!y,children:de?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:$h.map(ue=>o.jsxs("label",{children:[o.jsxs("span",{children:[ue.comment||ue.key,ue.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:ue.key.includes("SECRET")?"password":"text",value:E[ue.key]??"",placeholder:ue.placeholder,tabIndex:v?0:-1,disabled:!v||z||!w,autoComplete:"off",onChange:fe=>w==null?void 0:w(ue.key,fe.currentTarget.value)})]},ue.key))})]})]})})]}),!A&&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:ln,disabled:z,"aria-invalid":!ot.valid,onChange:ue=>Mt(ue.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:kt,disabled:z,"aria-invalid":!ot.valid,onChange:ue=>Vt(ue.currentTarget.value)})]})]}),j&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!ot.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:ot.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),G&&Rn(!0),A&&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(ue=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:ue,checked:cn===ue,onChange:()=>Ii(ue),disabled:z||A||!_}),o.jsx("span",{children:ue==="public"?"公网":ue==="private"?"VPC":"公网 + VPC"})]},ue))}),cn!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(N==null?void 0:N.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:z||A,onChange:ue=>Ri({vpcId:ue.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(N==null?void 0:N.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:z||A,onChange:ue=>Ri({subnetIds:ue.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(N!=null&&N.enableSharedInternetAccess),disabled:z||A,onChange:ue=>Ri({enableSharedInternetAccess:ue.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),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:He,disabled:z,onChange:ue=>Xt(ue.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.jsxs("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:[nn," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),o.jsx("button",{type:"button",className:"pp-icon-btn",title:Q?"隐藏值":"显示值",onClick:()=>oe(ue=>!ue),children:Q?o.jsx(SJ,{className:"pp-ic"}):o.jsx(GP,{className:"pp-ic"})})]}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:gs,disabled:z,children:[o.jsx(Ns,{className:"pp-ic"}),"添加变量"]}),(Et.length>0||Pe.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[Et.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:[Et.length," 项"]})]}),Et.map(ue=>{const fe=ue.key.startsWith("ENABLE_"),De=c2(ue,E),We=ue.multiline||ue.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${We?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${ue.key} 环境变量名`,"aria-disabled":z,children:[o.jsx("span",{title:ue.key,children:ue.key}),(ue.help||ue.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":ue.help||ue.comment,"aria-label":`${ue.key}说明:${ue.help||ue.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:ue.help||ue.comment})]}),ue.link&&o.jsx("a",{className:"pp-env-link",href:ue.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${ue.link.label}`,"aria-label":`${ue.key}:打开 OpenViking ${ue.link.label}`,children:o.jsx(xm,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[We?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:ue.value,placeholder:ue.required?"必填,尚未填写":"可选,尚未填写",readOnly:fe,disabled:z||!fe&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!De,"aria-label":`${ue.key} 环境变量值`,onChange:rt=>w==null?void 0:w(ue.key,rt.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:fe||Q?"text":"password",value:ue.value,placeholder:ue.required?"必填,尚未填写":"可选,尚未填写",readOnly:fe,disabled:z||!fe&&!w,autoComplete:"off","aria-invalid":!!De,"aria-label":`${ue.key} 环境变量值`,onChange:rt=>w==null?void 0:w(ue.key,rt.currentTarget.value)}),De&&o.jsx("span",{className:"pp-env-error",children:De})]}),o.jsx("span",{className:"pp-env-source",children:fe?"自动":"同步"})]},ue.key)})]}),Pe.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Pe.length," 项"]})]}),Pe.map(ue=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:ue.key,placeholder:"名称",disabled:z,autoComplete:"off",onChange:fe=>Bn(ue.id,{key:fe.currentTarget.value})}),o.jsx("input",{type:Q?"text":"password",value:ue.value,placeholder:"值",disabled:z,autoComplete:"off",onChange:fe=>Bn(ue.id,{value:fe.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:z,onClick:()=>$i(ue.id),children:o.jsx(As,{className:"pp-ic"})})]},ue.id))]})]}),(z||ae||Object.keys(ve).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:Qt.map((ue,fe)=>{const De=Me?Qt.findIndex(sn=>sn.phase===Me):-1,We=!!Oe&&(De===-1?fe===0:fe===De);let rt;ae?rt="done":We?rt="failed":De===-1?rt=z?"active":"pending":feue.phase===Me))==null?void 0:_t.label)??Me}阶段):`:""}${Oe}`,onRetry:Sn,retryLabel:A?"重试更新":"重试部署"}),ae&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:A?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[ae.warnings&&ae.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:ae.warnings.map(ue=>o.jsx("span",{children:ue},ue))}),ae.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:ae.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:ae.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:ae.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Oi,disabled:Se,children:[Se?o.jsx(mn,{className:"pp-ic spin"}):o.jsx(XP,{className:"pp-ic"}),Se?"连接中…":"立即对话"]}),ae.consoleUrl&&o.jsxs("a",{href:ae.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(xm,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${nt?" is-external":""}`,children:nt?ks.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:Sn,disabled:z||de||D||!!n,title:n,children:z?`${f}中…`:Oe?`重试${f}`:f}),nt):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:Sn,disabled:z||de||D||!!n,title:n,children:z?`${f}中…`:Oe?`重试${f}`:f})})]})]}),me&&i&&ks.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ue=>{ue.target===ue.currentTarget&&_e(!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:()=>_e(!1),"aria-label":"关闭执行流程预览",children:o.jsx(As,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(jm,{draft:i,direction:"horizontal",selectedPath:[],onSelect:bl,onAdd:bl,onInsert:bl,onDelete:bl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(Tke,{open:q,isUpdate:A,onCancel:ji,onConfirm:()=>void si()})]})}const xD="dogfooding",_w="dogfooding",Sw="dogfooding_b";let Hke=0;const Nw=()=>++Hke;function ED(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function zke(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function vD(e){const t=[],n=zke(e);t.push(n);const i=n.indexOf("{"),s=n.lastIndexOf("}");i>=0&&s>i&&t.push(n.slice(i,s+1));for(const r of t)try{const a=JSON.parse(r);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await ix(l2(a))}catch{}return null}function Vke({userId:e,onBack:t,onCreate:n,onAgentAdded:i,onDeploymentTaskChange:s}){const[r,a]=b.useState([{id:Nw(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(null),[p,m]=b.useState(null),[g,v]=b.useState(!1),[y,x]=b.useState(null),[E,w]=b.useState(null),[N,_]=b.useState(!1),[T,k]=b.useState(!1),[C,I]=b.useState({}),O=b.useRef(null),L=b.useRef(null),G=b.useRef(null),D=b.useRef(null),F=b.useRef(null);b.useEffect(()=>{const K=D.current;K&&K.scrollTo({top:K.scrollHeight,behavior:"smooth"})},[r,u]),b.useEffect(()=>{const K=F.current;K&&(K.style.height="auto",K.style.height=Math.min(K.scrollHeight,160)+"px")},[l]);const A=K=>a(z=>[...z,{id:Nw(),role:"assistant",text:K}]);async function j(){if(O.current)return O.current;const K=await By(xD,e);return O.current=K,K}async function P(K,z){if(z.current)return z.current;const W=await By(K,e);return z.current=W,W}async function $(K,z){if(!C[K])try{const W=await Ik(z);I(q=>({...q,[K]:W.model||z}))}catch{I(W=>({...W,[K]:z}))}}async function R(K,z,W){const q=await P(K,z);let ce=xa();for await(const _e of Em({appName:K,userId:e,sessionId:q,text:W}))ce=gf(ce,_e);const me=ED(ce).trim();return{project:await vD(me),finalText:me}}const Y=async(K,z,W)=>ug(K.name,K.files,{region:"cn-beijing",projectName:"default"},{...W,onStage:z}),Z=async()=>{const K=l.trim();if(!(!K||u)){if(a(z=>[...z,{id:Nw(),role:"user",text:K}]),c(""),h(null),d(!0),g){x(null),w(null),_(!0),k(!0),$("a",_w),$("b",Sw);const z=R(_w,L,K).then(({project:q})=>(x(q),q)).catch(q=>{const ce=q instanceof Error?q.message:String(q);return h(ce),null}).finally(()=>_(!1)),W=R(Sw,G,K).then(({project:q})=>(w(q),q)).catch(q=>{const ce=q instanceof Error?q.message:String(q);return h(ce),null}).finally(()=>k(!1));try{const[q,ce]=await Promise.all([z,W]),me=[q?`方案 A:${q.name}`:null,ce?`方案 B:${ce.name}`:null].filter(Boolean);me.length?A(`已生成两个方案(${me.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const z=await j();let W=xa();for await(const me of Em({appName:xD,userId:e,sessionId:z,text:K}))W=gf(W,me);const q=ED(W).trim(),ce=await vD(q);ce?(m(ce),A(`已生成项目:${ce.name}(${ce.files.length} 个文件),可在右侧预览和编辑。`)):A(q||"(助手没有返回内容,请再描述一下你的需求。)")}catch(z){const W=z instanceof Error?z.message:String(z);h(W),A(`抱歉,调用智能构建助手失败:${W}`)}finally{d(!1)}}},B=K=>{const z=K==="a"?y:E;if(!z)return;m(z),v(!1),x(null),w(null),_(!1),k(!1);const W=K==="a"?"A":"B",q=K==="a"?C.a:C.b;A(`已采用方案 ${W}(${q??(K==="a"?_w:Sw)}),可继续编辑。`)},te=K=>{K.key==="Enter"&&!K.shiftKey&&!K.nativeEvent.isComposing&&(K.preventDefault(),Z())};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:D,children:[o.jsx(Ro,{initial:!1,children:r.map(K=>o.jsxs(Jn.div,{className:`ic-turn ic-turn--${K.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[K.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(su,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:K.role==="assistant"?o.jsx(rh,{text:K.text}):K.text})]},K.id))}),u&&o.jsxs(Jn.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(su,{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"})]})]})]}),f&&o.jsxs("div",{className:"ic-error",children:[o.jsx(pk,{className:"ic-error-icon"}),f]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:F,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:l,onChange:K=>c(K.target.value),onKeyDown:te,disabled:u}),o.jsx("button",{className:"ic-send",onClick:()=>void Z(),disabled:!l.trim()||u,title:"发送 (Enter)",children:o.jsx(ZJ,{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:g,disabled:u,onChange:K=>v(K.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:g?o.jsxs("div",{className:"ic-compare",children:[o.jsx(wD,{side:"a",project:y,loading:N,model:C.a,onAdopt:()=>B("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(wD,{side:"b",project:E,loading:T,model:C.b,onAdopt:()=>B("b")})]}):p?o.jsx(qx,{project:p,onChange:m,onDeploy:Y,onAgentAdded:i,onDeploymentTaskChange:s,deploymentTelemetrySource:"intelligent_create"}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(IJ,{className:"ic-preview-empty-glyph"}),o.jsx(ru,{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 wD({side:e,project:t,loading:n,model:i,onAdopt:s}){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}),i&&o.jsx("span",{className:"ic-pane-model",children:i})]}),o.jsxs("button",{className:"ic-adopt",onClick:s,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(mn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(qx,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var Gke=Object.defineProperty,u2=(e,t)=>Gke(e,"name",{value:t,configurable:!0});function dN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}u2(dN,"setRef");function QH(...e){return t=>{let n=!1;const i=e.map(s=>{const r=dN(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;sKke(e,"name",{value:t,configurable:!0});function Lf(e){const t=b.forwardRef((n,i)=>{let{children:s,...r}=n,a=null,l=!1;const c=[];fN(s)&&typeof tb=="function"&&(s=tb(s._payload)),b.Children.forEach(s,h=>{var p;if(tz(h)){l=!0;const m=h;let g="child"in m.props?m.props.child:m.props.children;fN(g)&&typeof tb=="function"&&(g=tb(g._payload)),a=Yke(m,g),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=b.cloneElement(a,void 0,c):!l&&b.Children.count(s)===1&&b.isValidElement(s)&&(a=s);const u=a?ez(a):void 0,d=ur(i,u);if(!a){if(s||s===0)throw new Error(l?Qke(e):Xke(e));return s}const f=JH(r,a.props??{});return a.type!==b.Fragment&&(f.ref=i?d:u),b.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}ja(Lf,"createSlot");var ZH=Symbol.for("radix.slottable");function qke(e){const t=ja(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=ZH,t}ja(qke,"createSlottable");var Yke=ja((e,t)=>{if("child"in e.props){const n=e.props.child;return b.isValidElement(n)?b.cloneElement(n,void 0,e.props.children(n.props.children)):null}return b.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function JH(e,t){const n={...t};for(const i in t){const s=e[i],r=t[i];/^on[A-Z]/.test(i)?s&&r?n[i]=(...l)=>{const c=r(...l);return s(...l),c}:s&&(n[i]=s):i==="style"?n[i]={...s,...r}:i==="className"&&(n[i]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}ja(JH,"mergeProps");function ez(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ja(ez,"getElementRef");function tz(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ZH}ja(tz,"isSlottable");var Wke=Symbol.for("react.lazy");function fN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Wke&&"_payload"in e&&nz(e._payload)}ja(fN,"isLazyComponent");function nz(e){return typeof e=="object"&&e!==null&&"then"in e}ja(nz,"isPromiseLike");var Xke=ja(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Qke=ja(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),tb=Bf[" use ".trim().toString()],Zke=Object.defineProperty,Jke=(e,t)=>Zke(e,"name",{value:t,configurable:!0}),eAe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ea=eAe.reduce((e,t)=>{const n=Lf(`Primitive.${t}`),i=b.forwardRef((s,r)=>{const{asChild:a,...l}=s,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function tAe(e,t){e&&ks.flushSync(()=>e.dispatchEvent(t))}Jke(tAe,"dispatchDiscreteCustomEvent");var nAe=Object.defineProperty,Yr=(e,t)=>nAe(e,"name",{value:t,configurable:!0});function iAe(e,t){const n=b.createContext(t);n.displayName=e+"Context";const i=Yr(r=>{const{children:a,...l}=r,c=b.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");i.displayName=e+"Provider";function s(r,a={}){const{optional:l=!1}=a,c=b.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return Yr(s,"useContext"),[i,s]}Yr(iAe,"createContext");function dc(e,t=[]){let n=[];function i(r,a){const l=b.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=Yr(f=>{var y;const{scope:h,children:p,...m}=f,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=b.useMemo(()=>m,Object.values(m));return o.jsx(g.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=b.useContext(g);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return Yr(d,"useContext"),[u,d]}Yr(i,"createContext");const s=Yr(()=>{const r=n.map(a=>b.createContext(a));return Yr(function(l){const c=(l==null?void 0:l[e])||r;return b.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return s.scopeName=e,[i,iz(s,...t)]}Yr(dc,"createContextScope");function iz(...e){const t=e[0];if(e.length===1)return t;const n=Yr(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Yr(function(r){const a=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Yr(iz,"composeContextScopes");var sAe=Object.defineProperty,hs=(e,t)=>sAe(e,"name",{value:t,configurable:!0});function sz(e){const t=e+"CollectionProvider",[n,i]=dc(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=hs(g=>{const{scope:v,children:y}=g,x=b.useRef(null),E=b.useRef(new Map).current;return o.jsx(s,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Lf(l),u=b.forwardRef((g,v)=>{const{scope:y,children:x}=g,E=r(l,y),w=ur(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Lf(d),p=b.forwardRef((g,v)=>{const{scope:y,children:x,...E}=g,w=b.useRef(null),N=ur(v,w),_=r(d,y);return b.useEffect(()=>(_.itemMap.set(w,{ref:w,...E}),()=>void _.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:N,children:x})});p.displayName=d;function m(g){const v=r(e+"CollectionConsumer",g);return b.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 hs(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,i]}hs(sz,"createCollection");var _D=new WeakMap,Vi,br,Tw=(br=class extends Map{constructor(n){super(n);lC(this,Vi);_E(this,Vi,[...super.keys()]),_D.set(this,!0)}set(n,i){return _D.get(this)&&(this.has(n)?Rs(this,Vi)[Rs(this,Vi).indexOf(n)]=n:Rs(this,Vi).push(n)),super.set(n,i),this}insert(n,i,s){const r=this.has(i),a=Rs(this,Vi).length,l=d2(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(i,s),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...Rs(this,Vi)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,i){const s=this.indexOf(n);if(s===-1)return;let r=s+i;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return r;s++}}findIndex(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return s;s++}return-1}filter(n,i){const s=[];let r=0;for(const a of this)Reflect.apply(n,i,[a,r,this])&&s.push(a),r++;return new br(s)}map(n,i){const s=[];let r=0;for(const a of this)s.push([a[0],Reflect.apply(n,i,[a,r,this])]),r++;return new br(s)}reduce(...n){const[i,s]=n;let r=0,a=s??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[i,s]=n;let r=s??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(i,this,[r,l,a,this])}return r}toSorted(n){const i=[...this.entries()].sort(n);return new br(i)}toReversed(){const n=new br;for(let i=this.size-1;i>=0;i--){const s=this.keyAt(i),r=this.get(s);n.set(s,r)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new br(i)}slice(n,i){const s=new br;let r=this.size-1;if(n===void 0)return s;n<0&&(n=n+this.size),i!==void 0&&i>0&&(r=i-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);s.set(l,c)}return s}every(n,i){let s=0;for(const r of this){if(!Reflect.apply(n,i,[r,s,this]))return!1;s++}return!0}some(n,i){let s=0;for(const r of this){if(Reflect.apply(n,i,[r,s,this]))return!0;s++}return!1}},Vi=new WeakMap,hs(br,"OrderedDict"),br);function Yb(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=rz(e,t);return n===-1?void 0:e[n]}hs(Yb,"at");function rz(e,t){const n=e.length,i=d2(t),s=i>=0?i:n+i;return s<0||s>=n?-1:s}hs(rz,"toSafeIndex");function d2(e){return e!==e||e===0?0:Math.trunc(e)}hs(d2,"toSafeInteger");function rAe(e){const t=e+"CollectionProvider",[n,i]=dc(t),[s,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Tw,setItemMap:hs(()=>{},"setItemMap")}),a=hs(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=hs(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=hs(E=>{const{scope:w,children:N,state:_}=E,T=b.useRef(null),[k,C]=b.useState(null),I=ur(T,C),[O,L]=_;return b.useEffect(()=>{if(!k)return;const G=lz(()=>{});return G.observe(k,{childList:!0,subtree:!0}),()=>{G.disconnect()}},[k]),o.jsx(s,{scope:w,itemMap:O,setItemMap:L,collectionRef:I,collectionRefObject:T,collectionElement:k,children:N})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Lf(u),f=b.forwardRef((E,w)=>{const{scope:N,children:_}=E,T=r(u,N),k=ur(w,T.collectionRef);return o.jsx(d,{ref:k,children:_})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Lf(h),g=b.forwardRef((E,w)=>{const{scope:N,children:_,...T}=E,k=b.useRef(null),[C,I]=b.useState(null),O=ur(w,k,I),L=r(h,N),{setItemMap:G}=L,D=b.useRef(T);az(D.current,T)||(D.current=T);const F=D.current;return b.useEffect(()=>{const A=F;return G(j=>C?j.has(C)?j.set(C,{...A,element:C}).toSorted(hN):(j.set(C,{...A,element:C}),j.toSorted(hN)):j),()=>{G(j=>!C||!j.has(C)?j:(j.delete(C),new Tw(j)))}},[C,F,G]),o.jsx(m,{[p]:"",ref:O,children:_})});g.displayName=h;function v(){return b.useState(new Tw)}hs(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return hs(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:g},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}hs(rAe,"createCollection");function az(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),i=Object.keys(t);if(n.length!==i.length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1;return!0}hs(az,"shallowEqual");function oz(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}hs(oz,"isElementPreceding");function hN(e,t){return!e[1].element||!t[1].element?0:oz(e[1].element,t[1].element)?-1:1}hs(hN,"sortByDocumentPosition");function lz(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}hs(lz,"getChildListObserver");var aAe=Object.defineProperty,hh=(e,t)=>aAe(e,"name",{value:t,configurable:!0}),cz=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ws(e,t,{checkForDefaultPrevented:n=!0}={}){return hh(function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}hh(Ws,"composeEventHandlers");function oAe(e){var t;if(!cz)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}hh(oAe,"getOwnerWindow");function pN(e){if(!cz)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}hh(pN,"getOwnerDocument");function uz(e,t=!1){const{activeElement:n}=pN(e);if(!(n!=null&&n.nodeName))return null;if(dz(n)&&n.contentDocument)return uz(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const s=pN(n).getElementById(i);if(s)return s}}return n}hh(uz,"getActiveElement");function dz(e){return e.tagName==="IFRAME"}hh(dz,"isFrame");var pu=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},lAe=Object.defineProperty,cAe=(e,t)=>lAe(e,"name",{value:t,configurable:!0}),SD=Bf[" useEffectEvent ".trim().toString()],ND=Bf[" useInsertionEffect ".trim().toString()];function fz(e){if(typeof SD=="function")return SD(e);const t=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ND=="function"?ND(()=>{t.current=e}):pu(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}cAe(fz,"useEffectEvent");var uAe=Object.defineProperty,Mg=(e,t)=>uAe(e,"name",{value:t,configurable:!0}),dAe=Bf[" useInsertionEffect ".trim().toString()]||pu;function Iu({prop:e,defaultProp:t,onChange:n=Mg(()=>{},"onChange"),caller:i}){const[s,r,a]=hz({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s,u=b.useCallback(d=>{var f;if(l){const h=pz(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Mg(Iu,"useControllableState");function hz({defaultProp:e,onChange:t}){const[n,i]=b.useState(e),s=b.useRef(n),r=b.useRef(t);return dAe(()=>{r.current=t},[t]),b.useEffect(()=>{var a;s.current!==n&&((a=r.current)==null||a.call(r,n),s.current=n)},[n,s]),[n,i,r]}Mg(hz,"useUncontrolledState");function pz(e){return typeof e=="function"}Mg(pz,"isFunction");var TD=Symbol("RADIX:SYNC_STATE");function fAe(e,t,n,i){const{prop:s,defaultProp:r,onChange:a,caller:l}=t,c=s!==void 0,u=fz(a),d=[{...n,state:r}];i&&d.push(i);const[f,h]=b.useReducer((v,y)=>{if(y.type===TD)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=b.useRef(p);b.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const g=b.useMemo(()=>s!==void 0?{...f,state:s}:f,[f,s]);return b.useEffect(()=>{c&&!Object.is(s,f.state)&&h({type:TD,state:s})},[s,f.state,c]),[g,h]}Mg(fAe,"useControllableStateReducer");var hAe=Object.defineProperty,Xo=(e,t)=>hAe(e,"name",{value:t,configurable:!0});function mz(e,t){return b.useReducer((n,i)=>t[n][i]??n,e)}Xo(mz,"useStateMachine");var gz=Xo(e=>{const{present:t,children:n}=e,i=bz(t),s=typeof n=="function"?n({present:i.isPresent}):b.Children.only(n),r=yz(i.ref,xz(s));return typeof n=="function"||i.isPresent?b.cloneElement(s,{ref:r}):null},"Presence");function bz(e){const[t,n]=b.useState(),i=b.useRef(null),s=b.useRef(e),r=b.useRef("none"),a=b.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=mz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{c==="mounted"?(r.current=a.current??ud(i.current),a.current=void 0):r.current="none"},[c]),pu(()=>{const d=i.current,f=s.current;if(f!==e){const p=r.current,m=ud(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"),s.current=e}},[e,u]),pu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Xo(m=>{const v=ud(i.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Xo(m=>{m.target===t&&(r.current=ud(i.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:b.useCallback(d=>{if(d){const f=getComputedStyle(d);i.current=f,a.current=ud(f)}else i.current=null;n(d)},[])}}Xo(bz,"usePresence");function mN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Xo(mN,"setRef");function yz(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const i=t.current;let s=!1;const r=i.map(a=>{const l=mN(a,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let a=0;apAe(e,"name",{value:t,configurable:!0}),gAe=Bf[" useId ".trim().toString()]||(()=>{}),bAe=0;function Ez(e){const[t,n]=b.useState(gAe());return pu(()=>{e||n(i=>i??String(bAe++))},[e]),e||(t?`radix-${t}`:"")}mAe(Ez,"useId");var yAe=Object.defineProperty,xAe=(e,t)=>yAe(e,"name",{value:t,configurable:!0}),EAe=b.createContext(void 0);function Yx(e){const t=b.useContext(EAe);return e||t||"ltr"}xAe(Yx,"useDirection");var vAe=Object.defineProperty,wAe=(e,t)=>vAe(e,"name",{value:t,configurable:!0});function vz(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}wAe(vz,"useCallbackRef");var _Ae=Object.defineProperty,SAe=(e,t)=>_Ae(e,"name",{value:t,configurable:!0});function f2(e){const[t,n]=b.useState(void 0);return pu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const r=s[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 i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}SAe(f2,"useSize");var NAe=Object.defineProperty,Qo=(e,t)=>NAe(e,"name",{value:t,configurable:!0}),h2="Checkbox",[TAe,nOe]=dc(h2),[kAe,p2]=TAe(h2);function wz(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:s,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Iu({prop:n,defaultProp:s??!1,onChange:c,caller:h2}),[m,g]=b.useState(null),[v,y]=b.useState(null),x=b.useRef(!1),[E,w]=b.useReducer(T=>T+1,0),N=m?!!a||!!m.closest("form"):!0,_={checked:h,disabled:r,setChecked:p,control:m,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:Fo(s)?!1:s,isFormControl:N,bubbleInput:v,setBubbleInput:y};return o.jsx(kAe,{scope:t,..._,children:_z(f)?f(_):i})}Qo(wz,"CheckboxProvider");var AAe="CheckboxTrigger",CAe=b.forwardRef(Qo(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...s},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:g,bubbleInput:v}=p2(AAe,t),y=ur(r,f),x=b.useRef(u);return b.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=Qo(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(ea.button,{type:"button",role:"checkbox","aria-checked":Fo(u)?"mixed":u,"aria-required":d,"data-state":m2(u),"data-disabled":c?"":void 0,disabled:c,value:l,...s,ref:y,onKeyDown:Ws(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Ws(i,E=>{m(),h(w=>Fo(w)?!0:!w),v&&g&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),IAe=b.forwardRef(Qo(function(t,n){const{__scopeCheckbox:i,name:s,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(wz,{__scopeCheckbox:i,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:s,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(CAe,{...h,ref:n,__scopeCheckbox:i}),p&&o.jsx(MAe,{__scopeCheckbox:i})]})})},"Checkbox")),RAe="CheckboxIndicator",jAe=b.forwardRef(Qo(function(t,n){const{__scopeCheckbox:i,forceMount:s,...r}=t,a=p2(RAe,i);return o.jsx(gz,{present:s||Fo(a.checked)||a.checked===!0,children:o.jsx(ea.span,{"data-state":m2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),OAe="CheckboxBubbleInput",MAe=b.forwardRef(Qo(function({__scopeCheckbox:t,onClick:n,...i},s){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:g,setBubbleInput:v}=p2(OAe,t),y=ur(s,v),x=f2(r),E=b.useRef(!1),w=b.useRef(c),N=b.useRef(l);b.useEffect(()=>{const T=g;if(!T)return;const k=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(k,"checked").set,O=l!==N.current;N.current=l;const L=w.current!==c;w.current=c;const G=!(O&&a.current);if(L&&I){E.current=!O;const D=new Event("click",{bubbles:G});T.indeterminate=Fo(c),I.call(T,Fo(c)?!1:c),T.dispatchEvent(D),E.current=!1}},[g,c,a,l]);const _=b.useRef(Fo(c)?!1:c);return o.jsx(ea.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??_.current,required:d,disabled:f,name:h,value:p,form:m,...i,tabIndex:-1,ref:y,onClick:Ws(n,T=>{E.current&&T.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function _z(e){return typeof e=="function"}Qo(_z,"isFunction");function Fo(e){return e==="indeterminate"}Qo(Fo,"isIndeterminate");function m2(e){return Fo(e)?"indeterminate":e?"checked":"unchecked"}Qo(m2,"getState");var LAe=Object.defineProperty,g2=(e,t)=>LAe(e,"name",{value:t,configurable:!0}),kw=!1;function Sz(){const[e,t]=b.useState(kw);return b.useEffect(()=>{kw||(kw=!0,t(!0))},[]),e}g2(Sz,"useIsHydrated");var Nz=Bf[" useSyncExternalStore ".trim().toString()];function Tz(){return()=>{}}g2(Tz,"subscribe");function kz(){return Nz(Tz,()=>!0,()=>!1)}g2(kz,"useIsHydratedModern");var DAe=typeof Nz=="function"?kz:Sz,PAe=Object.defineProperty,Ru=(e,t)=>PAe(e,"name",{value:t,configurable:!0}),Aw="rovingFocusGroup.onEntryFocus",BAe={bubbles:!1,cancelable:!0},Wx="RovingFocusGroup",[gN,Az,UAe]=sz(Wx),[FAe,Xx]=dc(Wx,[UAe]),[$Ae,HAe]=FAe(Wx),zAe=b.forwardRef(Ru(function(t,n){return o.jsx(gN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(gN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(VAe,{...t,ref:n})})})},"RovingFocusGroup")),VAe=b.forwardRef(Ru(function(t,n){const{__scopeRovingFocusGroup:i,orientation:s,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=b.useRef(null),m=ur(n,p),g=Yx(a),[v,y]=Iu({prop:l,defaultProp:c??null,onChange:u,caller:Wx}),[x,E]=b.useState(!1),w=vz(d),N=Az(i),_=b.useRef(!1),[T,k]=b.useState(0);return b.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(Aw,w),()=>C.removeEventListener(Aw,w)},[w]),o.jsx($Ae,{scope:i,orientation:s,dir:g,loop:r,currentTabStopId:v,onItemFocus:b.useCallback(C=>y(C),[y]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:b.useCallback(()=>k(C=>C-1),[]),children:o.jsx(ea.div,{tabIndex:x||T===0?-1:0,"data-orientation":s,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:Ws(t.onMouseDown,()=>{_.current=!0}),onFocus:Ws(t.onFocus,C=>{const I=!_.current;if(C.target===C.currentTarget&&I&&!x){const O=new CustomEvent(Aw,BAe);if(C.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=N().filter(j=>j.focusable),G=L.find(j=>j.active),D=L.find(j=>j.id===v),A=[G,D,...L].filter(Boolean).map(j=>j.ref.current);b2(A,f)}}_.current=!1}),onBlur:Ws(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),GAe="RovingFocusGroupItem",KAe=b.forwardRef(Ru(function(t,n){const{__scopeRovingFocusGroup:i,focusable:s=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=Ez(),d=a||u,f=HAe(GAe,i),h=f.currentTabStopId===d,p=Az(i),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=f,y=DAe();return pu(()=>{if(!(!y||!s))return m(),()=>g()},[y,s,m,g]),b.useEffect(()=>{if(!(y||!s))return m(),()=>g()},[y,s,m,g]),o.jsx(gN.ItemSlot,{scope:i,id:d,focusable:s,active:r,children:o.jsx(ea.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:Ws(t.onMouseDown,x=>{s?f.onItemFocus(d):x.preventDefault()}),onFocus:Ws(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ws(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=Iz(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let N=p().filter(_=>_.focusable).map(_=>_.ref.current);if(E==="last")N.reverse();else if(E==="prev"||E==="next"){E==="prev"&&N.reverse();const _=N.indexOf(x.currentTarget);N=f.loop?Rz(N,_+1):N.slice(_+1)}setTimeout(()=>b2(N))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),qAe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Ru(Cz,"getDirectionAwareKey");function Iz(e,t,n){const i=Cz(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return qAe[i]}Ru(Iz,"getFocusIntent");function b2(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Ru(b2,"focusFirst");function Rz(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Ru(Rz,"wrapArray");var jz=zAe,Oz=KAe,YAe=Object.defineProperty,Ds=(e,t)=>YAe(e,"name",{value:t,configurable:!0}),Mz="Radio",[WAe,Lz]=dc(Mz),[XAe,Qx]=WAe(Mz);function Dz(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:s,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=b.useState(null),[p,m]=b.useState(null),g=b.useRef(!1),[v,y]=b.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:s,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:g,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Ds(()=>l==null?void 0:l(),"onCheck")};return o.jsx(XAe,{scope:t,...E,children:Pz(d)?d(E):i})}Ds(Dz,"RadioProvider");var QAe="RadioTrigger",ZAe=b.forwardRef(Ds(function({__scopeRadio:t,onClick:n,...i},s){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=Qx(QAe,t),m=ur(s,c);return o.jsx(ea.button,{type:"button",role:"radio","aria-checked":r,"data-state":y2(r),"data-disabled":a?"":void 0,disabled:a,value:l,...i,ref:m,onClick:Ws(n,g=>{r||(f(),u()),p&&h&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"RadioTrigger")),JAe="RadioIndicator",e2e=b.forwardRef(Ds(function(t,n){const{__scopeRadio:i,forceMount:s,...r}=t,a=Qx(JAe,i);return o.jsx(gz,{present:s||a.checked,children:o.jsx(ea.span,{"data-state":y2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),t2e="RadioBubbleInput",n2e=b.forwardRef(Ds(function({__scopeRadio:t,onClick:n,...i},s){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:g}=Qx(t2e,t),v=ur(s,p),y=f2(r),x=b.useRef(!1),E=b.useRef(a),w=b.useRef(g);b.useEffect(()=>{const _=h;if(!_)return;const T=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(T,"checked").set,I=g!==w.current;w.current=g;const O=E.current!==a;E.current=a;const L=!(I&&m.current);if(O&&C){x.current=!I;const G=new Event("click",{bubbles:L});C.call(_,a),_.dispatchEvent(G),x.current=!1}},[h,a,m,g]);const N=b.useRef(a);return o.jsx(ea.input,{type:"radio","aria-hidden":!0,defaultChecked:N.current,required:l,disabled:c,name:u,value:d,form:f,...i,tabIndex:-1,ref:v,onClick:Ws(n,_=>{x.current&&_.stopPropagation()}),style:{...i.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function Pz(e){return typeof e=="function"}Ds(Pz,"isFunction");function y2(e){return e?"checked":"unchecked"}Ds(y2,"getState");var i2e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],x2="RadioGroup",[s2e,iOe]=dc(x2,[Xx,Lz]),Bz=Xx(),Zx=Lz(),[r2e,a2e]=s2e(x2),o2e=b.forwardRef(Ds(function(t,n){const{__scopeRadioGroup:i,name:s,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,g=Bz(i),v=Yx(f),[y,x]=Iu({prop:l,defaultProp:a??null,onChange:p,caller:x2}),[E,w]=b.useState(null),N=ur(n,w),_=b.useRef(y);return b.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=Ds(()=>x(_.current),"reset");return T.addEventListener("reset",k),()=>T.removeEventListener("reset",k)}},[E,r,x]),o.jsx(r2e,{scope:i,name:s,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(jz,{asChild:!0,...g,orientation:d,dir:v,loop:h,children:o.jsx(ea.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:N})})})},"RadioGroup")),l2e="RadioGroupItemProvider",c2e="RadioGroupItemTrigger";function Uz(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:s,internal_do_not_use_render:r}=e,a=a2e(l2e,t),l=Zx(t),c=a.disabled||i;return o.jsx(Dz,{...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:s})}Ds(Uz,"RadioGroupItemProvider");var u2e=b.forwardRef(Ds(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Bz(i),a=Zx(i),{checked:l,disabled:c}=Qx(c2e,a.__scopeRadio),u=b.useRef(null),d=ur(n,u),f=b.useRef(!1);return b.useEffect(()=>{const h=Ds(m=>{i2e.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Ds(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(Oz,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(ZAe,{...a,...s,ref:d,onKeyDown:Ws(s.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Ws(s.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),d2e=b.forwardRef(Ds(function(t,n){const{__scopeRadioGroup:i,value:s,disabled:r,...a}=t;return o.jsx(Uz,{__scopeRadioGroup:i,value:s,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(u2e,{...a,ref:n,__scopeRadioGroup:i}),l&&o.jsx(f2e,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),f2e=b.forwardRef(Ds(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Zx(i);return o.jsx(n2e,{...r,...s,ref:n})},"RadioGroupItemBubbleInput")),h2e=b.forwardRef(Ds(function(t,n){const{__scopeRadioGroup:i,...s}=t,r=Zx(i);return o.jsx(e2e,{...r,...s,ref:n})},"RadioGroupIndicator")),p2e=Object.defineProperty,m2e=(e,t)=>p2e(e,"name",{value:t,configurable:!0}),g2e="Toggle",b2e=b.forwardRef(m2e(function(t,n){const{pressed:i,defaultPressed:s,onPressedChange:r,...a}=t,[l,c]=Iu({prop:i,onChange:r,defaultProp:s??!1,caller:g2e});return o.jsx(ea.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:Ws(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),y2e=Object.defineProperty,sc=(e,t)=>y2e(e,"name",{value:t,configurable:!0}),ph="ToggleGroup",[Fz,sOe]=dc(ph,[Xx]),$z=Xx(),x2e=b.forwardRef(sc(function(t,n){const{type:i,...s}=t;if(i==="single"){const r=s;return o.jsx(E2e,{role:"radiogroup",...r,ref:n})}if(i==="multiple"){const r=s;return o.jsx(v2e,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${ph}\``)},"ToggleGroup")),[Hz,zz]=Fz(ph),E2e=b.forwardRef(sc(function(t,n){const{value:i,defaultValue:s,onValueChange:r=sc(()=>{},"onValueChange"),...a}=t,[l,c]=Iu({prop:i,defaultProp:s??"",onChange:r,caller:ph});return o.jsx(Hz,{scope:t.__scopeToggleGroup,type:"single",value:b.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:b.useCallback(()=>c(""),[c]),children:o.jsx(Vz,{...a,ref:n})})},"ToggleGroupImplSingle")),v2e=b.forwardRef(sc(function(t,n){const{value:i,defaultValue:s,onValueChange:r=sc(()=>{},"onValueChange"),...a}=t,[l,c]=Iu({prop:i,defaultProp:s??[],onChange:r,caller:ph}),u=b.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=b.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(Hz,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Vz,{...a,ref:n})})},"ToggleGroupImplMultiple")),[w2e,_2e]=Fz(ph),Vz=b.forwardRef(sc(function(t,n){const{__scopeToggleGroup:i,disabled:s=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=$z(i),f=Yx(l),h={dir:f,...u};return o.jsx(w2e,{scope:i,rovingFocus:r,disabled:s,children:r?o.jsx(jz,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(ea.div,{...h,ref:n})}):o.jsx(ea.div,{...h,ref:n})})},"ToggleGroupImpl")),bN="ToggleGroupItem",S2e=b.forwardRef(sc(function(t,n){const i=zz(bN,t.__scopeToggleGroup),s=_2e(bN,t.__scopeToggleGroup),r=$z(t.__scopeToggleGroup),a=i.value.includes(t.value),l=s.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=b.useRef(null);return s.rovingFocus?o.jsx(Oz,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(kD,{...c,ref:n})}):o.jsx(kD,{...c,ref:n})},"ToggleGroupItem")),kD=b.forwardRef(sc(function(t,n){const{__scopeToggleGroup:i,value:s,...r}=t,a=zz(bN,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(b2e,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(s):a.onItemDeactivate(s)}})},"ToggleGroupItemImpl"));const N2e="_Container_1tuad_1",T2e="_Checkbox_1tuad_22",k2e="_CheckMark_1tuad_92",A2e="_Label_1tuad_162",nb={Container:N2e,Checkbox:T2e,CheckMark:k2e,Label:A2e},Gz=({className:e,label:t,id:n,disabled:i,orientation:s="left",...r})=>{const a=b.useId(),l=n??a;return o.jsxs("div",{"data-disabled":i?"":void 0,"data-has-label":t?"":void 0,"data-orientation":s,className:na(e,nb.Container),children:[o.jsx(IAe,{className:nb.Checkbox,id:l,disabled:i,...r,children:o.jsx(jAe,{className:nb.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:nb.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},C2e="_RadioGroup_onrfm_1",I2e="_RadioLabel_onrfm_9",R2e="_RadioIndicatorWrapper_onrfm_26",j2e="_RadioItem_onrfm_43",O2e="_RadioIndicator_onrfm_26",mp={RadioGroup:C2e,RadioLabel:I2e,RadioIndicatorWrapper:R2e,RadioItem:j2e,RadioIndicator:O2e},Kz=b.createContext(null),M2e=()=>{const e=b.use(Kz);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},yN=({onChange:e,children:t,className:n,direction:i="row",disabled:s=!1,...r})=>{const a=b.useMemo(()=>({disabled:s,direction:i}),[s,i]);return o.jsx(Kz,{value:a,children:o.jsx(o2e,{className:na(mp.RadioGroup,n),"data-direction":i,onValueChange:e,disabled:s,...r,children:t})})},L2e=({value:e,disabled:t=!1,required:n,children:i,className:s,block:r=!1,...a})=>{const{disabled:l}=M2e(),c=l||t,u=b.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:na(mp.RadioLabel,s),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:mp.RadioIndicatorWrapper,children:o.jsx(d2e,{id:d,value:e,disabled:c,required:n,className:mp.RadioItem,children:o.jsx(h2e,{className:mp.RadioIndicator})})}),i]})})};yN.Item=L2e;function D2e({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 dd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:D2e},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:RJ},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:eee},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:xk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:X1}},P2e=[dd.llm,dd.sequential,dd.parallel,dd.loop,dd.a2a];function qz(e){return dd[e??"llm"]}const Yz=e=>e==="sequential"||e==="parallel"||e==="loop",Jx=e=>e==="a2a";function rc(e){return e.trimEnd().replace(/[。.]+$/,"")}function g1(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(i=>i==null?void 0:i.toLocaleLowerCase().includes(n)):!0}function vc(e,t){return e[t]|e[t+1]<<8}function td(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function B2e(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 Wz(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(td(e,u)===101010256){i=u;break}if(i<0)throw new Error("无效的 zip:找不到 EOCD");const s=vc(e,i+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=td(e,i+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=vc(e,v+26),E=vc(e,v+28),w=v+30+x+E,N=e.subarray(w,w+f);let _;if(d===0)_=N;else if(d===8)_=await B2e(N);else{r+=46+p+m+g;continue}l.push({name:y,text:a.decode(_)}),r+=46+p+m+g}return l}const U2e="/skillhub/v1/skills";async function F2e(e,t="public"){const n=e.trim(),i=`${U2e}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(i,{headers:{accept:"application/json"},signal:On(void 0,Yf)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var l;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((l=a.Metadata)==null?void 0:l.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function $2e({selected:e,onChange:t}){const[n,i]=b.useState(""),[s,r]=b.useState([]),[a,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(!1),h=g=>e.some(v=>v.source==="skillhub"&&v.slug===g),p=g=>{g.slug&&(h(g.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.slug===g.slug))):t([...e,{source:"skillhub",slug:g.slug,name:g.name,folder:g.slug.split("/").pop()||g.name,namespace:g.namespace||"public",description:g.description}]))},m=async g=>{l(!0),u(null),f(!0);try{const v=await F2e(g);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return b.useEffect(()=>{const g=n.trim();if(!g){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(g),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(Ly,{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:g=>i(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.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(mn,{className:"cw-i cw-spin"}):o.jsx(Ly,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(wu,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&s.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在搜索…"]}):s.length>0?o.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const v=h(g.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(g),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(Aa,{className:"cw-i cw-i-sm"}):o.jsx(Ns,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:g.name}),g.description&&o.jsx("span",{className:"cw-skill-result-desc",children:rc(g.description)}),g.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:g.sourceRepo})]})]},g.id||g.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const xN=/(^|\/)skill\.md$/i;function H2e(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let s=1;s=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function m2e(...e){var t;for(const n of e){const i=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(i)return i.slice(0,64)}return"local-skill"}function g2e(e,t){return t.trim()||e}function Pz(e){const t=e.map(i=>({path:i.path.replace(/\\/g,"/").replace(/^\.\//,""),text:i.text})).filter(i=>i.path.length>0&&!i.path.endsWith("/")),n=new Set(t.map(i=>i.path.split("/")[0]));if(n.size===1&&t.every(i=>i.path.includes("/"))){const i=[...n][0]+"/";return t.map(s=>({path:s.path.slice(i.length),text:s.text}))}return t}function b2e(e){const t=new Map,n=new Set;for(const i of e)if(dN.test("/"+i.path)){const s=i.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const i of e){const s=i.path.split("/");let r="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=dN.test("/"+i.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?i.path.slice(r.length+1):i.path,c=t.get(r)||[];c.push({path:l,text:i.text}),t.set(r,c)}return t}function y2e(e,t,n){const i=`${n}${e?"/"+e:""}`,s=t.find(c=>dN.test("/"+c.path));if(!s)return{hit:null,error:`${i} 缺少 SKILL.md`};const r=h2e(s.text),a=m2e(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${i} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${i} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:g2e(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function x2e(e){const t=new Uint8Array(await e.arrayBuffer()),i=(await Dz(t)).map(s=>({path:s.name,text:s.text}));return Bz(Pz(i),e.name)}async function E2e(e,t=new Map){const n=[];for(let i=0;ie.file(t,n))}async function w2e(e){const t=e.createReader(),n=[];for(;;){const i=await new Promise((s,r)=>t.readEntries(s,r));if(i.length===0)return n;n.push(...i)}}async function Uz(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await v2e(e),path:n}];if(!e.isDirectory)return[];const i=await w2e(e);return(await Promise.all(i.map(s=>Uz(s,n)))).flat()}function _2e({selected:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState([]),[a,l]=b.useState(!1),[c,u]=b.useState(!1),d=b.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=b.useRef([]),m=b.useRef(e);b.useEffect(()=>{p.current=s},[s]),b.useEffect(()=>{m.current=e},[e]);const g=E=>{const w=new Set([...p.current.map(k=>k.folder||k.name),...m.current.filter(k=>k.source==="local").map(k=>k.folder)]),N=[],_=[];for(const k of E.hits){const C=k.folder||k.name;if(w.has(C)){N.push(k.name);continue}w.add(C),_.push(k)}r(k=>[...k,..._]);const T=[...E.errors];if(N.length>0&&T.push(`已跳过重复技能:${N.join("、")}`),i(T),_.length===1&&E.errors.length===0&&N.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(N=>{var _;return(_=N.webkitGetAsEntry)==null?void 0:_.call(N)}).filter(N=>N!==null);if(w.length===0){i(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const N=(await Promise.all(w.map(k=>Uz(k)))).flat(),_=w.some(k=>k.isDirectory);if(!_&&N.length===1&&N[0].file.name.toLowerCase().endsWith(".zip")){g(await x2e(N[0].file));return}if(!_){i(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const T=new Map(N.map(({file:k,path:C})=>[k,C]));g(await E2e(N.map(({file:k})=>k),T))}catch(N){i([`读取失败:${N instanceof Error?N.message:String(N)}`])}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(ck,{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(Eu,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),s.length>0&&o.jsx("div",{className:"cw-skill-results",children:s.map(E=>{var N;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(ka,{className:"cw-i cw-i-sm"}):o.jsx(ws,{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:ic(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((N=E.localFiles)==null?void 0:N.length)??0," 个文件"]})]})]},E.id)})})]})}function S2e(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function N2e({selected:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState([]),[a,l]=b.useState(""),[c,u]=b.useState(!0),[d,f]=b.useState(!1),[h,p]=b.useState(null);b.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const x=await uU();y||(i(x),x.length>0&&l(x[0].id))}catch(x){y||p(x instanceof Error?x.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),b.useEffect(()=>{if(!a){r([]);return}const y=n.find(E=>E.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const E=await dU(a,y==null?void 0:y.region);x||r(E)}catch(E){x||p(E instanceof Error?E.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(y=>y.id===a),g=(y,x)=>e.some(E=>E.source==="skillspace"&&E.skillId===y&&(E.version||"")===x),v=y=>{if(m)if(g(y.skillId,y.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===y.skillId&&(x.version||"")===y.version)));else{const x=gde(m,y);t([...e,{source:"skillspace",folder:x.folder||y.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return o.jsx("div",{className:"cw-skillspace",children:c?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?o.jsxs("div",{className:"cw-banner",children:[o.jsx(Eu,{className:"cw-i"}),o.jsx("span",{children:h})]}):n.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:a,onChange:y=>l(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>o.jsxs("option",{value:y.id,children:[y.name||y.id,y.description?` — ${ic(y.description)}`:""]},y.id))}),m&&o.jsxs(o.Fragment,{children:[m.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:m.region,children:S2e(m.region)}),o.jsx("a",{href:bde(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(mm,{className:"cw-i cw-i-sm"})})]})]}),d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const x=g(y.skillId,y.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>v(y),"aria-pressed":x,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?o.jsx(ka,{className:"cw-i cw-i-sm"}):o.jsx(ws,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:ic(y.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(oJ,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function T2e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Cn(void 0,Gf)});if(t.status===409)throw new Error("服务端未配置 Volcengine 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 k2e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await T2e(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function A2e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Cn(void 0,Gf)});if(t.status===409)throw new Error("服务端未配置 Volcengine 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 C2e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await A2e(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const yD=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function ww(e){let t=0;for(let n=0;n>>0;return yD[t%yD.length]}function I2e(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,i=[];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):i.push(u);const s=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>r(f,d+1))}),a=i.sort(s).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 R2e(e,t){const n=[],i=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(i)};return e.forEach(i),n}function xD(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const j2e=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function ED(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const i=String(n);return{key:j2e(t),value:i,long:i.length>80||i.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function Fz({appName:e,testRunId:t,sessionId:n,onClose:i,title:s="调用链路观测"}){const[r,a]=b.useState(null),[l,c]=b.useState(""),[u,d]=b.useState(new Set),[f,h]=b.useState(null);b.useEffect(()=>{a(null),c("");let w;if(t)w=DB(t,n);else if(e)w=fB(e,n);else{c("缺少调用链路来源");return}w.then(N=>{a(N),h(N.length?N.reduce((_,T)=>_.start_time<=T.start_time?_:T).span_id:null)}).catch(N=>c(String(N)))},[e,n,t]);const{rootNodes:p,min:m,total:g}=b.useMemo(()=>I2e(r??[]),[r]),v=b.useMemo(()=>R2e(p,u),[p,u]),y=(r==null?void 0:r.find(w=>w.span_id===f))??null,x=g/1e6,E=w=>d(N=>{const _=new Set(N);return _.has(w)?_.delete(w):_.add(w),_});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:s}),o.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${x.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(Ns,{className:"icon"})})]}),r==null&&!l&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载调用链路…"]}),l&&o.jsx("div",{className:"error",children:l}),r&&r.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),v.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:v.map(w=>{const N=w.span,_=(N.start_time-m)/g*100,T=Math.max((N.end_time-N.start_time)/g*100,.6),k=w.children.length>0;return o.jsxs("button",{className:`trace-row ${f===N.span_id?"active":""}`,onClick:()=>h(N.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:w.depth*14},children:[o.jsx("span",{className:`trace-caret ${k?"":"hidden"} ${u.has(N.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),k&&E(N.span_id)},children:o.jsx(ec,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:ww(N.name)}}),o.jsx("span",{className:"trace-name",title:N.name,children:N.name})]}),o.jsx("span",{className:"trace-dur",children:xD(N.end_time-N.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${T}%`,background:ww(N.name)}})})]},N.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:y?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:y.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:ww(y.name)}}),xD(y.end_time-y.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:ED(y).filter(w=>!w.long).map(w=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:w.key}),o.jsx("span",{className:"td-val",children:w.value})]},w.key))}),ED(y).filter(w=>w.long).map(w=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:w.key}),o.jsx("pre",{className:"td-pre",children:w.value})]},w.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const O2e=b.lazy(()=>Zd(()=>import("./MarkdownPromptEditor-DyNPLGxa.js"),__vite__mapDeps([0,1]))),fN="veadk.generatedAgentTestRuns",vD=4;function f2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(fN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function $z(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(fN,JSON.stringify(t)):window.sessionStorage.removeItem(fN)}catch{}}function M2e(e){$z([...f2(),e])}function Kh(e){$z(f2().filter(t=>t!==e))}function L2e(e,t,n="text/plain"){const i=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(i)}const D2e=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:FJ,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:Eu,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:cJ},{id:"tools",label:"工具",hint:"可调用的能力",icon:$P},{id:"skills",label:"技能",hint:"声明式技能",icon:iu},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:vb},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:BP},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:iJ},{id:"review",label:"完成",hint:"预览并创建",icon:PJ}];function P2e({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 wD({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 Hz({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 zz({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 B2e={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},_D={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},Vz="REGISTRY_SPACE_ID",U2e=lU.filter(e=>e.key!==Vz);function Gz(e,t){var i,s,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((i=e.registryTopK)==null?void 0:i.trim())||va.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||va.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||va.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function F2e({items:e,selected:t,onToggle:n,scrollRows:i}){return o.jsx("div",{className:`cw-checklist ${i?"cw-checklist-tools":""}`,style:i?{"--cw-checklist-max-height":`${i*40+(i-1)*8}px`}:void 0,children:e.map(s=>{const r=t.includes(s.id);return o.jsx(jz,{id:`cw-check-${s.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(s.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:s.label})})},s.id)})})}function _w({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(i=>{var r;const s=(t??((r=e[0])==null?void 0:r.id))===i.id;return o.jsx("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(i.id),"aria-pressed":s,children:o.jsx("span",{className:"cw-seg-title",children:i.label})},i.id)})})}function $2e(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function qh({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(i=>{const s=t[i.key]??i.defaultValue??"",r=t2(i,t),a=`cw-env-${i.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:[i.comment||i.key,i.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),i.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":i.help,"aria-label":`${i.comment||i.key}说明:${i.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:i.help})]}),i.link&&o.jsx("a",{className:"cw-env-link",href:i.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${i.link.label}`,"aria-label":`打开 OpenViking ${i.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(mm,{"aria-hidden":"true"})})]}),i.comment&&o.jsx("code",{title:i.key,children:i.key})]}),i.multiline||i.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:s,placeholder:i.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(i.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:$2e(i.key)?"password":"text",value:s,placeholder:i.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(i.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},i.key)})})}function Sw(e){return e.name.trim()||"未命名智能体中心"}function Nw(e){return e.name.trim()||e.id||"未命名知识库"}function H2e({value:e,region:t,invalid:n,onChange:i}){const s=t.trim()||va.region,[r,a]=b.useState([]),[l,c]=b.useState(!1),[u,d]=b.useState(null),[f,h]=b.useState(0),[p,m]=b.useState(!1),[g,v]=b.useState(""),y=b.useRef(null);b.useEffect(()=>{let C=!1;return c(!0),d(null),k2e({region:s}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[s,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?Sw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",N=l&&r.length===0,_=b.useMemo(()=>r.filter(C=>c1(g,[Sw(C),C.id,C.projectName])),[g,r]),T=!!(e&&!x&&c1(g,["已选择的智能体中心",e]));b.useEffect(()=>{if(!p)return;const C=O=>{const M=O.target;M instanceof Node&&y.current&&!y.current.contains(M)&&m(!1)},I=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const k=C=>{i(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",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:N,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(Hz,{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:g,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.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(C=>{const I=Sw(C),O=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":O,className:`cw-a2a-space-option ${O?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>k(C.id),children:I},C.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(C=>C+1),children:l?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(zz,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(Eu,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(mn,{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 z2e({value:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState(!1),[a,l]=b.useState(null),[c,u]=b.useState(0),[d,f]=b.useState(!1),[h,p]=b.useState(""),m=b.useRef(null);b.useEffect(()=>{let _=!1;return r(!0),l(null),C2e().then(T=>{_||i(T)}).catch(T=>{_||(i([]),l(T instanceof Error?T.message:"加载失败"))}).finally(()=>{_||r(!1)}),()=>{_=!0}},[c]);const g=!e||n.some(_=>_.id===e.trim()),v=n.find(_=>_.id===e.trim()),y=v?Nw(v):e&&!g?e:"请选择 VikingDB 知识库",x=s&&n.length===0,E=b.useMemo(()=>n.filter(_=>c1(h,[Nw(_),_.id,_.description,_.projectName])),[n,h]),w=!!(e&&!g&&c1(h,[e]));b.useEffect(()=>{if(!d)return;const _=k=>{const C=k.target;C instanceof Node&&m.current&&!m.current.contains(C)&&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 N=_=>{t(_),f(!1)};return s&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",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(Hz,{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:()=>N(e),children:e}),E.map(_=>{const T=Nw(_),k=_.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":k,className:`cw-a2a-space-option ${k?"is-selected":""}`,title:`${T} (${_.id})`,onClick:()=>N(_.id),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:s,onClick:()=>u(_=>_+1),children:s?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(zz,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(Eu,{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 V2e({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),i=r=>t(e.filter((a,l)=>l!==r)),s=()=>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(Co,{initial:!1,children:e.map((r,a)=>o.jsxs(Wn.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:()=>i(a),"aria-label":"移除 MCP 工具",children:o.jsx(tc,{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})}),o.jsx("input",{className:"cw-input",value:r.authToken??"",placeholder:"Bearer Token(可选)",onChange:l=>n(a,{authToken:l.target.value})})]}):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:s,children:[o.jsx(ws,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function Kz({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 G2e({s:e,onRemove:t}){let n=iu,i="火山 Find Skill 技能广场";return e.source==="local"?(n=ck,i="本地"):e.source==="skillspace"&&(n=Kz,i="AgentKit Skills 中心"),o.jsxs(Wn.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:[i,e.description?` · ${ic(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Ns,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Tw=[{id:"local",label:"本地文件",icon:ck},{id:"skillspace",label:"AgentKit Skills 中心",icon:Kz},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:z1}];function K2e({selected:e,onChange:t}){const[n,i]=b.useState("local"),[s,r]=b.useState(!1),a=Tw.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>kw(u)!==c));return b.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(ws,{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(Co,{initial:!1,children:e.map(c=>o.jsx(G2e,{s:c,onRemove:()=>l(kw(c))},kw(c)))})})]}),o.jsx(Co,{children:s&&o.jsx(Wn.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(Wn.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:()=>r(!1),children:o.jsx(Ns,{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) / ${Tw.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Tw.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>i(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx(f2e,{selected:e,onChange:t}),n==="local"&&o.jsx(_2e,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(N2e,{selected:e,onChange:t})]})]})]})})})]})}function kw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Z0({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(Wn.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function q2e(e,t){var i;let n=e;for(const s of t)if(n=(i=n.subAgents)==null?void 0:i[s],!n)return!1;return!0}function J0(e,t){let n=e;for(const i of t)n=n.subAgents[i];return n}function Ig(e,t,n){if(t.length===0)return n(e);const[i,...s]=t,r=e.subAgents.slice();return r[i]=Ig(r[i],s,n),{...e,subAgents:r}}function Y2e(e,t){return Ig(e,t,n=>({...n,subAgents:[...n.subAgents,Es()]}))}function W2e(e,t,n){return Ig(e,t,i=>{const s=i.subAgents.slice();return s.splice(n,0,Es()),{...i,subAgents:s}})}function X2e(e,t){if(t.length===0)return e;const n=t.slice(0,-1),i=t[t.length-1];return Ig(e,n,s=>({...s,subAgents:s.subAgents.filter((r,a)=>a!==i)}))}const hN=e=>!Kx(e.agentType),SD=3;function Q2e(e,t,n=!1){var s;if(Kx(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const i=Kl(e.name);return i||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":Lz(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function qz(e,t,n=[]){const i=[],s=Kx(e.agentType),r=Q2e(e,t,n.length===0);return r&&i.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",typeLabel:Mz(e.agentType).label,problem:r}),hN(e)&&e.subAgents.forEach((a,l)=>i.push(...qz(a,t,[...n,l]))),i}function Z2e(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function Yz(e){return 1+e.subAgents.reduce((t,n)=>t+Yz(n),0)}function Wz(e){const t=[],n={},i=r=>{var a,l,c,u;for(const d of r.builtinTools??[]){const f=wu.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=r.a2aRegistry)!=null&&a.enabled&&(t.push({env:lU}),Object.assign(n,Gz(r.a2aRegistry,{includeDefaults:!0}))),r.memory.shortTerm&&t.push({env:((l=SS.find(d=>d.id===(r.shortTermBackend??"local")))==null?void 0:l.env)??[]}),r.memory.longTerm&&t.push({env:((c=NS.find(d=>d.id===(r.longTermBackend??"local")))==null?void 0:c.env)??[]}),r.knowledgebase&&t.push({env:((u=TS.find(d=>d.id===(r.knowledgebaseBackend??cu)))==null?void 0:u.env)??[]}),r.tracing)for(const d of r.tracingExporters??[]){const f=cde.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}r.subAgents.forEach(i)};i(e);const s=OH(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function Xz(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function pN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const i of e.subAgents){const s=pN(i);if(s)return s}return""}function Qz(e){var i,s;const t=Wz(e),n={...((i=e.deployment)==null?void 0:i.envValues)??{},...t.fixedValues};return{...Xz(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(MH(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function J2e(e){return JSON.stringify(Qz(e))}function u1(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Dd(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function eCe({enabled:e,disabledReason:t,variants:n,draftSnapshot:i,input:s,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const g=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===u1(i,x)),v=n.some(x=>x.phase==="sending"),y=g.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(),N=x.description.trim(),_=x.instruction.trim(),T=Dd(x),k=!!(w&&N&&_&&n.findIndex(P=>Dd(P)===T)!==E),C=!w||!N||!_||k,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==u1(i,x)),O=x.phase==="starting",M=x.phase==="ready"&&!I,G=O||x.phase==="sending",D=M&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=G||x.configOpen||C,A=w?N?_?k?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",j=O?"正在启动":I?"应用配置并重启":M||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||G,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||G,onClick:()=>d(x.id),children:o.jsx(wD,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(l1,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):O?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?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:M?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:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(l1,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(DA,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(O$,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[M||I||x.phase==="error"?o.jsx(DJ,{className:"cw-i"}):o.jsx(P2e,{className:"cw-i cw-debug-run-icon"}),j]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:G||!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:G,onClick:()=>d(x.id),children:o.jsx(wD,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),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:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.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:Zz.map(P=>o.jsx(jz,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.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:s,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{PA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!s.trim(),onClick:a,children:v?o.jsx(mn,{className:"cw-i cw-spin"}):o.jsx(jP,{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(ws,{className:"cw-i"}),"添加对照组"]})]})]})}const eb=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],Zz=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function tCe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function nCe({mode:e,busy:t,onChange:n,assistant:i}){const s=eb.findIndex(l=>l.id===e),r=eb[s-1],a=eb[s+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${i?" 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"}),i?o.jsx("div",{className:"cw-workspace-ai-slot",children:i}):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:eb.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 iCe({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:i,features:s,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var oo,is,Ps,Rr,Jo,Ve,lo,uc,re,gt,cn,li,Jt,Ei;const[h,p]=b.useState(()=>i??Es()),[m,g]=b.useState(""),[v,y]=b.useState(!1),[x,E]=b.useState(!1),[w,N]=b.useState(null),_=m.trim(),T=_.length>0&&_.length{M.current=d},[d]),b.useEffect(()=>{var se;I!==C.current&&(C.current=I,(se=M.current)==null||se.call(M,h,O))},[h,O,I]);const[G,D]=b.useState("build"),[F,A]=b.useState(!1),[j,P]=b.useState(0),[$,R]=b.useState(null),[Y,Z]=b.useState(!1),[B,te]=b.useState((a==null?void 0:a.region)??l),z=(s==null?void 0:s.generatedAgentTestRun)===!0,q=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,K]=b.useState(()=>[{id:"baseline",name:"基准组",modelName:pN(i??Es()),description:(i??Es()).description,instruction:(i??Es()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ue,pe]=b.useState("baseline"),_e=b.useRef(1),fe=b.useRef(!1),me=b.useRef(new Map),[Re,ge]=b.useState(0),[oe,Te]=b.useState(""),[ve,Xe]=b.useState(null),[De,ze]=b.useState(!1),[Ne,Pe]=b.useState(!1),Fe=b.useRef(null),[qe,Q]=b.useState(""),[ae,ie]=b.useState(!1),[be,Ue]=b.useState(!1),[Ye,yt]=b.useState([]),lt=b.useRef(null),ln=b.useRef({});async function Dt(){const se=new Set([...me.current.values()].map(({run:$e})=>$e.runId)),ke=f2().filter($e=>!se.has($e));ke.length&&await Promise.all(ke.map(async $e=>{try{await sd($e),Kh($e)}catch(Je){console.warn("清理遗留调试运行失败",Je)}}))}b.useEffect(()=>(Dt(),()=>{for(const{run:se}of me.current.values())sd(se.runId).then(()=>Kh(se.runId)).catch(ke=>console.warn("清理调试运行失败",ke));me.current.clear()}),[]),b.useEffect(()=>()=>{var se;(se=Fe.current)==null||se.call(Fe,!1),Fe.current=null},[]);const kt=b.useRef(null);kt.current||(kt.current=({meta:se,children:ke})=>o.jsxs("section",{ref:$e=>{ln.current[se.id]=$e},id:`cw-sec-${se.id}`,"data-step-id":se.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:se.label})}),o.jsx("div",{className:"cw-sec-body",children:ke})]}));const $t=q2e(h,Ye)?Ye:[],Ge=J0(h,$t),Kt=$t.length===0,nt=`cw-model-advanced-${$t.join("-")||"root"}`,at=`cw-a2a-registry-advanced-${$t.join("-")||"root"}`,Qe=se=>p(ke=>Ig(ke,$t,$e=>({...$e,...se}))),Nt=(se,ke)=>p($e=>{var Je;return{...$e,deployment:{...$e.deployment??{feishuEnabled:!1},envValues:{...((Je=$e.deployment)==null?void 0:Je.envValues)??{},[se]:ke}}}}),ye=se=>Qe({a2aRegistry:{...Ge.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...se}}),Ze=(se,ke)=>{if(!(se in _D))return;const $e=_D[se];ye({[$e]:ke}),Nt(se,ke)},Et=se=>{if(!(Kt&&se==="a2a")){if(se==="a2a"){Qe({agentType:se,a2aRegistry:{...Ge.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Qe({agentType:se,a2aRegistry:Ge.a2aRegistry?{...Ge.a2aRegistry,enabled:!1}:void 0})}},sn=(se,ke)=>{p(se),ke&&yt(ke)},jn=async()=>{const se=m.trim();if(!(!se||v)&&!(se.length{const ke=J0(h,se);if(!hN(ke)||se.length>=SD)return;const $e=Y2e(h,se),Je=J0($e,se).subAgents.length-1;sn($e,[...se,Je])},mt=(se,ke)=>{const $e=J0(h,se);if(!hN($e)||se.length>=SD)return;const Je=Math.max(0,Math.min(ke,$e.subAgents.length)),wn=W2e(h,se,Je);sn(wn,[...se,Je])},rn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(Es()),yt([]),A(!1))},fn=se=>{if(se.length===0){rn();return}sn(X2e(h,se),se.slice(0,-1))},At=Ge.builtinTools??[],Wt=Ge.mcpTools??[],Ti=Ge.selectedSkills??[],bi=se=>Qe({builtinTools:At.includes(se)?At.filter(ke=>ke!==se):[...At,se]}),On=Lz(Ge.agentType),$n=Kx(Ge.agentType),hn=b.useMemo(()=>v$(h),[h]),vn=$n?null:Kl(Ge.name)??(hn.has(Ge.name)?"Agent 名称在当前结构中必须唯一":null),Hn=vn!==null,Bi=!$n&&Ge.description.trim().length===0,Xi=Ge.instruction.trim().length===0,ki=$n&&!((oo=Ge.a2aRegistry)!=null&&oo.registrySpaceId.trim()),Ui=se=>F&&se?`is-error cw-error-shake-${j%2}`:"",gn=b.useMemo(()=>qz(h,hn),[h,hn]),Ai=gn.length===0,zn=b.useMemo(()=>J2e(h),[h]),Jn=W.find(se=>se.id===ue)??W[0],Ci=b.useMemo(()=>Wz(h),[h]),yi=se=>{var ke;(ke=ln.current[se])==null||ke.scrollIntoView({behavior:"smooth",block:"start"})},pn=()=>Ai?!0:(A(!0),P(se=>se+1),gn[0]&&(yt(gn[0].path),window.requestAnimationFrame(()=>yi(gn[0].problem==="缺少子 Agent"?"type":"basic"))),!1),An=async()=>{Xe(null);const se=[...me.current.values()];me.current.clear(),ge(0),K(ke=>ke.map($e=>({...$e,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(se.map(async({run:ke})=>{try{await sd(ke.runId),Kh(ke.runId)}catch($e){console.warn("清理调试运行失败",$e)}}))},Mn=async se=>{const ke=me.current.get(se);if(ke){me.current.delete(se),ge(me.current.size);try{await sd(ke.run.runId),Kh(ke.run.runId)}catch($e){console.warn("清理调试运行失败",$e)}}},Ln=se=>{const ke=me.current.get(se),$e=W.find(Je=>Je.id===se);!ke||!$e||Xe({runId:ke.run.runId,sessionId:ke.sessionId,variantName:$e.name})},ce=se=>{const ke=Fe.current;Fe.current=null,ke==null||ke(se)},Se=()=>{Ne||(ze(!1),ce(!1))},Le=async()=>{if(!Ne){Pe(!0);try{await An(),ze(!1),ce(!0)}finally{Pe(!1)}}},Ee=async()=>G!=="validate"||Re===0?!0:Fe.current?!1:new Promise(se=>{Fe.current=se,ze(!0)}),rt=async se=>{var $e;if(!await Ee())return;if(Q(""),!pn()){D("build");return}const ke=LH(Ci.specs,(($e=h.deployment)==null?void 0:$e.envValues)??{});if(ke){Q(`${ke.spec.comment||ke.spec.key}:${ke.error}`),D("build");return}Z(!0);try{const Je=se?W.find(Gn=>Gn.id===se):Jn;Je&&pe(Je.id);const wn=Je?{...h,modelName:Je.modelName||h.modelName,description:Je.description,instruction:Je.instruction}:h,ci=await X1(Xz(wn));wn!==h&&p(wn),R(ci),D("publish")}catch(Je){Q(Je instanceof Error?Je.message:String(Je))}finally{Z(!1)}},it=async se=>{if(!z||Y||!pn())return;const ke=W.find(an=>an.id===se);if(!ke||ke.phase==="starting"||ke.phase==="sending")return;const $e=ke.modelName.trim(),Je=ke.description.trim(),wn=ke.instruction.trim(),ci=Dd(ke),Gn=W.findIndex(an=>an.id===se),ss=W.findIndex(an=>Dd(an)===ci);if(!$e||!Je||!wn||ss!==Gn)return;const ui=u1(zn,ke);K(an=>an.map(Fi=>Fi.id===se?{...Fi,configOpen:!1,phase:"starting",messages:[],error:null}:Fi)),Te("");let Xt=null;try{await Mn(se),await Dt();const an={...h,modelName:ke.modelName||h.modelName,description:ke.description,instruction:ke.instruction};Xt=await MB(Qz(an)),M2e(Xt.runId);const Fi=await LB(Xt.runId,"test_user");me.current.set(se,{run:Xt,sessionId:Fi}),ge(me.current.size),K(Ws=>Ws.map(na=>na.id===se?{...na,phase:"ready",runtimeSnapshot:ui}:na))}catch(an){if(Xt)try{await sd(Xt.runId),Kh(Xt.runId)}catch(Fi){console.warn("清理调试运行失败",Fi)}K(Fi=>Fi.map(Ws=>Ws.id===se?{...Ws,phase:"error",runtimeSnapshot:"",error:an instanceof Error?an.message:String(an)}:Ws))}},jt=async()=>{const se=oe.trim(),ke=W.filter(Je=>Je.phase==="ready"&&Je.runtimeSnapshot===u1(zn,Je)&&me.current.has(Je.id));if(!se||ke.length===0)return;Te("");const $e=new Set(ke.map(Je=>Je.id));K(Je=>Je.map(wn=>$e.has(wn.id)?{...wn,phase:"sending",messages:[...wn.messages,{role:"user",content:se},{role:"assistant",content:"",blocks:[]}]}:wn)),await Promise.all(ke.map(async Je=>{const wn=me.current.get(Je.id);if(wn)try{let ci=ya();for await(const Gn of PB({runId:wn.run.runId,userId:"test_user",sessionId:wn.sessionId,text:se})){const ss=Gn.error||Gn.errorMessage||Gn.error_message;if(ss||(ci=pf(ci,Gn)),K(ui=>ui.map(Xt=>{if(Xt.id!==Je.id)return Xt;const an=[...Xt.messages],Fi={...an[an.length-1]};return ss?Fi.error=String(ss):(Fi.content=ci.blocks.filter(Ws=>Ws.kind==="text").map(Ws=>Ws.text).join(""),Fi.blocks=ci.blocks),an[an.length-1]=Fi,{...Xt,messages:an}})),ss)break}}catch(ci){K(Gn=>Gn.map(ss=>{if(ss.id!==Je.id)return ss;const ui=[...ss.messages],Xt={...ui[ui.length-1]};return Xt.error=ci instanceof Error?ci.message:String(ci),ui[ui.length-1]=Xt,{...ss,messages:ui}}))}finally{K(ci=>ci.map(Gn=>Gn.id===Je.id?{...Gn,phase:"ready"}:Gn))}}))},Pt=()=>{K(se=>{if(se.length>=3)return se;const ke=_e.current++,$e=`variant-${ke}`;return[...se,{id:$e,name:`对照组 ${ke}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},oi=async se=>{await Mn(se),K(ke=>ke.filter($e=>$e.id!==se)),ue===se&&pe("baseline")},Dn=(se,ke)=>K($e=>$e.map(Je=>Je.id===se?{...Je,...ke}:Je)),ps=(se,ke,$e)=>{se==="baseline"&&ke==="modelName"&&(fe.current=!0),Dn(se,{[ke]:$e}),!(ue!==se||se==="baseline")&&pe("baseline")},xi=se=>{const ke=W.find(ui=>ui.id===se);if(!ke)return;const $e=ke.modelName.trim(),Je=ke.description.trim(),wn=ke.instruction.trim(),ci=Dd(ke),Gn=W.findIndex(ui=>ui.id===se),ss=W.findIndex(ui=>Dd(ui)===ci);if(!(!$e||!Je||!wn||ss!==Gn)){if(se==="baseline"){Dn(se,{configOpen:!1});return}it(se)}},wt=async(se,ke,$e)=>{var ci;const Je=(ci=h.deployment)==null?void 0:ci.network,wn=Je&&Je.mode&&Je.mode!=="public"?{mode:Je.mode,vpc_id:Je.vpcId,subnet_ids:Je.subnetIds,enable_shared_internet_access:Je.enableSharedInternetAccess}:void 0;return rg(se.name,se.files,{region:(a==null?void 0:a.region)??B,projectName:"default",network:wn},{...$e,onStage:ke,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Tt=()=>{pn()&&(K(se=>se.map(ke=>ke.id==="baseline"&&!me.current.has(ke.id)?{...ke,modelName:fe.current?ke.modelName:pN(h),description:h.description,instruction:h.instruction}:ke)),D("validate"))},Ii=async se=>{if(se==="publish"){if(!pn())return;$?D("publish"):rt();return}if(se==="validate"){Tt();return}await Ee()&&D(se)},Vn=kt.current,Ds=se=>D2e.find(ke=>ke.id===se),ta=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Co,{initial:!1,mode:"wait",children:x?o.jsxs(Wn.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:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(Wn.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:se=>{se.preventDefault(),jn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!T,"aria-describedby":T?"ai-requirement-error":void 0,onChange:se=>g(se.target.value),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),jn())}}),o.jsx("button",{type:"submit",disabled:v||!_||!!T,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),T&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:T})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${G}`,children:[o.jsx(tCe,{mode:G}),qe&&o.jsx(l1,{className:"cw-workspace-alert",message:qe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[G==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(Am,{draft:h,direction:"horizontal",selectedPath:$t,onSelect:yt,onAdd:ot,onInsert:mt,onDelete:fn}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:lt,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(Vn,{meta:Ds("type"),children:[o.jsx(uN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:Ge.agentType??"llm",onChange:Et,children:l2e.map(se=>{const ke=(Ge.agentType??"llm")===se.id,$e=Kt&&se.id==="a2a",Je=$e?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":se.id,className:`cw-agent-type-option ${ke?"is-on":""} ${$e?"is-disabled":""}`,tabIndex:$e?0:void 0,"aria-describedby":Je,children:[o.jsx(uN.Item,{value:se.id,disabled:$e,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:B2e[se.id]})})}),$e&&o.jsx("span",{id:Je,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},se.id)})}),F&&On&&Ge.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:Z2e({name:Ge.name.trim()||"未命名",typeLabel:Mz(Ge.agentType).label})})]}),o.jsx(Vn,{meta:Ds("basic"),children:o.jsxs("div",{className:"cw-form",children:[!$n&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Kt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Ui(Hn)}`,value:Ge.name,placeholder:"assistant",onChange:se=>Qe({name:se.target.value})}),F&&vn?o.jsx("span",{className:"cw-error-text",children:vn}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Kt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Ui(Bi)}`,value:Ge.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:se=>Qe({description:se.target.value})}),F&&Bi?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Kt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),On?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),Ge.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:Ge.maxIterations??3,onChange:se=>Qe({maxIterations:Math.max(1,Number(se.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):$n?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(H2e,{value:((is=Ge.a2aRegistry)==null?void 0:is.registrySpaceId)??"",region:((Ps=Ge.a2aRegistry)==null?void 0:Ps.registryRegion)||va.region,invalid:F&&ki,onChange:se=>Ze(Vz,se)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":be,"aria-controls":at,onClick:()=>Ue(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(ec,{className:`cw-more-options-chevron ${be?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Co,{initial:!1,children:be&&o.jsx(Wn.div,{id:at,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(qh,{env:U2e,values:Gz(Ge.a2aRegistry,{includeDefaults:!1}),onChange:Ze})})}),F&&ki&&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(b.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(O2e,{value:Ge.instruction,invalid:Xi,onChange:se=>Qe({instruction:se})})}),F&&Xi?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!On&&!$n&&o.jsxs(o.Fragment,{children:[o.jsx(Vn,{meta:Ds("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:Ge.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:se=>Qe({modelName:se.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":ae,"aria-controls":nt,onClick:()=>ie(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(ec,{className:`cw-more-options-chevron ${ae?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Co,{initial:!1,children:ae&&o.jsxs(Wn.div,{id:nt,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:Ge.modelProvider??"",placeholder:"openai",onChange:se=>Qe({modelProvider:se.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:Ge.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:se=>Qe({modelApiBase:se.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(Vn,{meta:Ds("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(F2e,{items:cU,selected:At,onToggle:bi,scrollRows:6})}),o.jsx(Co,{initial:!1,children:At.includes("run_code")&&o.jsxs(Wn.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(qh,{env:((Rr=wu.find(se=>se.id==="run_code"))==null?void 0:Rr.env)??[],values:((Jo=h.deployment)==null?void 0:Jo.envValues)??{},onChange:Nt})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(V2e,{tools:Wt,onChange:se=>Qe({mcpTools:se})})]})]})}),o.jsx(Vn,{meta:Ds("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(K2e,{selected:Ti,onChange:se=>Qe({selectedSkills:se})})})}),o.jsx(Vn,{meta:Ds("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Z0,{checked:Ge.knowledgebase,onChange:se=>Qe({knowledgebase:se}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:vb}),Ge.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(_w,{options:TS,value:Ge.knowledgebaseBackend,onChange:se=>Qe({knowledgebaseBackend:se,knowledgebaseIndex:se==="viking"?Ge.knowledgebaseIndex:""})}),(Ge.knowledgebaseBackend??cu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(z2e,{value:Ge.knowledgebaseIndex??"",onChange:se=>Qe({knowledgebaseIndex:se})})]}),o.jsx(qh,{env:((Ve=TS.find(se=>se.id===(Ge.knowledgebaseBackend??cu)))==null?void 0:Ve.env)??[],values:((lo=h.deployment)==null?void 0:lo.envValues)??{},onChange:Nt})]})]})}),Kt&&o.jsx(Vn,{meta:Ds("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(Z0,{checked:Ge.memory.shortTerm,onChange:se=>Qe({memory:{...Ge.memory,shortTerm:se}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:BP}),Ge.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(_w,{options:SS,value:Ge.shortTermBackend,onChange:se=>Qe({shortTermBackend:se})}),o.jsx(qh,{env:((uc=SS.find(se=>se.id===(Ge.shortTermBackend??"local")))==null?void 0:uc.env)??[],values:((re=h.deployment)==null?void 0:re.envValues)??{},onChange:Nt})]}),o.jsx(Z0,{checked:Ge.memory.longTerm,onChange:se=>Qe({memory:{...Ge.memory,longTerm:se}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:vb}),Ge.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(_w,{options:NS,value:Ge.longTermBackend,onChange:se=>Qe({longTermBackend:se})}),o.jsx(qh,{env:((gt=NS.find(se=>se.id===(Ge.longTermBackend??"local")))==null?void 0:gt.env)??[],values:((cn=h.deployment)==null?void 0:cn.envValues)??{},onChange:Nt}),o.jsx(Z0,{checked:!!Ge.autoSaveSession,onChange:se=>Qe({autoSaveSession:se}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:vb})]})]})})]})]})})})})})]})}),G==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(eCe,{enabled:z,disabledReason:q,variants:W,draftSnapshot:zn,input:oe,onInput:Te,onSend:jt,onStartVariant:it,onDeployVariant:se=>void rt(se),onAddVariant:Pt,onRemoveVariant:oi,onToggleConfig:se=>{const ke=W.find($e=>$e.id===se);ke&&Dn(se,{configOpen:!ke.configOpen})},onCompleteConfig:xi,onConfigChange:ps,onOpenTrace:Ln})})}),G==="publish"&&o.jsx("div",{className:"cw-preview-body",children:$?o.jsx(Fx,{embedded:!0,project:$,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:Yz(h),releaseConfiguration:Jn?{modelName:Jn.modelName||h.modelName||"默认模型",description:Jn.description,instruction:Jn.instruction,optimizations:Jn.optimizations.flatMap(se=>{const ke=Zz.find($e=>$e.id===se);return ke?[ke.label]:[]})}:void 0,onChange:R,onDeploy:wt,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((li=h.deployment)!=null&&li.feishuEnabled),onFeishuEnabledChange:se=>{const ke={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:se}};p(ke)},deploymentEnv:Ci.specs,deploymentEnvValues:{...(Jt=h.deployment)==null?void 0:Jt.envValues,...Ci.fixedValues},onDeploymentEnvChange:Nt,network:(Ei=h.deployment)==null?void 0:Ei.network,onNetworkChange:se=>p(ke=>({...ke,deployment:{...ke.deployment??{feishuEnabled:!1},network:se}})),deployRegion:B,onDeployRegionChange:te,onExportYaml:()=>L2e(`${h.name||"agent"}.yaml`,OTe(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(nCe,{mode:G,busy:Y,onChange:Ii,assistant:G==="build"?ta:void 0}),ve&&o.jsx(Fz,{testRunId:ve.runId,sessionId:ve.sessionId,title:`调用链路 · ${ve.variantName}`,onClose:()=>Xe(null)}),De&&o.jsx(NA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:Ne?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:Ne,onCancel:Se,onConfirm:()=>void Le()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>N(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:se=>se.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:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>N(null),children:"关闭"})})]})})]})}function yo(e){return{...Es(),...e}}const sCe=[{id:"support",icon:vJ,draft:yo({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:rJ,draft:yo({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:wJ,draft:yo({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:ok,draft:yo({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:AJ,draft:yo({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:VJ,draft:yo({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[yo({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),yo({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),yo({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function rCe(e){const t=[];return e.tools.length&&t.push({icon:$P,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:sJ,label:"记忆"}),e.knowledgebase&&t.push({icon:nJ,label:"知识库"}),e.tracing&&t.push({icon:tJ,label:"观测"}),e.subAgents.length&&t.push({icon:RJ,label:`子Agent ${e.subAgents.length}`}),t}function aCe({onBack:e,onCreate:t}){const[n,i]=b.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(lCe,{template:n,onBack:()=>i(null),onCreate:t}):o.jsx(oCe,{onPick:i})})}function oCe({onPick:e}){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:sCe.map((t,n)=>o.jsxs(Wn.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:ic(t.draft.description)})]},t.id))})]})}function lCe({template:e,onBack:t,onCreate:n}){const[i,s]=b.useState(e.draft.name),r=e.icon,a=rCe(e.draft);function l(){const c=i.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(rk,{className:"icon"})," 返回模板列表"]}),o.jsxs(Wn.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:ic(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:i,onChange:c=>s(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:cCe(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:ic(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(ec,{className:"icon"})]})]})]})}function cCe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const uCe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:UP},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:RP},{type:"loop",label:"循环",desc:"节点循环执行",Icon:dk}];let mN=0;function Aw(){return mN+=1,`node_${mN}`}function Cw(e,t,n){const i=Es();return{id:e,type:"agentNode",position:t,data:{agent:{...i,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function dCe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Rs,{type:"target",position:We.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(nu,{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(Rs,{type:"source",position:We.Right,className:"wfb-handle"})]})}const fCe={agentNode:dCe},ND={type:"smoothstep",markerEnd:{type:yf.ArrowClosed,width:16,height:16}};function hCe({onBack:e,onCreate:t}){const n=b.useRef(null),[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState("sequential"),u=b.useMemo(()=>{mN=0;const A=Aw();return Cw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=A9([u]),[p,m,g]=C9([]),[v,y]=b.useState(u.id),x=d.find(A=>A.id===v)??null,E=i.trim()||"workflow_agent",w=b.useMemo(()=>v$({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),N=Kl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),_=x?Kl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,T=d.length>0&&N===null&&d.every(A=>Kl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),k=b.useCallback(A=>m(j=>n9({...A,...ND},j)),[m]),C=b.useCallback(()=>{const A=Aw(),j=d.length*28,P=Cw(A,{x:80+j,y:120+j});f($=>$.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},O=b.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),M=b.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),$=Aw(),R=Cw($,P);f(Y=>Y.concat(R)),y($)},[f]),G=b.useCallback(A=>{v&&f(j=>j.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=b.useCallback(()=>{v&&(f(A=>A.filter(j=>j.id!==v)),m(A=>A.filter(j=>j.source!==v&&j.target!==v)),y(null))},[v,f,m]),F=b.useCallback(()=>{if(!T)return;const A=d.map(P=>P.data.agent),j={...Es(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(j)},[T,d,p,E,r,l,t]);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 ${N?"wfb-input--error":""}`,value:i,onChange:A=>s(A.target.value),placeholder:"my_workflow"}),N&&o.jsx("span",{className:"wfb-field-error",children:N})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:uCe.map(({type:A,label:j,desc:P,Icon:$})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx($,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:j}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(EJ,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(nu,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(ws,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!T,type:"button",children:[o.jsx(iu,{className:"icon"}),"创建工作流"]}),o.jsxs(k9,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:g,onConnect:k,onInit:A=>n.current=A,nodeTypes:fCe,defaultEdgeOptions:ND,onDrop:M,onDragOver:O,onNodeClick:(A,j)=>y(j.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(R9,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(O9,{showInteractive:!1}),o.jsx(ble,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?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:D,title:"删除节点",children:o.jsx(tc,{className:"icon"})})]}),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:x.data.agent.name,onChange:A=>G({name:A.target.value}),placeholder:"agent_name"}),_?o.jsx("span",{className:"wfb-field-error",children:_}):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:x.data.agent.description,onChange:A=>G({description:A.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:x.data.agent.instruction,onChange:A=>G({instruction:A.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:x.data.agent.tools.join(", "),onChange:A=>G({tools:A.target.value.split(",").map(j=>j.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:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(nu,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function pCe(e){return o.jsx(Gk,{children:o.jsx(hCe,{...e})})}const TD=50*1024*1024,gN=800,mCe={name:"code_package",files:[]};function gCe(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 bCe(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(i=>!i||i==="."||i===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function yCe(e){const t=e.flatMap(a=>{const l=bCe(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>gN)throw new Error(`代码包文件数不能超过 ${gN} 个。`);const s=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 s){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 s}function xCe({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:i,onDeploymentComplete:s,initialDeployRegion:r="cn-beijing"}){const a=b.useRef(null),l=b.useRef(0),[c,u]=b.useState(null),[d,f]=b.useState(""),[h,p]=b.useState(!1),[m,g]=b.useState(!1),[v,y]=b.useState(!1),[x,E]=b.useState(""),[w,N]=b.useState(r),[_,T]=b.useState();b.useEffect(()=>()=>{l.current+=1},[]);async function k(M){const G=++l.current;if(E(""),!M.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(M.size>TD){E("代码包不能超过 50 MB。");return}g(!0);try{const D=await Dz(new Uint8Array(await M.arrayBuffer()),{maxEntries:gN,maxUncompressedBytes:TD}),F=yCe(D);if(G!==l.current)return;f(M.name),u({name:gCe(M.name),files:F})}catch(D){if(G!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{G===l.current&&g(!1)}}function C(M){var D;const G=(D=M.currentTarget.files)==null?void 0:D[0];M.currentTarget.value="",G&&k(G)}function I(M){var D;M.preventDefault(),y(!1);const G=(D=M.dataTransfer.files)==null?void 0:D[0];G&&k(G)}async function O(M,G,D){const F=_&&_.mode!=="public"?{mode:_.mode,vpc_id:_.vpcId,subnet_ids:_.subnetIds,enable_shared_internet_access:_.enableSharedInternetAccess}:void 0;return rg(M.name,M.files,{region:w,projectName:"default",network:F},{...D,onStage:G})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(Fx,{project:c??mCe,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:O,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:i,onDeploymentComplete:s,network:_,onNetworkChange:T,deployRegion:w,onDeployRegionChange:N,onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?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${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:M=>{M.preventDefault(),y(!0)},onDragOver:M=>M.preventDefault(),onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var M;m||(M=a.current)==null||M.click()},onKeyDown:M=>{var G;!m&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),(G=a.current)==null||G.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:M=>{M.stopPropagation(),p(!0)},onKeyDown:M=>M.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(DH,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const Jz=1;function d1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ECe(e){return d1(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&d1(e.draft)}function qx(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function bN(e){var i;const t=(i=e.mcpTools)==null?void 0:i.map(s=>{const r={...s};return delete r.authToken,r}),n=e.deployment?{...e.deployment}:void 0;return n&&delete n.envValues,{...e,subAgents:e.subAgents.map(bN),...t?{mcpTools:t}:{},...n?{deployment:n}:{},...e.workflow?{workflow:{...e.workflow,nodes:e.workflow.nodes.map(s=>({...s,agent:bN(s.agent)}))}}:{}}}function eV(e){return{...e,draft:bN(e.draft)}}function vCe(e){const t=Array.isArray(e)?e:d1(e)&&e.version===Jz?e.drafts:void 0;if(!Array.isArray(t)||!t.every(ECe))throw d1(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(eV)}function wCe(e,t){if(!t)return[];const n=e.getItem(qx(t));if(!n)return[];try{return vCe(JSON.parse(n))}catch(i){throw i instanceof Error&&i.message.startsWith("本机草稿")?i:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function kD(e,t,n){if(!t)return;const i={version:Jz,drafts:n.map(eV)};try{e.setItem(qx(t),JSON.stringify(i))}catch(s){throw s instanceof DOMException&&(s.name==="QuotaExceededError"||s.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const _Ce="/web/skill-creator";class h2 extends Error{constructor(n,i){super(n);Z2(this,"status");this.name="SkillCreatorApiError",this.status=i}}function Iu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function si(e,...t){for(const n of t){const i=e[n];if(typeof i=="string"&&i)return i}}function tV(e,...t){for(const n of t){const i=e[n];if(typeof i=="number"&&Number.isFinite(i))return i}}async function Rg(e,t){return fetch(Nn(`${_Ce}${e}`),{...t,headers:V1({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function p2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=Iu(await e.json(),"错误响应");return si(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function m2(e,t){if(!e.ok)throw new h2(await p2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function SCe(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 NCe(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function TCe(e){return Array.isArray(e)?e.map((t,n)=>{const i=Iu(t,`文件 ${n+1}`),s=si(i,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const r=tV(i,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:r}}):[]}function kCe(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],i=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:i}}function ACe(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const i=Iu(t,`活动 ${n+1}`),s=si(i,"id"),r=si(i,"kind"),a=si(i,"status");if(!s||!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=si(i,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:r,name:c,args:i.input,response:i.output,status:a}}const l=si(i,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:r,text:l,status:a}})}function CCe(e,t){const n=Iu(e,`候选方案 ${t+1}`),i=si(n,"id","candidate_id","candidateId"),s=si(n,"model","model_id","modelId");if(!i||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:i,model:s,modelLabel:si(n,"modelLabel","model_label")??s,status:SCe(n.status),stage:NCe(n.stage),name:si(n,"name","skill_name","skillName"),description:si(n,"description"),skillMd:si(n,"skillMd","skill_md"),files:TCe(n.files),activities:ACe(n.activities),validation:kCe(n.validation),durationMs:tV(n,"elapsedMs","elapsed_ms"),error:si(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:si(n,"skill_id","skillId"),version:si(n,"version")}}function yN(e,t=""){const n=Iu(e,"Skill 创建任务"),i=si(n,"id","job_id","jobId");if(!i)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(CCe):[],r=si(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:i,prompt:si(n,"prompt")??t,status:r,candidates:s}}async function ICe(e,t){const n=await Rg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new h2(await p2(n,"创建 Skill 任务失败"),n.status);const i=n.headers.get("content-type")??"";if(i.includes("application/json")){const u=yN(await n.json(),e);return t==null||t(u),u}if(!i.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Iu(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(si(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=yN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await s.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 RCe(e){const t=await Rg(`/jobs/${encodeURIComponent(e)}`);return yN(await m2(t,"读取 Skill 任务失败"))}async function jCe(e){const t=await Rg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await m2(t,"清理 Skill 任务失败")}async function OCe(e,t){var l;const n=await Rg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await p2(n,"下载 Skill 失败"));const s=((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=s,a.click(),URL.revokeObjectURL(r)}async function MCe(e,t,n){const i=await Rg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=Iu(await m2(i,"添加到 AgentKit 失败"),"发布结果"),r=si(s,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:si(s,"name"),version:si(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:si(s,"message")}}const LCe=()=>{};function DCe(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 PCe({activities:e}){const t=b.useMemo(()=>e.filter(n=>n.kind!=="status").map(DCe),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(DA,{blocks:t,onAction:LCe})})}const AD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},CD=12e4;function BCe({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 UCe(){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 FCe(){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 $Ce({candidate:e}){var c,u;const[t,n]=b.useState("SKILL.md"),i=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!i?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,CD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>CD;return s.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:s.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 HCe({label:e,jobId:t,candidate:n,selected:i,publishing:s,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=b.useState("conversation"),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(""),[y,x]=b.useState(""),[E,w]=b.useState(""),[N,_]=b.useState(""),T=b.useRef(null),k=b.useRef(null),C=n.status==="queued"||n.status==="running",I=n.status==="succeeded",O=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${i?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),i?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(BCe,{status:n.status})}),C?o.jsx(wa,{duration:2.2,spread:16,children:AD[n.stage]}):o.jsx("span",{children:AD[n.stage]}),n.durationMs!==void 0&&I?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(PCe,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?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 M;return(M=k.current)==null?void 0:M.focus()})},children:[o.jsx(UCe,{}),"查看 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 M;return(M=T.current)==null?void 0:M.focus()})},children:[o.jsx(FCe,{}),"返回对话"]})}),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:(O==null?void 0:O.valid)===!1?"is-invalid":"is-valid",children:(O==null?void 0:O.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,O&&(O.errors.length>0||O.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...O.errors,...O.warnings].map((M,G)=>o.jsx("div",{children:M},`${M}-${G}`))]}):null,o.jsx($Ce,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":i,onClick:l,children:i?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),OCe(t,n.id).catch(M=>{v(M instanceof Error?M.message:String(M))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!i||s||r||n.published,title:i?void 0:"请先采用此方案",onClick:()=>h(M=>!M),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),g?o.jsx("div",{className:"skill-candidate__error",children:g}):null,f&&i&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:M=>{M.preventDefault();const G=y.split(",").map(D=>D.trim()).filter(Boolean);c({skillSpaceIds:G,...E.trim()?{projectName:E.trim()}:{},...N.trim()?{skillId:N.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:M=>x(M.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:M=>w(M.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:N,onChange:M=>_(M.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const ID=new Set(["completed"]),tb=1100,zCe=3e4;function VCe(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 GCe({initialJob:e}){const[t,n]=b.useState(e),[i,s]=b.useState(""),[r,a]=b.useState(!1),[l,c]=b.useState(),[u,d]=b.useState(),[f,h]=b.useState(()=>new Set),[p,m]=b.useState({});b.useEffect(()=>{n(e),s(""),a(!1)},[e]),b.useEffect(()=>{if(ID.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+zCe,w=async()=>{try{const N=await RCe(e.id);y||(n({...N,prompt:N.prompt||e.prompt}),s(""),ID.has(N.status)||(x=window.setTimeout(w,tb)))}catch(N){if(!y){const _=N instanceof h2?N:void 0;if((_==null?void 0:_.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const g=BA.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??VCe(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await MCe(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"})}),i?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",i,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:g.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(HCe,{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:N=>void v(y,N)},`${y.model}-${y.id}`)})})]})}function KCe(e){return Object.prototype.toString.call(e)==="[object Object]"}function RD(e){return KCe(e)||Array.isArray(e)}function qCe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function g2(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;const s=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return s!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!RD(l)||!RD(c)?l===c:g2(l,c)})}function jD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function YCe(e,t){if(e.length!==t.length)return!1;const n=jD(e),i=jD(t);return n.every((s,r)=>{const a=i[r];return g2(s,a)})}function b2(e){return typeof e=="number"}function xN(e){return typeof e=="string"}function Yx(e){return typeof e=="boolean"}function OD(e){return Object.prototype.toString.call(e)==="[object Object]"}function gi(e){return Math.abs(e)}function y2(e){return Math.sign(e)}function Yp(e,t){return gi(e-t)}function WCe(e,t){if(e===0||t===0||gi(e)<=gi(t))return 0;const n=Yp(gi(e),gi(t));return gi(n/e)}function XCe(e){return Math.round(e*100)/100}function Bm(e){return Um(e).map(Number)}function Sa(e){return e[jg(e)]}function jg(e){return Math.max(0,e.length-1)}function x2(e,t){return t===jg(e)}function MD(e,t=0){return Array.from(Array(e),(n,i)=>t+i)}function Um(e){return Object.keys(e)}function nV(e,t){return[e,t].reduce((n,i)=>(Um(i).forEach(s=>{const r=n[s],a=i[s],l=OD(r)&&OD(a);n[s]=l?nV(r,a):a}),n),{})}function EN(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function QCe(e,t){const n={start:i,center:s,end:r};function i(){return 0}function s(c){return r(c)/2}function r(c){return t-c}function a(c,u){return xN(e)?n[e](c):e(t,c,u)}return{measure:a}}function Fm(){let e=[];function t(s,r,a,l={passive:!0}){let c;if("addEventListener"in s)s.addEventListener(r,a,l),c=()=>s.removeEventListener(r,a,l);else{const u=s;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),i}function n(){e=e.filter(s=>s())}const i={add:t,clear:n};return i}function ZCe(e,t,n,i){const s=Fm(),r=1e3/60;let a=null,l=0,c=0;function u(){s.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),s.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;i(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:i}}function JCe(e,t){const n=t==="rtl",i=e==="y",s=i?"y":"x",r=i?"x":"y",a=!i&&n?-1:1,l=d(),c=f();function u(m){const{height:g,width:v}=m;return i?g:v}function d(){return i?"top":n?"right":"left"}function f(){return i?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:s,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function hu(e=0,t=0){const n=gi(e-t);function i(u){return ut}function r(u){return i(u)||s(u)}function a(u){return r(u)?i(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:s,reachedMin:i,removeOffset:l}}function iV(e,t,n){const{constrain:i}=hu(0,e),s=e+1;let r=a(t);function a(h){return n?gi((s+h)%s):i(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return iV(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function eIe(e,t,n,i,s,r,a,l,c,u,d,f,h,p,m,g,v,y,x){const{cross:E,direction:w}=e,N=["INPUT","SELECT","TEXTAREA"],_={passive:!1},T=Fm(),k=Fm(),C=hu(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},O={mouse:500,touch:600},M=m?43:25;let G=!1,D=0,F=0,A=!1,j=!1,P=!1,$=!1;function R(fe){if(!x)return;function me(ge){(Yx(x)||x(fe,ge))&&q(ge)}const Re=t;T.add(Re,"dragstart",ge=>ge.preventDefault(),_).add(Re,"touchmove",()=>{},_).add(Re,"touchend",()=>{}).add(Re,"touchstart",me).add(Re,"mousedown",me).add(Re,"touchcancel",K).add(Re,"contextmenu",K).add(Re,"click",ue,!0)}function Y(){T.clear(),k.clear()}function Z(){const fe=$?n:t;k.add(fe,"touchmove",W,_).add(fe,"touchend",K).add(fe,"mousemove",W,_).add(fe,"mouseup",K)}function B(fe){const me=fe.nodeName||"";return N.includes(me)}function te(){return(m?O:I)[$?"mouse":"touch"]}function z(fe,me){const Re=f.add(y2(fe)*-1),ge=d.byDistance(fe,!m).distance;return m||gi(fe)=2,!(me&&fe.button!==0)&&(B(fe.target)||(A=!0,r.pointerDown(fe),u.useFriction(0).useDuration(0),s.set(a),Z(),D=r.readPoint(fe),F=r.readPoint(fe,E),h.emit("pointerDown")))}function W(fe){if(!EN(fe,i)&&fe.touches.length>=2)return K(fe);const Re=r.readPoint(fe),ge=r.readPoint(fe,E),oe=Yp(Re,D),Te=Yp(ge,F);if(!j&&!$&&(!fe.cancelable||(j=oe>Te,!j)))return K(fe);const ve=r.pointerMove(fe);oe>g&&(P=!0),u.useFriction(.3).useDuration(.75),l.start(),s.add(w(ve)),fe.preventDefault()}function K(fe){const Re=d.byDistance(0,!1).index!==f.get(),ge=r.pointerUp(fe)*te(),oe=z(w(ge),Re),Te=WCe(ge,oe),ve=M-10*Te,Xe=y+Te/50;j=!1,A=!1,k.clear(),u.useDuration(ve).useFriction(Xe),c.distance(oe,!m),$=!1,h.emit("pointerUp")}function ue(fe){P&&(fe.stopPropagation(),fe.preventDefault(),P=!1)}function pe(){return A}return{init:R,destroy:Y,pointerDown:pe}}function tIe(e,t){let i,s;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(EN(f,t)?f:f.touches[0])[m]}function l(f){return i=f,s=f,a(f)}function c(f){const h=a(f)-a(s),p=r(f)-r(i)>170;return s=f,p&&(i=f),h}function u(f){if(!i||!s)return 0;const h=a(s)-a(i),p=r(f)-r(i),m=r(f)-r(s)>170,g=h/p;return p&&!m&&gi(g)>.1?g:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function nIe(){function e(n){const{offsetTop:i,offsetLeft:s,offsetWidth:r,offsetHeight:a}=n;return{top:i,right:s+r,bottom:i+a,left:s,width:r,height:a}}return{measure:e}}function iIe(e){function t(i){return e*(i/100)}return{measure:t}}function sIe(e,t,n,i,s,r,a){const l=[e].concat(i);let c,u,d=[],f=!1;function h(v){return s.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=i.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,N=i.indexOf(E.target),_=w?u:d[N],T=h(w?e:i[N]);if(gi(T-_)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(Yx(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 rIe(e,t,n,i,s,r){let a=0,l=0,c=s,u=r,d=e.get(),f=0;function h(){const _=i.get()-e.get(),T=!c;let k=0;return T?(a=0,n.set(i),e.set(i),k=_):(n.set(e),a+=_/c,a*=u,d+=a,e.add(a),k=d-f),l=y2(k),f=d,N}function p(){const _=i.get()-t.get();return gi(_)<.001}function m(){return c}function g(){return l}function v(){return a}function y(){return E(s)}function x(){return w(r)}function E(_){return c=_,N}function w(_){return u=_,N}const N={direction:g,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return N}function aIe(e,t,n,i,s){const r=s.measure(10),a=s.measure(50),l=hu(.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",g=gi(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(g/a);n.subtract(v*y),!p&&gi(v){const{min:v,max:y}=r,x=r.constrain(m),E=!g,w=x2(n,g);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+s)return[r.max];if(i==="keepSnaps")return a;const{min:m,max:g}=l;return a.slice(m,g)}return{snapsContained:c,scrollContainLimit:l}}function lIe(e,t,n){const i=t[0],s=n?i-e:Sa(t);return{limit:hu(s,i)}}function cIe(e,t,n,i){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=hu(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);i.forEach(m=>m.add(p))}return{loop:d}}function uIe(e){const{max:t,length:n}=e;function i(r){const a=r-t;return n?a/-n:0}return{get:i}}function dIe(e,t,n,i,s){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=s,c=f().map(t.measure),u=h(),d=p();function f(){return l(i).map(g=>Sa(g)[a]-g[0][r]).map(gi)}function h(){return i.map(g=>n[r]-g[r]).map(g=>-gi(g))}function p(){return l(u).map(g=>g[0]).map((g,v)=>g+c[v])}return{snaps:u,snapsAligned:d}}function fIe(e,t,n,i,s,r){const{groupSlides:a}=s,{min:l,max:c}=i,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,g,v)=>{const y=!g,x=x2(v,g);if(y){const E=Sa(v[0])+1;return MD(E)}if(x){const E=jg(r)-Sa(v)[0]+1;return MD(E,Sa(v)[0])}return m})}return{slideRegistry:u}}function hIe(e,t,n,i,s){const{reachedAny:r,removeOffset:a,constrain:l}=i;function c(m){return m.concat().sort((g,v)=>gi(g)-gi(v))[0]}function u(m){const g=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-g,0),index:E})).sort((x,E)=>gi(x.diff)-gi(E.diff)),{index:y}=v[0];return{index:y,distance:g}}function d(m,g){const v=[m,m+n,m-n];if(!e)return m;if(!g)return c(v);const y=v.filter(x=>y2(x)===g);return y.length?c(y):Sa(v)-n}function f(m,g){const v=t[m]-s.get(),y=d(v,g);return{index:m,distance:y}}function h(m,g){const v=s.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!g||E)return{index:y,distance:m};const w=t[y]-x,N=m+d(w,0);return{index:y,distance:N}}return{byDistance:h,byIndex:f,shortcut:d}}function pIe(e,t,n,i,s,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(i.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=s.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=s.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function mIe(e,t,n,i,s,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(g){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(g));b2(x)&&(s.useDuration(0),i.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((g,v)=>{r.add(g,"focus",y=>{(Yx(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function fp(e){let t=e;function n(){return t}function i(c){t=a(c)}function s(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return b2(c)?c:c.get()}return{get:n,set:i,add:s,subtract:r}}function sV(e,t){const n=e.scroll==="x"?a:l,i=t.style;let s=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=XCe(e.direction(h));p!==s&&(i.transform=n(p),s=p)}function u(h){r=!h}function d(){r||(i.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function gIe(e,t,n,i,s,r,a,l,c){const d=Bm(s),f=Bm(s).reverse(),h=y().concat(x());function p(T,k){return T.reduce((C,I)=>C-s[I],k)}function m(T,k){return T.reduce((C,I)=>p(C,k)>0?C.concat([I]):C,[])}function g(T){return r.map((k,C)=>({start:k-i[C]+.5+T,end:k+t-.5+T}))}function v(T,k,C){const I=g(k);return T.map(O=>{const M=C?0:-n,G=C?n:0,D=C?"end":"start",F=I[O][D];return{index:O,loopPoint:F,slideLocation:fp(-1),translate:sV(e,c[O]),target:()=>l.get()>F?M:G}})}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(C=>C!==T);return p(k,t)<=.1})}function w(){h.forEach(T=>{const{target:k,translate:C,slideLocation:I}=T,O=k();O!==I.get()&&(C.to(O),I.set(O))})}function N(){h.forEach(T=>T.translate.clear())}return{canLoop:E,clear:N,loop:w,loopPoints:h}}function bIe(e,t,n){let i,s=!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}}i=new MutationObserver(d=>{s||(Yx(n)||n(c,d))&&u(d)}),i.observe(e,{childList:!0})}function a(){i&&i.disconnect(),s=!0}return{init:r,destroy:a}}function yIe(e,t,n,i){const s={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(g=>{const v=t.indexOf(g.target);s[v]=g}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:i}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return Um(s).reduce((g,v)=>{const y=parseInt(v),{isIntersecting:x}=s[y];return(m&&x||!m&&!x)&&g.push(y),g},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const g=f(m);return m&&(r=g),m||(a=g),g}return{init:u,destroy:d,get:h}}function xIe(e,t,n,i,s,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&s,d=m(),f=g(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return gi(t[l]-x[l])}function g(){if(!u)return 0;const x=r.getComputedStyle(Sa(i));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const N=!E,_=x2(w,E);return N?h[E]+d:_?h[E]+f:w[E+1][l]-x[l]}).map(gi)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function EIe(e,t,n,i,s,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=b2(n);function p(y,x){return Bm(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?Bm(y).reduce((x,E,w)=>{const N=Sa(x)||0,_=N===0,T=E===jg(y),k=s[u]-r[N][u],C=s[u]-r[E][d],I=!i&&_?f(a):0,O=!i&&T?f(l):0,M=gi(C-O-(k+I));return w&&M>t+c&&x.push(E),T&&x.push(y.length),x},[]).map((x,E,w)=>{const N=Math.max(w[E-1]||0);return y.slice(N,x)}):[]}function g(y){return h?p(y,n):m(y)}return{groupSlides:g}}function vIe(e,t,n,i,s,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:N,watchFocus:_}=r,T=2,k=nIe(),C=k.measure(t),I=n.map(k.measure),O=JCe(c,u),M=O.measureSize(C),G=iIe(M),D=QCe(l,M),F=!f&&!!x,A=f||!!x,{slideSizes:j,slideSizesWithGaps:P,startGap:$,endGap:R}=xIe(O,C,I,n,A,s),Y=EIe(O,M,v,f,C,I,$,R,T),{snaps:Z,snapsAligned:B}=dIe(O,D,C,I,Y),te=-Sa(Z)+Sa(P),{snapsContained:z,scrollContainLimit:q}=oIe(M,te,B,x,T),W=F?z:B,{limit:K}=lIe(te,W,f),ue=iV(jg(W),d,f),pe=ue.clone(),_e=Bm(n),fe=({dragHandler:Ue,scrollBody:Ye,scrollBounds:yt,options:{loop:lt}})=>{lt||yt.constrain(Ue.pointerDown()),Ye.seek()},me=({scrollBody:Ue,translate:Ye,location:yt,offsetLocation:lt,previousLocation:ln,scrollLooper:Dt,slideLooper:kt,dragHandler:$t,animation:Ge,eventHandler:Kt,scrollBounds:nt,options:{loop:at}},Qe)=>{const Nt=Ue.settled(),ye=!nt.shouldConstrain(),Ze=at?Nt:Nt&&ye,Et=Ze&&!$t.pointerDown();Et&&Ge.stop();const sn=yt.get()*Qe+ln.get()*(1-Qe);lt.set(sn),at&&(Dt.loop(Ue.direction()),kt.loop()),Ye.to(lt.get()),Et&&Kt.emit("settle"),Ze||Kt.emit("scroll")},Re=ZCe(i,s,()=>fe(be),Ue=>me(be,Ue)),ge=.68,oe=W[ue.get()],Te=fp(oe),ve=fp(oe),Xe=fp(oe),De=fp(oe),ze=rIe(Te,Xe,ve,De,h,ge),Ne=hIe(f,W,te,K,De),Pe=pIe(Re,ue,pe,ze,Ne,De,a),Fe=uIe(K),qe=Fm(),Q=yIe(t,n,a,g),{slideRegistry:ae}=fIe(F,x,W,q,Y,_e),ie=mIe(e,n,ae,Pe,ze,qe,a,_),be={ownerDocument:i,ownerWindow:s,eventHandler:a,containerRect:C,slideRects:I,animation:Re,axis:O,dragHandler:eIe(O,e,i,s,De,tIe(O,s),Te,Re,Pe,ze,Ne,ue,a,G,p,m,y,ge,N),eventStore:qe,percentOfView:G,index:ue,indexPrevious:pe,limit:K,location:Te,offsetLocation:Xe,previousLocation:ve,options:r,resizeHandler:sIe(t,a,s,n,O,E,k),scrollBody:ze,scrollBounds:aIe(K,Xe,De,ze,G),scrollLooper:cIe(te,K,Xe,[Te,Xe,ve,De]),scrollProgress:Fe,scrollSnapList:W.map(Fe.get),scrollSnaps:W,scrollTarget:Ne,scrollTo:Pe,slideLooper:gIe(O,M,te,j,P,Z,W,Xe,n),slideFocus:ie,slidesHandler:bIe(t,a,w),slidesInView:Q,slideIndexes:_e,slideRegistry:ae,slidesToScroll:Y,target:De,translate:sV(O,t)};return be}function wIe(){let e={},t;function n(u){t=u}function i(u){return e[u]||[]}function s(u){return i(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=i(u).concat([d]),c}function a(u,d){return e[u]=i(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:s,off:a,on:r,clear:l};return c}const _Ie={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 SIe(e){function t(r,a){return nV(r,a||{})}function n(r){const a=r.breakpoints||{},l=Um(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function i(r){return r.map(a=>Um(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:i}}function NIe(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 i(){t=t.filter(r=>r.destroy())}return{init:n,destroy:i}}function f1(e,t,n){const i=e.ownerDocument,s=i.defaultView,r=SIe(s),a=NIe(r),l=Fm(),c=wIe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,g=O;let v=!1,y,x=u(_Ie,f1.globalOptions),E=u(x),w=[],N,_,T;function k(){const{container:_e,slides:fe}=E;_=(xN(_e)?e.querySelector(_e):_e)||e.children[0];const Re=xN(fe)?_.querySelectorAll(fe):fe;T=[].slice.call(Re||_.children)}function C(_e){const fe=vIe(e,_,T,i,s,_e,c);if(_e.loop&&!fe.slideLooper.canLoop()){const me=Object.assign({},_e,{loop:!1});return C(me)}return fe}function I(_e,fe){v||(x=u(x,_e),E=d(x),w=fe||w,k(),y=C(E),f([x,...w.map(({options:me})=>me)]).forEach(me=>l.add(me,"change",O)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(pe),y.eventHandler.init(pe),y.resizeHandler.init(pe),y.slidesHandler.init(pe),y.options.loop&&y.slideLooper.loop(),_.offsetParent&&T.length&&y.dragHandler.init(pe),N=a.init(pe,w)))}function O(_e,fe){const me=Y();M(),I(u({startIndex:me},_e),fe),c.emit("reInit")}function M(){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 G(){v||(v=!0,l.clear(),M(),c.emit("destroy"),c.clear())}function D(_e,fe,me){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(fe===!0?0:E.duration),y.scrollTo.index(_e,me||0))}function F(_e){const fe=y.index.add(1).get();D(fe,_e,-1)}function A(_e){const fe=y.index.add(-1).get();D(fe,_e,1)}function j(){return y.index.add(1).get()!==Y()}function P(){return y.index.add(-1).get()!==Y()}function $(){return y.scrollSnapList}function R(){return y.scrollProgress.get(y.offsetLocation.get())}function Y(){return y.index.get()}function Z(){return y.indexPrevious.get()}function B(){return y.slidesInView.get()}function te(){return y.slidesInView.get(!1)}function z(){return N}function q(){return y}function W(){return e}function K(){return _}function ue(){return T}const pe={canScrollNext:j,canScrollPrev:P,containerNode:K,internalEngine:q,destroy:G,off:p,on:h,emit:m,plugins:z,previousScrollSnap:Z,reInit:g,rootNode:W,scrollNext:F,scrollPrev:A,scrollProgress:R,scrollSnapList:$,scrollTo:D,selectedScrollSnap:Y,slideNodes:ue,slidesInView:B,slidesNotInView:te};return I(t,n),setTimeout(()=>c.emit("init"),0),pe}f1.globalOptions=void 0;function E2(e={},t=[]){const n=b.useRef(e),i=b.useRef(t),[s,r]=b.useState(),[a,l]=b.useState(),c=b.useCallback(()=>{s&&s.reInit(n.current,i.current)},[s]);return b.useEffect(()=>{g2(n.current,e)||(n.current=e,c())},[e,c]),b.useEffect(()=>{YCe(i.current,t)||(i.current=t,c())},[t,c]),b.useEffect(()=>{if(qCe()&&a){f1.globalOptions=E2.globalOptions;const u=f1(a,n.current,i.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,s]}E2.globalOptions=void 0;const rV=b.createContext(null);function Og(...e){return e.filter(Boolean).join(" ")}function Wx(){const e=b.useContext(rV);if(!e)throw new Error("useCarousel must be used within a ");return e}function TIe({orientation:e="horizontal",opts:t,setApi:n,plugins:i,className:s,children:r,...a}){const[l,c]=E2({...t,axis:e==="horizontal"?"x":"y"},i),[u,d]=b.useState(!1),[f,h]=b.useState(!1),p=b.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=b.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),g=b.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=b.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),g())},[g,m]);return b.useEffect(()=>{c&&n&&n(c)},[c,n]),b.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(rV.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:i,setApi:n,scrollPrev:m,scrollNext:g,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Og("ui-carousel",s),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function kIe({className:e,...t}){const{carouselRef:n,orientation:i}=Wx();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Og("ui-carousel__track",i==="vertical"?"is-vertical":void 0,e),...t})})}function AIe({className:e,...t}){const{orientation:n}=Wx();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Og("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function aV({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 CIe({className:e,...t}){const{orientation:n,scrollPrev:i,canScrollPrev:s}=Wx();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Og("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!s,onClick:i,"aria-label":"上一张",...t,children:o.jsx(aV,{direction:"left"})})}function IIe({className:e,...t}){const{orientation:n,scrollNext:i,canScrollNext:s}=Wx();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Og("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!s,onClick:i,"aria-label":"下一张",...t,children:o.jsx(aV,{direction:"right"})})}const LD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function RIe(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 jIe({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 OIe(){const[e,t]=b.useState(),[n,i]=b.useState(!1),[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState(!0);return b.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]),b.useEffect(()=>{if(!c||!e||n||s||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,s,n,a,c]),c?o.jsxs(TIe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>i(!0),onPointerLeave:()=>i(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(CIe,{"aria-label":"上一张新特性"}),o.jsx(kIe,{children:LD.map((d,f)=>o.jsx(AIe,{"aria-label":`${f+1} / ${LD.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(jIe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(RIe,{})}),o.jsx(IIe,{"aria-label":"下一张新特性"})]}):null}const MIe=3*60*1e3,LIe=3e3,DIe=10*60*1e3,h1="veadk.studio.pending-update",DD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],PIe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function BIe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function UIe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function FIe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(h1);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(h1),null}function Iw(e,t){window.localStorage.setItem(h1,JSON.stringify({targetVersion:e,startedAt:t}))}function nb(){window.localStorage.removeItem(h1)}function PD({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 $Ie(){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 HIe(){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 BD({lines:e,phase:t,copyState:n,onCopy:i}){const s=b.useRef(null),r=b.useRef(!0);return b.useEffect(()=>{const a=s.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:i,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:s,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 zIe({variant:e="default"}){var D,F;const[t]=b.useState(FIe),[n,i]=b.useState(null),[s,r]=b.useState(t?"submitting":"idle"),[a,l]=b.useState(!1),[c,u]=b.useState(""),[d,f]=b.useState((t==null?void 0:t.targetVersion)??""),[h,p]=b.useState(!1),[m,g]=b.useState("idle"),[v,y]=b.useState(0),x=b.useRef(null),E=b.useRef((t==null?void 0:t.targetVersion)??""),w=b.useRef((t==null?void 0:t.startedAt)??0);b.useEffect(()=>{if(!h)return;const A=P=>{var $;P.target instanceof Node&&!(($=x.current)!=null&&$.contains(P.target))&&p(!1)},j=P=>{P.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",j)}},[h]);const N=b.useCallback(async()=>{const A=await NB(E.current||void 0,w.current||void 0);return i(A),A},[]);if(b.useEffect(()=>{let A=!0;const j=()=>{N().catch(()=>{A&&i($=>$)})};j();const P=window.setInterval(j,MIe);return()=>{A=!1,window.clearInterval(P)}},[N]),b.useEffect(()=>{if(s!=="submitting")return;const A=window.setInterval(()=>{N().then(j=>{const P=E.current;if(P&&UIe(j.currentVersion,P)||!P&&!j.available&&j.latestVersion){window.clearInterval(A),nb(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(j.state==="error"){window.clearInterval(A),nb(),r("error"),u(j.message||"Studio 更新失败");return}Date.now()-w.current>DIe&&(window.clearInterval(A),nb(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},LIe);return()=>window.clearInterval(A)},[s,N]),b.useEffect(()=>{s!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),Iw(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[s,n]),b.useEffect(()=>{if(s!=="submitting"){y(0);return}const A=()=>{const P=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-P)/1e3)))};A();const j=window.setInterval(A,1e3);return()=>window.clearInterval(j)},[s]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||s!=="idle"))return null;const T=n.releases??[],k=d||((D=T[0])==null?void 0:D.version)||n.latestVersion,C=T.find(A=>A.version===k),I=async()=>{E.current=k,w.current=Date.now(),Iw(k,w.current),r("submitting"),u(""),g("idle");try{const A=await TB(k);E.current=A.version,Iw(A.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(A){if(A instanceof TypeError){u("连接已切换,正在确认新版本状态");return}nb(),r("error");const j=A instanceof Error?A.message:"Studio 更新失败";try{const P=await N();u(P.message||j)}catch{u(j)}}},O=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` -`).filter(Boolean),M=async()=>{try{await navigator.clipboard.writeText(O.join(` -`)),g("copied")}catch{g("error")}},G=()=>{var A;p(!1),g("idle"),u(""),f(E.current||((A=T[0])==null?void 0:A.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-${s}`,title:s==="submitting"?"正在更新 Studio":s==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var A;s==="published"?window.location.reload():(s==="submitting"||s==="error"||(f(((A=T[0])==null?void 0:A.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(PD,{className:"studio-update-icon"}),s==="submitting"?o.jsx(wa,{as:"span",children:"正在更新"}):s==="published"?o.jsx("span",{children:"刷新使用新版"}):s==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&s!=="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(PD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:s==="error"?"Studio 更新失败":s==="submitting"?"正在更新 Studio":s==="published"?"Studio 更新完成":"发现新版本"}),s==="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:PIe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx(BD,{lines:O,phase:"error",copyState:m,onCopy:()=>void M()}),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:"↗"})]})]}):s==="submitting"||s==="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:s==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:s==="published"?"已完成":BIe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:DD.map((A,j)=>{const P=DD.findIndex(Y=>Y.id===n.progressStage),$=s==="published"||jvoid M()}),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(A=>!A),onKeyDown:A=>{(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0))},children:[o.jsx("span",{children:k}),o.jsx($Ie,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:T.map(A=>{const j=A.version===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`studio-update-version-option${j?" is-selected":""}`,onClick:()=>{f(A.version),p(!1)},children:[o.jsx("span",{children:A.version}),j&&o.jsx(HIe,{})]},A.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:((C==null?void 0:C.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:"更新内容"}),C!=null&&C.changelog.length?o.jsx("ul",{children:C.changelog.map(A=>o.jsx("li",{children:A},A))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),s==="confirm"&&(r("idle"),u(""))},children:s==="submitting"?"后台运行":s==="confirm"?"取消":"关闭"}),s==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void I(),children:"立即更新"}),s==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:G,children:"重新尝试"})]})]})})]})}const VIe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function GIe({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:VIe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(zIe,{variant:"feature-link"})]})}const KIe=1e4;async function oV(e){const t=await fetch(Nn(e),{headers:V1({Accept:"application/json"}),signal:Cn(void 0,KIe)});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 qIe(){return oV("/web/sandbox/capabilities")}async function YIe(){return oV("/web/skill-creator/capabilities")}const WIe="我的智能体";function XIe({open:e,state:t,agentKind:n="codex",error:i,onCancel:s,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?WIe:`我的 ${a}`,c=b.useRef(null),u=b.useRef(null),d=b.useRef(null),f=b.useRef(!1),h=b.useRef(s),[p,m]=b.useState(l);if(h.current=s,b.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var N,_;(N=u.current)==null||N.focus(),(_=u.current)==null||_.select()}),w=N=>{var C;if(N.key==="Escape"){N.preventDefault(),h.current();return}if(N.key!=="Tab")return;const _=(C=c.current)==null?void 0:C.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(_!=null&&_.length))return;const T=_[0],k=_[_.length-1];N.shiftKey&&document.activeElement===T?(N.preventDefault(),k.focus()):!N.shiftKey&&document.activeElement===k&&(N.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 g=t==="loading",v=p.trim(),y=g?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return Ss.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!g&&s()},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(),!g&&!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:g?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Lm,{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:i||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):g?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,"/",RL]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:RL,disabled:g,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:s,children:g?"取消创建":"取消"}),!g&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function QIe({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 ZIe({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(i=>o.jsxs("div",{children:[o.jsx("dt",{children:i.label}),o.jsx("dd",{title:i.value,children:i.code?o.jsx("code",{children:i.value}):i.value})]},`${i.label}:${i.value}`))}):null]})}function JIe(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 eRe({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,i])=>o.jsxs("span",{title:`${n}: ${i.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:JIe(i)})]},n))})}function lV(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 cV(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 v2(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 zb(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 tRe(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 nRe(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 iRe(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 sRe(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 rRe(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 aRe(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 oRe(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 vN(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 lRe(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 Uo(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 Mg({open:e,title:t,subtitle:n,icon:i,className:s="",onClose:r,children:a}){const l=b.useId(),c=b.useRef(null),u=b.useRef(null),d=b.useRef(r);return d.current=r,b.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 g=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((g==null?void 0:g.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?Ss.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${s}`.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:i}),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(oRe,{})})]}),a]})}),document.body):null}function cRe({open:e,kind:t,launch:n,loading:i,error:s,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Mg,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(lV,{}):o.jsx(cV,{}),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:i?"is-loading":n?"is-ready":""}),i?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:i?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Uo,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):s?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:s}),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 uRe({open:e,threads:t,currentThreadId:n,loading:i,error:s,onSelect:r,onClose:a}){return o.jsx(Mg,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(lRe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:i?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Uo,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):s?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:s})]}):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(vN,{})]},l.id)})})})}const dRe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],fRe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],hRe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function pRe({open:e,value:t,busy:n,error:i,onSave:s,onClose:r}){const[a,l]=b.useState(t);return b.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Mg,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(v2,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(Rw,{label:"沙箱模式",choices:dRe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(Rw,{label:"审批策略",choices:fRe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(Rw,{label:"审批方式",choices:hRe,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,i?o.jsx("div",{className:"sandbox-control-error",children:i}):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:()=>s(a),children:[n?o.jsx(Uo,{className:"spin"}):null,"保存权限"]})]})]})}function Rw({label:e,choices:t,value:n,disabled:i,onChange:s}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:i,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:()=>s(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(),s(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 mRe({open:e,cwd:t,locked:n,busy:i,error:s,browse:r,onSave:a,onClose:l}){const[c,u]=b.useState(t||"/"),[d,f]=b.useState(null),[h,p]=b.useState(!1),[m,g]=b.useState("");b.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),g("");try{const x=await r(y);f(x),u(x.path)}catch(x){g(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Mg,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(zb,{}),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:i||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:i||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(Uo,{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(zb,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(vN,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(zb,{}),o.jsx("span",{children:y.name}),o.jsx(vN,{})]},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||s?o.jsx("div",{className:"sandbox-control-error",children:m||s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:i,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:i||n||!c.startsWith("/"),onClick:()=>a(c),children:[i?o.jsx(Uo,{className:"spin"}):null,"使用此目录"]})]})]})}function gRe({approval:e,busy:t,error:n,onDecision:i}){var a;const s=(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(Mg,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(v2,{}),className:"sandbox-approval-dialog",onClose:()=>{t||i("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,s?o.jsx("pre",{children:s}):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:()=>i("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>i("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>i("acceptForSession"),children:[t?o.jsx(Uo,{className:"spin"}):null,"本会话允许"]})]})]})}const bRe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function UD(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 yRe({session:e,onBack:t,onOpen:n,onDelete:i}){const[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(""),h=bRe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(g){f(g instanceof Error?g.message:String(g))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await i()}catch(g){f(g instanceof Error?g.message:String(g)),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:kx(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:UD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:UD(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?"打开中…":"打开智能体"})]})]}),s?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:g=>g.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 xRe="_SegmentedControl_1sl7d_1",ERe="_SegmentedControlOption_1sl7d_140",vRe="_SegmentedControlThumb_1sl7d_219",wN={SegmentedControl:xRe,SegmentedControlOption:ERe,SegmentedControlThumb:vRe},Vb=({value:e,onChange:t,children:n,block:i,pill:s=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=b.useRef(null),f=b.useRef(null),h=b.useCallback(m=>{const g=d.current,v=f.current;if(!g||!v)return;const y=g==null?void 0:g.querySelector('[data-state="on"]');if(!y)return;const x=g.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)`,g.scrollWidth>x){const N=x*.15,_=g.scrollLeft,T=y.offsetLeft,k=T+E;(T<_+N||k>_+x-N)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);Xwe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const g=m.style.transition;m.style.transition="",h(!1),m.style.transition=g}}),b.useLayoutEffect(()=>{const m=d.current,g=f.current;!m||!g||(h(!!g.style.transition),g.style.transition||WS(()=>{g.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,s]);const p=m=>{m&&t&&t(m)};return o.jsxs(VAe,{ref:d,className:ea(wN.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":i?"":void 0,"data-pill":s?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:wN.SegmentedControlThumb,ref:f}),n]})},wRe=({children:e,...t})=>o.jsx(WAe,{className:wN.SegmentedControlOption,...t,onPointerEnter:u$,children:o.jsx("span",{className:"relative",children:e})});Vb.Option=wRe;function _Re({workspace:e,onBack:t}){const[n,i]=b.useState("main"),[s,r]=b.useState(""),[a,l]=b.useState(!1),[c,u]=b.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";b.useEffect(()=>{i("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(i("terminal"),!(s||a)){l(!0),u("");try{const h=await nn.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:kx(e.session.status)})]})]})]}),o.jsxs(Vb,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():i("main")},children:[o.jsx(Vb.Option,{value:"main",children:"主界面"}),o.jsx(Vb.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:"重新尝试"})]}):s?o.jsx("iframe",{src:s,title:`${d} 终端`}):null})]})}const Xx=[{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 SRe(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 NRe(e){const t=e.toLocaleLowerCase();return Xx.filter(n=>!t||[n.name,n.description,...n.keywords].some(i=>i.toLocaleLowerCase().includes(t))).sort((n,i)=>FD(n,t)-FD(i,t)).slice(0,12)}function FD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:Xx.indexOf(e)}function TRe(e,t){const n=t.toLocaleLowerCase();return e.filter(i=>!n||`${i.id} ${i.displayName} ${i.description}`.toLocaleLowerCase().includes(n)).sort((i,s)=>{if(!n)return Number(s.isDefault)-Number(i.isDefault);const r=i.id.toLocaleLowerCase(),a=s.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,i.displayName)-l(a,s.displayName)}).slice(0,12)}function kRe(){return Xx.map(e=>({label:e.usage,value:e.description}))}function ARe(e,t){return e.map(n=>{const i=n.displayName.trim(),s=i&&i!==n.id?`${i} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${s} — ${n.description}`:s,code:!1}})}function CRe(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 IRe(e){return e.messages.map(t=>{var i;const n=[];return t.role==="user"&&((i=t.skillNames)!=null&&i.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(s=>({name:s,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function RRe({appName:e,value:t,onChange:n,onSubmit:i,disabled:s,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:g,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const N=b.useRef(null),_=b.useRef(null),T=b.useRef(null),k=b.useRef(null),[C,I]=b.useState(!1),[O,M]=b.useState(0),[G,D]=b.useState(!1);b.useLayoutEffect(()=>{const q=N.current;q&&(q.style.height="auto",q.style.height=`${Math.min(q.scrollHeight,200)}px`)},[t]);const F=b.useMemo(()=>{if(!t.startsWith("/")||t.includes(` -`))return;const q=t.slice(1),W=q.search(/\s/),K=(W<0?q:q.slice(0,W)).toLocaleLowerCase(),ue=W<0?"":q.slice(W).trim();if(!(W>=0&&K!=="model"))return{command:K,argument:ue,modelMode:W>=0}},[t]),A=b.useMemo(()=>{const q=/(^|\s)\$([^\s$]*)$/.exec(t);if(q)return{query:q[2],start:t.length-q[2].length-1,end:t.length}},[t]),j=b.useMemo(()=>{if(A){const q=A.query.toLocaleLowerCase();return g.filter(W=>!x.some(K=>K.id===W.id||K.name===W.name)).filter(W=>`${W.name} ${W.description}`.toLocaleLowerCase().includes(q)).slice(0,12).map(W=>({kind:"skill",skill:W}))}return F!=null&&F.modelMode?TRe(d,F.argument).map(q=>({kind:"model",model:q})):F?NRe(F.command).map(q=>({kind:"command",command:q})):[]},[A,d,x,g,F]),P=!G&&!!(A||F);b.useEffect(()=>{M(0)},[t]),b.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),b.useEffect(()=>{A&&!y&&!v&&E()},[A,E,y,v]);const $=a.some(q=>q.status!=="ready"),R=!s&&!r&&!$&&(t.trim().length>0||a.length>0);function Y(q){D(!1),I(!1),n(q)}function Z(q){if(q.kind==="skill"){if(!A)return;const W=t.slice(0,A.start)+t.slice(A.end);w([...x,q.skill]),Y(W),D(!0),requestAnimationFrame(()=>{var K,ue;(K=N.current)==null||K.focus(),(ue=N.current)==null||ue.setSelectionRange(A.start,A.start)});return}if(q.kind==="model"){Y(`/model ${q.model.id}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}if(q.command.name==="model"){Y("/model "),m(),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}if(q.command.name==="skill"||q.command.name==="skills"){Y(`/${q.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}Y(`/${q.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()})}function B(q){var W;I(!1),(W=q.current)==null||W.click()}function te(q){const W=q.target.files?Array.from(q.target.files):[];W.length&&l(W),q.target.value=""}const z=A?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx(Ix,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[P?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":z,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx(aRe,{}),o.jsx("span",{children:z}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:A?"$":"/"})]}),A&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(Uo,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(Uo,{className:"spin"})," 正在读取模型…"]}):j.length===0?o.jsx("div",{className:"composer-command-empty",children:A?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:j.map((q,W)=>{const K=q.kind==="command"?`command:${q.command.name}`:q.kind==="model"?`model:${q.model.id}`:`skill:${q.skill.id}`,ue=q.kind==="command"?q.command.usage:q.kind==="model"?q.model.displayName:`$${q.skill.name}`,pe=q.kind==="command"?q.command.description:q.kind==="model"?q.model.description||q.model.id:q.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":W===O,className:`composer-command-item${W===O?" is-active":""}`,onMouseDown:_e=>{_e.preventDefault(),Z(q)},onMouseEnter:()=>M(W),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${q.kind}`,"aria-hidden":"true",children:q.kind==="command"?"/":q.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ue}),o.jsx("span",{children:pe})]}),W===O?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:s,onClick:()=>I(q=>!q),children:o.jsx(tRe,{className:"icon"})}),C?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>I(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(_),children:[o.jsx(iRe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(T),children:[o.jsx(sRe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(k),children:[o.jsx(rRe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenTerminal()},children:[o.jsx(lV,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenBrowser()},children:[o.jsx(cV,{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(v2,{})}),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(zb,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(Cx,{skillPrefix:"$",value:{skills:x.map(({name:q,description:W})=>({name:q,description:W}))},onRemoveSkill:q=>w(x.filter(W=>W.name!==q))}):null,o.jsx("textarea",{ref:N,className:"comp-input scroll",rows:1,value:t,disabled:s,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":P,onChange:q=>Y(q.target.value),onBlur:()=>window.setTimeout(()=>D(!0),0),onKeyDown:q=>{if(!PA(q.nativeEvent)){if(P){if((q.key==="ArrowDown"||q.key==="Tab"&&!q.shiftKey)&&j.length>0){q.preventDefault(),M(W=>(W+1)%j.length);return}if((q.key==="ArrowUp"||q.key==="Tab"&&q.shiftKey)&&j.length>0){q.preventDefault(),M(W=>(W-1+j.length)%j.length);return}if(q.key==="Enter"&&!q.shiftKey&&j[O]){q.preventDefault(),Z(j[O]);return}if(q.key==="Escape"){q.preventDefault(),D(!0);return}}if(q.key==="Backspace"&&!t&&q.currentTarget.selectionStart===0&&x.length>0){q.preventDefault(),w(x.slice(0,-1));return}q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),R&&i(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!R,onClick:()=>i(t),"aria-label":"发送",children:r?o.jsx(Uo,{className:"icon spin"}):o.jsx(nRe,{className:"icon"})})]}),o.jsx("input",{ref:_,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:T,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:k,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:te})]})}function jRe({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:i,onSnapshot:s,onActivity:r,onError:a}){const l=b.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=b.useState(!1),[d,f]=b.useState([]),[h,p]=b.useState(!1),[m,g]=b.useState(!1),[v,y]=b.useState([]),[x,E]=b.useState(!1),[w,N]=b.useState(!1),[_,T]=b.useState([]),[k,C]=b.useState(!1),[I,O]=b.useState([]),[M,G]=b.useState(!1),[D,F]=b.useState("");b.useEffect(()=>{u(!1),f([]),p(!1),g(!1),y([]),E(!1),N(!1),T([]),C(!1),O([]),G(!1),F("")},[e==null?void 0:e.id]);const A=b.useCallback(async()=>{const B=l.current;if(!B)return[];p(!0);try{const te=await nn.listModels(B);return l.current===B&&(f(te),g(!0)),te}catch(te){return l.current===B&&(g(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===B&&p(!1)}},[a]),j=b.useCallback(async()=>{const B=l.current;if(!B)return[];E(!0);try{const te=await nn.listSkills(B);return l.current===B&&(y(te),N(!0)),te}catch(te){return l.current===B&&(N(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===B&&E(!1)}},[a]),P=b.useCallback(async()=>{const B=l.current;if(B){C(!0),G(!0),F("");try{const te=await nn.listThreads(B);l.current===B&&O(te.threads)}catch(te){l.current===B&&F(te instanceof Error?te.message:String(te))}finally{l.current===B&&G(!1)}}},[]);function $(B){s(B),T([]),y([]),N(!1),C(!1)}async function R(B){const te=l.current;if(!(!te||c||t)){if(B===(e==null?void 0:e.threadId)){C(!1);return}u(!0),a("");try{const z=await nn.resumeThread(te,B);if(l.current!==te)return;$(z),r("已恢复 Codex 对话",[{label:"Thread",value:z.threadId,code:!0}])}catch(z){l.current===te&&a(z instanceof Error?z.message:String(z))}finally{l.current===te&&u(!1)}}}async function Y(B){const te=e,z=B.trim();if(!z.startsWith("/"))return!1;if(!te||t||c)return!0;const q=SRe(z),W=q&&Xx.find(K=>K.name===q.name);if(!q||!W)return a(`未知快捷命令:${z.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),T([]),W.name==="model"&&!q.argument)return n("/model "),m||await A(),!0;if(W.name==="skill"||W.name==="skills")return n("$"),w||(await j()).length===0&&n(""),!0;if(W.name==="resume"&&!q.argument)return n(""),await P(),!0;n(""),u(!0);try{if(W.name==="model"){const K=await nn.setModel(te.id,q.argument);if(l.current!==te.id)return!0;i({model:K}),r("已切换 Codex 模型",[{label:"模型",value:K,code:!0}])}else if(W.name==="models"){const K=m?d:await A();if(l.current!==te.id)return!0;r(K.length>0?"Codex 可用模型":"当前没有可用模型",ARe(K,te.model))}else if(W.name==="new"||W.name==="clear"){const K=await nn.newThread(te.id);if(l.current!==te.id)return!0;$(K),r("已新建 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(W.name==="resume"){const K=await nn.resumeThread(te.id,q.argument);if(l.current!==te.id)return!0;$(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(W.name==="fork"){const K=await nn.forkThread(te.id);if(l.current!==te.id)return!0;$(K),r("已分叉 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}else if(W.name==="compact"){if(await nn.compactThread(te.id),l.current!==te.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:te.threadId,code:!0}])}else if(W.name==="archive"){const K=te.threadId,ue=await nn.archiveThread(te.id,K);if(l.current!==te.id)return!0;ue.snapshot&&$(ue.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:K,code:!0}])}else if(W.name==="status"){const K=await nn.getStatus(te.id);if(l.current!==te.id)return!0;i(K),r("Codex 当前状态",CRe(K))}else W.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",kRe())}catch(K){l.current===te.id&&(n(z),a(K instanceof Error?K.message:String(K)))}finally{l.current===te.id&&u(!1)}return!0}function Z(){y([]),N(!1),T([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:A,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:j,selectedSkills:_,setSelectedSkills:T,invalidateSkills:Z,threadsOpen:k,threads:I,threadsLoading:M,threadsError:D,openThreads:P,closeThreads:()=>{c||(C(!1),F(""))},resumeThread:R,executeSlash:Y}}function ORe({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 MRe({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 LRe(e){return e.toLowerCase()==="github"?o.jsx(xJ,{className:"icon"}):o.jsx(SJ,{className:"icon"})}function DRe({branding:e,onUsername:t}){const[n,i]=b.useState(null),[s,r]=b.useState(""),[a,l]=b.useState(0),[c,u]=b.useState(""),d=b.useRef(null);b.useEffect(()=>{let m=!0;return i(null),r(""),VP().then(g=>{m&&i(g)}).catch(g=>{m&&r(g instanceof Error?g.message:String(g))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;b.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=YJ.test(c),p=()=>{h&&t(c)};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||Nk,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(wa,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:s}),o.jsx("button",{type:"button",onClick:()=>l(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:n.map(m=>o.jsxs("button",{className:"login-btn",onClick:()=>XJ(m.loginUrl),children:[LRe(m.id),o.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[o.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:o.jsx(Rp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function PRe({open:e,checking:t,error:n,onLogin:i}){const s=b.useRef(null);return b.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?Ss.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(ak,{})}),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:s,type:"button",onClick:i,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function BRe({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)})}ku("Button",BRe);function URe({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)})}ku("Card",URe);const FRe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},$Re={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function uV(e){return FRe[e]??"flex-start"}function dV(e){return $Re[e]??"stretch"}function HRe({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:uV(e.justify),alignItems:dV(e.align)},children:n.map(i=>t.render(i))})}ku("Column",HRe);function zRe({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})}ku("Divider",zRe);const VRe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function GRe({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:VRe[t]??"•"})}ku("Icon",GRe);function KRe({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:uV(e.justify),alignItems:dV(e.align??"center")},children:n.map(i=>t.render(i))})}ku("Row",KRe);const qRe=new Set(["h1","h2","h3","h4","h5"]);function YRe({node:e,ctx:t}){const n=e.variant??"body",i=t.resolveString(e.text),s=qRe.has(n)?n:"p";return o.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:i})}ku("Text",YRe);async function jw(e){const[t,n,i]=await Promise.allSettled([qIe(),YIe(),vk(e)]);return{agentId:e,ready:!0,harnessEnabled:i.status==="fulfilled",builtinTools:i.status==="fulfilled"?i.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const ua={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},WRe=600,XRe=new Set,QRe=[];function Ha(){return{skills:[]}}function Ow(e){return`${qx(e)}.active`}function _N(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function ZRe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(_N(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function SN(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const i=SN(n,t);if(i)return i}}function fV(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(...fV(n)));return t}function $D(){const e=typeof localStorage<"u"?localStorage.getItem(ua.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function JRe({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 eje({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 tje({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 nje(){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 NN(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 ije(e){if(!e)return"";const t=[];return e.ts&&t.push(NN(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Gb(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function sje(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return Gb(e[n]);return""}const rje="send_a2ui_json_to_client";function aje(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===rje&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?S$(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function oje(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function lje(e){return new Promise((t,n)=>{let i="";try{i=new URL(e,window.location.href).protocol}catch{}if(i!=="http:"&&i!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{s.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(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&l(d)}catch{}}},500)})}function cje(e,t){const n=JSON.parse(JSON.stringify(e??{})),i=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=i.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,i.oauth2=s,n.exchangedAuthCredential=i,n}function HD({text:e}){const[t,n]=b.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(ka,{className:"icon"}):o.jsx($1,{className:"icon"})})}const zD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],VD=()=>zD[Math.floor(Math.random()*zD.length)];function xo(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function GD(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function KD(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 uje={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},dje={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},fje={user:"由我审批",auto_review:"自动审查"};function hje(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function pje(e){var n,i,s;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(i=e.grantRoot)!=null&&i.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(s=e.cwd)!=null&&s.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function qD(e){return e.flatMap(t=>t.apps.map(n=>qo(t.id,n)))}function mje(e,t){var n;return((n=e.find(i=>i.runtimeId&&i.apps.some(s=>qo(i.id,s)===t)))==null?void 0:n.runtimeId)??""}function gje(){const[e,t]=b.useState([]),[n,i]=b.useState(""),[s,r]=b.useState([]),[a,l]=b.useState(""),c=b.useRef(null),[u,d]=b.useState(!1),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,v]=b.useState([]),[y,x]=b.useState(!1),[E,w]=b.useState(!1),[N,_]=b.useState(""),[T,k]=b.useState(!1),[C,I]=b.useState(!1),[O,M]=b.useState(null),[G,D]=b.useState(null),[F,A]=b.useState(!1),[j,P]=b.useState(""),[$,R]=b.useState(null),[Y,Z]=b.useState(!1),[B,te]=b.useState(""),[z,q]=b.useState(!1),[W,K]=b.useState(!1),[ue,pe]=b.useState("confirm"),[_e,fe]=b.useState(""),[me,Re]=b.useState("codex"),[ge,oe]=b.useState(!1),[Te,ve]=b.useState(0),[Xe,De]=b.useState(null),[ze,Ne]=b.useState(null),Pe=b.useRef(null),Fe=b.useRef(null),qe=b.useRef((p==null?void 0:p.id)??""),Q=b.useRef(""),ae=b.useRef(0);qe.current=(p==null?void 0:p.id)??"";const[ie,be]=b.useState({}),Ue=a?ie[a]??[]:f,Ye=p?g:Ue,yt=(L,U)=>be(ee=>({...ee,[L]:typeof U=="function"?U(ee[L]??[]):U}));function lt(L,U,ee=[],le=""){if(qe.current!==L)return;const we=crypto.randomUUID(),Ie={role:"system",blocks:[],activity:{id:we,title:U,...ee.length>0?{details:ee}:{}},meta:{localId:we,ts:Date.now()/1e3}};v(tt=>{if(!le)return[...tt,Ie];const Ke=tt.findIndex(st=>{var ct;return((ct=st.meta)==null?void 0:ct.localId)===le});return Ke<0?[...tt,Ie]:[...tt.slice(0,Ke),Ie,...tt.slice(Ke)]})}const[ln,Dt]=b.useState(""),[kt,$t]=b.useState("agent"),[Ge,Kt]=b.useState(null),[nt,at]=b.useState({}),Qe=b.useRef(new Map),Nt=!n||nt.ready===!0&&nt.agentId===n,[ye,Ze]=b.useState(null),[Et,sn]=b.useState(!1),jn=b.useRef(0),[ot,mt]=b.useState([]),[rn,fn]=b.useState(Ha),[At,Wt]=b.useState(null),[Ti,bi]=b.useState(0),[On,$n]=b.useState(!1),[hn,vn]=b.useState(null),[Hn,Bi]=b.useState(!1),[Xi,ki]=b.useState([]),[Ui,gn]=b.useState(!1),Ai=b.useRef(new Set),[zn,Jn]=b.useState(()=>new Set),[Ci,yi]=b.useState(()=>new Set),pn=b.useRef(new Map),An=b.useRef(new Map),Mn=(L,U)=>Jn(ee=>{const le=new Set(ee);return U?le.add(L):le.delete(L),le}),Ln=L=>{const U=An.current.get(L);U!==void 0&&window.clearTimeout(U),An.current.delete(L),yi(ee=>new Set(ee).add(L))},ce=L=>{const U=An.current.get(L);U!==void 0&&window.clearTimeout(U);const ee=window.setTimeout(()=>{An.current.delete(L),yi(le=>{const we=new Set(le);return we.delete(L),we})},2400);An.current.set(L,ee)},Se=b.useRef(""),[Le,Ee]=b.useState(""),[rt,it]=b.useState(""),[jt,Pt]=b.useState(()=>new Set),[oi,Dn]=b.useState(!1),[ps,xi]=b.useState(VD),[wt,Tt]=b.useState(null),[Ii,Vn]=b.useState(!1),[Ds,ta]=b.useState(!1),[oo,is]=b.useState(""),Ps=b.useRef(!1),[Rr,Jo]=b.useState(null),[Ve,lo]=b.useState(""),[uc,re]=b.useState(),[gt,cn]=b.useState(null),li=(gt==null?void 0:gt.capabilities.runtimeScope)??"mine",[Jt,Ei]=b.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[se,ke]=b.useState("cloud"),[$e,Je]=b.useState(bm),[wn,ci]=b.useState(""),[Gn,ss]=b.useState(!1),[ui,Xt]=b.useState(!1),[an,Fi]=b.useState(!1),[Ws,na]=b.useState({}),[Ru,dc]=b.useState({}),[Lg,ia]=b.useState({}),ms=zn.has(a),ja=Ci.has(a),el=ms||u,Qx=!!a&&Hn,co=p?y:el,dh=co||!p&&ja,Bt=jRe({session:p,conversationBusy:y,onInputChange:Dt,onSessionPatch:L=>{const U=qe.current;m(ee=>(ee==null?void 0:ee.id)===U?{...ee,...L}:ee)},onSnapshot:L=>{const U=qe.current;v(IRe(L)),m(ee=>(ee==null?void 0:ee.id)===U?{...ee,threadId:L.threadId,cwd:L.cwd??ee.cwd,model:L.model??ee.model,workspaceLocked:L.workspaceLocked,permissions:L.permissions,busy:!1}:ee)},onActivity:(L,U=[])=>{const ee=qe.current;ee&<(ee,L,U)},onError:Ee}),Zx=Ws[a]??"",Jx=Ru[a]??XRe,Dg=Lg[a]??QRe,Qi=At==null?void 0:At.graph,Pg=[At==null?void 0:At.name,Qi==null?void 0:Qi.name,Qi==null?void 0:Qi.id].filter(L=>!!L),fh=rn.targetAgent&&Qi?SN(Qi,rn.targetAgent.name):Qi,Bg=(fh==null?void 0:fh.skills)??(rn.targetAgent?[]:(At==null?void 0:At.skills)??[]),Ug=Qi?fV(Qi):[];function ju(L){xo(L);for(const U of L)U.status==="uploading"?Ai.current.add(U.id):U.uri&&Nb(n,U.uri).catch(ee=>Ee(String(ee)))}function Oa(){jn.current+=1;const L=ye;Ze(null),sn(!1),L&&!L.id.startsWith("pending-")&&jCe(L.id).catch(U=>{Ee(U instanceof Error?U.message:String(U))})}async function tl(L){try{await J_(n,Ve,L),await Z_(n,Ve,L),r(U=>U.filter(ee=>ee.id!==L)),be(U=>{const{[L]:ee,...le}=U;return le})}catch(U){Ee(String(U))}}function nl(L){const U=ot.find(we=>we.id===L);if(!U)return;const ee=ot.filter(we=>we.id!==L);xo([U]),U.status==="uploading"&&Ai.current.add(L),mt(ee),ee.length===0&&!ln.trim()&&!!a&&Ye.length===0?(Se.current="",l(""),tl(a)):U.uri&&Nb(n,U.uri).catch(we=>Ee(String(we)))}const Ou=(L,U)=>{var Ie,tt,Ke,st,ct;const ee=U.author&&U.author!=="user"?U.author:void 0;ee&&(na(Oe=>({...Oe,[L]:ee})),dc(Oe=>({...Oe,[L]:new Set(Oe[L]??[]).add(ee)})),ia(Oe=>{var ut;return(ut=Oe[L])!=null&&ut.length?Oe:{...Oe,[L]:[ee]}}));const le=((Ie=U.actions)==null?void 0:Ie.transferToAgent)??((tt=U.actions)==null?void 0:tt.transfer_to_agent);le&&ia(Oe=>{const ut=Oe[L]??[];return ut[ut.length-1]===le?Oe:{...Oe,[L]:[...ut,le]}}),(((Ke=U.actions)==null?void 0:Ke.endOfAgent)??((st=U.actions)==null?void 0:st.end_of_agent)??((ct=U.actions)==null?void 0:ct.escalate))&&ia(Oe=>{const ut=Oe[L]??[];return ut.length<=1?Oe:{...Oe,[L]:ut.slice(0,-1)}})},[Ma,Ut]=b.useState($D),[Fg,$g]=b.useState([]),[eE,hh]=b.useState({}),ph=b.useCallback(L=>{$g(U=>{const ee=U.findIndex(we=>we.id===L.id);if(ee===-1)return[L,...U];const le=[...U];return le[ee]={...le[ee],...L},le})},[]),[Hg,zg]=b.useState(!0),[Mu,rs]=b.useState(!1),[mh,vi]=b.useState(!1),[Vg,Pn]=b.useState(!1),[tE,as]=b.useState(null),[gh,bh]=b.useState([]),La=b.useRef([]),Da=b.useRef(null),il=b.useRef(null),[Gg,fc]=b.useState([]),[di,Bs]=b.useState(""),Ts=b.useRef(null),[Lu,$i]=b.useState(!1),[H,ne]=b.useState(!1),[he,Ce]=b.useState(""),[et,_t]=b.useState("good"),[wi,uo]=b.useState("basic"),[bn,Pa]=b.useState("good"),[yh,Kg]=b.useState(""),[hV,pV]=b.useState(null),[sl,fi]=b.useState(!1),[Du,sa]=b.useState(null),nE=b.useRef(null),[rl,xh]=b.useState(()=>{const L=ma();return ih(L),L}),[mV,w2]=b.useState(!1),[gV,_2]=b.useState(""),[S2,qg]=b.useState(null),[bV,N2]=b.useState({}),[yV,T2]=b.useState(()=>new Set),[Pu,ra]=b.useState(null),[Yg,iE]=b.useState("cn-beijing"),[k2,Us]=b.useState(""),[A2,ks]=b.useState(""),[yn,Xs]=b.useState(null),[xV,sE]=b.useState(!1),Wg=b.useRef(!1),Bu=b.useRef(!1),Ba=b.useCallback(L=>{if(!Ve)return!1;try{kD(localStorage,Ve,L)}catch(U){return it(U instanceof Error?U.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return La.current=L,bh(L),it(""),!0},[Ve]),Ua=b.useCallback(L=>{var U;L&&((U=Da.current)==null?void 0:U.id)!==L||(Da.current=null,il.current!==null&&(window.clearTimeout(il.current),il.current=null))},[]),Uu=b.useCallback(()=>{const L=Da.current;L&&(Ua(),Ba([L,...La.current.filter(U=>U.id!==L.id)]))},[Ua,Ba]),EV=b.useCallback((L,U,ee)=>{!L||!Ve||(Da.current&&Da.current.id!==L&&Uu(),Da.current={id:L,draft:U,updatedAt:Date.now(),deploymentTarget:ee},il.current!==null&&window.clearTimeout(il.current),il.current=window.setTimeout(Uu,WRe))},[Uu,Ve]),rE=b.useCallback(L=>{!L||!Ve||(Ua(L),Ba(La.current.filter(U=>U.id!==L)))},[Ua,Ba,Ve]),C2=b.useCallback(L=>{if(!Ve||L.length===0)return;const U=new Set(L.map(ee=>ee.id));Da.current&&U.has(Da.current.id)&&Ua(),Ba(La.current.filter(ee=>!U.has(ee.id))),hh(ee=>Object.fromEntries(Object.entries(ee).filter(([le])=>!U.has(le)))),U.has(di)&&(Bs(""),as(null),ra(null),Ts.current=null,localStorage.removeItem(Ow(Ve)))},[Ua,Ba,di,Ve]),I2=b.useCallback(L=>{if(!L||!Ve)return;Ua(L);const U=Ts.current,ee=La.current.filter(le=>le.id!==L);Ba((U==null?void 0:U.id)===L?[U,...ee]:ee)},[Ua,Ba,Ve]);b.useEffect(()=>(window.addEventListener("pagehide",Uu),()=>{window.removeEventListener("pagehide",Uu)}),[Uu]),b.useEffect(()=>{if(!Ve){Ua(),La.current=[],bh([]),fc([]),Bs(""),it(""),Ts.current=null;return}let L=[],U="";try{L=wCe(localStorage,Ve),localStorage.getItem(qx(Ve))!==null&&kD(localStorage,Ve,L),U=localStorage.getItem(Ow(Ve))||"",it("")}catch(le){it(le instanceof Error?le.message:"无法读取本机草稿,请稍后重试。")}La.current=L,bh(L),fc(ZRe(Ve));const ee=L.find(le=>le.id===U);Ts.current=ee??null,Ma==="custom"&&ee&&(Bs(ee.id),as(ee.draft),ra(ee.deploymentTarget??null))},[Ua,Ve]),b.useEffect(()=>{if(!Ve)return;const L=Ow(Ve);try{Ma==="custom"&&di?localStorage.setItem(L,di):localStorage.removeItem(L)}catch{it("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[Ma,di,Ve]);const vV=b.useCallback(L=>{if(!Ve)return;const U=[...new Set(L.filter(Boolean))];fc(U),localStorage.setItem(_N(Ve),JSON.stringify(U))},[Ve]),wV=b.useCallback(async L=>{const U=L.filter(st=>!!st.runtimeId&&st.canDelete===!0);if(U.length===0)return;const ee=mje(rl,n),le=new Set(U.map(st=>st.runtimeId));T2(st=>{const ct=new Set(st);for(const Oe of le)ct.add(Oe);return ct}),V0(le);const we=new Set,Ie=new Set,tt=new Set,Ke=[];for(const st of U)try{if(!st.region)throw new Error("Runtime 缺少地域信息,无法删除");await CB(st.runtimeId,st.region),s1(st.runtimeId),we.add(st.runtimeId),Ie.add(st.id)}catch(ct){const Oe=ct instanceof Error?ct.message:String(ct);tt.add(st.runtimeId),Ke.push(`${st.label}: ${Oe}`)}if(we.size>0&&(V0(we),xh(ma()),qg(ct=>{if(!ct)return ct;const Oe=new Set(ct);for(const ut of we)Oe.delete(ut);return Oe}),N2(ct=>Object.fromEntries(Object.entries(ct).filter(([Oe])=>!we.has(Oe)))),fc(ct=>{const Oe=ct.filter(ut=>!Ie.has(ut));return Ve&&localStorage.setItem(_N(Ve),JSON.stringify(Oe)),Oe}),Ba(La.current.filter(ct=>{var Oe;return!((Oe=ct.deploymentTarget)!=null&&Oe.runtimeId)||!we.has(ct.deploymentTarget.runtimeId)})),(ee?we.has(ee):U.some(ct=>ct.id===n))&&(HV(),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),Us(""),ks(""),fi(!0),Ee("")),yn!=null&&yn.runtime&&we.has(yn.runtime.runtimeId)&&(Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),Us(""),ks(""),fi(!0),Ee(""))),tt.size>0&&T2(st=>{const ct=new Set(st);for(const Oe of tt)ct.delete(Oe);return ct}),Ke.length>0){const st=Ke.slice(0,3).join(";"),ct=Ke.length>3?`;另有 ${Ke.length-3} 个失败`:"";throw new Error(`${Ke.length} 个 Agent 删除失败:${st}${ct}`)}},[yn,n,Ba,rl,Ve]),aE=b.useCallback(async()=>{w2(!0),_2("");try{const L=[];let U="";do{const ee=await W1({scope:li,region:"all",pageSize:100,nextToken:U});L.push(...ee.runtimes),U=ee.nextToken}while(U&&L.length<2e3);qg(new Set(L.map(ee=>ee.runtimeId))),N2(Object.fromEntries(L.map(ee=>[ee.runtimeId,{canDelete:ee.canDelete}])))}catch(L){_2(L instanceof Error?L.message:String(L))}finally{w2(!1)}},[li]);function Xg(L){console.log("create agent draft:",L),Ut(null),ol()}function oE(L,U){console.log("Agent added, navigating to:",L,U),xh(ma()),qg(null),V0(),rE(di),Bs(""),Ts.current=null,ra(null),Us(""),ks(L),uo("basic"),Ut(null),ne(!0),i(L)}const lE=b.useCallback(L=>{Ut(null),Pn(!1),fi(!1),Xs(null),ne(!0),ks(""),uo("basic"),Us(L.id),Ee("")},[]),R2=b.useCallback(L=>{di&&hh(U=>({...U,[di]:L.id})),lE(L)},[di,lE]),j2=b.useCallback(async L=>{if(!L.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const U=(Pu==null?void 0:Pu.region)??Yg,ee=await Bb(L.runtimeId,L.agentName,L.region??U,L.version);xh(ma()),bi(we=>we+1);const le=await jw(ee);Qe.current.set(ee,le),at(le),qg(we=>{const Ie=new Set(we??[]);return Ie.add(L.runtimeId),Ie}),V0(),ra(null),rE(di),hh(we=>{if(!di||!we[di])return we;const Ie={...we};return delete Ie[di],Ie}),Bs(""),Ts.current=null,ks(ee),uo("basic"),Ut(null),ne(!0),i(ee)},[di,Yg,rE,Pu]),Eh=b.useRef(null),cE=b.useRef(new Map),hc=b.useRef(!0),al=b.useRef(!1),pc=b.useRef(null),O2=b.useRef({key:"",turnCount:0}),uE=(p==null?void 0:p.id)??a;b.useLayoutEffect(()=>{const L=Eh.current,U=O2.current,ee=U.key!==uE,le=!ee&&Ye.length>U.turnCount;if(O2.current={key:uE,turnCount:Ye.length},!L||Ye.length===0||!ee&&!le)return;hc.current=!0,al.current=!1,pc.current!==null&&(window.clearTimeout(pc.current),pc.current=null);const we=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ee||we){L.scrollTop=L.scrollHeight;return}al.current=!0,L.scrollTo({top:L.scrollHeight,behavior:"smooth"}),pc.current=window.setTimeout(()=>{al.current=!1,pc.current=null},450)},[uE,Ye.length]),b.useLayoutEffect(()=>{const L=Eh.current;!L||!hc.current||al.current||(L.scrollTop=L.scrollHeight)},[co,Ye]),b.useEffect(()=>{if(!yh||H||Ye.length===0)return;const L=cE.current.get(yh);if(!L)return;hc.current=!1,L.scrollIntoView({behavior:"smooth",block:"center"});const U=window.setTimeout(()=>{Kg("")},2600);return()=>window.clearTimeout(U)},[yh,H,Ye]),b.useEffect(()=>()=>{pc.current!==null&&window.clearTimeout(pc.current)},[]);const _V=b.useCallback(()=>{const L=Eh.current;!L||al.current||(hc.current=L.scrollHeight-L.scrollTop-L.clientHeight<32)},[]),SV=b.useCallback(L=>{L.deltaY<0&&(al.current=!1,hc.current=!1)},[]),NV=b.useCallback(()=>{al.current=!1,hc.current=!1},[]),TV=b.useCallback(()=>{const L=Eh.current;!L||!hc.current||al.current||(L.scrollTop=L.scrollHeight)},[]),dE=b.useCallback(()=>{Jo(null),W_().then(L=>{lo(L.userId),re(L.info),Xt(!!L.local),Tt(L.status),L.status==="authenticated"&&(Wg.current=!0,Bu.current=!0,localStorage.removeItem(ua.app),i(""),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),fi(!1))}).catch(L=>{Jo(L instanceof Error?L.message:String(L))})},[]);b.useEffect(()=>{dE()},[dE]),b.useEffect(()=>{const L=()=>{is(""),Vn(!0)};return window.addEventListener(X_,L),see()&&L(),()=>window.removeEventListener(X_,L)},[]);const kV=b.useCallback(async()=>{if(Ps.current)return;Ps.current=!0;const L=QJ();if(!L){Ps.current=!1,is("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}ta(!0),is("");try{for(;;){await new Promise(U=>window.setTimeout(U,1e3));try{const U=await W_();if(U.status==="authenticated"){lo(U.userId),re(U.info),Xt(!!U.local),Tt(U.status),Vn(!1),ree(),L.close();return}}catch{}if(L.closed){is("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{Ps.current=!1,ta(!1)}},[]);b.useEffect(()=>{ui&&Ve&&ZR(Ve)},[ui,Ve]),b.useEffect(()=>{if(wt!=="authenticated"||!Ve||!n){at({});return}const L=Qe.current.get(n);if(L){at(L);return}let U=!1;return at({}),jw(n).then(ee=>{U||(Qe.current.set(n,ee),at(ee))}),()=>{U=!0}},[n,wt,Ve]),b.useEffect(()=>{if(wt!=="authenticated"||!Ve){cn(null);return}let L=!1;return cn(null),SB().then(U=>{L||cn(U)}).catch(U=>{console.warn("[app] /web/access failed; using ordinary-user access:",U),L||cn(_B)}),()=>{L=!0}},[wt,Ve]),b.useEffect(()=>{wB().then(L=>{Ei(L.features),ke(L.agentsSource),Je(L.branding),ci(L.version),ss(!0)})},[]),b.useEffect(()=>{gt&&(gt.capabilities.createAgents||(Ut(null),as(null),vi(!1),Pn(!1),$g([])),gt.capabilities.manageAgents||ne(!1))},[gt]),b.useEffect(()=>{wt!=="authenticated"||se!=="cloud"||!Gn||!H||yn||aE()},[yn,se,wt,H,aE,Gn]),b.useEffect(()=>{document.title=$e.title;let L=document.querySelector('link[rel~="icon"]');L||(L=document.createElement("link"),L.rel="icon",document.head.appendChild(L)),L.removeAttribute("type"),L.href=$e.logoUrl||Nk},[$e]),b.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(L=>L.ok?L.json():null).then(L=>{L&&zg(!!L.credentials)}).catch(L=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",L)})},[]);function AV(L){ZR(L),Wg.current=!0,Bu.current=!0,localStorage.removeItem(ua.app),cn(null),Ut(null),as(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),ol(),i(""),fi(!1),lo(L),re({name:L}),Xt(!0),Tt("authenticated")}function CV(){cn(null),ui?(WJ(),lo(""),re(void 0),Tt("unauthenticated")):JJ()}b.useEffect(()=>{if(wt==="authenticated"){if(se==="cloud"){const L=qD(rl);i(U=>U&&L.includes(U)?U:(U&&(Bu.current=!0,localStorage.removeItem(ua.app)),""));return}YP().then(L=>{t(L);const U=qD(rl);i(ee=>ee&&(L.includes(ee)||U.includes(ee))?ee:(ee&&(Bu.current=!0,localStorage.removeItem(ua.app)),""))}).catch(L=>Ee(String(L)))}},[wt,se,rl]),b.useEffect(()=>{n?(Bu.current=!1,localStorage.setItem(ua.app,n)):localStorage.removeItem(ua.app)},[n]),b.useEffect(()=>{let L=!1;if(vn(null),ki([]),sl||yn||!n||!Ve||!a){Bi(!1);return}return Bi(!0),eS(n,Ve,a).then(U=>{L||(vn(U),vk(n).then(ee=>{L||ki(ee)}).catch(()=>{L||ki([])}))}).catch(()=>{L||vn(null)}).finally(()=>{L||Bi(!1)}),()=>{L=!0}},[yn,n,sl,Ve,a]),b.useEffect(()=>{let L=!1;if(Wt(null),fn(Ha()),wt!=="authenticated"||sl||yn||!n){$n(!1);return}return $n(!0),wk(n).then(U=>{L||Wt(U)}).catch(()=>{L||Wt(null)}).finally(()=>{L||$n(!1)}),()=>{L=!0}},[yn,n,Ti,wt,sl]),b.useEffect(()=>{gt&&localStorage.setItem(ua.view,gt.capabilities.createAgents?Ma??"chat":"chat")},[gt,Ma]),b.useEffect(()=>{localStorage.setItem(ua.session,a),Se.current=a},[a]),b.useEffect(()=>()=>pn.current.forEach(L=>L.abort()),[]),b.useEffect(()=>()=>An.current.forEach(L=>{window.clearTimeout(L)}),[]),b.useEffect(()=>()=>{var L,U;(L=Pe.current)==null||L.abort(),(U=Fe.current)==null||U.abort()},[]),b.useEffect(()=>{if(sl||yn||p||!n||!Ve)return;let L=!1;return(async()=>{const U=await Qg(n);if(!L){if(!Wg.current){Wg.current=!0;const ee=localStorage.getItem(ua.session)||"";if($D()===null&&ee&&U.some(le=>le.id===ee)){vh(ee);return}}ol()}})(),()=>{L=!0}},[yn,n,sl,p,Ve]),b.useEffect(()=>{const L=nE.current;L&&L.app===n&&(nE.current=null,vh(L.sid))},[n]);function IV(L,U){$i(!1),L===n?vh(U):(nE.current={app:L,sid:U},i(L))}async function Qg(L){try{const U=await yk(L,Ve),ee=await Promise.allSettled(U.map(Ie=>{var tt;return(tt=Ie.events)!=null&&tt.length?Promise.resolve(Ie):Oy(L,Ve,Ie.id)})),le=ee.find(Ie=>Ie.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(Ie.reason)));if((le==null?void 0:le.status)==="rejected")throw le.reason;const we=ee.flatMap(Ie=>Ie.status==="fulfilled"?[Ie.value]:[]);return r(we),we}catch(U){return Ee(String(U)),[]}}function M2(L="codex",U=!1){p||(Ee(""),fe(""),pe("confirm"),Re(L),oe(U),K(!0))}function RV(){var L;(L=Pe.current)==null||L.abort(),Pe.current=null,K(!1),pe("confirm"),fe(""),!p&&kt==="temporary"&&!ge&&$t("agent")}async function jV(L){var ee;(ee=Pe.current)==null||ee.abort();const U=new AbortController;Pe.current=U,pe("loading"),fe("");try{const le=me==="codex"?await nn.startSession({displayName:L,signal:U.signal}):await nn.startAgentSession(me,{displayName:L,signal:U.signal});if(Pe.current!==U)return;if(ge){ve(Ie=>Ie+1),K(!1),pe("confirm"),fi(!0);return}if(me!=="codex")return;const we=await nn.connectSession(le.id,{signal:U.signal});if(Pe.current!==U)return;Se.current="",l(""),h([]),Dt(""),fn(Ha()),$t("temporary"),Oa(),sn(!1),ju(ot),mt([]),v([]),m(we),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),fi(!1),De(null),Ne(null),K(!1),pe("confirm")}catch(le){if((le==null?void 0:le.name)==="AbortError"||Pe.current!==U)return;fe(le instanceof Error?le.message:String(le)),pe("error")}finally{Pe.current===U&&(Pe.current=null)}}async function fE(L){if(Ee(""),L.toolName==="codex"){const ee=await nn.connectSession(L.id);Se.current="",l(""),h([]),Dt(""),fn(Ha()),v([]),m(ee),De(null),Ne(null),fi(!1),ne(!1);return}const U=await nn.openAgentSession(L.toolName,L.id);Ne(U),De(null),fi(!1),ne(!1)}function OV(L){De(L),Ne(null),fi(!1),ne(!1),Ee("")}async function MV(L){(p==null?void 0:p.id)===L.id&&fo(),L.toolName==="codex"?await nn.deleteSession(L.id):await nn.deleteAgentSession(L.toolName,L.id),De(null),Ne(null),ve(U=>U+1),fi(!0)}function fo(){var U;(U=Fe.current)==null||U.abort(),Fe.current=null,qe.current="",Q.current="",x(!1),v([]),xo(ot),mt([]),Dt(""),Ee(""),$t("agent"),w(!1),_(""),k(!1),I(!1),M(null),D(null),A(!1),P(""),R(null),Z(!1),te(""),q(!1),ae.current+=1;const L=p;m(null),L&&nn.closeSession(L.id).catch(ee=>Ee(String(ee)))}async function hE(L){const U=p;if(U){M(L),D(null),P(""),A(!0);try{const ee=L==="terminal"?await nn.launchTerminal(U.id):await nn.launchBrowser(U.id);D(ee)}catch(ee){P(ee instanceof Error?ee.message:String(ee))}finally{A(!1)}}}async function LV(L){const U=p;if(!(!U||E)){w(!0),_("");try{const ee=await nn.updatePermissions(U.id,L);m(le=>(le==null?void 0:le.id)===U.id?{...le,permissions:ee}:le),lt(U.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:uje[ee.sandboxMode]},{label:"审批策略",value:dje[ee.approvalPolicy]},{label:"审批方式",value:fje[ee.approvalsReviewer]},{label:"网络访问",value:ee.networkAccess?"允许":"关闭"}]),qe.current===U.id&&k(!1)}catch(ee){_(ee instanceof Error?ee.message:String(ee))}finally{w(!1)}}}const DV=b.useCallback(async L=>{const U=p==null?void 0:p.id;if(!U)throw new Error("当前没有已连接的 Sandbox。");return nn.listDirectories(U,L)},[p==null?void 0:p.id]);async function PV(L){const U=p;if(!(!U||U.workspaceLocked||E)){w(!0),_("");try{const ee=await nn.updateWorkspace(U.id,L);m(le=>(le==null?void 0:le.id)===U.id?{...le,cwd:ee}:le),Bt.invalidateSkills(),lt(U.id,"已更新工作空间",[{label:"工作目录",value:ee,code:!0}]),qe.current===U.id&&I(!1)}catch(ee){_(ee instanceof Error?ee.message:String(ee))}finally{w(!1)}}}async function BV(L){const U=p,ee=$;if(!(!U||!ee||Y)){Z(!0),te("");try{await nn.resolveApproval(U.id,ee.id,L),lt(U.id,hje(ee,L),pje(ee),Q.current),R(le=>(le==null?void 0:le.id)===ee.id?null:le)}catch(le){te(le instanceof Error?le.message:String(le))}finally{Z(!1)}}}async function UV(L){const U=p;if(!U||z)return;const ee=++ae.current;Ee(""),q(!0);const le=Array.from(L).map(we=>{const Ie={id:GD(),mimeType:KD(we),name:we.name,sizeBytes:we.size,status:"uploading",previewUrl:URL.createObjectURL(we)};return{file:we,attachment:Ie}});mt(we=>[...we,...le.map(({attachment:Ie})=>Ie)]);try{const Ie=(await Promise.all(le.map(async({file:tt,attachment:Ke})=>{try{const st=await nn.uploadFile(U.id,tt);return ae.current!==ee?null:(mt(ct=>ct.map(Oe=>Oe.id===Ke.id?{...Oe,id:st.id,uri:st.path,name:st.name,mimeType:st.mimeType,sizeBytes:st.sizeBytes,status:"ready"}:Oe)),st)}catch(st){if(ae.current!==ee)return null;const ct=st instanceof Error?st.message:String(st);return mt(Oe=>Oe.map(ut=>ut.id===Ke.id?{...ut,status:"error",error:ct}:ut)),Ee(ct),null}}))).filter(tt=>tt!==null);ae.current===ee&&Ie.length>0&<(U.id,Ie.length===1?"已上传文件到 Sandbox":`已上传 ${Ie.length} 个文件到 Sandbox`,Ie.map((tt,Ke)=>({label:Ie.length===1?"文件":`文件 ${Ke+1}`,value:tt.path,code:!0})))}finally{ae.current===ee?q(!1):xo(le.map(({attachment:we})=>we))}}function FV(L){const U=ot.find(ee=>ee.id===L);U&&(xo([U]),mt(ee=>ee.filter(le=>le.id!==L)))}async function L2(L,U=[],ee=[]){var Qs;const le=p,we=U.filter(dt=>dt.status==="ready"&&dt.uri);if(!le||y||!L.trim()&&we.length===0)return;Ee(""),R(null),te("");const Ie=new AbortController;(Qs=Fe.current)==null||Qs.abort(),Fe.current=Ie;const tt=[];ee.length>0&&tt.push({kind:"invocation",value:{skills:ee.map(({name:dt,description:ft})=>({name:dt,description:ft}))}}),we.length>0&&tt.push({kind:"attachment",files:we.map(dt=>({id:dt.id,mimeType:dt.mimeType,name:dt.name,sizeBytes:dt.sizeBytes}))}),L.trim()&&tt.push({kind:"text",text:L});const Ke=we.map(dt=>dt.uri).filter(dt=>!!dt),ct=[ee.map(dt=>`$${dt.name}`).join(" "),L.trim()].filter(Boolean).join(" "),Oe=Ke.length>0?[ct,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...Ke.map(dt=>`- ${dt}`)].filter(Boolean).join(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let s=1;s=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function V2e(...e){var t;for(const n of e){const i=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(i)return i.slice(0,64)}return"local-skill"}function G2e(e,t){return t.trim()||e}function Xz(e){const t=e.map(i=>({path:i.path.replace(/\\/g,"/").replace(/^\.\//,""),text:i.text})).filter(i=>i.path.length>0&&!i.path.endsWith("/")),n=new Set(t.map(i=>i.path.split("/")[0]));if(n.size===1&&t.every(i=>i.path.includes("/"))){const i=[...n][0]+"/";return t.map(s=>({path:s.path.slice(i.length),text:s.text}))}return t}function K2e(e){const t=new Map,n=new Set;for(const i of e)if(xN.test("/"+i.path)){const s=i.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const i of e){const s=i.path.split("/");let r="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=xN.test("/"+i.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?i.path.slice(r.length+1):i.path,c=t.get(r)||[];c.push({path:l,text:i.text}),t.set(r,c)}return t}function q2e(e,t,n){const i=`${n}${e?"/"+e:""}`,s=t.find(c=>xN.test("/"+c.path));if(!s)return{hit:null,error:`${i} 缺少 SKILL.md`};const r=H2e(s.text),a=V2e(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${i} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${i} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:G2e(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function Y2e(e){const t=new Uint8Array(await e.arrayBuffer()),i=(await Wz(t)).map(s=>({path:s.name,text:s.text}));return Qz(Xz(i),e.name)}async function W2e(e,t=new Map){const n=[];for(let i=0;ie.file(t,n))}async function Q2e(e){const t=e.createReader(),n=[];for(;;){const i=await new Promise((s,r)=>t.readEntries(s,r));if(i.length===0)return n;n.push(...i)}}async function Zz(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await X2e(e),path:n}];if(!e.isDirectory)return[];const i=await Q2e(e);return(await Promise.all(i.map(s=>Zz(s,n)))).flat()}function Z2e({selected:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState([]),[a,l]=b.useState(!1),[c,u]=b.useState(!1),d=b.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=b.useRef([]),m=b.useRef(e);b.useEffect(()=>{p.current=s},[s]),b.useEffect(()=>{m.current=e},[e]);const g=E=>{const w=new Set([...p.current.map(k=>k.folder||k.name),...m.current.filter(k=>k.source==="local").map(k=>k.folder)]),N=[],_=[];for(const k of E.hits){const C=k.folder||k.name;if(w.has(C)){N.push(k.name);continue}w.add(C),_.push(k)}r(k=>[...k,..._]);const T=[...E.errors];if(N.length>0&&T.push(`已跳过重复技能:${N.join("、")}`),i(T),_.length===1&&E.errors.length===0&&N.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(N=>{var _;return(_=N.webkitGetAsEntry)==null?void 0:_.call(N)}).filter(N=>N!==null);if(w.length===0){i(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const N=(await Promise.all(w.map(k=>Zz(k)))).flat(),_=w.some(k=>k.isDirectory);if(!_&&N.length===1&&N[0].file.name.toLowerCase().endsWith(".zip")){g(await Y2e(N[0].file));return}if(!_){i(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const T=new Map(N.map(({file:k,path:C})=>[k,C]));g(await W2e(N.map(({file:k})=>k),T))}catch(N){i([`读取失败:${N instanceof Error?N.message:String(N)}`])}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(bk,{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(wu,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),s.length>0&&o.jsx("div",{className:"cw-skill-results",children:s.map(E=>{var N;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(Aa,{className:"cw-i cw-i-sm"}):o.jsx(Ns,{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:rc(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((N=E.localFiles)==null?void 0:N.length)??0," 个文件"]})]})]},E.id)})})]})}function J2e(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function eCe({selected:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState([]),[a,l]=b.useState(""),[c,u]=b.useState(!0),[d,f]=b.useState(!1),[h,p]=b.useState(null);b.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const x=await EU();y||(i(x),x.length>0&&l(x[0].id))}catch(x){y||p(x instanceof Error?x.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),b.useEffect(()=>{if(!a){r([]);return}const y=n.find(E=>E.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const E=await vU(a,y==null?void 0:y.region);x||r(E)}catch(E){x||p(E instanceof Error?E.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(y=>y.id===a),g=(y,x)=>e.some(E=>E.source==="skillspace"&&E.skillId===y&&(E.version||"")===x),v=y=>{if(m)if(g(y.skillId,y.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===y.skillId&&(x.version||"")===y.version)));else{const x=Ide(m,y);t([...e,{source:"skillspace",folder:x.folder||y.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return o.jsx("div",{className:"cw-skillspace",children:c?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?o.jsxs("div",{className:"cw-banner",children:[o.jsx(wu,{className:"cw-i"}),o.jsx("span",{children:h})]}):n.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:a,onChange:y=>l(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>o.jsxs("option",{value:y.id,children:[y.name||y.id,y.description?` — ${rc(y.description)}`:""]},y.id))}),m&&o.jsxs(o.Fragment,{children:[m.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:m.region,children:J2e(m.region)}),o.jsx("a",{href:Rde(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(xm,{className:"cw-i cw-i-sm"})})]})]}),d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const x=g(y.skillId,y.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>v(y),"aria-pressed":x,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?o.jsx(Aa,{className:"cw-i cw-i-sm"}):o.jsx(Ns,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:rc(y.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(EJ,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function tCe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:On(void 0,Yf)});if(t.status===409)throw new Error("服务端未配置 Volcengine 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 nCe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await tCe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function iCe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:On(void 0,Yf)});if(t.status===409)throw new Error("服务端未配置 Volcengine 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 sCe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await iCe(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const AD=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Cw(e){let t=0;for(let n=0;n>>0;return AD[t%AD.length]}function rCe(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,i=[];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):i.push(u);const s=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>r(f,d+1))}),a=i.sort(s).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 aCe(e,t){const n=[],i=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(i)};return e.forEach(i),n}function CD(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const oCe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function ID(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const i=String(n);return{key:oCe(t),value:i,long:i.length>80||i.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function Jz({appName:e,testRunId:t,sessionId:n,onClose:i,title:s="调用链路观测"}){const[r,a]=b.useState(null),[l,c]=b.useState(""),[u,d]=b.useState(new Set),[f,h]=b.useState(null);b.useEffect(()=>{a(null),c("");let w;if(t)w=KB(t,n);else if(e)w=wB(e,n);else{c("缺少调用链路来源");return}w.then(N=>{a(N),h(N.length?N.reduce((_,T)=>_.start_time<=T.start_time?_:T).span_id:null)}).catch(N=>c(String(N)))},[e,n,t]);const{rootNodes:p,min:m,total:g}=b.useMemo(()=>rCe(r??[]),[r]),v=b.useMemo(()=>aCe(p,u),[p,u]),y=(r==null?void 0:r.find(w=>w.span_id===f))??null,x=g/1e6,E=w=>d(N=>{const _=new Set(N);return _.has(w)?_.delete(w):_.add(w),_});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:s}),o.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${x.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(As,{className:"icon"})})]}),r==null&&!l&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载调用链路…"]}),l&&o.jsx("div",{className:"error",children:l}),r&&r.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),v.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:v.map(w=>{const N=w.span,_=(N.start_time-m)/g*100,T=Math.max((N.end_time-N.start_time)/g*100,.6),k=w.children.length>0;return o.jsxs("button",{className:`trace-row ${f===N.span_id?"active":""}`,onClick:()=>h(N.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:w.depth*14},children:[o.jsx("span",{className:`trace-caret ${k?"":"hidden"} ${u.has(N.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),k&&E(N.span_id)},children:o.jsx(nc,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:Cw(N.name)}}),o.jsx("span",{className:"trace-name",title:N.name,children:N.name})]}),o.jsx("span",{className:"trace-dur",children:CD(N.end_time-N.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${T}%`,background:Cw(N.name)}})})]},N.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:y?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:y.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:Cw(y.name)}}),CD(y.end_time-y.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:ID(y).filter(w=>!w.long).map(w=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:w.key}),o.jsx("span",{className:"td-val",children:w.value})]},w.key))}),ID(y).filter(w=>w.long).map(w=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:w.key}),o.jsx("pre",{className:"td-pre",children:w.value})]},w.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const lCe=b.lazy(()=>Zc(()=>import("./MarkdownPromptEditor-CAzekCWa.js"),__vite__mapDeps([0,1]))),EN="veadk.generatedAgentTestRuns",RD=4;function E2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(EN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function eV(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(EN,JSON.stringify(t)):window.sessionStorage.removeItem(EN)}catch{}}function cCe(e){eV([...E2(),e])}function Xh(e){eV(E2().filter(t=>t!==e))}function uCe(e,t,n="text/plain"){const i=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(i)}const dCe=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:JJ,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:wu,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:wJ},{id:"tools",label:"工具",hint:"可调用的能力",icon:QP},{id:"skills",label:"技能",hint:"声明式技能",icon:ru},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Tb},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:YP},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:gJ},{id:"review",label:"完成",hint:"预览并创建",icon:XJ}];function fCe({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 jD({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 tV({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 nV({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 hCe={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},OD={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},iV="REGISTRY_SPACE_ID",pCe=yU.filter(e=>e.key!==iV);function sV(e,t){var i,s,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((i=e.registryTopK)==null?void 0:i.trim())||wa.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||wa.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||wa.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function mCe({items:e,selected:t,onToggle:n,scrollRows:i}){return o.jsx("div",{className:`cw-checklist ${i?"cw-checklist-tools":""}`,style:i?{"--cw-checklist-max-height":`${i*40+(i-1)*8}px`}:void 0,children:e.map(s=>{const r=t.includes(s.id);return o.jsx(Gz,{id:`cw-check-${s.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(s.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:s.label})})},s.id)})})}function Iw({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(i=>{var r;const s=(t??((r=e[0])==null?void 0:r.id))===i.id;return o.jsx("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(i.id),"aria-pressed":s,children:o.jsx("span",{className:"cw-seg-title",children:i.label})},i.id)})})}function gCe(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Qh({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(i=>{const s=t[i.key]??i.defaultValue??"",r=c2(i,t),a=`cw-env-${i.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:[i.comment||i.key,i.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),i.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":i.help,"aria-label":`${i.comment||i.key}说明:${i.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:i.help})]}),i.link&&o.jsx("a",{className:"cw-env-link",href:i.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${i.link.label}`,"aria-label":`打开 OpenViking ${i.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(xm,{"aria-hidden":"true"})})]}),i.comment&&o.jsx("code",{title:i.key,children:i.key})]}),i.multiline||i.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:s,placeholder:i.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(i.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:gCe(i.key)?"password":"text",value:s,placeholder:i.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(i.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},i.key)})})}function Rw(e){return e.name.trim()||"未命名智能体中心"}function jw(e){return e.name.trim()||e.id||"未命名知识库"}function bCe({value:e,region:t,invalid:n,onChange:i}){const s=t.trim()||wa.region,[r,a]=b.useState([]),[l,c]=b.useState(!1),[u,d]=b.useState(null),[f,h]=b.useState(0),[p,m]=b.useState(!1),[g,v]=b.useState(""),y=b.useRef(null);b.useEffect(()=>{let C=!1;return c(!0),d(null),nCe({region:s}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[s,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?Rw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",N=l&&r.length===0,_=b.useMemo(()=>r.filter(C=>g1(g,[Rw(C),C.id,C.projectName])),[g,r]),T=!!(e&&!x&&g1(g,["已选择的智能体中心",e]));b.useEffect(()=>{if(!p)return;const C=O=>{const L=O.target;L instanceof Node&&y.current&&!y.current.contains(L)&&m(!1)},I=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const k=C=>{i(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",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:N,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(tV,{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:g,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.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(C=>{const I=Rw(C),O=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":O,className:`cw-a2a-space-option ${O?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>k(C.id),children:I},C.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(C=>C+1),children:l?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(nV,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(wu,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(mn,{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 yCe({value:e,onChange:t}){const[n,i]=b.useState([]),[s,r]=b.useState(!1),[a,l]=b.useState(null),[c,u]=b.useState(0),[d,f]=b.useState(!1),[h,p]=b.useState(""),m=b.useRef(null);b.useEffect(()=>{let _=!1;return r(!0),l(null),sCe().then(T=>{_||i(T)}).catch(T=>{_||(i([]),l(T instanceof Error?T.message:"加载失败"))}).finally(()=>{_||r(!1)}),()=>{_=!0}},[c]);const g=!e||n.some(_=>_.id===e.trim()),v=n.find(_=>_.id===e.trim()),y=v?jw(v):e&&!g?e:"请选择 VikingDB 知识库",x=s&&n.length===0,E=b.useMemo(()=>n.filter(_=>g1(h,[jw(_),_.id,_.description,_.projectName])),[n,h]),w=!!(e&&!g&&g1(h,[e]));b.useEffect(()=>{if(!d)return;const _=k=>{const C=k.target;C instanceof Node&&m.current&&!m.current.contains(C)&&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 N=_=>{t(_),f(!1)};return s&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",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(tV,{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:()=>N(e),children:e}),E.map(_=>{const T=jw(_),k=_.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":k,className:`cw-a2a-space-option ${k?"is-selected":""}`,title:`${T} (${_.id})`,onClick:()=>N(_.id),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:s,onClick:()=>u(_=>_+1),children:s?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(nV,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(wu,{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 xCe({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),i=r=>t(e.filter((a,l)=>l!==r)),s=()=>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(Ro,{initial:!1,children:e.map((r,a)=>o.jsxs(Jn.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:()=>i(a),"aria-label":"移除 MCP 工具",children:o.jsx(ic,{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})}),o.jsx("input",{className:"cw-input",value:r.authToken??"",placeholder:"Bearer Token(可选)",onChange:l=>n(a,{authToken:l.target.value})})]}):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:s,children:[o.jsx(Ns,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function rV({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 ECe({s:e,onRemove:t}){let n=ru,i="火山 Find Skill 技能广场";return e.source==="local"?(n=bk,i="本地"):e.source==="skillspace"&&(n=rV,i="AgentKit Skills 中心"),o.jsxs(Jn.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:[i,e.description?` · ${rc(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(As,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Ow=[{id:"local",label:"本地文件",icon:bk},{id:"skillspace",label:"AgentKit Skills 中心",icon:rV},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:X1}];function vCe({selected:e,onChange:t}){const[n,i]=b.useState("local"),[s,r]=b.useState(!1),a=Ow.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>Mw(u)!==c));return b.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(Ns,{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(Ro,{initial:!1,children:e.map(c=>o.jsx(ECe,{s:c,onRemove:()=>l(Mw(c))},Mw(c)))})})]}),o.jsx(Ro,{children:s&&o.jsx(Jn.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(Jn.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:()=>r(!1),children:o.jsx(As,{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) / ${Ow.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Ow.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>i(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx($2e,{selected:e,onChange:t}),n==="local"&&o.jsx(Z2e,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(eCe,{selected:e,onChange:t})]})]})]})})})]})}function Mw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function ib({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(Jn.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function wCe(e,t){var i;let n=e;for(const s of t)if(n=(i=n.subAgents)==null?void 0:i[s],!n)return!1;return!0}function sb(e,t){let n=e;for(const i of t)n=n.subAgents[i];return n}function Lg(e,t,n){if(t.length===0)return n(e);const[i,...s]=t,r=e.subAgents.slice();return r[i]=Lg(r[i],s,n),{...e,subAgents:r}}function _Ce(e,t){return Lg(e,t,n=>({...n,subAgents:[...n.subAgents,_s()]}))}function SCe(e,t,n){return Lg(e,t,i=>{const s=i.subAgents.slice();return s.splice(n,0,_s()),{...i,subAgents:s}})}function NCe(e,t){if(t.length===0)return e;const n=t.slice(0,-1),i=t[t.length-1];return Lg(e,n,s=>({...s,subAgents:s.subAgents.filter((r,a)=>a!==i)}))}const vN=e=>!Jx(e.agentType),MD=3;function TCe(e,t,n=!1){var s;if(Jx(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const i=Yl(e.name);return i||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":Yz(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function aV(e,t,n=[]){const i=[],s=Jx(e.agentType),r=TCe(e,t,n.length===0);return r&&i.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",typeLabel:qz(e.agentType).label,problem:r}),vN(e)&&e.subAgents.forEach((a,l)=>i.push(...aV(a,t,[...n,l]))),i}function kCe(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function oV(e){return 1+e.subAgents.reduce((t,n)=>t+oV(n),0)}function lV(e){const t=[],n={},i=r=>{var a,l,c,u;for(const d of r.builtinTools??[]){const f=Su.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=r.a2aRegistry)!=null&&a.enabled&&(t.push({env:yU}),Object.assign(n,sV(r.a2aRegistry,{includeDefaults:!0}))),r.memory.shortTerm&&t.push({env:((l=RS.find(d=>d.id===(r.shortTermBackend??"local")))==null?void 0:l.env)??[]}),r.memory.longTerm&&t.push({env:((c=jS.find(d=>d.id===(r.longTermBackend??"local")))==null?void 0:c.env)??[]}),r.knowledgebase&&t.push({env:((u=OS.find(d=>d.id===(r.knowledgebaseBackend??du)))==null?void 0:u.env)??[]}),r.tracing)for(const d of r.tracingExporters??[]){const f=_de.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}r.subAgents.forEach(i)};i(e);const s=zH(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function cV(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function wN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const i of e.subAgents){const s=wN(i);if(s)return s}return""}function uV(e){var i,s;const t=lV(e),n={...((i=e.deployment)==null?void 0:i.envValues)??{},...t.fixedValues};return{...cV(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(VH(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function ACe(e){return JSON.stringify(uV(e))}function b1(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Ud(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function CCe({enabled:e,disabledReason:t,variants:n,draftSnapshot:i,input:s,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const g=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===b1(i,x)),v=n.some(x=>x.phase==="sending"),y=g.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(),N=x.description.trim(),_=x.instruction.trim(),T=Ud(x),k=!!(w&&N&&_&&n.findIndex(P=>Ud(P)===T)!==E),C=!w||!N||!_||k,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==b1(i,x)),O=x.phase==="starting",L=x.phase==="ready"&&!I,G=O||x.phase==="sending",D=L&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=G||x.configOpen||C,A=w?N?_?k?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",j=O?"正在启动":I?"应用配置并重启":L||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||G,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||G,onClick:()=>d(x.id),children:o.jsx(jD,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(m1,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):O?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?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:L?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:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(m1,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(VA,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(z$,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[L||I||x.phase==="error"?o.jsx(WJ,{className:"cw-i"}):o.jsx(fCe,{className:"cw-i cw-debug-run-icon"}),j]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:G||!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:G,onClick:()=>d(x.id),children:o.jsx(jD,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),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:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.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:dV.map(P=>o.jsx(Gz,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.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:s,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{GA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!s.trim(),onClick:a,children:v?o.jsx(mn,{className:"cw-i cw-spin"}):o.jsx(HP,{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(Ns,{className:"cw-i"}),"添加对照组"]})]})]})}const rb=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],dV=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function ICe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function RCe({mode:e,busy:t,onChange:n,assistant:i}){const s=rb.findIndex(l=>l.id===e),r=rb[s-1],a=rb[s+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${i?" 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"}),i?o.jsx("div",{className:"cw-workspace-ai-slot",children:i}):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:rb.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 jCe({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:i,features:s,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var lo,rs,Us,Or,tl,Ve,co,uo,re,ct,fn,hi,Zt,_i;const[h,p]=b.useState(()=>i??_s()),[m,g]=b.useState(""),[v,y]=b.useState(!1),[x,E]=b.useState(!1),[w,N]=b.useState(null),_=m.trim(),T=_.length>0&&_.length{L.current=d},[d]),b.useEffect(()=>{var se;I!==C.current&&(C.current=I,(se=L.current)==null||se.call(L,h,O))},[h,O,I]);const[G,D]=b.useState("build"),[F,A]=b.useState(!1),[j,P]=b.useState(0),[$,R]=b.useState(null),[Y,Z]=b.useState(!1),[B,te]=b.useState((a==null?void 0:a.region)??l),K=(s==null?void 0:s.generatedAgentTestRun)===!0,z=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,q]=b.useState(()=>[{id:"baseline",name:"基准组",modelName:wN(i??_s()),description:(i??_s()).description,instruction:(i??_s()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ce,me]=b.useState("baseline"),_e=b.useRef(1),de=b.useRef(!1),ge=b.useRef(new Map),[Oe,Ee]=b.useState(0),[ae,Ne]=b.useState(""),[ve,Qe]=b.useState(null),[Me,ze]=b.useState(!1),[Se,Ue]=b.useState(!1),Pe=b.useRef(null),[Ke,Q]=b.useState(""),[oe,ie]=b.useState(!1),[be,Le]=b.useState(!1),[qe,gt]=b.useState([]),lt=b.useRef(null),ln=b.useRef({});async function Mt(){const se=new Set([...ge.current.values()].map(({run:Fe})=>Fe.runId)),Te=E2().filter(Fe=>!se.has(Fe));Te.length&&await Promise.all(Te.map(async Fe=>{try{await ad(Fe),Xh(Fe)}catch(et){console.warn("清理遗留调试运行失败",et)}}))}b.useEffect(()=>(Mt(),()=>{for(const{run:se}of ge.current.values())ad(se.runId).then(()=>Xh(se.runId)).catch(Te=>console.warn("清理调试运行失败",Te));ge.current.clear()}),[]),b.useEffect(()=>()=>{var se;(se=Pe.current)==null||se.call(Pe,!1),Pe.current=null},[]);const kt=b.useRef(null);kt.current||(kt.current=({meta:se,children:Te})=>o.jsxs("section",{ref:Fe=>{ln.current[se.id]=Fe},id:`cw-sec-${se.id}`,"data-step-id":se.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:se.label})}),o.jsx("div",{className:"cw-sec-body",children:Te})]}));const Vt=wCe(h,qe)?qe:[],He=sb(h,Vt),Xt=Vt.length===0,nt=`cw-model-advanced-${Vt.join("-")||"root"}`,yt=`cw-a2a-registry-advanced-${Vt.join("-")||"root"}`,Je=se=>p(Te=>Lg(Te,Vt,Fe=>({...Fe,...se}))),ot=(se,Te)=>p(Fe=>{var et;return{...Fe,deployment:{...Fe.deployment??{feishuEnabled:!1},envValues:{...((et=Fe.deployment)==null?void 0:et.envValues)??{},[se]:Te}}}}),ye=se=>Je({a2aRegistry:{...He.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...se}}),Xe=(se,Te)=>{if(!(se in OD))return;const Fe=OD[se];ye({[Fe]:Te}),ot(se,Te)},St=se=>{if(!(Xt&&se==="a2a")){if(se==="a2a"){Je({agentType:se,a2aRegistry:{...He.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Je({agentType:se,a2aRegistry:He.a2aRegistry?{...He.a2aRegistry,enabled:!1}:void 0})}},Qt=(se,Te)=>{p(se),Te&>(Te)},Rn=async()=>{const se=m.trim();if(!(!se||v)&&!(se.length{const Te=sb(h,se);if(!vN(Te)||se.length>=MD)return;const Fe=_Ce(h,se),et=sb(Fe,se).subAgents.length-1;Qt(Fe,[...se,et])},Ze=(se,Te)=>{const Fe=sb(h,se);if(!vN(Fe)||se.length>=MD)return;const et=Math.max(0,Math.min(Te,Fe.subAgents.length)),Nn=SCe(h,se,et);Qt(Nn,[...se,et])},cn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(_s()),gt([]),A(!1))},un=se=>{if(se.length===0){cn();return}Qt(NCe(h,se),se.slice(0,-1))},Et=He.builtinTools??[],nn=He.mcpTools??[],Ci=He.selectedSkills??[],ii=se=>Je({builtinTools:Et.includes(se)?Et.filter(Te=>Te!==se):[...Et,se]}),Dn=Yz(He.agentType),Pn=Jx(He.agentType),gn=b.useMemo(()=>R$(h),[h]),_n=Pn?null:Yl(He.name)??(gn.has(He.name)?"Agent 名称在当前结构中必须唯一":null),Bn=_n!==null,$i=!Pn&&He.description.trim().length===0,gs=He.instruction.trim().length===0,Ii=Pn&&!((lo=He.a2aRegistry)!=null&&lo.registrySpaceId.trim()),Ri=se=>F&&se?`is-error cw-error-shake-${j%2}`:"",Un=b.useMemo(()=>aV(h,gn),[h,gn]),vi=Un.length===0,Sn=b.useMemo(()=>ACe(h),[h]),si=W.find(se=>se.id===ce)??W[0],ji=b.useMemo(()=>lV(h),[h]),Oi=se=>{var Te;(Te=ln.current[se])==null||Te.scrollIntoView({behavior:"smooth",block:"start"})},bn=()=>vi?!0:(A(!0),P(se=>se+1),Un[0]&&(gt(Un[0].path),window.requestAnimationFrame(()=>Oi(Un[0].problem==="缺少子 Agent"?"type":"basic"))),!1),jn=async()=>{Qe(null);const se=[...ge.current.values()];ge.current.clear(),Ee(0),q(Te=>Te.map(Fe=>({...Fe,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(se.map(async({run:Te})=>{try{await ad(Te.runId),Xh(Te.runId)}catch(Fe){console.warn("清理调试运行失败",Fe)}}))},Fn=async se=>{const Te=ge.current.get(se);if(Te){ge.current.delete(se),Ee(ge.current.size);try{await ad(Te.run.runId),Xh(Te.run.runId)}catch(Fe){console.warn("清理调试运行失败",Fe)}}},$n=se=>{const Te=ge.current.get(se),Fe=W.find(et=>et.id===se);!Te||!Fe||Qe({runId:Te.run.runId,sessionId:Te.sessionId,variantName:Fe.name})},yn=se=>{const Te=Pe.current;Pe.current=null,Te==null||Te(se)},_t=()=>{Se||(ze(!1),yn(!1))},ue=async()=>{if(!Se){Ue(!0);try{await jn(),ze(!1),yn(!0)}finally{Ue(!1)}}},fe=async()=>G!=="validate"||Oe===0?!0:Pe.current?!1:new Promise(se=>{Pe.current=se,ze(!0)}),De=async se=>{var Fe;if(!await fe())return;if(Q(""),!bn()){D("build");return}const Te=GH(ji.specs,((Fe=h.deployment)==null?void 0:Fe.envValues)??{});if(Te){Q(`${Te.spec.comment||Te.spec.key}:${Te.error}`),D("build");return}Z(!0);try{const et=se?W.find(qn=>qn.id===se):si;et&&me(et.id);const Nn=et?{...h,modelName:et.modelName||h.modelName,description:et.description,instruction:et.instruction}:h,pi=await ix(cV(Nn));Nn!==h&&p(Nn),R(pi),D("publish")}catch(et){Q(et instanceof Error?et.message:String(et))}finally{Z(!1)}},We=async se=>{if(!K||Y||!bn())return;const Te=W.find(an=>an.id===se);if(!Te||Te.phase==="starting"||Te.phase==="sending")return;const Fe=Te.modelName.trim(),et=Te.description.trim(),Nn=Te.instruction.trim(),pi=Ud(Te),qn=W.findIndex(an=>an.id===se),as=W.findIndex(an=>Ud(an)===pi);if(!Fe||!et||!Nn||as!==qn)return;const Yn=b1(Sn,Te);q(an=>an.map(Hi=>Hi.id===se?{...Hi,configOpen:!1,phase:"starting",messages:[],error:null}:Hi)),Ne("");let qt=null;try{await Fn(se),await Mt();const an={...h,modelName:Te.modelName||h.modelName,description:Te.description,instruction:Te.instruction};qt=await VB(uV(an)),cCe(qt.runId);const Hi=await GB(qt.runId,"test_user");ge.current.set(se,{run:qt,sessionId:Hi}),Ee(ge.current.size),q(Qs=>Qs.map(ia=>ia.id===se?{...ia,phase:"ready",runtimeSnapshot:Yn}:ia))}catch(an){if(qt)try{await ad(qt.runId),Xh(qt.runId)}catch(Hi){console.warn("清理调试运行失败",Hi)}q(Hi=>Hi.map(Qs=>Qs.id===se?{...Qs,phase:"error",runtimeSnapshot:"",error:an instanceof Error?an.message:String(an)}:Qs))}},rt=async()=>{const se=ae.trim(),Te=W.filter(et=>et.phase==="ready"&&et.runtimeSnapshot===b1(Sn,et)&&ge.current.has(et.id));if(!se||Te.length===0)return;Ne("");const Fe=new Set(Te.map(et=>et.id));q(et=>et.map(Nn=>Fe.has(Nn.id)?{...Nn,phase:"sending",messages:[...Nn.messages,{role:"user",content:se},{role:"assistant",content:"",blocks:[]}]}:Nn)),await Promise.all(Te.map(async et=>{const Nn=ge.current.get(et.id);if(Nn)try{let pi=xa();for await(const qn of qB({runId:Nn.run.runId,userId:"test_user",sessionId:Nn.sessionId,text:se})){const as=qn.error||qn.errorMessage||qn.error_message;if(as||(pi=gf(pi,qn)),q(Yn=>Yn.map(qt=>{if(qt.id!==et.id)return qt;const an=[...qt.messages],Hi={...an[an.length-1]};return as?Hi.error=String(as):(Hi.content=pi.blocks.filter(Qs=>Qs.kind==="text").map(Qs=>Qs.text).join(""),Hi.blocks=pi.blocks),an[an.length-1]=Hi,{...qt,messages:an}})),as)break}}catch(pi){q(qn=>qn.map(as=>{if(as.id!==et.id)return as;const Yn=[...as.messages],qt={...Yn[Yn.length-1]};return qt.error=pi instanceof Error?pi.message:String(pi),Yn[Yn.length-1]=qt,{...as,messages:Yn}}))}finally{q(pi=>pi.map(qn=>qn.id===et.id?{...qn,phase:"ready"}:qn))}}))},at=()=>{q(se=>{if(se.length>=3)return se;const Te=_e.current++,Fe=`variant-${Te}`;return[...se,{id:Fe,name:`对照组 ${Te}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},sn=async se=>{await Fn(se),q(Te=>Te.filter(Fe=>Fe.id!==se)),ce===se&&me("baseline")},rn=(se,Te)=>q(Fe=>Fe.map(et=>et.id===se?{...et,...Te}:et)),fi=(se,Te,Fe)=>{se==="baseline"&&Te==="modelName"&&(de.current=!0),rn(se,{[Te]:Fe}),!(ce!==se||se==="baseline")&&me("baseline")},Zi=se=>{const Te=W.find(Yn=>Yn.id===se);if(!Te)return;const Fe=Te.modelName.trim(),et=Te.description.trim(),Nn=Te.instruction.trim(),pi=Ud(Te),qn=W.findIndex(Yn=>Yn.id===se),as=W.findIndex(Yn=>Ud(Yn)===pi);if(!(!Fe||!et||!Nn||as!==qn)){if(se==="baseline"){rn(se,{configOpen:!1});return}We(se)}},dn=async(se,Te,Fe)=>{var pi;const et=(pi=h.deployment)==null?void 0:pi.network,Nn=et&&et.mode&&et.mode!=="public"?{mode:et.mode,vpc_id:et.vpcId,subnet_ids:et.subnetIds,enable_shared_internet_access:et.enableSharedInternetAccess}:void 0;return ug(se.name,se.files,{region:(a==null?void 0:a.region)??B,projectName:"default",network:Nn},{...Fe,onStage:Te,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Hn=()=>{bn()&&(q(se=>se.map(Te=>Te.id==="baseline"&&!ge.current.has(Te.id)?{...Te,modelName:de.current?Te.modelName:wN(h),description:h.description,instruction:h.instruction}:Te)),D("validate"))},Ut=async se=>{if(se==="publish"){if(!bn())return;$?D("publish"):De();return}if(se==="validate"){Hn();return}await fe()&&D(se)},vt=kt.current,wi=se=>dCe.find(Te=>Te.id===se),bs=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Ro,{initial:!1,mode:"wait",children:x?o.jsxs(Jn.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:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(Jn.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:se=>{se.preventDefault(),Rn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!T,"aria-describedby":T?"ai-requirement-error":void 0,onChange:se=>g(se.target.value),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),Rn())}}),o.jsx("button",{type:"submit",disabled:v||!_||!!T,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),T&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:T})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${G}`,children:[o.jsx(ICe,{mode:G}),Ke&&o.jsx(m1,{className:"cw-workspace-alert",message:Ke}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[G==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(jm,{draft:h,direction:"horizontal",selectedPath:Vt,onSelect:gt,onAdd:Bt,onInsert:Ze,onDelete:un}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:lt,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:wi("type"),children:[o.jsx(yN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:He.agentType??"llm",onChange:St,children:P2e.map(se=>{const Te=(He.agentType??"llm")===se.id,Fe=Xt&&se.id==="a2a",et=Fe?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":se.id,className:`cw-agent-type-option ${Te?"is-on":""} ${Fe?"is-disabled":""}`,tabIndex:Fe?0:void 0,"aria-describedby":et,children:[o.jsx(yN.Item,{value:se.id,disabled:Fe,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:hCe[se.id]})})}),Fe&&o.jsx("span",{id:et,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},se.id)})}),F&&Dn&&He.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:kCe({name:He.name.trim()||"未命名",typeLabel:qz(He.agentType).label})})]}),o.jsx(vt,{meta:wi("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Pn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Xt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Ri(Bn)}`,value:He.name,placeholder:"assistant",onChange:se=>Je({name:se.target.value})}),F&&_n?o.jsx("span",{className:"cw-error-text",children:_n}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Xt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Ri($i)}`,value:He.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:se=>Je({description:se.target.value})}),F&&$i?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Xt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),Dn?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:se=>Je({maxIterations:Math.max(1,Number(se.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Pn?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(bCe,{value:((rs=He.a2aRegistry)==null?void 0:rs.registrySpaceId)??"",region:((Us=He.a2aRegistry)==null?void 0:Us.registryRegion)||wa.region,invalid:F&&Ii,onChange:se=>Xe(iV,se)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":be,"aria-controls":yt,onClick:()=>Le(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(nc,{className:`cw-more-options-chevron ${be?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ro,{initial:!1,children:be&&o.jsx(Jn.div,{id:yt,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(Qh,{env:pCe,values:sV(He.a2aRegistry,{includeDefaults:!1}),onChange:Xe})})}),F&&Ii&&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(b.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(lCe,{value:He.instruction,invalid:gs,onChange:se=>Je({instruction:se})})}),F&&gs?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!Dn&&!Pn&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{meta:wi("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:"doubao-seed-2-1-pro-260628",onChange:se=>Je({modelName:se.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":oe,"aria-controls":nt,onClick:()=>ie(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(nc,{className:`cw-more-options-chevron ${oe?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ro,{initial:!1,children:oe&&o.jsxs(Jn.div,{id:nt,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:se=>Je({modelProvider:se.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:"https://ark.cn-beijing.volces.com/api/v3/",onChange:se=>Je({modelApiBase:se.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(vt,{meta:wi("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(mCe,{items:xU,selected:Et,onToggle:ii,scrollRows:6})}),o.jsx(Ro,{initial:!1,children:Et.includes("run_code")&&o.jsxs(Jn.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(Qh,{env:((Or=Su.find(se=>se.id==="run_code"))==null?void 0:Or.env)??[],values:((tl=h.deployment)==null?void 0:tl.envValues)??{},onChange:ot})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(xCe,{tools:nn,onChange:se=>Je({mcpTools:se})})]})]})}),o.jsx(vt,{meta:wi("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(vCe,{selected:Ci,onChange:se=>Je({selectedSkills:se})})})}),o.jsx(vt,{meta:wi("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(ib,{checked:He.knowledgebase,onChange:se=>Je({knowledgebase:se}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Tb}),He.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(Iw,{options:OS,value:He.knowledgebaseBackend,onChange:se=>Je({knowledgebaseBackend:se,knowledgebaseIndex:se==="viking"?He.knowledgebaseIndex:""})}),(He.knowledgebaseBackend??du)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(yCe,{value:He.knowledgebaseIndex??"",onChange:se=>Je({knowledgebaseIndex:se})})]}),o.jsx(Qh,{env:((Ve=OS.find(se=>se.id===(He.knowledgebaseBackend??du)))==null?void 0:Ve.env)??[],values:((co=h.deployment)==null?void 0:co.envValues)??{},onChange:ot})]})]})}),Xt&&o.jsx(vt,{meta:wi("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(ib,{checked:He.memory.shortTerm,onChange:se=>Je({memory:{...He.memory,shortTerm:se}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:YP}),He.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(Iw,{options:RS,value:He.shortTermBackend,onChange:se=>Je({shortTermBackend:se})}),o.jsx(Qh,{env:((uo=RS.find(se=>se.id===(He.shortTermBackend??"local")))==null?void 0:uo.env)??[],values:((re=h.deployment)==null?void 0:re.envValues)??{},onChange:ot})]}),o.jsx(ib,{checked:He.memory.longTerm,onChange:se=>Je({memory:{...He.memory,longTerm:se}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Tb}),He.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(Iw,{options:jS,value:He.longTermBackend,onChange:se=>Je({longTermBackend:se})}),o.jsx(Qh,{env:((ct=jS.find(se=>se.id===(He.longTermBackend??"local")))==null?void 0:ct.env)??[],values:((fn=h.deployment)==null?void 0:fn.envValues)??{},onChange:ot}),o.jsx(ib,{checked:!!He.autoSaveSession,onChange:se=>Je({autoSaveSession:se}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Tb})]})]})})]})]})})})})})]})}),G==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(CCe,{enabled:K,disabledReason:z,variants:W,draftSnapshot:Sn,input:ae,onInput:Ne,onSend:rt,onStartVariant:We,onDeployVariant:se=>void De(se),onAddVariant:at,onRemoveVariant:sn,onToggleConfig:se=>{const Te=W.find(Fe=>Fe.id===se);Te&&rn(se,{configOpen:!Te.configOpen})},onCompleteConfig:Zi,onConfigChange:fi,onOpenTrace:$n})})}),G==="publish"&&o.jsx("div",{className:"cw-preview-body",children:$?o.jsx(qx,{embedded:!0,project:$,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:oV(h),releaseConfiguration:si?{modelName:si.modelName||h.modelName||"默认模型",description:si.description,instruction:si.instruction,optimizations:si.optimizations.flatMap(se=>{const Te=dV.find(Fe=>Fe.id===se);return Te?[Te.label]:[]})}:void 0,onChange:R,onDeploy:dn,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((hi=h.deployment)!=null&&hi.feishuEnabled),onFeishuEnabledChange:se=>{const Te={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:se}};p(Te)},deploymentEnv:ji.specs,deploymentEnvValues:{...(Zt=h.deployment)==null?void 0:Zt.envValues,...ji.fixedValues},onDeploymentEnvChange:ot,network:(_i=h.deployment)==null?void 0:_i.network,onNetworkChange:se=>p(Te=>({...Te,deployment:{...Te.deployment??{feishuEnabled:!1},network:se}})),deployRegion:B,onDeployRegionChange:te,deploymentTelemetrySource:"custom_create",onExportYaml:()=>uCe(`${h.name||"agent"}.yaml`,qTe(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(RCe,{mode:G,busy:Y,onChange:Ut,assistant:G==="build"?bs:void 0}),ve&&o.jsx(Jz,{testRunId:ve.runId,sessionId:ve.sessionId,title:`调用链路 · ${ve.variantName}`,onClose:()=>Qe(null)}),Me&&o.jsx(OA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:Se?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:Se,onCancel:_t,onConfirm:()=>void ue()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>N(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:se=>se.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:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>N(null),children:"关闭"})})]})})]})}function Eo(e){return{..._s(),...e}}const OCe=[{id:"support",icon:MJ,draft:Eo({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:yJ,draft:Eo({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:LJ,draft:Eo({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:mk,draft:Eo({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:$J,draft:Eo({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:iee,draft:Eo({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[Eo({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),Eo({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),Eo({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function MCe(e){const t=[];return e.tools.length&&t.push({icon:QP,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:bJ,label:"记忆"}),e.knowledgebase&&t.push({icon:mJ,label:"知识库"}),e.tracing&&t.push({icon:pJ,label:"观测"}),e.subAgents.length&&t.push({icon:VJ,label:`子Agent ${e.subAgents.length}`}),t}function LCe({onBack:e,onCreate:t}){const[n,i]=b.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(PCe,{template:n,onBack:()=>i(null),onCreate:t}):o.jsx(DCe,{onPick:i})})}function DCe({onPick:e}){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:OCe.map((t,n)=>o.jsxs(Jn.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:rc(t.draft.description)})]},t.id))})]})}function PCe({template:e,onBack:t,onCreate:n}){const[i,s]=b.useState(e.draft.name),r=e.icon,a=MCe(e.draft);function l(){const c=i.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(hk,{className:"icon"})," 返回模板列表"]}),o.jsxs(Jn.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:rc(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:i,onChange:c=>s(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:BCe(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:rc(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(nc,{className:"icon"})]})]})]})}function BCe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const UCe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:WP},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:$P},{type:"loop",label:"循环",desc:"节点循环执行",Icon:xk}];let _N=0;function Lw(){return _N+=1,`node_${_N}`}function Dw(e,t,n){const i=_s();return{id:e,type:"agentNode",position:t,data:{agent:{...i,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function FCe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Ms,{type:"target",position:Ye.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(su,{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(Ms,{type:"source",position:Ye.Right,className:"wfb-handle"})]})}const $Ce={agentNode:FCe},LD={type:"smoothstep",markerEnd:{type:Ef.ArrowClosed,width:16,height:16}};function HCe({onBack:e,onCreate:t}){const n=b.useRef(null),[i,s]=b.useState(""),[r,a]=b.useState(""),[l,c]=b.useState("sequential"),u=b.useMemo(()=>{_N=0;const A=Lw();return Dw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=B9([u]),[p,m,g]=U9([]),[v,y]=b.useState(u.id),x=d.find(A=>A.id===v)??null,E=i.trim()||"workflow_agent",w=b.useMemo(()=>R$({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),N=Yl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),_=x?Yl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,T=d.length>0&&N===null&&d.every(A=>Yl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),k=b.useCallback(A=>m(j=>f9({...A,...LD},j)),[m]),C=b.useCallback(()=>{const A=Lw(),j=d.length*28,P=Dw(A,{x:80+j,y:120+j});f($=>$.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},O=b.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),L=b.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),$=Lw(),R=Dw($,P);f(Y=>Y.concat(R)),y($)},[f]),G=b.useCallback(A=>{v&&f(j=>j.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=b.useCallback(()=>{v&&(f(A=>A.filter(j=>j.id!==v)),m(A=>A.filter(j=>j.source!==v&&j.target!==v)),y(null))},[v,f,m]),F=b.useCallback(()=>{if(!T)return;const A=d.map(P=>P.data.agent),j={..._s(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(j)},[T,d,p,E,r,l,t]);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 ${N?"wfb-input--error":""}`,value:i,onChange:A=>s(A.target.value),placeholder:"my_workflow"}),N&&o.jsx("span",{className:"wfb-field-error",children:N})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:UCe.map(({type:A,label:j,desc:P,Icon:$})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx($,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:j}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(OJ,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(su,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(Ns,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!T,type:"button",children:[o.jsx(ru,{className:"icon"}),"创建工作流"]}),o.jsxs(P9,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:g,onConnect:k,onInit:A=>n.current=A,nodeTypes:$Ce,defaultEdgeOptions:LD,onDrop:L,onDragOver:O,onNodeClick:(A,j)=>y(j.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx($9,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(z9,{showInteractive:!1}),o.jsx(Rle,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?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:D,title:"删除节点",children:o.jsx(ic,{className:"icon"})})]}),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:x.data.agent.name,onChange:A=>G({name:A.target.value}),placeholder:"agent_name"}),_?o.jsx("span",{className:"wfb-field-error",children:_}):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:x.data.agent.description,onChange:A=>G({description:A.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:x.data.agent.instruction,onChange:A=>G({instruction:A.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:x.data.agent.tools.join(", "),onChange:A=>G({tools:A.target.value.split(",").map(j=>j.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:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(su,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function zCe(e){return o.jsx(Jk,{children:o.jsx(HCe,{...e})})}const DD=50*1024*1024,SN=800,VCe={name:"code_package",files:[]};function GCe(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 KCe(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(i=>!i||i==="."||i===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function qCe(e){const t=e.flatMap(a=>{const l=KCe(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>SN)throw new Error(`代码包文件数不能超过 ${SN} 个。`);const s=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 s){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 s}function YCe({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:i,onDeploymentComplete:s,initialDeployRegion:r="cn-beijing"}){const a=b.useRef(null),l=b.useRef(0),[c,u]=b.useState(null),[d,f]=b.useState(""),[h,p]=b.useState(!1),[m,g]=b.useState(!1),[v,y]=b.useState(!1),[x,E]=b.useState(""),[w,N]=b.useState(r),[_,T]=b.useState();b.useEffect(()=>()=>{l.current+=1},[]);async function k(L){const G=++l.current;if(E(""),!L.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(L.size>DD){E("代码包不能超过 50 MB。");return}g(!0);try{const D=await Wz(new Uint8Array(await L.arrayBuffer()),{maxEntries:SN,maxUncompressedBytes:DD}),F=qCe(D);if(G!==l.current)return;f(L.name),u({name:GCe(L.name),files:F})}catch(D){if(G!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{G===l.current&&g(!1)}}function C(L){var D;const G=(D=L.currentTarget.files)==null?void 0:D[0];L.currentTarget.value="",G&&k(G)}function I(L){var D;L.preventDefault(),y(!1);const G=(D=L.dataTransfer.files)==null?void 0:D[0];G&&k(G)}async function O(L,G,D){const F=_&&_.mode!=="public"?{mode:_.mode,vpc_id:_.vpcId,subnet_ids:_.subnetIds,enable_shared_internet_access:_.enableSharedInternetAccess}:void 0;return ug(L.name,L.files,{region:w,projectName:"default",network:F},{...D,onStage:G})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(qx,{project:c??VCe,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:O,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:i,onDeploymentComplete:s,network:_,onNetworkChange:T,deployRegion:w,onDeployRegionChange:N,deploymentTelemetrySource:"code_package",onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?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${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:L=>{L.preventDefault(),y(!0)},onDragOver:L=>L.preventDefault(),onDragLeave:L=>{L.currentTarget.contains(L.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var L;m||(L=a.current)==null||L.click()},onKeyDown:L=>{var G;!m&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),(G=a.current)==null||G.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:L=>{L.stopPropagation(),p(!0)},onKeyDown:L=>L.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(WH,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const fV=1;function y1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function WCe(e){return y1(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&y1(e.draft)}function eE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function NN(e){var i;const t=(i=e.mcpTools)==null?void 0:i.map(s=>{const r={...s};return delete r.authToken,r}),n=e.deployment?{...e.deployment}:void 0;return n&&delete n.envValues,{...e,subAgents:e.subAgents.map(NN),...t?{mcpTools:t}:{},...n?{deployment:n}:{},...e.workflow?{workflow:{...e.workflow,nodes:e.workflow.nodes.map(s=>({...s,agent:NN(s.agent)}))}}:{}}}function hV(e){return{...e,draft:NN(e.draft)}}function XCe(e){const t=Array.isArray(e)?e:y1(e)&&e.version===fV?e.drafts:void 0;if(!Array.isArray(t)||!t.every(WCe))throw y1(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(hV)}function QCe(e,t){if(!t)return[];const n=e.getItem(eE(t));if(!n)return[];try{return XCe(JSON.parse(n))}catch(i){throw i instanceof Error&&i.message.startsWith("本机草稿")?i:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function PD(e,t,n){if(!t)return;const i={version:fV,drafts:n.map(hV)};try{e.setItem(eE(t),JSON.stringify(i))}catch(s){throw s instanceof DOMException&&(s.name==="QuotaExceededError"||s.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const ZCe="/web/skill-creator";class v2 extends Error{constructor(n,i){super(n);aC(this,"status");this.name="SkillCreatorApiError",this.status=i}}function ju(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function ci(e,...t){for(const n of t){const i=e[n];if(typeof i=="string"&&i)return i}}function pV(e,...t){for(const n of t){const i=e[n];if(typeof i=="number"&&Number.isFinite(i))return i}}async function Dg(e,t){return fetch(An(`${ZCe}${e}`),{...t,headers:Q1({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function w2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=ju(await e.json(),"错误响应");return ci(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function _2(e,t){if(!e.ok)throw new v2(await w2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function JCe(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 eIe(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function tIe(e){return Array.isArray(e)?e.map((t,n)=>{const i=ju(t,`文件 ${n+1}`),s=ci(i,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const r=pV(i,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:r}}):[]}function nIe(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],i=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:i}}function iIe(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const i=ju(t,`活动 ${n+1}`),s=ci(i,"id"),r=ci(i,"kind"),a=ci(i,"status");if(!s||!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=ci(i,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:r,name:c,args:i.input,response:i.output,status:a}}const l=ci(i,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:r,text:l,status:a}})}function sIe(e,t){const n=ju(e,`候选方案 ${t+1}`),i=ci(n,"id","candidate_id","candidateId"),s=ci(n,"model","model_id","modelId");if(!i||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:i,model:s,modelLabel:ci(n,"modelLabel","model_label")??s,status:JCe(n.status),stage:eIe(n.stage),name:ci(n,"name","skill_name","skillName"),description:ci(n,"description"),skillMd:ci(n,"skillMd","skill_md"),files:tIe(n.files),activities:iIe(n.activities),validation:nIe(n.validation),durationMs:pV(n,"elapsedMs","elapsed_ms"),error:ci(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:ci(n,"skill_id","skillId"),version:ci(n,"version")}}function TN(e,t=""){const n=ju(e,"Skill 创建任务"),i=ci(n,"id","job_id","jobId");if(!i)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(sIe):[],r=ci(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:i,prompt:ci(n,"prompt")??t,status:r,candidates:s}}async function rIe(e,t){const n=await Dg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new v2(await w2(n,"创建 Skill 任务失败"),n.status);const i=n.headers.get("content-type")??"";if(i.includes("application/json")){const u=TN(await n.json(),e);return t==null||t(u),u}if(!i.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=ju(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(ci(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=TN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await s.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 aIe(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`);return TN(await _2(t,"读取 Skill 任务失败"))}async function oIe(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await _2(t,"清理 Skill 任务失败")}async function lIe(e,t){var l;const n=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await w2(n,"下载 Skill 失败"));const s=((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=s,a.click(),URL.revokeObjectURL(r)}async function cIe(e,t,n){const i=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=ju(await _2(i,"添加到 AgentKit 失败"),"发布结果"),r=ci(s,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:ci(s,"name"),version:ci(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:ci(s,"message")}}const uIe=()=>{};function dIe(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 fIe({activities:e}){const t=b.useMemo(()=>e.filter(n=>n.kind!=="status").map(dIe),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(VA,{blocks:t,onAction:uIe})})}const BD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},UD=12e4;function hIe({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 pIe(){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 mIe(){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 gIe({candidate:e}){var c,u;const[t,n]=b.useState("SKILL.md"),i=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!i?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,UD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>UD;return s.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:s.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 bIe({label:e,jobId:t,candidate:n,selected:i,publishing:s,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=b.useState("conversation"),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(""),[y,x]=b.useState(""),[E,w]=b.useState(""),[N,_]=b.useState(""),T=b.useRef(null),k=b.useRef(null),C=n.status==="queued"||n.status==="running",I=n.status==="succeeded",O=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${i?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),i?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(hIe,{status:n.status})}),C?o.jsx(_a,{duration:2.2,spread:16,children:BD[n.stage]}):o.jsx("span",{children:BD[n.stage]}),n.durationMs!==void 0&&I?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(fIe,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?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 L;return(L=k.current)==null?void 0:L.focus()})},children:[o.jsx(pIe,{}),"查看 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 L;return(L=T.current)==null?void 0:L.focus()})},children:[o.jsx(mIe,{}),"返回对话"]})}),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:(O==null?void 0:O.valid)===!1?"is-invalid":"is-valid",children:(O==null?void 0:O.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,O&&(O.errors.length>0||O.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...O.errors,...O.warnings].map((L,G)=>o.jsx("div",{children:L},`${L}-${G}`))]}):null,o.jsx(gIe,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":i,onClick:l,children:i?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),lIe(t,n.id).catch(L=>{v(L instanceof Error?L.message:String(L))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!i||s||r||n.published,title:i?void 0:"请先采用此方案",onClick:()=>h(L=>!L),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),g?o.jsx("div",{className:"skill-candidate__error",children:g}):null,f&&i&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:L=>{L.preventDefault();const G=y.split(",").map(D=>D.trim()).filter(Boolean);c({skillSpaceIds:G,...E.trim()?{projectName:E.trim()}:{},...N.trim()?{skillId:N.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:L=>x(L.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:L=>w(L.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:N,onChange:L=>_(L.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const FD=new Set(["completed"]),ab=1100,yIe=3e4;function xIe(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 EIe({initialJob:e}){const[t,n]=b.useState(e),[i,s]=b.useState(""),[r,a]=b.useState(!1),[l,c]=b.useState(),[u,d]=b.useState(),[f,h]=b.useState(()=>new Set),[p,m]=b.useState({});b.useEffect(()=>{n(e),s(""),a(!1)},[e]),b.useEffect(()=>{if(FD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+yIe,w=async()=>{try{const N=await aIe(e.id);y||(n({...N,prompt:N.prompt||e.prompt}),s(""),FD.has(N.status)||(x=window.setTimeout(w,ab)))}catch(N){if(!y){const _=N instanceof v2?N:void 0;if((_==null?void 0:_.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const g=KA.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??xIe(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await cIe(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"})}),i?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",i,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:g.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(bIe,{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:N=>void v(y,N)},`${y.model}-${y.id}`)})})]})}function vIe(e){return Object.prototype.toString.call(e)==="[object Object]"}function $D(e){return vIe(e)||Array.isArray(e)}function wIe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function S2(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;const s=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return s!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!$D(l)||!$D(c)?l===c:S2(l,c)})}function HD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function _Ie(e,t){if(e.length!==t.length)return!1;const n=HD(e),i=HD(t);return n.every((s,r)=>{const a=i[r];return S2(s,a)})}function N2(e){return typeof e=="number"}function kN(e){return typeof e=="string"}function tE(e){return typeof e=="boolean"}function zD(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ei(e){return Math.abs(e)}function T2(e){return Math.sign(e)}function Zp(e,t){return Ei(e-t)}function SIe(e,t){if(e===0||t===0||Ei(e)<=Ei(t))return 0;const n=Zp(Ei(e),Ei(t));return Ei(n/e)}function NIe(e){return Math.round(e*100)/100}function zm(e){return Vm(e).map(Number)}function Na(e){return e[Pg(e)]}function Pg(e){return Math.max(0,e.length-1)}function k2(e,t){return t===Pg(e)}function VD(e,t=0){return Array.from(Array(e),(n,i)=>t+i)}function Vm(e){return Object.keys(e)}function mV(e,t){return[e,t].reduce((n,i)=>(Vm(i).forEach(s=>{const r=n[s],a=i[s],l=zD(r)&&zD(a);n[s]=l?mV(r,a):a}),n),{})}function AN(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function TIe(e,t){const n={start:i,center:s,end:r};function i(){return 0}function s(c){return r(c)/2}function r(c){return t-c}function a(c,u){return kN(e)?n[e](c):e(t,c,u)}return{measure:a}}function Gm(){let e=[];function t(s,r,a,l={passive:!0}){let c;if("addEventListener"in s)s.addEventListener(r,a,l),c=()=>s.removeEventListener(r,a,l);else{const u=s;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),i}function n(){e=e.filter(s=>s())}const i={add:t,clear:n};return i}function kIe(e,t,n,i){const s=Gm(),r=1e3/60;let a=null,l=0,c=0;function u(){s.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),s.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;i(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:i}}function AIe(e,t){const n=t==="rtl",i=e==="y",s=i?"y":"x",r=i?"x":"y",a=!i&&n?-1:1,l=d(),c=f();function u(m){const{height:g,width:v}=m;return i?g:v}function d(){return i?"top":n?"right":"left"}function f(){return i?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:s,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function mu(e=0,t=0){const n=Ei(e-t);function i(u){return ut}function r(u){return i(u)||s(u)}function a(u){return r(u)?i(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:s,reachedMin:i,removeOffset:l}}function gV(e,t,n){const{constrain:i}=mu(0,e),s=e+1;let r=a(t);function a(h){return n?Ei((s+h)%s):i(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return gV(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function CIe(e,t,n,i,s,r,a,l,c,u,d,f,h,p,m,g,v,y,x){const{cross:E,direction:w}=e,N=["INPUT","SELECT","TEXTAREA"],_={passive:!1},T=Gm(),k=Gm(),C=mu(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},O={mouse:500,touch:600},L=m?43:25;let G=!1,D=0,F=0,A=!1,j=!1,P=!1,$=!1;function R(de){if(!x)return;function ge(Ee){(tE(x)||x(de,Ee))&&z(Ee)}const Oe=t;T.add(Oe,"dragstart",Ee=>Ee.preventDefault(),_).add(Oe,"touchmove",()=>{},_).add(Oe,"touchend",()=>{}).add(Oe,"touchstart",ge).add(Oe,"mousedown",ge).add(Oe,"touchcancel",q).add(Oe,"contextmenu",q).add(Oe,"click",ce,!0)}function Y(){T.clear(),k.clear()}function Z(){const de=$?n:t;k.add(de,"touchmove",W,_).add(de,"touchend",q).add(de,"mousemove",W,_).add(de,"mouseup",q)}function B(de){const ge=de.nodeName||"";return N.includes(ge)}function te(){return(m?O:I)[$?"mouse":"touch"]}function K(de,ge){const Oe=f.add(T2(de)*-1),Ee=d.byDistance(de,!m).distance;return m||Ei(de)=2,!(ge&&de.button!==0)&&(B(de.target)||(A=!0,r.pointerDown(de),u.useFriction(0).useDuration(0),s.set(a),Z(),D=r.readPoint(de),F=r.readPoint(de,E),h.emit("pointerDown")))}function W(de){if(!AN(de,i)&&de.touches.length>=2)return q(de);const Oe=r.readPoint(de),Ee=r.readPoint(de,E),ae=Zp(Oe,D),Ne=Zp(Ee,F);if(!j&&!$&&(!de.cancelable||(j=ae>Ne,!j)))return q(de);const ve=r.pointerMove(de);ae>g&&(P=!0),u.useFriction(.3).useDuration(.75),l.start(),s.add(w(ve)),de.preventDefault()}function q(de){const Oe=d.byDistance(0,!1).index!==f.get(),Ee=r.pointerUp(de)*te(),ae=K(w(Ee),Oe),Ne=SIe(Ee,ae),ve=L-10*Ne,Qe=y+Ne/50;j=!1,A=!1,k.clear(),u.useDuration(ve).useFriction(Qe),c.distance(ae,!m),$=!1,h.emit("pointerUp")}function ce(de){P&&(de.stopPropagation(),de.preventDefault(),P=!1)}function me(){return A}return{init:R,destroy:Y,pointerDown:me}}function IIe(e,t){let i,s;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(AN(f,t)?f:f.touches[0])[m]}function l(f){return i=f,s=f,a(f)}function c(f){const h=a(f)-a(s),p=r(f)-r(i)>170;return s=f,p&&(i=f),h}function u(f){if(!i||!s)return 0;const h=a(s)-a(i),p=r(f)-r(i),m=r(f)-r(s)>170,g=h/p;return p&&!m&&Ei(g)>.1?g:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function RIe(){function e(n){const{offsetTop:i,offsetLeft:s,offsetWidth:r,offsetHeight:a}=n;return{top:i,right:s+r,bottom:i+a,left:s,width:r,height:a}}return{measure:e}}function jIe(e){function t(i){return e*(i/100)}return{measure:t}}function OIe(e,t,n,i,s,r,a){const l=[e].concat(i);let c,u,d=[],f=!1;function h(v){return s.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=i.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,N=i.indexOf(E.target),_=w?u:d[N],T=h(w?e:i[N]);if(Ei(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 MIe(e,t,n,i,s,r){let a=0,l=0,c=s,u=r,d=e.get(),f=0;function h(){const _=i.get()-e.get(),T=!c;let k=0;return T?(a=0,n.set(i),e.set(i),k=_):(n.set(e),a+=_/c,a*=u,d+=a,e.add(a),k=d-f),l=T2(k),f=d,N}function p(){const _=i.get()-t.get();return Ei(_)<.001}function m(){return c}function g(){return l}function v(){return a}function y(){return E(s)}function x(){return w(r)}function E(_){return c=_,N}function w(_){return u=_,N}const N={direction:g,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return N}function LIe(e,t,n,i,s){const r=s.measure(10),a=s.measure(50),l=mu(.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",g=Ei(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(g/a);n.subtract(v*y),!p&&Ei(v){const{min:v,max:y}=r,x=r.constrain(m),E=!g,w=k2(n,g);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+s)return[r.max];if(i==="keepSnaps")return a;const{min:m,max:g}=l;return a.slice(m,g)}return{snapsContained:c,scrollContainLimit:l}}function PIe(e,t,n){const i=t[0],s=n?i-e:Na(t);return{limit:mu(s,i)}}function BIe(e,t,n,i){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=mu(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);i.forEach(m=>m.add(p))}return{loop:d}}function UIe(e){const{max:t,length:n}=e;function i(r){const a=r-t;return n?a/-n:0}return{get:i}}function FIe(e,t,n,i,s){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=s,c=f().map(t.measure),u=h(),d=p();function f(){return l(i).map(g=>Na(g)[a]-g[0][r]).map(Ei)}function h(){return i.map(g=>n[r]-g[r]).map(g=>-Ei(g))}function p(){return l(u).map(g=>g[0]).map((g,v)=>g+c[v])}return{snaps:u,snapsAligned:d}}function $Ie(e,t,n,i,s,r){const{groupSlides:a}=s,{min:l,max:c}=i,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,g,v)=>{const y=!g,x=k2(v,g);if(y){const E=Na(v[0])+1;return VD(E)}if(x){const E=Pg(r)-Na(v)[0]+1;return VD(E,Na(v)[0])}return m})}return{slideRegistry:u}}function HIe(e,t,n,i,s){const{reachedAny:r,removeOffset:a,constrain:l}=i;function c(m){return m.concat().sort((g,v)=>Ei(g)-Ei(v))[0]}function u(m){const g=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-g,0),index:E})).sort((x,E)=>Ei(x.diff)-Ei(E.diff)),{index:y}=v[0];return{index:y,distance:g}}function d(m,g){const v=[m,m+n,m-n];if(!e)return m;if(!g)return c(v);const y=v.filter(x=>T2(x)===g);return y.length?c(y):Na(v)-n}function f(m,g){const v=t[m]-s.get(),y=d(v,g);return{index:m,distance:y}}function h(m,g){const v=s.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!g||E)return{index:y,distance:m};const w=t[y]-x,N=m+d(w,0);return{index:y,distance:N}}return{byDistance:h,byIndex:f,shortcut:d}}function zIe(e,t,n,i,s,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(i.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=s.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=s.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function VIe(e,t,n,i,s,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(g){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(g));N2(x)&&(s.useDuration(0),i.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((g,v)=>{r.add(g,"focus",y=>{(tE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function gp(e){let t=e;function n(){return t}function i(c){t=a(c)}function s(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return N2(c)?c:c.get()}return{get:n,set:i,add:s,subtract:r}}function bV(e,t){const n=e.scroll==="x"?a:l,i=t.style;let s=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=NIe(e.direction(h));p!==s&&(i.transform=n(p),s=p)}function u(h){r=!h}function d(){r||(i.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function GIe(e,t,n,i,s,r,a,l,c){const d=zm(s),f=zm(s).reverse(),h=y().concat(x());function p(T,k){return T.reduce((C,I)=>C-s[I],k)}function m(T,k){return T.reduce((C,I)=>p(C,k)>0?C.concat([I]):C,[])}function g(T){return r.map((k,C)=>({start:k-i[C]+.5+T,end:k+t-.5+T}))}function v(T,k,C){const I=g(k);return T.map(O=>{const L=C?0:-n,G=C?n:0,D=C?"end":"start",F=I[O][D];return{index:O,loopPoint:F,slideLocation:gp(-1),translate:bV(e,c[O]),target:()=>l.get()>F?L:G}})}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(C=>C!==T);return p(k,t)<=.1})}function w(){h.forEach(T=>{const{target:k,translate:C,slideLocation:I}=T,O=k();O!==I.get()&&(C.to(O),I.set(O))})}function N(){h.forEach(T=>T.translate.clear())}return{canLoop:E,clear:N,loop:w,loopPoints:h}}function KIe(e,t,n){let i,s=!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}}i=new MutationObserver(d=>{s||(tE(n)||n(c,d))&&u(d)}),i.observe(e,{childList:!0})}function a(){i&&i.disconnect(),s=!0}return{init:r,destroy:a}}function qIe(e,t,n,i){const s={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(g=>{const v=t.indexOf(g.target);s[v]=g}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:i}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return Vm(s).reduce((g,v)=>{const y=parseInt(v),{isIntersecting:x}=s[y];return(m&&x||!m&&!x)&&g.push(y),g},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const g=f(m);return m&&(r=g),m||(a=g),g}return{init:u,destroy:d,get:h}}function YIe(e,t,n,i,s,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&s,d=m(),f=g(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return Ei(t[l]-x[l])}function g(){if(!u)return 0;const x=r.getComputedStyle(Na(i));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const N=!E,_=k2(w,E);return N?h[E]+d:_?h[E]+f:w[E+1][l]-x[l]}).map(Ei)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function WIe(e,t,n,i,s,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=N2(n);function p(y,x){return zm(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?zm(y).reduce((x,E,w)=>{const N=Na(x)||0,_=N===0,T=E===Pg(y),k=s[u]-r[N][u],C=s[u]-r[E][d],I=!i&&_?f(a):0,O=!i&&T?f(l):0,L=Ei(C-O-(k+I));return w&&L>t+c&&x.push(E),T&&x.push(y.length),x},[]).map((x,E,w)=>{const N=Math.max(w[E-1]||0);return y.slice(N,x)}):[]}function g(y){return h?p(y,n):m(y)}return{groupSlides:g}}function XIe(e,t,n,i,s,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:N,watchFocus:_}=r,T=2,k=RIe(),C=k.measure(t),I=n.map(k.measure),O=AIe(c,u),L=O.measureSize(C),G=jIe(L),D=TIe(l,L),F=!f&&!!x,A=f||!!x,{slideSizes:j,slideSizesWithGaps:P,startGap:$,endGap:R}=YIe(O,C,I,n,A,s),Y=WIe(O,L,v,f,C,I,$,R,T),{snaps:Z,snapsAligned:B}=FIe(O,D,C,I,Y),te=-Na(Z)+Na(P),{snapsContained:K,scrollContainLimit:z}=DIe(L,te,B,x,T),W=F?K:B,{limit:q}=PIe(te,W,f),ce=gV(Pg(W),d,f),me=ce.clone(),_e=zm(n),de=({dragHandler:Le,scrollBody:qe,scrollBounds:gt,options:{loop:lt}})=>{lt||gt.constrain(Le.pointerDown()),qe.seek()},ge=({scrollBody:Le,translate:qe,location:gt,offsetLocation:lt,previousLocation:ln,scrollLooper:Mt,slideLooper:kt,dragHandler:Vt,animation:He,eventHandler:Xt,scrollBounds:nt,options:{loop:yt}},Je)=>{const ot=Le.settled(),ye=!nt.shouldConstrain(),Xe=yt?ot:ot&&ye,St=Xe&&!Vt.pointerDown();St&&He.stop();const Qt=gt.get()*Je+ln.get()*(1-Je);lt.set(Qt),yt&&(Mt.loop(Le.direction()),kt.loop()),qe.to(lt.get()),St&&Xt.emit("settle"),Xe||Xt.emit("scroll")},Oe=kIe(i,s,()=>de(be),Le=>ge(be,Le)),Ee=.68,ae=W[ce.get()],Ne=gp(ae),ve=gp(ae),Qe=gp(ae),Me=gp(ae),ze=MIe(Ne,Qe,ve,Me,h,Ee),Se=HIe(f,W,te,q,Me),Ue=zIe(Oe,ce,me,ze,Se,Me,a),Pe=UIe(q),Ke=Gm(),Q=qIe(t,n,a,g),{slideRegistry:oe}=$Ie(F,x,W,z,Y,_e),ie=VIe(e,n,oe,Ue,ze,Ke,a,_),be={ownerDocument:i,ownerWindow:s,eventHandler:a,containerRect:C,slideRects:I,animation:Oe,axis:O,dragHandler:CIe(O,e,i,s,Me,IIe(O,s),Ne,Oe,Ue,ze,Se,ce,a,G,p,m,y,Ee,N),eventStore:Ke,percentOfView:G,index:ce,indexPrevious:me,limit:q,location:Ne,offsetLocation:Qe,previousLocation:ve,options:r,resizeHandler:OIe(t,a,s,n,O,E,k),scrollBody:ze,scrollBounds:LIe(q,Qe,Me,ze,G),scrollLooper:BIe(te,q,Qe,[Ne,Qe,ve,Me]),scrollProgress:Pe,scrollSnapList:W.map(Pe.get),scrollSnaps:W,scrollTarget:Se,scrollTo:Ue,slideLooper:GIe(O,L,te,j,P,Z,W,Qe,n),slideFocus:ie,slidesHandler:KIe(t,a,w),slidesInView:Q,slideIndexes:_e,slideRegistry:oe,slidesToScroll:Y,target:Me,translate:bV(O,t)};return be}function QIe(){let e={},t;function n(u){t=u}function i(u){return e[u]||[]}function s(u){return i(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=i(u).concat([d]),c}function a(u,d){return e[u]=i(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:s,off:a,on:r,clear:l};return c}const ZIe={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 JIe(e){function t(r,a){return mV(r,a||{})}function n(r){const a=r.breakpoints||{},l=Vm(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function i(r){return r.map(a=>Vm(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:i}}function eRe(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 i(){t=t.filter(r=>r.destroy())}return{init:n,destroy:i}}function x1(e,t,n){const i=e.ownerDocument,s=i.defaultView,r=JIe(s),a=eRe(r),l=Gm(),c=QIe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,g=O;let v=!1,y,x=u(ZIe,x1.globalOptions),E=u(x),w=[],N,_,T;function k(){const{container:_e,slides:de}=E;_=(kN(_e)?e.querySelector(_e):_e)||e.children[0];const Oe=kN(de)?_.querySelectorAll(de):de;T=[].slice.call(Oe||_.children)}function C(_e){const de=XIe(e,_,T,i,s,_e,c);if(_e.loop&&!de.slideLooper.canLoop()){const ge=Object.assign({},_e,{loop:!1});return C(ge)}return de}function I(_e,de){v||(x=u(x,_e),E=d(x),w=de||w,k(),y=C(E),f([x,...w.map(({options:ge})=>ge)]).forEach(ge=>l.add(ge,"change",O)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(me),y.eventHandler.init(me),y.resizeHandler.init(me),y.slidesHandler.init(me),y.options.loop&&y.slideLooper.loop(),_.offsetParent&&T.length&&y.dragHandler.init(me),N=a.init(me,w)))}function O(_e,de){const ge=Y();L(),I(u({startIndex:ge},_e),de),c.emit("reInit")}function L(){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 G(){v||(v=!0,l.clear(),L(),c.emit("destroy"),c.clear())}function D(_e,de,ge){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(de===!0?0:E.duration),y.scrollTo.index(_e,ge||0))}function F(_e){const de=y.index.add(1).get();D(de,_e,-1)}function A(_e){const de=y.index.add(-1).get();D(de,_e,1)}function j(){return y.index.add(1).get()!==Y()}function P(){return y.index.add(-1).get()!==Y()}function $(){return y.scrollSnapList}function R(){return y.scrollProgress.get(y.offsetLocation.get())}function Y(){return y.index.get()}function Z(){return y.indexPrevious.get()}function B(){return y.slidesInView.get()}function te(){return y.slidesInView.get(!1)}function K(){return N}function z(){return y}function W(){return e}function q(){return _}function ce(){return T}const me={canScrollNext:j,canScrollPrev:P,containerNode:q,internalEngine:z,destroy:G,off:p,on:h,emit:m,plugins:K,previousScrollSnap:Z,reInit:g,rootNode:W,scrollNext:F,scrollPrev:A,scrollProgress:R,scrollSnapList:$,scrollTo:D,selectedScrollSnap:Y,slideNodes:ce,slidesInView:B,slidesNotInView:te};return I(t,n),setTimeout(()=>c.emit("init"),0),me}x1.globalOptions=void 0;function A2(e={},t=[]){const n=b.useRef(e),i=b.useRef(t),[s,r]=b.useState(),[a,l]=b.useState(),c=b.useCallback(()=>{s&&s.reInit(n.current,i.current)},[s]);return b.useEffect(()=>{S2(n.current,e)||(n.current=e,c())},[e,c]),b.useEffect(()=>{_Ie(i.current,t)||(i.current=t,c())},[t,c]),b.useEffect(()=>{if(wIe()&&a){x1.globalOptions=A2.globalOptions;const u=x1(a,n.current,i.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,s]}A2.globalOptions=void 0;const yV=b.createContext(null);function Bg(...e){return e.filter(Boolean).join(" ")}function nE(){const e=b.useContext(yV);if(!e)throw new Error("useCarousel must be used within a ");return e}function tRe({orientation:e="horizontal",opts:t,setApi:n,plugins:i,className:s,children:r,...a}){const[l,c]=A2({...t,axis:e==="horizontal"?"x":"y"},i),[u,d]=b.useState(!1),[f,h]=b.useState(!1),p=b.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=b.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),g=b.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=b.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),g())},[g,m]);return b.useEffect(()=>{c&&n&&n(c)},[c,n]),b.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(yV.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:i,setApi:n,scrollPrev:m,scrollNext:g,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Bg("ui-carousel",s),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function nRe({className:e,...t}){const{carouselRef:n,orientation:i}=nE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Bg("ui-carousel__track",i==="vertical"?"is-vertical":void 0,e),...t})})}function iRe({className:e,...t}){const{orientation:n}=nE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Bg("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function xV({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 sRe({className:e,...t}){const{orientation:n,scrollPrev:i,canScrollPrev:s}=nE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Bg("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!s,onClick:i,"aria-label":"上一张",...t,children:o.jsx(xV,{direction:"left"})})}function rRe({className:e,...t}){const{orientation:n,scrollNext:i,canScrollNext:s}=nE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Bg("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!s,onClick:i,"aria-label":"下一张",...t,children:o.jsx(xV,{direction:"right"})})}const GD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function aRe(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 oRe({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 lRe(){const[e,t]=b.useState(),[n,i]=b.useState(!1),[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState(!0);return b.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]),b.useEffect(()=>{if(!c||!e||n||s||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,s,n,a,c]),c?o.jsxs(tRe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>i(!0),onPointerLeave:()=>i(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(sRe,{"aria-label":"上一张新特性"}),o.jsx(nRe,{children:GD.map((d,f)=>o.jsx(iRe,{"aria-label":`${f+1} / ${GD.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(oRe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(aRe,{})}),o.jsx(rRe,{"aria-label":"下一张新特性"})]}):null}const cRe=3*60*1e3,uRe=3e3,dRe=10*60*1e3,E1="veadk.studio.pending-update",KD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],fRe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function hRe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function pRe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function mRe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(E1);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(E1),null}function Pw(e,t){window.localStorage.setItem(E1,JSON.stringify({targetVersion:e,startedAt:t}))}function ob(){window.localStorage.removeItem(E1)}function qD({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 gRe(){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 bRe(){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 YD({lines:e,phase:t,copyState:n,onCopy:i}){const s=b.useRef(null),r=b.useRef(!0);return b.useEffect(()=>{const a=s.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:i,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:s,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 yRe({variant:e="default"}){var D,F;const[t]=b.useState(mRe),[n,i]=b.useState(null),[s,r]=b.useState(t?"submitting":"idle"),[a,l]=b.useState(!1),[c,u]=b.useState(""),[d,f]=b.useState((t==null?void 0:t.targetVersion)??""),[h,p]=b.useState(!1),[m,g]=b.useState("idle"),[v,y]=b.useState(0),x=b.useRef(null),E=b.useRef((t==null?void 0:t.targetVersion)??""),w=b.useRef((t==null?void 0:t.startedAt)??0);b.useEffect(()=>{if(!h)return;const A=P=>{var $;P.target instanceof Node&&!(($=x.current)!=null&&$.contains(P.target))&&p(!1)},j=P=>{P.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",j)}},[h]);const N=b.useCallback(async()=>{const A=await LB(E.current||void 0,w.current||void 0);return i(A),A},[]);if(b.useEffect(()=>{let A=!0;const j=()=>{N().catch(()=>{A&&i($=>$)})};j();const P=window.setInterval(j,cRe);return()=>{A=!1,window.clearInterval(P)}},[N]),b.useEffect(()=>{if(s!=="submitting")return;const A=window.setInterval(()=>{N().then(j=>{const P=E.current;if(P&&pRe(j.currentVersion,P)||!P&&!j.available&&j.latestVersion){window.clearInterval(A),ob(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(j.state==="error"){window.clearInterval(A),ob(),r("error"),u(j.message||"Studio 更新失败");return}Date.now()-w.current>dRe&&(window.clearInterval(A),ob(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},uRe);return()=>window.clearInterval(A)},[s,N]),b.useEffect(()=>{s!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),Pw(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[s,n]),b.useEffect(()=>{if(s!=="submitting"){y(0);return}const A=()=>{const P=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-P)/1e3)))};A();const j=window.setInterval(A,1e3);return()=>window.clearInterval(j)},[s]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||s!=="idle"))return null;const T=n.releases??[],k=d||((D=T[0])==null?void 0:D.version)||n.latestVersion,C=T.find(A=>A.version===k),I=async()=>{E.current=k,w.current=Date.now(),Pw(k,w.current),r("submitting"),u(""),g("idle");try{const A=await DB(k);E.current=A.version,Pw(A.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(A){if(A instanceof TypeError){u("连接已切换,正在确认新版本状态");return}ob(),r("error");const j=A instanceof Error?A.message:"Studio 更新失败";try{const P=await N();u(P.message||j)}catch{u(j)}}},O=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` +`).filter(Boolean),L=async()=>{try{await navigator.clipboard.writeText(O.join(` +`)),g("copied")}catch{g("error")}},G=()=>{var A;p(!1),g("idle"),u(""),f(E.current||((A=T[0])==null?void 0:A.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-${s}`,title:s==="submitting"?"正在更新 Studio":s==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var A;s==="published"?window.location.reload():(s==="submitting"||s==="error"||(f(((A=T[0])==null?void 0:A.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(qD,{className:"studio-update-icon"}),s==="submitting"?o.jsx(_a,{as:"span",children:"正在更新"}):s==="published"?o.jsx("span",{children:"刷新使用新版"}):s==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&s!=="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(qD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:s==="error"?"Studio 更新失败":s==="submitting"?"正在更新 Studio":s==="published"?"Studio 更新完成":"发现新版本"}),s==="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:fRe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx(YD,{lines:O,phase:"error",copyState:m,onCopy:()=>void L()}),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:"↗"})]})]}):s==="submitting"||s==="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:s==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:s==="published"?"已完成":hRe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:KD.map((A,j)=>{const P=KD.findIndex(Y=>Y.id===n.progressStage),$=s==="published"||jvoid L()}),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(A=>!A),onKeyDown:A=>{(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0))},children:[o.jsx("span",{children:k}),o.jsx(gRe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:T.map(A=>{const j=A.version===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`studio-update-version-option${j?" is-selected":""}`,onClick:()=>{f(A.version),p(!1)},children:[o.jsx("span",{children:A.version}),j&&o.jsx(bRe,{})]},A.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:((C==null?void 0:C.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:"更新内容"}),C!=null&&C.changelog.length?o.jsx("ul",{children:C.changelog.map(A=>o.jsx("li",{children:A},A))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),s==="confirm"&&(r("idle"),u(""))},children:s==="submitting"?"后台运行":s==="confirm"?"取消":"关闭"}),s==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void I(),children:"立即更新"}),s==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:G,children:"重新尝试"})]})]})})]})}const xRe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function ERe({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:xRe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(yRe,{variant:"feature-link"})]})}const vRe=1e4;async function EV(e){const t=await fetch(An(e),{headers:Q1({Accept:"application/json"}),signal:On(void 0,vRe)});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 wRe(){return EV("/web/sandbox/capabilities")}async function _Re(){return EV("/web/skill-creator/capabilities")}const SRe="我的智能体";function NRe({open:e,state:t,agentKind:n="codex",error:i,onCancel:s,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?SRe:`我的 ${a}`,c=b.useRef(null),u=b.useRef(null),d=b.useRef(null),f=b.useRef(!1),h=b.useRef(s),[p,m]=b.useState(l);if(h.current=s,b.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var N,_;(N=u.current)==null||N.focus(),(_=u.current)==null||_.select()}),w=N=>{var C;if(N.key==="Escape"){N.preventDefault(),h.current();return}if(N.key!=="Tab")return;const _=(C=c.current)==null?void 0:C.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(_!=null&&_.length))return;const T=_[0],k=_[_.length-1];N.shiftKey&&document.activeElement===T?(N.preventDefault(),k.focus()):!N.shiftKey&&document.activeElement===k&&(N.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 g=t==="loading",v=p.trim(),y=g?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return ks.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!g&&s()},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(),!g&&!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:g?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Um,{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:i||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):g?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,"/",UL]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:UL,disabled:g,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:s,children:g?"取消创建":"取消"}),!g&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function TRe({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 kRe({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(i=>o.jsxs("div",{children:[o.jsx("dt",{children:i.label}),o.jsx("dd",{title:i.value,children:i.code?o.jsx("code",{children:i.value}):i.value})]},`${i.label}:${i.value}`))}):null]})}function ARe(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 CRe({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,i])=>o.jsxs("span",{title:`${n}: ${i.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:ARe(i)})]},n))})}function vV(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 wV(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 C2(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 Wb(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 IRe(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 RRe(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 jRe(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 ORe(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 MRe(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 LRe(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 DRe(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 CN(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 PRe(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 $o(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 Ug({open:e,title:t,subtitle:n,icon:i,className:s="",onClose:r,children:a}){const l=b.useId(),c=b.useRef(null),u=b.useRef(null),d=b.useRef(r);return d.current=r,b.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 g=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((g==null?void 0:g.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?ks.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${s}`.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:i}),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(DRe,{})})]}),a]})}),document.body):null}function BRe({open:e,kind:t,launch:n,loading:i,error:s,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Ug,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(vV,{}):o.jsx(wV,{}),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:i?"is-loading":n?"is-ready":""}),i?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:i?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx($o,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):s?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:s}),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 URe({open:e,threads:t,currentThreadId:n,loading:i,error:s,onSelect:r,onClose:a}){return o.jsx(Ug,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(PRe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:i?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx($o,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):s?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:s})]}):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(CN,{})]},l.id)})})})}const FRe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],$Re=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],HRe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function zRe({open:e,value:t,busy:n,error:i,onSave:s,onClose:r}){const[a,l]=b.useState(t);return b.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Ug,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(C2,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(Bw,{label:"沙箱模式",choices:FRe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(Bw,{label:"审批策略",choices:$Re,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(Bw,{label:"审批方式",choices:HRe,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,i?o.jsx("div",{className:"sandbox-control-error",children:i}):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:()=>s(a),children:[n?o.jsx($o,{className:"spin"}):null,"保存权限"]})]})]})}function Bw({label:e,choices:t,value:n,disabled:i,onChange:s}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:i,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:()=>s(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(),s(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 VRe({open:e,cwd:t,locked:n,busy:i,error:s,browse:r,onSave:a,onClose:l}){const[c,u]=b.useState(t||"/"),[d,f]=b.useState(null),[h,p]=b.useState(!1),[m,g]=b.useState("");b.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),g("");try{const x=await r(y);f(x),u(x.path)}catch(x){g(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Ug,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(Wb,{}),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:i||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:i||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($o,{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(Wb,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(CN,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(Wb,{}),o.jsx("span",{children:y.name}),o.jsx(CN,{})]},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||s?o.jsx("div",{className:"sandbox-control-error",children:m||s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:i,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:i||n||!c.startsWith("/"),onClick:()=>a(c),children:[i?o.jsx($o,{className:"spin"}):null,"使用此目录"]})]})]})}function GRe({approval:e,busy:t,error:n,onDecision:i}){var a;const s=(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(Ug,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(C2,{}),className:"sandbox-approval-dialog",onClose:()=>{t||i("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,s?o.jsx("pre",{children:s}):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:()=>i("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>i("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>i("acceptForSession"),children:[t?o.jsx($o,{className:"spin"}):null,"本会话允许"]})]})]})}const KRe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function WD(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 qRe({session:e,onBack:t,onOpen:n,onDelete:i}){const[s,r]=b.useState(!1),[a,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(""),h=KRe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(g){f(g instanceof Error?g.message:String(g))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await i()}catch(g){f(g instanceof Error?g.message:String(g)),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:Mx(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:WD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:WD(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?"打开中…":"打开智能体"})]})]}),s?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:g=>g.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 YRe="_SegmentedControl_1sl7d_1",WRe="_SegmentedControlOption_1sl7d_140",XRe="_SegmentedControlThumb_1sl7d_219",IN={SegmentedControl:YRe,SegmentedControlOption:WRe,SegmentedControlThumb:XRe},Xb=({value:e,onChange:t,children:n,block:i,pill:s=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=b.useRef(null),f=b.useRef(null),h=b.useCallback(m=>{const g=d.current,v=f.current;if(!g||!v)return;const y=g==null?void 0:g.querySelector('[data-state="on"]');if(!y)return;const x=g.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)`,g.scrollWidth>x){const N=x*.15,_=g.scrollLeft,T=y.offsetLeft,k=T+E;(T<_+N||k>_+x-N)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);u_e({ref:d,onResize:()=>{const m=f.current;if(!m)return;const g=m.style.transition;m.style.transition="",h(!1),m.style.transition=g}}),b.useLayoutEffect(()=>{const m=d.current,g=f.current;!m||!g||(h(!!g.style.transition),g.style.transition||nN(()=>{g.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,s]);const p=m=>{m&&t&&t(m)};return o.jsxs(x2e,{ref:d,className:na(IN.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":i?"":void 0,"data-pill":s?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:IN.SegmentedControlThumb,ref:f}),n]})},QRe=({children:e,...t})=>o.jsx(S2e,{className:IN.SegmentedControlOption,...t,onPointerEnter:E$,children:o.jsx("span",{className:"relative",children:e})});Xb.Option=QRe;function ZRe({workspace:e,onBack:t}){const[n,i]=b.useState("main"),[s,r]=b.useState(""),[a,l]=b.useState(!1),[c,u]=b.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";b.useEffect(()=>{i("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(i("terminal"),!(s||a)){l(!0),u("");try{const h=await tn.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:Mx(e.session.status)})]})]})]}),o.jsxs(Xb,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():i("main")},children:[o.jsx(Xb.Option,{value:"main",children:"主界面"}),o.jsx(Xb.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:"重新尝试"})]}):s?o.jsx("iframe",{src:s,title:`${d} 终端`}):null})]})}const iE=[{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 JRe(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 eje(e){const t=e.toLocaleLowerCase();return iE.filter(n=>!t||[n.name,n.description,...n.keywords].some(i=>i.toLocaleLowerCase().includes(t))).sort((n,i)=>XD(n,t)-XD(i,t)).slice(0,12)}function XD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:iE.indexOf(e)}function tje(e,t){const n=t.toLocaleLowerCase();return e.filter(i=>!n||`${i.id} ${i.displayName} ${i.description}`.toLocaleLowerCase().includes(n)).sort((i,s)=>{if(!n)return Number(s.isDefault)-Number(i.isDefault);const r=i.id.toLocaleLowerCase(),a=s.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,i.displayName)-l(a,s.displayName)}).slice(0,12)}function nje(){return iE.map(e=>({label:e.usage,value:e.description}))}function ije(e,t){return e.map(n=>{const i=n.displayName.trim(),s=i&&i!==n.id?`${i} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${s} — ${n.description}`:s,code:!1}})}function sje(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 rje(e){return e.messages.map(t=>{var i;const n=[];return t.role==="user"&&((i=t.skillNames)!=null&&i.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(s=>({name:s,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function aje({appName:e,value:t,onChange:n,onSubmit:i,disabled:s,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:g,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const N=b.useRef(null),_=b.useRef(null),T=b.useRef(null),k=b.useRef(null),[C,I]=b.useState(!1),[O,L]=b.useState(0),[G,D]=b.useState(!1);b.useLayoutEffect(()=>{const z=N.current;z&&(z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,200)}px`)},[t]);const F=b.useMemo(()=>{if(!t.startsWith("/")||t.includes(` +`))return;const z=t.slice(1),W=z.search(/\s/),q=(W<0?z:z.slice(0,W)).toLocaleLowerCase(),ce=W<0?"":z.slice(W).trim();if(!(W>=0&&q!=="model"))return{command:q,argument:ce,modelMode:W>=0}},[t]),A=b.useMemo(()=>{const z=/(^|\s)\$([^\s$]*)$/.exec(t);if(z)return{query:z[2],start:t.length-z[2].length-1,end:t.length}},[t]),j=b.useMemo(()=>{if(A){const z=A.query.toLocaleLowerCase();return g.filter(W=>!x.some(q=>q.id===W.id||q.name===W.name)).filter(W=>`${W.name} ${W.description}`.toLocaleLowerCase().includes(z)).slice(0,12).map(W=>({kind:"skill",skill:W}))}return F!=null&&F.modelMode?tje(d,F.argument).map(z=>({kind:"model",model:z})):F?eje(F.command).map(z=>({kind:"command",command:z})):[]},[A,d,x,g,F]),P=!G&&!!(A||F);b.useEffect(()=>{L(0)},[t]),b.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),b.useEffect(()=>{A&&!y&&!v&&E()},[A,E,y,v]);const $=a.some(z=>z.status!=="ready"),R=!s&&!r&&!$&&(t.trim().length>0||a.length>0);function Y(z){D(!1),I(!1),n(z)}function Z(z){if(z.kind==="skill"){if(!A)return;const W=t.slice(0,A.start)+t.slice(A.end);w([...x,z.skill]),Y(W),D(!0),requestAnimationFrame(()=>{var q,ce;(q=N.current)==null||q.focus(),(ce=N.current)==null||ce.setSelectionRange(A.start,A.start)});return}if(z.kind==="model"){Y(`/model ${z.model.id}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}if(z.command.name==="model"){Y("/model "),m(),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}if(z.command.name==="skill"||z.command.name==="skills"){Y(`/${z.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()});return}Y(`/${z.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=N.current)==null?void 0:W.focus()})}function B(z){var W;I(!1),(W=z.current)==null||W.click()}function te(z){const W=z.target.files?Array.from(z.target.files):[];W.length&&l(W),z.target.value=""}const K=A?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx(Px,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[P?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx(LRe,{}),o.jsx("span",{children:K}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:A?"$":"/"})]}),A&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx($o,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx($o,{className:"spin"})," 正在读取模型…"]}):j.length===0?o.jsx("div",{className:"composer-command-empty",children:A?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:j.map((z,W)=>{const q=z.kind==="command"?`command:${z.command.name}`:z.kind==="model"?`model:${z.model.id}`:`skill:${z.skill.id}`,ce=z.kind==="command"?z.command.usage:z.kind==="model"?z.model.displayName:`$${z.skill.name}`,me=z.kind==="command"?z.command.description:z.kind==="model"?z.model.description||z.model.id:z.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":W===O,className:`composer-command-item${W===O?" is-active":""}`,onMouseDown:_e=>{_e.preventDefault(),Z(z)},onMouseEnter:()=>L(W),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${z.kind}`,"aria-hidden":"true",children:z.kind==="command"?"/":z.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ce}),o.jsx("span",{children:me})]}),W===O?o.jsx("kbd",{children:"↵"}):null]},q)})})]}):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:s,onClick:()=>I(z=>!z),children:o.jsx(IRe,{className:"icon"})}),C?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>I(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(_),children:[o.jsx(jRe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(T),children:[o.jsx(ORe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>B(k),children:[o.jsx(MRe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenTerminal()},children:[o.jsx(vV,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenBrowser()},children:[o.jsx(wV,{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(C2,{})}),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(Wb,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(Dx,{skillPrefix:"$",value:{skills:x.map(({name:z,description:W})=>({name:z,description:W}))},onRemoveSkill:z=>w(x.filter(W=>W.name!==z))}):null,o.jsx("textarea",{ref:N,className:"comp-input scroll",rows:1,value:t,disabled:s,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":P,onChange:z=>Y(z.target.value),onBlur:()=>window.setTimeout(()=>D(!0),0),onKeyDown:z=>{if(!GA(z.nativeEvent)){if(P){if((z.key==="ArrowDown"||z.key==="Tab"&&!z.shiftKey)&&j.length>0){z.preventDefault(),L(W=>(W+1)%j.length);return}if((z.key==="ArrowUp"||z.key==="Tab"&&z.shiftKey)&&j.length>0){z.preventDefault(),L(W=>(W-1+j.length)%j.length);return}if(z.key==="Enter"&&!z.shiftKey&&j[O]){z.preventDefault(),Z(j[O]);return}if(z.key==="Escape"){z.preventDefault(),D(!0);return}}if(z.key==="Backspace"&&!t&&z.currentTarget.selectionStart===0&&x.length>0){z.preventDefault(),w(x.slice(0,-1));return}z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),R&&i(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!R,onClick:()=>i(t),"aria-label":"发送",children:r?o.jsx($o,{className:"icon spin"}):o.jsx(RRe,{className:"icon"})})]}),o.jsx("input",{ref:_,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:T,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:k,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:te})]})}function oje({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:i,onSnapshot:s,onActivity:r,onError:a}){const l=b.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=b.useState(!1),[d,f]=b.useState([]),[h,p]=b.useState(!1),[m,g]=b.useState(!1),[v,y]=b.useState([]),[x,E]=b.useState(!1),[w,N]=b.useState(!1),[_,T]=b.useState([]),[k,C]=b.useState(!1),[I,O]=b.useState([]),[L,G]=b.useState(!1),[D,F]=b.useState("");b.useEffect(()=>{u(!1),f([]),p(!1),g(!1),y([]),E(!1),N(!1),T([]),C(!1),O([]),G(!1),F("")},[e==null?void 0:e.id]);const A=b.useCallback(async()=>{const B=l.current;if(!B)return[];p(!0);try{const te=await tn.listModels(B);return l.current===B&&(f(te),g(!0)),te}catch(te){return l.current===B&&(g(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===B&&p(!1)}},[a]),j=b.useCallback(async()=>{const B=l.current;if(!B)return[];E(!0);try{const te=await tn.listSkills(B);return l.current===B&&(y(te),N(!0)),te}catch(te){return l.current===B&&(N(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===B&&E(!1)}},[a]),P=b.useCallback(async()=>{const B=l.current;if(B){C(!0),G(!0),F("");try{const te=await tn.listThreads(B);l.current===B&&O(te.threads)}catch(te){l.current===B&&F(te instanceof Error?te.message:String(te))}finally{l.current===B&&G(!1)}}},[]);function $(B){s(B),T([]),y([]),N(!1),C(!1)}async function R(B){const te=l.current;if(!(!te||c||t)){if(B===(e==null?void 0:e.threadId)){C(!1);return}u(!0),a("");try{const K=await tn.resumeThread(te,B);if(l.current!==te)return;$(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}catch(K){l.current===te&&a(K instanceof Error?K.message:String(K))}finally{l.current===te&&u(!1)}}}async function Y(B){const te=e,K=B.trim();if(!K.startsWith("/"))return!1;if(!te||t||c)return!0;const z=JRe(K),W=z&&iE.find(q=>q.name===z.name);if(!z||!W)return a(`未知快捷命令:${K.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),T([]),W.name==="model"&&!z.argument)return n("/model "),m||await A(),!0;if(W.name==="skill"||W.name==="skills")return n("$"),w||(await j()).length===0&&n(""),!0;if(W.name==="resume"&&!z.argument)return n(""),await P(),!0;n(""),u(!0);try{if(W.name==="model"){const q=await tn.setModel(te.id,z.argument);if(l.current!==te.id)return!0;i({model:q}),r("已切换 Codex 模型",[{label:"模型",value:q,code:!0}])}else if(W.name==="models"){const q=m?d:await A();if(l.current!==te.id)return!0;r(q.length>0?"Codex 可用模型":"当前没有可用模型",ije(q,te.model))}else if(W.name==="new"||W.name==="clear"){const q=await tn.newThread(te.id);if(l.current!==te.id)return!0;$(q),r("已新建 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="resume"){const q=await tn.resumeThread(te.id,z.argument);if(l.current!==te.id)return!0;$(q),r("已恢复 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="fork"){const q=await tn.forkThread(te.id);if(l.current!==te.id)return!0;$(q),r("已分叉 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="compact"){if(await tn.compactThread(te.id),l.current!==te.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:te.threadId,code:!0}])}else if(W.name==="archive"){const q=te.threadId,ce=await tn.archiveThread(te.id,q);if(l.current!==te.id)return!0;ce.snapshot&&$(ce.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:q,code:!0}])}else if(W.name==="status"){const q=await tn.getStatus(te.id);if(l.current!==te.id)return!0;i(q),r("Codex 当前状态",sje(q))}else W.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",nje())}catch(q){l.current===te.id&&(n(K),a(q instanceof Error?q.message:String(q)))}finally{l.current===te.id&&u(!1)}return!0}function Z(){y([]),N(!1),T([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:A,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:j,selectedSkills:_,setSelectedSkills:T,invalidateSkills:Z,threadsOpen:k,threads:I,threadsLoading:L,threadsError:D,openThreads:P,closeThreads:()=>{c||(C(!1),F(""))},resumeThread:R,executeSlash:Y}}function lje({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 cje({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 uje(e){return e.toLowerCase()==="github"?o.jsx(jJ,{className:"icon"}):o.jsx(PJ,{className:"icon"})}function dje({branding:e,onUsername:t}){const[n,i]=b.useState(null),[s,r]=b.useState(""),[a,l]=b.useState(0),[c,u]=b.useState(""),d=b.useRef(null);b.useEffect(()=>{let m=!0;return i(null),r(""),eB().then(g=>{m&&i(g)}).catch(g=>{m&&r(g instanceof Error?g.message:String(g))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;b.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=oee.test(c),p=()=>{h&&t(c)};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||Ok,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(_a,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:s}),o.jsx("button",{type:"button",onClick:()=>l(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:n.map(m=>o.jsxs("button",{className:"login-btn",onClick:()=>cee(m.loginUrl),children:[uje(m.id),o.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[o.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:o.jsx(Lp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function fje({open:e,checking:t,error:n,onLogin:i}){const s=b.useRef(null);return b.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?ks.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(pk,{})}),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:s,type:"button",onClick:i,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function hje({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)})}Cu("Button",hje);function pje({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)})}Cu("Card",pje);const mje={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},gje={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function _V(e){return mje[e]??"flex-start"}function SV(e){return gje[e]??"stretch"}function bje({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:_V(e.justify),alignItems:SV(e.align)},children:n.map(i=>t.render(i))})}Cu("Column",bje);function yje({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})}Cu("Divider",yje);const xje={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function Eje({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:xje[t]??"•"})}Cu("Icon",Eje);function vje({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:_V(e.justify),alignItems:SV(e.align??"center")},children:n.map(i=>t.render(i))})}Cu("Row",vje);const wje=new Set(["h1","h2","h3","h4","h5"]);function _je({node:e,ctx:t}){const n=e.variant??"body",i=t.resolveString(e.text),s=wje.has(n)?n:"p";return o.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:i})}Cu("Text",_je);async function Uw(e){const[t,n,i]=await Promise.allSettled([wRe(),_Re(),Ck(e)]);return{agentId:e,ready:!0,harnessEnabled:i.status==="fulfilled",builtinTools:i.status==="fulfilled"?i.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const da={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},Sje=600,Nje=new Set,Tje=[];function za(){return{skills:[]}}function Fw(e){return`${eE(e)}.active`}function RN(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function kje(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(RN(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function jN(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const i=jN(n,t);if(i)return i}}function NV(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(...NV(n)));return t}function QD(){const e=typeof localStorage<"u"?localStorage.getItem(da.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function Aje({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 Cje({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 Ije({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 Rje(){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 ON(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 jje(e){if(!e)return"";const t=[];return e.ts&&t.push(ON(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Qb(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function Oje(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return Qb(e[n]);return""}const Mje="send_a2ui_json_to_client";function Lje(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===Mje&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?M$(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function Dje(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Pje(e){return new Promise((t,n)=>{let i="";try{i=new URL(e,window.location.href).protocol}catch{}if(i!=="http:"&&i!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{s.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(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&l(d)}catch{}}},500)})}function Bje(e,t){const n=JSON.parse(JSON.stringify(e??{})),i=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=i.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,i.oauth2=s,n.exchangedAuthCredential=i,n}function ZD({text:e}){const[t,n]=b.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(Aa,{className:"icon"}):o.jsx(Y1,{className:"icon"})})}const JD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],e3=()=>JD[Math.floor(Math.random()*JD.length)];function vo(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function t3(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function n3(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 Uje={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},Fje={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},$je={user:"由我审批",auto_review:"自动审查"};function Hje(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function zje(e){var n,i,s;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(i=e.grantRoot)!=null&&i.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(s=e.cwd)!=null&&s.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function i3(e){return e.flatMap(t=>t.apps.map(n=>Wo(t.id,n)))}function Vje(e,t){var n;return((n=e.find(i=>i.runtimeId&&i.apps.some(s=>Wo(i.id,s)===t)))==null?void 0:n.runtimeId)??""}function Gje(){const[e,t]=b.useState([]),[n,i]=b.useState(""),[s,r]=b.useState([]),[a,l]=b.useState(""),c=b.useRef(null),[u,d]=b.useState(!1),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,v]=b.useState([]),[y,x]=b.useState(!1),[E,w]=b.useState(!1),[N,_]=b.useState(""),[T,k]=b.useState(!1),[C,I]=b.useState(!1),[O,L]=b.useState(null),[G,D]=b.useState(null),[F,A]=b.useState(!1),[j,P]=b.useState(""),[$,R]=b.useState(null),[Y,Z]=b.useState(!1),[B,te]=b.useState(""),[K,z]=b.useState(!1),[W,q]=b.useState(!1),[ce,me]=b.useState("confirm"),[_e,de]=b.useState(""),[ge,Oe]=b.useState("codex"),[Ee,ae]=b.useState(!1),[Ne,ve]=b.useState(0),[Qe,Me]=b.useState(null),[ze,Se]=b.useState(null),Ue=b.useRef(null),Pe=b.useRef(null),Ke=b.useRef((p==null?void 0:p.id)??""),Q=b.useRef(""),oe=b.useRef(0);Ke.current=(p==null?void 0:p.id)??"";const[ie,be]=b.useState({}),Le=a?ie[a]??[]:f,qe=p?g:Le,gt=(M,U)=>be(ee=>({...ee,[M]:typeof U=="function"?U(ee[M]??[]):U}));function lt(M,U,ee=[],le=""){if(Ke.current!==M)return;const we=crypto.randomUUID(),Ce={role:"system",blocks:[],activity:{id:we,title:U,...ee.length>0?{details:ee}:{}},meta:{localId:we,ts:Date.now()/1e3}};v(it=>{if(!le)return[...it,Ce];const Ge=it.findIndex(st=>{var ut;return((ut=st.meta)==null?void 0:ut.localId)===le});return Ge<0?[...it,Ce]:[...it.slice(0,Ge),Ce,...it.slice(Ge)]})}const[ln,Mt]=b.useState(""),[kt,Vt]=b.useState("agent"),[He,Xt]=b.useState(null),[nt,yt]=b.useState({}),Je=b.useRef(new Map),ot=!n||nt.ready===!0&&nt.agentId===n,[ye,Xe]=b.useState(null),[St,Qt]=b.useState(!1),Rn=b.useRef(0),[Bt,Ze]=b.useState([]),[cn,un]=b.useState(za),[Et,nn]=b.useState(null),[Ci,ii]=b.useState(0),[Dn,Pn]=b.useState(!1),[gn,_n]=b.useState(null),[Bn,$i]=b.useState(!1),[gs,Ii]=b.useState([]),[Ri,Un]=b.useState(!1),vi=b.useRef(new Set),[Sn,si]=b.useState(()=>new Set),[ji,Oi]=b.useState(()=>new Set),bn=b.useRef(new Map),jn=b.useRef(new Map),Fn=(M,U)=>si(ee=>{const le=new Set(ee);return U?le.add(M):le.delete(M),le}),$n=M=>{const U=jn.current.get(M);U!==void 0&&window.clearTimeout(U),jn.current.delete(M),Oi(ee=>new Set(ee).add(M))},yn=M=>{const U=jn.current.get(M);U!==void 0&&window.clearTimeout(U);const ee=window.setTimeout(()=>{jn.current.delete(M),Oi(le=>{const we=new Set(le);return we.delete(M),we})},2400);jn.current.set(M,ee)},_t=b.useRef(""),[ue,fe]=b.useState(""),[De,We]=b.useState(""),[rt,at]=b.useState(()=>new Set),[sn,rn]=b.useState(!1),[fi,Zi]=b.useState(e3),[dn,Hn]=b.useState(null),[Ut,vt]=b.useState(!1),[wi,bs]=b.useState(!1),[lo,rs]=b.useState(""),Us=b.useRef(!1),[Or,tl]=b.useState(null),[Ve,co]=b.useState(""),[uo,re]=b.useState(),[ct,fn]=b.useState(null),hi=(ct==null?void 0:ct.capabilities.runtimeScope)??"mine",[Zt,_i]=b.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[se,Te]=b.useState("cloud"),[Fe,et]=b.useState(vm),[Nn,pi]=b.useState(""),[qn,as]=b.useState(!1),[Yn,qt]=b.useState(!1),[an,Hi]=b.useState(!1),[Qs,ia]=b.useState({}),[Ou,fc]=b.useState({}),[Fg,sa]=b.useState({}),ys=Sn.has(a),Oa=ji.has(a),nl=ys||u,sE=!!a&&Bn,fo=p?y:nl,mh=fo||!p&&Oa,Lt=oje({session:p,conversationBusy:y,onInputChange:Mt,onSessionPatch:M=>{const U=Ke.current;m(ee=>(ee==null?void 0:ee.id)===U?{...ee,...M}:ee)},onSnapshot:M=>{const U=Ke.current;v(rje(M)),m(ee=>(ee==null?void 0:ee.id)===U?{...ee,threadId:M.threadId,cwd:M.cwd??ee.cwd,model:M.model??ee.model,workspaceLocked:M.workspaceLocked,permissions:M.permissions,busy:!1}:ee)},onActivity:(M,U=[])=>{const ee=Ke.current;ee&<(ee,M,U)},onError:fe}),rE=Qs[a]??"",aE=Ou[a]??Nje,$g=Fg[a]??Tje,Ji=Et==null?void 0:Et.graph,Hg=[Et==null?void 0:Et.name,Ji==null?void 0:Ji.name,Ji==null?void 0:Ji.id].filter(M=>!!M),gh=cn.targetAgent&&Ji?jN(Ji,cn.targetAgent.name):Ji,zg=(gh==null?void 0:gh.skills)??(cn.targetAgent?[]:(Et==null?void 0:Et.skills)??[]),Vg=Ji?NV(Ji):[];function Mu(M){vo(M);for(const U of M)U.status==="uploading"?vi.current.add(U.id):U.uri&&Ib(n,U.uri).catch(ee=>fe(String(ee)))}function Ma(){Rn.current+=1;const M=ye;Xe(null),Qt(!1),M&&!M.id.startsWith("pending-")&&oIe(M.id).catch(U=>{fe(U instanceof Error?U.message:String(U))})}async function il(M){try{await aS(n,Ve,M),await rS(n,Ve,M),r(U=>U.filter(ee=>ee.id!==M)),be(U=>{const{[M]:ee,...le}=U;return le})}catch(U){fe(String(U))}}function sl(M){const U=Bt.find(we=>we.id===M);if(!U)return;const ee=Bt.filter(we=>we.id!==M);vo([U]),U.status==="uploading"&&vi.current.add(M),Ze(ee),ee.length===0&&!ln.trim()&&!!a&&qe.length===0?(_t.current="",l(""),il(a)):U.uri&&Ib(n,U.uri).catch(we=>fe(String(we)))}const Lu=(M,U)=>{var Ce,it,Ge,st,ut;const ee=U.author&&U.author!=="user"?U.author:void 0;ee&&(ia(Re=>({...Re,[M]:ee})),fc(Re=>({...Re,[M]:new Set(Re[M]??[]).add(ee)})),sa(Re=>{var dt;return(dt=Re[M])!=null&&dt.length?Re:{...Re,[M]:[ee]}}));const le=((Ce=U.actions)==null?void 0:Ce.transferToAgent)??((it=U.actions)==null?void 0:it.transfer_to_agent);le&&sa(Re=>{const dt=Re[M]??[];return dt[dt.length-1]===le?Re:{...Re,[M]:[...dt,le]}}),(((Ge=U.actions)==null?void 0:Ge.endOfAgent)??((st=U.actions)==null?void 0:st.end_of_agent)??((ut=U.actions)==null?void 0:ut.escalate))&&sa(Re=>{const dt=Re[M]??[];return dt.length<=1?Re:{...Re,[M]:dt.slice(0,-1)}})},[La,Dt]=b.useState(QD),[Gg,Kg]=b.useState([]),[oE,bh]=b.useState({}),yh=b.useCallback(M=>{Kg(U=>{const ee=U.findIndex(we=>we.id===M.id);if(ee===-1)return[M,...U];const le=[...U];return le[ee]={...le[ee],...M},le})},[]),[qg,Yg]=b.useState(!0),[Du,os]=b.useState(!1),[xh,Si]=b.useState(!1),[Wg,zn]=b.useState(!1),[lE,ls]=b.useState(null),[Eh,vh]=b.useState([]),Da=b.useRef([]),Pa=b.useRef(null),rl=b.useRef(null),[Xg,hc]=b.useState([]),[mi,Fs]=b.useState(""),Cs=b.useRef(null),[Pu,zi]=b.useState(!1),[H,ne]=b.useState(!1),[pe,Ae]=b.useState(""),[tt,Nt]=b.useState("good"),[Ni,ho]=b.useState("basic"),[xn,Ba]=b.useState("good"),[wh,Qg]=b.useState(""),[TV,kV]=b.useState(null),[al,gi]=b.useState(!1),[Bu,ra]=b.useState(null),cE=b.useRef(null),[ol,_h]=b.useState(()=>{const M=ga();return ah(M),M}),[AV,I2]=b.useState(!1),[CV,R2]=b.useState(""),[j2,Zg]=b.useState(null),[IV,O2]=b.useState({}),[RV,M2]=b.useState(()=>new Set),[Uu,aa]=b.useState(null),[Jg,uE]=b.useState("cn-beijing"),[L2,$s]=b.useState(""),[D2,Is]=b.useState(""),[En,Zs]=b.useState(null),[jV,dE]=b.useState(!1),e0=b.useRef(!1),Fu=b.useRef(!1),Ua=b.useCallback(M=>{if(!Ve)return!1;try{PD(localStorage,Ve,M)}catch(U){return We(U instanceof Error?U.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return Da.current=M,vh(M),We(""),!0},[Ve]),Fa=b.useCallback(M=>{var U;M&&((U=Pa.current)==null?void 0:U.id)!==M||(Pa.current=null,rl.current!==null&&(window.clearTimeout(rl.current),rl.current=null))},[]),$u=b.useCallback(()=>{const M=Pa.current;M&&(Fa(),Ua([M,...Da.current.filter(U=>U.id!==M.id)]))},[Fa,Ua]),OV=b.useCallback((M,U,ee)=>{!M||!Ve||(Pa.current&&Pa.current.id!==M&&$u(),Pa.current={id:M,draft:U,updatedAt:Date.now(),deploymentTarget:ee},rl.current!==null&&window.clearTimeout(rl.current),rl.current=window.setTimeout($u,Sje))},[$u,Ve]),fE=b.useCallback(M=>{!M||!Ve||(Fa(M),Ua(Da.current.filter(U=>U.id!==M)))},[Fa,Ua,Ve]),P2=b.useCallback(M=>{if(!Ve||M.length===0)return;const U=new Set(M.map(ee=>ee.id));Pa.current&&U.has(Pa.current.id)&&Fa(),Ua(Da.current.filter(ee=>!U.has(ee.id))),bh(ee=>Object.fromEntries(Object.entries(ee).filter(([le])=>!U.has(le)))),U.has(mi)&&(Fs(""),ls(null),aa(null),Cs.current=null,localStorage.removeItem(Fw(Ve)))},[Fa,Ua,mi,Ve]),B2=b.useCallback(M=>{if(!M||!Ve)return;Fa(M);const U=Cs.current,ee=Da.current.filter(le=>le.id!==M);Ua((U==null?void 0:U.id)===M?[U,...ee]:ee)},[Fa,Ua,Ve]);b.useEffect(()=>(window.addEventListener("pagehide",$u),()=>{window.removeEventListener("pagehide",$u)}),[$u]),b.useEffect(()=>{if(!Ve){Fa(),Da.current=[],vh([]),hc([]),Fs(""),We(""),Cs.current=null;return}let M=[],U="";try{M=QCe(localStorage,Ve),localStorage.getItem(eE(Ve))!==null&&PD(localStorage,Ve,M),U=localStorage.getItem(Fw(Ve))||"",We("")}catch(le){We(le instanceof Error?le.message:"无法读取本机草稿,请稍后重试。")}Da.current=M,vh(M),hc(kje(Ve));const ee=M.find(le=>le.id===U);Cs.current=ee??null,La==="custom"&&ee&&(Fs(ee.id),ls(ee.draft),aa(ee.deploymentTarget??null))},[Fa,Ve]),b.useEffect(()=>{if(!Ve)return;const M=Fw(Ve);try{La==="custom"&&mi?localStorage.setItem(M,mi):localStorage.removeItem(M)}catch{We("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[La,mi,Ve]);const MV=b.useCallback(M=>{if(!Ve)return;const U=[...new Set(M.filter(Boolean))];hc(U),localStorage.setItem(RN(Ve),JSON.stringify(U))},[Ve]),LV=b.useCallback(async M=>{const U=M.filter(st=>!!st.runtimeId&&st.canDelete===!0);if(U.length===0)return;const ee=Vje(ol,n),le=new Set(U.map(st=>st.runtimeId));M2(st=>{const ut=new Set(st);for(const Re of le)ut.add(Re);return ut}),W0(le);const we=new Set,Ce=new Set,it=new Set,Ge=[];for(const st of U)try{if(!st.region)throw new Error("Runtime 缺少地域信息,无法删除");await UB(st.runtimeId,st.region),u1(st.runtimeId),we.add(st.runtimeId),Ce.add(st.id)}catch(ut){const Re=ut instanceof Error?ut.message:String(ut);it.add(st.runtimeId),Ge.push(`${st.label}: ${Re}`)}if(we.size>0&&(W0(we),_h(ga()),Zg(ut=>{if(!ut)return ut;const Re=new Set(ut);for(const dt of we)Re.delete(dt);return Re}),O2(ut=>Object.fromEntries(Object.entries(ut).filter(([Re])=>!we.has(Re)))),hc(ut=>{const Re=ut.filter(dt=>!Ce.has(dt));return Ve&&localStorage.setItem(RN(Ve),JSON.stringify(Re)),Re}),Ua(Da.current.filter(ut=>{var Re;return!((Re=ut.deploymentTarget)!=null&&Re.runtimeId)||!we.has(ut.deploymentTarget.runtimeId)})),(ee?we.has(ee):U.some(ut=>ut.id===n))&&(tG(),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),$s(""),Is(""),gi(!0),fe("")),En!=null&&En.runtime&&we.has(En.runtime.runtimeId)&&(Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),$s(""),Is(""),gi(!0),fe(""))),it.size>0&&M2(st=>{const ut=new Set(st);for(const Re of it)ut.delete(Re);return ut}),Ge.length>0){const st=Ge.slice(0,3).join(";"),ut=Ge.length>3?`;另有 ${Ge.length-3} 个失败`:"";throw new Error(`${Ge.length} 个 Agent 删除失败:${st}${ut}`)}},[En,n,Ua,ol,Ve]),hE=b.useCallback(async()=>{I2(!0),R2("");try{const M=[];let U="";do{const ee=await nx({scope:hi,region:"all",pageSize:100,nextToken:U});M.push(...ee.runtimes),U=ee.nextToken}while(U&&M.length<2e3);Zg(new Set(M.map(ee=>ee.runtimeId))),O2(Object.fromEntries(M.map(ee=>[ee.runtimeId,{canDelete:ee.canDelete}])))}catch(M){R2(M instanceof Error?M.message:String(M))}finally{I2(!1)}},[hi]);function t0(M){console.log("create agent draft:",M),Dt(null),cl()}function pE(M,U){console.log("Agent added, navigating to:",M,U),_h(ga()),Zg(null),W0(),fE(mi),Fs(""),Cs.current=null,aa(null),$s(""),Is(M),ho("basic"),Dt(null),ne(!0),i(M)}const mE=b.useCallback(M=>{Dt(null),zn(!1),gi(!1),Zs(null),ne(!0),Is(""),ho("basic"),$s(M.id),fe("")},[]),U2=b.useCallback(M=>{mi&&bh(U=>({...U,[mi]:M.id})),mE(M)},[mi,mE]),F2=b.useCallback(async M=>{if(!M.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const U=(Uu==null?void 0:Uu.region)??Jg,ee=await Vb(M.runtimeId,M.agentName,M.region??U,M.version);_h(ga()),ii(we=>we+1);const le=await Uw(ee);Je.current.set(ee,le),yt(le),Zg(we=>{const Ce=new Set(we??[]);return Ce.add(M.runtimeId),Ce}),W0(),aa(null),fE(mi),bh(we=>{if(!mi||!we[mi])return we;const Ce={...we};return delete Ce[mi],Ce}),Fs(""),Cs.current=null,Is(ee),ho("basic"),Dt(null),ne(!0),i(ee)},[mi,Jg,fE,Uu]),Sh=b.useRef(null),gE=b.useRef(new Map),pc=b.useRef(!0),ll=b.useRef(!1),mc=b.useRef(null),$2=b.useRef({key:"",turnCount:0}),bE=(p==null?void 0:p.id)??a;b.useLayoutEffect(()=>{const M=Sh.current,U=$2.current,ee=U.key!==bE,le=!ee&&qe.length>U.turnCount;if($2.current={key:bE,turnCount:qe.length},!M||qe.length===0||!ee&&!le)return;pc.current=!0,ll.current=!1,mc.current!==null&&(window.clearTimeout(mc.current),mc.current=null);const we=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ee||we){M.scrollTop=M.scrollHeight;return}ll.current=!0,M.scrollTo({top:M.scrollHeight,behavior:"smooth"}),mc.current=window.setTimeout(()=>{ll.current=!1,mc.current=null},450)},[bE,qe.length]),b.useLayoutEffect(()=>{const M=Sh.current;!M||!pc.current||ll.current||(M.scrollTop=M.scrollHeight)},[fo,qe]),b.useEffect(()=>{if(!wh||H||qe.length===0)return;const M=gE.current.get(wh);if(!M)return;pc.current=!1,M.scrollIntoView({behavior:"smooth",block:"center"});const U=window.setTimeout(()=>{Qg("")},2600);return()=>window.clearTimeout(U)},[wh,H,qe]),b.useEffect(()=>()=>{mc.current!==null&&window.clearTimeout(mc.current)},[]);const DV=b.useCallback(()=>{const M=Sh.current;!M||ll.current||(pc.current=M.scrollHeight-M.scrollTop-M.clientHeight<32)},[]),PV=b.useCallback(M=>{M.deltaY<0&&(ll.current=!1,pc.current=!1)},[]),BV=b.useCallback(()=>{ll.current=!1,pc.current=!1},[]),UV=b.useCallback(()=>{const M=Sh.current;!M||!pc.current||ll.current||(M.scrollTop=M.scrollHeight)},[]),yE=b.useCallback(()=>{tl(null),nS().then(M=>{co(M.userId),re(M.info),qt(!!M.local),Hn(M.status),M.status==="authenticated"&&(e0.current=!0,Fu.current=!0,localStorage.removeItem(da.app),i(""),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),gi(!1))}).catch(M=>{tl(M instanceof Error?M.message:String(M))})},[]);b.useEffect(()=>{yE()},[yE]),b.useEffect(()=>{const M=()=>{rs(""),vt(!0)};return window.addEventListener(iS,M),bee()&&M(),()=>window.removeEventListener(iS,M)},[]);const FV=b.useCallback(async()=>{if(Us.current)return;Us.current=!0;const M=uee();if(!M){Us.current=!1,rs("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}bs(!0),rs("");try{for(;;){await new Promise(U=>window.setTimeout(U,1e3));try{const U=await nS();if(U.status==="authenticated"){co(U.userId),re(U.info),qt(!!U.local),Hn(U.status),vt(!1),yee(),M.close();return}}catch{}if(M.closed){rs("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{Us.current=!1,bs(!1)}},[]);b.useEffect(()=>{Yn&&Ve&&aj(Ve)},[Yn,Ve]),b.useEffect(()=>{if(dn!=="authenticated"||!Ve||!n){yt({});return}const M=Je.current.get(n);if(M){yt(M);return}let U=!1;return yt({}),Uw(n).then(ee=>{U||(Je.current.set(n,ee),yt(ee))}),()=>{U=!0}},[n,dn,Ve]),b.useEffect(()=>{if(dn!=="authenticated"||!Ve){fn(null);return}let M=!1;return fn(null),MB().then(U=>{M||fn(U)}).catch(U=>{console.warn("[app] /web/access failed; using ordinary-user access:",U),M||fn(OB)}),()=>{M=!0}},[dn,Ve]),b.useEffect(()=>{jB().then(M=>{lke(M.telemetry),uke({agentsSource:M.agentsSource}),_i(M.features),Te(M.agentsSource),et(M.branding),pi(M.version),as(!0)})},[]),b.useEffect(()=>{dn!=="authenticated"||!uo||!ct||cke({userId:ct.telemetry.userId,role:ct.role,local:Yn})},[ct,dn,Yn,uo]),b.useEffect(()=>{ct&&(ct.capabilities.createAgents||(Dt(null),ls(null),Si(!1),zn(!1),Kg([])),ct.capabilities.manageAgents||ne(!1))},[ct]),b.useEffect(()=>{dn!=="authenticated"||se!=="cloud"||!qn||!H||En||hE()},[En,se,dn,H,hE,qn]),b.useEffect(()=>{document.title=Fe.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=Fe.logoUrl||Ok},[Fe]),b.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(M=>M.ok?M.json():null).then(M=>{M&&Yg(!!M.credentials)}).catch(M=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",M)})},[]);function $V(M){aj(M),e0.current=!0,Fu.current=!0,localStorage.removeItem(da.app),fn(null),Dt(null),ls(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),cl(),i(""),gi(!1),co(M),re({name:M}),qt(!0),Hn("authenticated")}function HV(){fn(null),Yn?(lee(),co(""),re(void 0),Hn("unauthenticated")):fee()}b.useEffect(()=>{if(dn==="authenticated"){if(se==="cloud"){const M=i3(ol);i(U=>U&&M.includes(U)?U:(U&&(Fu.current=!0,localStorage.removeItem(da.app)),""));return}sB().then(M=>{t(M);const U=i3(ol);i(ee=>ee&&(M.includes(ee)||U.includes(ee))?ee:(ee&&(Fu.current=!0,localStorage.removeItem(da.app)),""))}).catch(M=>fe(String(M)))}},[dn,se,ol]),b.useEffect(()=>{n?(Fu.current=!1,localStorage.setItem(da.app,n)):localStorage.removeItem(da.app)},[n]),b.useEffect(()=>{let M=!1;if(_n(null),Ii([]),al||En||!n||!Ve||!a){$i(!1);return}return $i(!0),oS(n,Ve,a).then(U=>{M||(_n(U),Ck(n).then(ee=>{M||Ii(ee)}).catch(()=>{M||Ii([])}))}).catch(()=>{M||_n(null)}).finally(()=>{M||$i(!1)}),()=>{M=!0}},[En,n,al,Ve,a]),b.useEffect(()=>{let M=!1;if(nn(null),un(za()),dn!=="authenticated"||al||En||!n){Pn(!1);return}return Pn(!0),Ik(n).then(U=>{M||nn(U)}).catch(()=>{M||nn(null)}).finally(()=>{M||Pn(!1)}),()=>{M=!0}},[En,n,Ci,dn,al]),b.useEffect(()=>{ct&&localStorage.setItem(da.view,ct.capabilities.createAgents?La??"chat":"chat")},[ct,La]),b.useEffect(()=>{localStorage.setItem(da.session,a),_t.current=a},[a]),b.useEffect(()=>()=>bn.current.forEach(M=>M.abort()),[]),b.useEffect(()=>()=>jn.current.forEach(M=>{window.clearTimeout(M)}),[]),b.useEffect(()=>()=>{var M,U;(M=Ue.current)==null||M.abort(),(U=Pe.current)==null||U.abort()},[]),b.useEffect(()=>{if(al||En||p||!n||!Ve)return;let M=!1;return(async()=>{const U=await n0(n);if(!M){if(!e0.current){e0.current=!0;const ee=localStorage.getItem(da.session)||"";if(QD()===null&&ee&&U.some(le=>le.id===ee)){Nh(ee);return}}cl()}})(),()=>{M=!0}},[En,n,al,p,Ve]),b.useEffect(()=>{const M=cE.current;M&&M.app===n&&(cE.current=null,Nh(M.sid))},[n]);function zV(M,U){zi(!1),M===n?Nh(U):(cE.current={app:M,sid:U},i(M))}async function n0(M){try{const U=await Tk(M,Ve),ee=await Promise.allSettled(U.map(Ce=>{var it;return(it=Ce.events)!=null&&it.length?Promise.resolve(Ce):Uy(M,Ve,Ce.id)})),le=ee.find(Ce=>Ce.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(Ce.reason)));if((le==null?void 0:le.status)==="rejected")throw le.reason;const we=ee.flatMap(Ce=>Ce.status==="fulfilled"?[Ce.value]:[]);return r(we),we}catch(U){return fe(String(U)),[]}}function H2(M="codex",U=!1){p||(fe(""),de(""),me("confirm"),Oe(M),ae(U),q(!0))}function VV(){var M;(M=Ue.current)==null||M.abort(),Ue.current=null,q(!1),me("confirm"),de(""),!p&&kt==="temporary"&&!Ee&&Vt("agent")}async function GV(M){var ee;(ee=Ue.current)==null||ee.abort();const U=new AbortController;Ue.current=U,me("loading"),de("");try{const le=ge==="codex"?await tn.startSession({displayName:M,signal:U.signal}):await tn.startAgentSession(ge,{displayName:M,signal:U.signal});if(Ue.current!==U)return;if(hke({kind:ge,source:Ee?"my_agents":"new_chat",sessionId:le.id}),Ee){ve(Ce=>Ce+1),q(!1),me("confirm"),gi(!0);return}if(ge!=="codex")return;const we=await tn.connectSession(le.id,{signal:U.signal});if(Ue.current!==U)return;_t.current="",l(""),h([]),Mt(""),un(za()),Vt("temporary"),Ma(),Qt(!1),Mu(Bt),Ze([]),v([]),m(we),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),gi(!1),Me(null),Se(null),q(!1),me("confirm")}catch(le){if((le==null?void 0:le.name)==="AbortError"||Ue.current!==U)return;pke({kind:ge,source:Ee?"my_agents":"new_chat",error:le}),de(le instanceof Error?le.message:String(le)),me("error")}finally{Ue.current===U&&(Ue.current=null)}}async function xE(M){if(fe(""),M.toolName==="codex"){const ee=await tn.connectSession(M.id);_t.current="",l(""),h([]),Mt(""),un(za()),v([]),m(ee),Me(null),Se(null),gi(!1),ne(!1);return}const U=await tn.openAgentSession(M.toolName,M.id);Se(U),Me(null),gi(!1),ne(!1)}function KV(M){Me(M),Se(null),gi(!1),ne(!1),fe("")}async function qV(M){(p==null?void 0:p.id)===M.id&&po(),M.toolName==="codex"?await tn.deleteSession(M.id):await tn.deleteAgentSession(M.toolName,M.id),Me(null),Se(null),ve(U=>U+1),gi(!0)}function po(){var U;(U=Pe.current)==null||U.abort(),Pe.current=null,Ke.current="",Q.current="",x(!1),v([]),vo(Bt),Ze([]),Mt(""),fe(""),Vt("agent"),w(!1),_(""),k(!1),I(!1),L(null),D(null),A(!1),P(""),R(null),Z(!1),te(""),z(!1),oe.current+=1;const M=p;m(null),M&&tn.closeSession(M.id).catch(ee=>fe(String(ee)))}async function EE(M){const U=p;if(U){L(M),D(null),P(""),A(!0);try{const ee=M==="terminal"?await tn.launchTerminal(U.id):await tn.launchBrowser(U.id);D(ee)}catch(ee){P(ee instanceof Error?ee.message:String(ee))}finally{A(!1)}}}async function YV(M){const U=p;if(!(!U||E)){w(!0),_("");try{const ee=await tn.updatePermissions(U.id,M);m(le=>(le==null?void 0:le.id)===U.id?{...le,permissions:ee}:le),lt(U.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:Uje[ee.sandboxMode]},{label:"审批策略",value:Fje[ee.approvalPolicy]},{label:"审批方式",value:$je[ee.approvalsReviewer]},{label:"网络访问",value:ee.networkAccess?"允许":"关闭"}]),Ke.current===U.id&&k(!1)}catch(ee){_(ee instanceof Error?ee.message:String(ee))}finally{w(!1)}}}const WV=b.useCallback(async M=>{const U=p==null?void 0:p.id;if(!U)throw new Error("当前没有已连接的 Sandbox。");return tn.listDirectories(U,M)},[p==null?void 0:p.id]);async function XV(M){const U=p;if(!(!U||U.workspaceLocked||E)){w(!0),_("");try{const ee=await tn.updateWorkspace(U.id,M);m(le=>(le==null?void 0:le.id)===U.id?{...le,cwd:ee}:le),Lt.invalidateSkills(),lt(U.id,"已更新工作空间",[{label:"工作目录",value:ee,code:!0}]),Ke.current===U.id&&I(!1)}catch(ee){_(ee instanceof Error?ee.message:String(ee))}finally{w(!1)}}}async function QV(M){const U=p,ee=$;if(!(!U||!ee||Y)){Z(!0),te("");try{await tn.resolveApproval(U.id,ee.id,M),lt(U.id,Hje(ee,M),zje(ee),Q.current),R(le=>(le==null?void 0:le.id)===ee.id?null:le)}catch(le){te(le instanceof Error?le.message:String(le))}finally{Z(!1)}}}async function ZV(M){const U=p;if(!U||K)return;const ee=++oe.current;fe(""),z(!0);const le=Array.from(M).map(we=>{const Ce={id:t3(),mimeType:n3(we),name:we.name,sizeBytes:we.size,status:"uploading",previewUrl:URL.createObjectURL(we)};return{file:we,attachment:Ce}});Ze(we=>[...we,...le.map(({attachment:Ce})=>Ce)]);try{const Ce=(await Promise.all(le.map(async({file:it,attachment:Ge})=>{try{const st=await tn.uploadFile(U.id,it);return oe.current!==ee?null:(Ze(ut=>ut.map(Re=>Re.id===Ge.id?{...Re,id:st.id,uri:st.path,name:st.name,mimeType:st.mimeType,sizeBytes:st.sizeBytes,status:"ready"}:Re)),st)}catch(st){if(oe.current!==ee)return null;const ut=st instanceof Error?st.message:String(st);return Ze(Re=>Re.map(dt=>dt.id===Ge.id?{...dt,status:"error",error:ut}:dt)),fe(ut),null}}))).filter(it=>it!==null);oe.current===ee&&Ce.length>0&<(U.id,Ce.length===1?"已上传文件到 Sandbox":`已上传 ${Ce.length} 个文件到 Sandbox`,Ce.map((it,Ge)=>({label:Ce.length===1?"文件":`文件 ${Ge+1}`,value:it.path,code:!0})))}finally{oe.current===ee?z(!1):vo(le.map(({attachment:we})=>we))}}function JV(M){const U=Bt.find(ee=>ee.id===M);U&&(vo([U]),Ze(ee=>ee.filter(le=>le.id!==M)))}async function z2(M,U=[],ee=[]){var Js;const le=p,we=U.filter(ft=>ft.status==="ready"&&ft.uri);if(!le||y||!M.trim()&&we.length===0)return;fe(""),R(null),te("");const Ce=new AbortController;(Js=Pe.current)==null||Js.abort(),Pe.current=Ce;const it=[];ee.length>0&&it.push({kind:"invocation",value:{skills:ee.map(({name:ft,description:ht})=>({name:ft,description:ht}))}}),we.length>0&&it.push({kind:"attachment",files:we.map(ft=>({id:ft.id,mimeType:ft.mimeType,name:ft.name,sizeBytes:ft.sizeBytes}))}),M.trim()&&it.push({kind:"text",text:M});const Ge=we.map(ft=>ft.uri).filter(ft=>!!ft),ut=[ee.map(ft=>`$${ft.name}`).join(" "),M.trim()].filter(Boolean).join(" "),Re=Ge.length>0?[ut,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...Ge.map(ft=>`- ${ft}`)].filter(Boolean).join(` -`):ct,ut=crypto.randomUUID(),Ft=crypto.randomUUID(),ei=[{role:"user",blocks:tt,meta:{localId:ut,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:Ft}}];Q.current=Ft,v(dt=>[...dt,...ei]),x(!0),m(dt=>(dt==null?void 0:dt.id)===le.id?{...dt,busy:!0,workspaceLocked:!0}:dt);try{const dt=await nn.sendMessage({sessionId:le.id,text:Oe,skillIds:ee.map(ft=>ft.id)},{signal:Ie.signal,onApproval:ft=>{Fe.current===Ie&&(te(""),R(ft))},onApprovalResolved:ft=>{Fe.current===Ie&&R(St=>(St==null?void 0:St.id)===ft?null:St)},onBlocks:ft=>{Fe.current===Ie&&v(St=>{const ht=St.slice(),on=ht.findIndex(Fs=>{var ti;return((ti=Fs.meta)==null?void 0:ti.localId)===Ft}),hi=ht[on];return(hi==null?void 0:hi.role)==="assistant"&&(ht[on]={...hi,blocks:ft}),ht})},onUsage:ft=>{Fe.current===Ie&&v(St=>{const ht=St.slice(),on=ht.findIndex(Fs=>{var ti;return((ti=Fs.meta)==null?void 0:ti.localId)===Ft}),hi=ht[on];return(hi==null?void 0:hi.role)==="assistant"&&(ht[on]={...hi,meta:{...hi.meta,sandboxUsage:ft.usage}}),ht})}});if(Fe.current!==Ie)return;v(ft=>{const St=ft.slice(),ht=St.findIndex(hi=>{var Fs;return((Fs=hi.meta)==null?void 0:Fs.localId)===Ft}),on=St[ht];return(on==null?void 0:on.role)==="assistant"&&(St[ht]={...on,blocks:dt.blocks,meta:{...on.meta,ts:Date.now()/1e3,...dt.usage?{sandboxUsage:dt.usage.usage}:{}}}),St}),xo(U)}catch(dt){if((dt==null?void 0:dt.name)==="AbortError"){xo(U);return}if(Fe.current!==Ie){xo(U);return}v(ft=>ft.filter(St=>{var ht,on;return((ht=St.meta)==null?void 0:ht.localId)!==ut&&((on=St.meta)==null?void 0:on.localId)!==Ft})),Dt(L),mt(U),Bt.setSelectedSkills(ee),Ee(`内置智能体发送失败:${dt instanceof Error?dt.message:String(dt)}`);try{const ft=await nn.getSettings(le.id);m(St=>(St==null?void 0:St.id)===le.id?{...St,...ft}:St)}catch{}}finally{Fe.current===Ie&&(Fe.current=null,Q.current===Ft&&(Q.current=""),x(!1),R(null),m(dt=>(dt==null?void 0:dt.id)===le.id?{...dt,busy:!1}:dt))}}async function $V(L){if(await Bt.executeSlash(L)||!p||y||Bt.commandBusy)return;const U=ot,ee=Bt.selectedSkills;Dt(""),mt([]),Bt.setSelectedSkills([]),await L2(L.trim(),U,ee)}function ol(){fo(),Ee(""),xi(VD()),$t("agent"),Kt(null),Oa(),sn(!1);const L=a&&Ue.length===0&&ot.length>0?a:"";Se.current="",l(""),vn(null),ki([]),d(!1),h([]),fn(Ha()),ju(ot),mt([]),L&&tl(L)}function HV(){var L;Bu.current=!0,localStorage.removeItem(ua.app),a&&((L=pn.current.get(a))==null||L.abort()),c.current=null,ol(),i(""),at({}),Wt(null)}function zV(){Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),ol()}async function VV(L){var U;try{(U=pn.current.get(L))==null||U.abort(),await J_(n,Ve,L),await Z_(n,Ve,L);const ee=An.current.get(L);ee!==void 0&&window.clearTimeout(ee),An.current.delete(L),yi(le=>{if(!le.has(L))return le;const we=new Set(le);return we.delete(L),we}),be(le=>{const{[L]:we,...Ie}=le;return Ie}),L===a&&ol(),await Qg(n)}catch(ee){Ee(String(ee))}}async function vh(L){if(p&&fo(),L!==a&&(Se.current=L,Ee(""),d(!1),h([]),$t("agent"),Kt(null),Oa(),fn(Ha()),vn(null),ki([]),l(L),ie[L]===void 0)){Fi(!0);try{const U=await Oy(n,Ve,L);yt(L,Lee(U.events??[],U.state))}catch(U){Ee(String(U))}finally{Fi(!1)}}}async function GV(L){if(!L.sessionId||!L.messageId){Ee("这条案例缺少会话定位信息,无法跳转。");return}$i(!1),Ut(null),vi(!1),Pn(!1),rs(!1),ne(!1),Ce(n),_t(L.kind),Kg(L.messageId),await vh(L.sessionId)}function KV(){const L=he||n;$i(!1),Ut(null),vi(!1),Pn(!1),rs(!1),Us(""),ks(L),uo("evaluations"),Pa(et),ne(!0),Ce(""),Kg("")}function qV(L){const U=new Map,ee=new Map;for(const le of L){if(!le.sessionId||!le.messageId)continue;const we=U.get(le.sessionId)??new Set;if(we.add(le.messageId),U.set(le.sessionId,we),le.runtimeId&&le.userId){const Ie=[le.runtimeId,n,le.userId,le.sessionId].join(":"),tt=ee.get(Ie)??{runtimeId:le.runtimeId,appName:n,userId:le.userId,sessionId:le.sessionId,eventIds:new Set};tt.eventIds.add(le.messageId),ee.set(Ie,tt)}}if(U.size!==0){be(le=>{const we={...le};for(const[Ie,tt]of U){const Ke=we[Ie];Ke&&(we[Ie]=Ke.map(st=>{var ct;return(ct=st.meta)!=null&&ct.eventId&&tt.has(st.meta.eventId)?{...st,meta:{...st.meta,feedback:void 0}}:st}))}return we}),r(le=>le.map(we=>{const Ie=U.get(we.id);if(!Ie||!we.state)return we;const tt={...we.state};for(const Ke of Ie)delete tt[`veadk_feedback:${Ke}`];return{...we,state:tt}})),Pt(le=>{const we=new Set(le);for(const Ie of U.values())for(const tt of Ie)we.delete(tt);return we});for(const le of ee.values())GP({runtimeId:le.runtimeId,appName:le.appName,userId:le.userId,sessionId:le.sessionId,eventIds:[...le.eventIds]});pV(le=>le&&(L.some(we=>we.id===le.id||we.messageId===le.messageId)?null:le))}}async function D2(L=!0){if(a)return a;c.current||(c.current=jy(n,Ve));const U=c.current;try{const ee=await U;L&&l(ee);const le=Date.now()/1e3,we={id:ee,lastUpdateTime:le,events:[]};return r(Ie=>[we,...Ie.filter(tt=>tt.id!==ee)]),ee}finally{c.current===U&&(c.current=null)}}async function YV(L){if(!n||!Ve||!a||!hn)return!1;gn(!0),Ee("");try{const U=await tS(n,Ve,a,L,hn.revision);return vn(U),!0}catch(U){return Ee(String(U)),!1}finally{gn(!1)}}async function WV(L){if(!(!n||!Ve||!a||!hn)){gn(!0),Ee("");try{const U=await pB(n,Ve,a,L,hn.revision);vn(U)}catch(U){Ee(String(U))}finally{gn(!1)}}}async function XV(L){Ee("");let U;try{U=await D2()}catch(le){Ee(String(le));return}const ee=Array.from(L).map(le=>({file:le,attachment:{id:GD(),mimeType:KD(le),name:le.name,sizeBytes:le.size,status:"uploading"}}));mt(le=>[...le,...ee.map(we=>we.attachment)]),await Promise.all(ee.map(async({file:le,attachment:we})=>{try{const Ie=await cB(n,Ve,U,le);if(Ai.current.delete(we.id)){Ie.uri&&await Nb(n,Ie.uri);return}mt(tt=>tt.map(Ke=>Ke.id===we.id?Ie:Ke))}catch(Ie){if(Ai.current.delete(we.id))return;const tt=Ie instanceof Error?Ie.message:String(Ie);mt(Ke=>Ke.map(st=>st.id===we.id?{...st,status:"error",error:tt}:st)),Ee(tt)}}))}async function P2(L,U=[],ee=Ha()){if(!L.trim()&&U.length===0||el||Qx||!n||!Ve)return;Ee("");const le=[];(ee.skills.length>0||ee.targetAgent)&&le.push({kind:"invocation",value:ee}),U.length&&le.push({kind:"attachment",files:U.map(Oe=>({id:Oe.id,mimeType:Oe.mimeType,data:Oe.data,uri:Oe.uri,name:Oe.name,sizeBytes:Oe.sizeBytes}))}),L.trim()&&le.push({kind:"text",text:L});const we=[{role:"user",blocks:le,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Ie=!a;Ie&&(h(we),d(!0));const tt=Ge;let Ke;try{Ke=await D2(!Ie)}catch(Oe){Ie&&(h([]),d(!1),Dt(L),fn(ee)),Ee(String(Oe));return}let st=gv(hn);if(tt)try{let Oe=await eS(n,Ve,Ke);const ut=yNe[tt].filter(Ft=>{var ei;return(ei=nt.builtinTools)==null?void 0:ei.includes(Ft)});for(const Ft of[...M$[tt],...ut])Oe.tools.some(ei=>ei.name===Ft)||(Oe=await tS(n,Ve,Ke,{kind:"tool",name:Ft},Oe.revision));vn(Oe),st=gv(Oe)}catch(Oe){Ie&&(h([]),d(!1),Dt(L),fn(ee)),Ee(`任务能力挂载失败:${String(Oe)}`);return}yt(Ke,Oe=>Ie?we:[...Oe,...we]),Ie&&(Se.current=Ke,l(Ke),h([]),d(!1));const ct=new AbortController;pn.current.set(Ke,ct),Mn(Ke,!0),Ln(Ke),Se.current=Ke,na(Oe=>({...Oe,[Ke]:""})),dc(Oe=>({...Oe,[Ke]:new Set})),ia(Oe=>({...Oe,[Ke]:[]}));try{let Oe=ya(),ut="",Ft=0,ei=Date.now()/1e3,Qs="",dt="";for await(const ft of gm({appName:n,userId:Ve,sessionId:Ke,text:L,attachments:U,invocation:ee,signal:ct.signal,sessionCapabilities:st})){if(ct.signal.aborted)break;const St=ft.error??ft.errorMessage??ft.error_message;if(typeof St=="string"&&St){Se.current===Ke&&Ee(St);break}Ou(Ke,ft);const ht=ft.author&&ft.author!=="user"?ft.author:"";ht&&ht!==ut&&(ut=ht,Oe=ya()),Oe=pf(Oe,ft);const on=ft.usageMetadata??ft.usage_metadata;on!=null&&on.totalTokenCount&&(Ft=on.totalTokenCount),ft.timestamp&&(ei=ft.timestamp),ft.id&&(Qs=ft.id);const hi=ft.invocationId??ft.invocation_id;hi&&(dt=hi);const Fs=Oe.blocks,ti={author:ut||void 0,tokens:Ft||void 0,ts:ei,eventId:Qs||void 0,invocationId:dt||void 0};yt(Ke,Fa=>{var _h;const os=Fa.slice(),tn=os[os.length-1];return(tn==null?void 0:tn.role)==="assistant"&&(!((_h=tn.meta)!=null&&_h.author)||tn.meta.author===ut)?os[os.length-1]={...tn,blocks:Fs,meta:ti}:os.push({role:"assistant",blocks:Fs,meta:ti}),os})}Qg(n)}catch(Oe){(Oe==null?void 0:Oe.name)!=="AbortError"&&!ct.signal.aborted&&Se.current===Ke&&Ee(String(Oe))}finally{pn.current.get(Ke)===ct&&pn.current.delete(Ke),Mn(Ke,!1),ce(Ke),na(Oe=>({...Oe,[Ke]:""})),ia(Oe=>({...Oe,[Ke]:[]}))}}function QV(L,U){var we,Ie;const ee=((we=L==null?void 0:L.event)==null?void 0:we.name)??U.id,le=((Ie=L==null?void 0:L.event)==null?void 0:Ie.context)??{};P2(`[ui-action] ${ee}: ${JSON.stringify(le)}`)}async function ZV(L){var st,ct,Oe;if(!L.authUri)throw new Error("事件中没有授权地址。");if(!n||!Ve||!a)throw new Error("会话尚未就绪。");const U=a,ee=await lje(L.authUri),le=cje(L.authConfig,ee),we=ut=>ut.map(Ft=>Ft.kind==="auth"&&!Ft.done?{...Ft,done:!0}:Ft);yt(U,ut=>{const Ft=ut.slice(),ei=Ft[Ft.length-1];return(ei==null?void 0:ei.role)==="assistant"&&(Ft[Ft.length-1]={...ei,blocks:we(ei.blocks)}),Ft});const Ie=Ye[Ye.length-1],tt=we(Ie&&Ie.role==="assistant"?Ie.blocks:[]),Ke=new AbortController;pn.current.set(U,Ke),Mn(U,!0),Ln(U);try{let ut=ya(),Ft=((st=Ie==null?void 0:Ie.meta)==null?void 0:st.author)??"",ei=tt,Qs=0,dt=Date.now()/1e3,ft=((ct=Ie==null?void 0:Ie.meta)==null?void 0:ct.eventId)??"",St=((Oe=Ie==null?void 0:Ie.meta)==null?void 0:Oe.invocationId)??"";for await(const ht of gm({appName:n,userId:Ve,sessionId:a,text:"",functionResponses:[{id:L.callId,name:"adk_request_credential",response:le}],signal:Ke.signal,sessionCapabilities:gv(hn)})){if(Ke.signal.aborted)break;Ou(U,ht);const on=ht.author&&ht.author!=="user"?ht.author:"";on&&on!==Ft&&(Ft=on,ei=[],ut=ya()),ut=pf(ut,ht);const hi=ht.usageMetadata??ht.usage_metadata;hi!=null&&hi.totalTokenCount&&(Qs=hi.totalTokenCount),ht.timestamp&&(dt=ht.timestamp),ht.id&&(ft=ht.id);const Fs=ht.invocationId??ht.invocation_id;Fs&&(St=Fs);const ti=[...ei,...ut.blocks];yt(U,Fa=>{var K2,q2,Y2,W2,X2;const os=Fa.slice(),tn=os[os.length-1],_h={author:Ft||((K2=tn==null?void 0:tn.meta)==null?void 0:K2.author),tokens:Qs||((q2=tn==null?void 0:tn.meta)==null?void 0:q2.tokens),ts:dt,eventId:ft||((Y2=tn==null?void 0:tn.meta)==null?void 0:Y2.eventId),invocationId:St||((W2=tn==null?void 0:tn.meta)==null?void 0:W2.invocationId)};return(tn==null?void 0:tn.role)==="assistant"&&(!((X2=tn.meta)!=null&&X2.author)||tn.meta.author===Ft)?os[os.length-1]={...tn,blocks:ti,meta:_h}:os.push({role:"assistant",blocks:ti,meta:_h}),os})}Qg(n)}catch(ut){(ut==null?void 0:ut.name)!=="AbortError"&&!Ke.signal.aborted&&Se.current===U&&Ee(String(ut))}finally{pn.current.get(U)===Ke&&pn.current.delete(U),Mn(U,!1),ce(U),na(ut=>({...ut,[U]:""})),ia(ut=>({...ut,[U]:[]}))}}if(Rr)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:Rr}),o.jsx("button",{type:"button",onClick:dE,children:"重试"})]});if(wt===null)return o.jsx("div",{className:"boot"});if(wt==="unauthenticated")return o.jsx(DRe,{branding:$e,onUsername:AV});if(!gt)return o.jsx("div",{className:"boot"});const jr=gt.capabilities.createAgents,B2=gt.capabilities.manageAgents,ll=jr?Ma:null,U2=jr&&Vg,F2=jr&&mh,$2=H&&!!(yn||k2||A2),H2=e$(e,rl),wh=H2.filter(L=>L.runtimeId&&(S2===null||S2.has(L.runtimeId))).map(L=>{var U;return{...L,canDelete:L.runtimeId?((U=bV[L.runtimeId])==null?void 0:U.canDelete)===!0:!1}}),JV=(()=>{if(wh.length===0)return wh;const L=new Map(Gg.map((U,ee)=>[U,ee]));return[...wh].sort((U,ee)=>{const le=L.get(U.id),we=L.get(ee.id);return le!=null&&we!=null?le-we:le!=null?-1:we!=null?1:wh.indexOf(U)-wh.indexOf(ee)})})(),z2=L=>{var U;return((U=H2.find(ee=>ee.id===L))==null?void 0:U.label)??L},_n=rl.find(L=>L.runtimeId&&L.apps.some(U=>qo(L.id,U)===n)),cl=_n&&_n.runtimeId&&_n.region?{runtimeId:_n.runtimeId,name:_n.name,region:_n.region}:void 0,eG=(cl==null?void 0:cl.runtimeId)??"",mc=_n?_n.apps.find(L=>qo(_n.id,L)===n)??(At==null?void 0:At.appName)??_n.apps[0]??_n.name:"",V2=async(L,U,ee="")=>{var st,ct,Oe,ut,Ft,ei,Qs,dt;const le=(st=L.meta)==null?void 0:st.eventId,we=a;if(!le||!we||!cl)return;const Ie=Gb(L),tt=(ct=L.meta)==null?void 0:ct.feedback,Ke={...tt,rating:U,syncStatus:"syncing",updatedAt:Date.now()/1e3};yt(we,ft=>ft.map(St=>{var ht;return((ht=St.meta)==null?void 0:ht.eventId)===le?{...St,meta:{...St.meta,feedback:Ke}}:St})),Pt(ft=>new Set(ft).add(le)),_n!=null&&_n.runtimeId&&mc&&Sb({runtimeId:_n.runtimeId,region:_n.region??"cn-beijing",appName:mc,userId:Ve,sessionId:we,messageId:le,invocationId:(Oe=L.meta)==null?void 0:Oe.invocationId,rating:U,input:ee,output:Ie,createdAt:(ut=L.meta)!=null&&ut.ts?new Date(L.meta.ts*1e3).toISOString():void 0});try{const ft=await eB({appName:n,userId:Ve,sessionId:we,eventId:le,rating:U});yt(we,St=>St.map(ht=>{var on;return((on=ht.meta)==null?void 0:on.eventId)===le?{...ht,meta:{...ht.meta,feedback:ft}}:ht})),r(St=>St.map(ht=>ht.id===we?{...ht,state:{...ht.state??{},[`veadk_feedback:${le}`]:ft}}:ht)),_n!=null&&_n.runtimeId&&mc&&(Sb({runtimeId:_n.runtimeId,region:_n.region??"cn-beijing",appName:mc,userId:Ve,sessionId:we,messageId:le,invocationId:(Ft=L.meta)==null?void 0:Ft.invocationId,rating:ft.rating,input:ee,output:Ie,createdAt:(ei=L.meta)!=null&&ei.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),iB({runtimeId:_n.runtimeId,region:_n.region??"cn-beijing",appName:mc,pageSize:100}))}catch(ft){yt(we,St=>St.map(ht=>{var on;return((on=ht.meta)==null?void 0:on.eventId)===le?{...ht,meta:{...ht.meta,feedback:tt}}:ht})),_n!=null&&_n.runtimeId&&mc&&Sb({runtimeId:_n.runtimeId,region:_n.region??"cn-beijing",appName:mc,userId:Ve,sessionId:we,messageId:le,invocationId:(Qs=L.meta)==null?void 0:Qs.invocationId,rating:(tt==null?void 0:tt.rating)??null,input:ee,output:Ie,createdAt:(dt=L.meta)!=null&&dt.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),Se.current===we&&Ee(ft instanceof Error?ft.message:String(ft))}finally{Pt(ft=>{const St=new Set(ft);return St.delete(le),St})}},Zg=async L=>{xh(ma());let U=Qe.current.get(L);U||(U=await jw(L),Qe.current.set(L,U)),at(U),bi(ee=>ee+1),i(L),Xs(null),Us(""),ks(""),fi(!1),ne(!1),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ol()},tG=async L=>{await Zg(L)},nG=L=>{if(!jr){Ee("当前账号没有添加 Agent 的权限。");return}fi(!1),ne(!1),iE(L),as(null),Ut(null),Pn(!0),Ee("")},G2=async(L,U=!1)=>{if(L.runtime)try{const ee=await Bb(L.runtime.runtimeId,L.name,L.runtime.region,L.runtime.currentVersion);await Zg(ee)}catch(ee){const le=ee instanceof Error?ee.message:String(ee);if(Ee(le),U)throw new Error(le)}},iG=L=>{L.runtime&&(Xs(L),Us(""),ks(""),fi(!1),ne(!0),Ee(""))},sG=L=>{if(!jr){Ee("当前账号没有创建智能体的权限。");return}M2(L,!0)},pE=()=>{p&&fo(),Se.current="",l(""),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),Us(""),ks(""),fi(!0),sa(null),Ee("")},rG=()=>{p&&fo(),Se.current="",l(""),Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa("catalog"),Ee("")},aG=async L=>{if(Ce(""),Kg(""),L.runtimeId&&L.id.startsWith("detail:")){try{const U=await Bb(L.runtimeId,L.label,L.region??"cn-beijing",L.currentVersion);await Zg(U)}catch(U){Ee(U instanceof Error?U.message:String(U))}return}await Zg(L.id)},mE=yn!=null&&yn.runtime?rl.find(L=>{var U;return L.runtimeId===((U=yn.runtime)==null?void 0:U.runtimeId)}):void 0,ul=yn!=null&&yn.runtime?{id:`detail:${yn.runtime.runtimeId}`,label:yn.name,app:yn.appName??yn.name,remote:!0,runtimeApp:mE==null?void 0:mE.apps[0],runtimeId:yn.runtime.runtimeId,region:yn.runtime.region,currentVersion:yn.runtime.currentVersion,canDelete:yn.runtime.canDelete}:null,oG=Du?"applications":Lu?"search":sl||H||Xe||ze?"agents":a||Ma||Mu||mh||Vg?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(tte,{branding:$e,access:gt,features:Jt,sessions:s,currentSessionId:a,activePage:oG,streamingSids:zn,onNewChat:zV,onSearch:()=>{p&&fo(),Ut(null),rs(!1),vi(!1),Pn(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),$i(!0),Ee("")},onQuickCreate:()=>{if(!jr){Ee("当前账号没有添加 Agent 的权限。");return}p&&fo(),Se.current="",l(""),rs(!1),vi(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),Ut(null),as(null),iE("cn-beijing"),Pn(!0),Ee("")},onSkillCenter:()=>{p&&fo(),Ut(null),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),rs(!0),Ee("")},onAddAgent:()=>{if(!jr){Ee("当前账号没有添加 Agent 的权限。");return}p&&fo(),Se.current="",Ut(null),rs(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),l(""),Pn(!1),vi(!0),Ee("")},onMyAgents:pE,onApplications:rG,onPickSession:L=>{Ut(null),rs(!1),vi(!1),Pn(!1),$i(!1),ne(!1),Xs(null),De(null),Ne(null),fi(!1),sa(null),Ee(""),vh(L)},onDeleteSession:VV,userInfo:uc,version:wn,onLogout:CV}),(()=>{const L=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(QIe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:ol}),p?o.jsx(RRe,{appName:n,value:ln,onChange:Dt,onSubmit:U=>void $V(U),disabled:!1,busy:y||Bt.commandBusy,attachments:ot,onAddFiles:UV,onRemoveAttachment:FV,actions:{onOpenTerminal:()=>void hE("terminal"),onOpenBrowser:()=>void hE("browser"),onOpenPermissions:()=>{_(""),k(!0)},onOpenWorkspace:()=>{_(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:z||y},models:Bt.models,modelsLoading:Bt.modelsLoading,modelsLoaded:Bt.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Bt.loadModels(),skills:Bt.skills,skillsLoading:Bt.skillsLoading,skillsLoaded:Bt.skillsLoaded,selectedSkills:Bt.selectedSkills,onRequestSkills:()=>void Bt.loadSkills(),onSelectedSkillsChange:Bt.setSelectedSkills}):o.jsx(xNe,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?z2(n):"Agent",value:ln,onChange:Dt,onSubmit:()=>{if(!p&&kt==="skill-create"){const we=ln.trim();if(!we||Et)return;const Ie={id:`pending-${Date.now()}`,prompt:we,status:"provisioning",candidates:BA.map((Ke,st)=>({id:`pending-${st}`,model:Ke,modelLabel:Ke,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};sn(!0);const tt=++jn.current;Ee(""),Ze(Ie),Dt(""),ICe(we,Ke=>{jn.current===tt&&Ze(Ke)}).then(Ke=>{jn.current===tt&&Ze(Ke)}).catch(Ke=>{jn.current===tt&&(Ze(null),Dt(we),Ee(Ke instanceof Error?Ke.message:String(Ke)))}).finally(()=>{jn.current===tt&&sn(!1)});return}const U=ln;if(Dt(""),p){L2(U);return}const ee=ot,le=rn;mt([]),fn(Ha()),P2(U,ee,le),xo(ee)},disabled:p?!1:!Ve||kt==="temporary"||kt==="agent"&&!n,busy:p?y:kt==="skill-create"?Et:el,showMeta:Ye.length>0&&!p,attachments:p?[]:ot,skills:p?[]:Bg,agents:p?[]:Ug,invocation:p?Ha():rn,capabilitiesLoading:!p&&On,allowAttachments:!p,onInvocationChange:fn,onAddFiles:XV,onRemoveAttachment:nl,newChatMode:p?"agent":kt,newChatTask:p?null:Ge,newChatLayout:!p&&Ye.length===0&&ye===null,showAgentPicker:!p&&Ye.length===0&&ye===null&&kt==="agent",agentPickerDisabled:!Ve||el,selectedRuntimeId:cl==null?void 0:cl.runtimeId,runtimeScope:gt.capabilities.runtimeScope,onSelectRuntime:async U=>{var ee;await G2({id:U.runtimeId,name:U.name,description:((ee=U.description)==null?void 0:ee.trim())||"暂无描述",createdAt:U.createdAt??"",specificationLabel:"地域",specification:U.region==="cn-shanghai"?"上海":"北京",isMine:U.isMine,runtime:{runtimeId:U.runtimeId,region:U.region,currentVersion:U.currentVersion,canDelete:U.canDelete}},!0)},onSelectSandboxSession:fE,showModeSelector:!1,temporaryEnabled:Nt&&nt.temporaryEnabled,skillCreateEnabled:Nt&&nt.skillCreateEnabled,harnessEnabled:Nt&&nt.harnessEnabled,builtinTools:Nt?nt.builtinTools:[],onModeChange:U=>{if(!(U==="temporary"&&!nt.temporaryEnabled||U==="skill-create"&&!nt.skillCreateEnabled)){if(U==="temporary"){Kt(null),$t(U),M2();return}if($t(U),U!=="agent"&&Kt(null),Ee(""),U==="skill-create"){fn(Ha());const ee=a&&Ue.length===0&&ot.length>0?a:"";ju(ot),mt([]),ee&&(Se.current="",l(""),tl(ee))}}},onTaskChange:Kt})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Le&&o.jsx("div",{className:"error",role:"alert",children:Le}),rt&&o.jsx("div",{className:"error",role:"alert",children:rt}),an&&o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载会话…"]}),he&&!$2&&!U2&&!F2&&!Lu&&!Mu&&ll===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:KV,children:[o.jsx(rk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),Du==="feishu"?o.jsx(CSe,{onBack:()=>sa("catalog")}):Du&&Du!=="catalog"?o.jsx(vSe,{automation:Du,onBack:()=>sa("catalog")}):Du==="catalog"?o.jsx(gSe,{onOpen:sa}):ze?o.jsx(_Re,{workspace:ze,onBack:pE}):Xe?o.jsx(yRe,{session:Xe,onBack:pE,onOpen:()=>fE(Xe),onDelete:()=>MV(Xe)}):sl?o.jsx(K_e,{canCreate:jr,runtimeScope:gt.capabilities.runtimeScope,onCreateAgent:nG,onUseAgent:G2,onViewAgentDetails:iG,onCreateSandboxAgent:sG,onUseSandboxAgent:fE,onViewSandboxAgentDetails:OV,sandboxRefreshKey:Te,connectedRuntimeId:eG,hiddenRuntimeIds:yV,drafts:gh,deploymentTasks:Fg,draftDeploymentTaskIds:eE,onViewDeploymentTask:lE,onEditDraft:U=>{fi(!1),as(U.draft),Bs(U.id),Ts.current=U,ra(U.deploymentTarget??null),Us(""),ks(""),Ut("custom"),Ee("")},onDeleteDraft:U=>C2([U])}):$2?o.jsx(Mwe,{agents:ul?[ul]:JV,drafts:gh,agentOrder:Gg,selectedAgentId:n,agentInfo:At,agentInfoAgentId:n,loadingAgentInfo:On,canCreate:jr,canUpdate:jr||B2,loadingAgents:mV,agentsError:gV,deploymentTasks:Fg,focusedDeploymentTaskId:k2,focusedAgentId:(ul==null?void 0:ul.id)??A2,focusedAgentSection:wi,focusedCaseKind:bn,feedbackCasePreview:hV,detailOnly:!0,onRetryAgents:()=>void aE(),onAgentOrderChange:vV,onDeleteAgents:wV,onDeleteDrafts:C2,onSelectAgent:tG,onTalkAgent:aG,onOpenFeedbackCase:U=>void GV(U),onFeedbackCasesDeleted:qV,onCreateAgent:()=>{if(!jr){Ee("当前账号没有添加 Agent 的权限。");return}ne(!1),Pn(!0),Ut(null),as(null),ra(null),iE("cn-beijing"),Bs(""),Ts.current=null,Us(""),ks(""),Ee("")},onUpdateAgent:(U,ee)=>{var we;if(!B2&&!jr){Ee("当前账号没有管理 Agent 的权限。");return}if(!ee.canUpdate){Ee(ee.reason||"当前 Runtime 不支持原地更新。");return}if(!ee.runtime.runtimeId){Ee("仅支持更新已部署的云端智能体。");return}if(!ee.runtime.region){Ee("Runtime 缺少地域信息,无法更新。");return}if(!((we=ee.agent)!=null&&we.appName)){Ee("Runtime 缺少智能体名称,无法更新。");return}ne(!1),as(U);const le=`runtime-${ee.runtime.runtimeId}`;Bs(le),Ts.current=gh.find(Ie=>Ie.id===le)??null,Us(""),ks(""),ra({runtimeId:ee.runtime.runtimeId,name:ee.runtime.name||ee.agent.name||U.name,region:ee.runtime.region,appName:ee.agent.appName,currentVersion:ee.runtime.currentVersion}),Ut("custom"),Ee("")},onEditDraft:U=>{ne(!1),as(U.draft),Bs(U.id),Ts.current=U,ra(U.deploymentTarget??null),Us(""),ks(""),Ut("custom"),Ee("")}},(ul==null?void 0:ul.id)??"workspace"):U2?o.jsx(L$,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:JRe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{Pn(!1),as(null),Ut("menu")}},{key:"package",icon:eje,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{Pn(!1),as(null),Ut("package")}},{key:"migration",icon:tje,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):Lu?o.jsx(Yee,{userId:Ve,appId:n,agentInfo:At,capabilitiesLoading:On,agentLabel:z2,onOpenSession:IV}):F2?o.jsx(dwe,{onAdded:U=>{xh(ma()),vi(!1),i(U)},onCancel:()=>vi(!1)}):Mu?o.jsx(owe,{}):ll!==null&&!Hg?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.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):ll==="menu"?o.jsx(DTe,{onSelect:U=>{as(null),ra(null),Us(""),ks(""),Bs(U==="custom"?`draft-${Date.now().toString(36)}`:""),Ts.current=null,Ut(U)},onImport:U=>{as(U),ra(null),Us(""),ks(""),Bs(`draft-${Date.now().toString(36)}`),Ts.current=null,Ut("custom")}}):ll==="intelligent"?o.jsx(mke,{userId:Ve,onBack:()=>Ut("menu"),onCreate:Xg,onAgentAdded:oE,onDeploymentTaskChange:ph}):ll==="custom"?o.jsx(iCe,{initialDraft:tE??void 0,onBack:()=>Ut("menu"),onCreate:Xg,onAgentAdded:oE,features:Jt,onDeploymentTaskChange:ph,deploymentTarget:Pu??void 0,initialDeployRegion:Yg,onDraftChange:(U,ee)=>{di&&(ee?EV(di,U,Pu??void 0):I2(di))},onDiscard:di?()=>{I2(di),Bs(""),Ts.current=null,as(null),ra(null),Us(""),ks(n),Ut(null),Pn(!1),ne(!0),Ee("")}:void 0,onDeploymentStarted:R2,onDeploymentComplete:j2},di||"custom"):ll==="template"?o.jsx(aCe,{onBack:()=>Ut("menu"),onCreate:Xg}):ll==="workflow"?o.jsx(pCe,{onBack:()=>Ut("menu"),onCreate:Xg}):ll==="package"?o.jsx(xCe,{onBack:()=>{Ut(null),Pn(!0)},onAgentAdded:oE,onDeploymentTaskChange:ph,onDeploymentStarted:R2,onDeploymentComplete:j2,initialDeployRegion:Yg}):Ye.length===0&&ye?o.jsx(GCe,{initialJob:ye}):Ye.length===0&&!Nt?o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):Ye.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(GIe,{canUpdate:gt.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":kt==="skill-create"?"想创建一个什么 Skill?":ps})]}),L]}),o.jsx(OIe,{})]},`welcome-${nt.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${dh?" is-streaming":""}`,ref:Eh,onScroll:_V,onWheel:SV,onTouchMove:NV,children:Ye.map((U,ee)=>{var dt,ft,St,ht,on,hi,Fs;const le=ee===Ye.length-1;if(U.role==="system")return U.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(ZIe,{activity:U.activity,time:NN((dt=U.meta)==null?void 0:dt.ts)})},U.activity.id):null;if(U.role==="user"){const ti=U.blocks.map(tn=>tn.kind==="text"?tn.text:"").join(""),Fa=U.blocks.flatMap(tn=>tn.kind==="attachment"?tn.files:[]),os=U.blocks.find(tn=>tn.kind==="invocation");return o.jsxs(Wn.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(os==null?void 0:os.kind)==="invocation"&&o.jsx(Cx,{value:os.value}),Fa.length>0&&o.jsx(Ix,{appName:n,items:Fa}),ti&&o.jsx("div",{className:"bubble",children:o.jsx(nh,{text:ti})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((ft=U.meta)==null?void 0:ft.ts)&&o.jsx("span",{className:"meta-text",children:NN(U.meta.ts)}),o.jsx(HD,{text:ti})]})]},ee)}const we=((St=U.meta)==null?void 0:St.author)??"",Ie=we&&Qi?SN(Qi,we):void 0,tt=!!(we&&Pg.length>0&&!Pg.includes(we)),Ke=(Ie==null?void 0:Ie.name)||we,st=(Ie==null?void 0:Ie.description)||(tt?"正在执行主 Agent 移交的任务。":"");if(U.blocks.length>0&&U.blocks.every(ti=>ti.kind==="agent-transfer"))return null;const ct=U.blocks.length===0,Oe=((on=(ht=U.meta)==null?void 0:ht.feedback)==null?void 0:on.rating)??null,ut=((hi=U.meta)==null?void 0:hi.eventId)??"",Ft=jt.has(ut),ei=!!(cl&&ut&&Gb(U)),Qs=ei?sje(Ye,ee):"";return o.jsxs(Wn.div,{ref:ti=>{ut&&(ti?cE.current.set(ut,ti):cE.current.delete(ut))},className:["turn turn--assistant",tt?"turn--subagent":"",yh&&yh===ut?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[tt&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(lJ,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:Ke})]}),o.jsx("p",{className:"subagent-run-description",title:st,children:st})]}),ct?le&&co?o.jsx(O$,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(DA,{appName:n,blocks:U.blocks,streaming:le&&(co||ja),onStreamFrame:le?TV:void 0,onAction:QV,onAuth:ZV,onArtifactDownload:(ti,Fa)=>aB(n,Ve,a,ti,Fa),onArtifactPreview:(ti,Fa)=>lB(n,Ve,a,ti,Fa)}),!(le&&co)&&!aje(U)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(le&&co)&&!oje(U)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Fs=U.meta)!=null&&Fs.sandboxUsage)?o.jsx(eRe,{usage:U.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[ei&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Oe==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Oe==="good","aria-busy":Ft,title:Oe==="good"?"取消点赞":"赞",disabled:Ft,onClick:()=>void V2(U,Oe==="good"?null:"good",Qs),children:o.jsx(ORe,{className:"icon",filled:Oe==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Oe==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Oe==="bad","aria-busy":Ft,title:Oe==="bad"?"取消点踩":"踩",disabled:Ft,onClick:()=>void V2(U,Oe==="bad"?null:"bad",Qs),children:o.jsx(MRe,{className:"icon",filled:Oe==="bad"})})]}),!p&&o.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>Dn(!0),children:o.jsx(nje,{})}),o.jsx(HD,{text:Gb(U)})]}),U.meta&&o.jsx("span",{className:"meta-text",children:ije(U.meta)})]})]})]},ee)})}),!p&&o.jsx(Tde,{appName:n,info:At,loading:On,activeAgent:Zx,seenAgents:Jx,execPath:Dg,capabilities:hn,capabilityLoading:Hn,capabilityMutating:Ui,builtinTools:Xi,onAddCapability:YV,onRemoveCapability:U=>void WV(U)}),o.jsx("div",{className:"conversation-composer-slot",children:L})]})]})})})(),oi&&a&&o.jsx(Fz,{appName:n,sessionId:a,onClose:()=>Dn(!1)}),o.jsx(XIe,{open:W,state:ue,agentKind:me,error:_e,onCancel:RV,onConfirm:L=>void jV(L)}),p?o.jsxs(o.Fragment,{children:[o.jsx(cRe,{open:O!==null,kind:O??"terminal",launch:G,loading:F,error:j,onReload:()=>{O&&hE(O)},onClose:()=>{M(null),D(null),A(!1),P("")}}),o.jsx(pRe,{open:T,value:p.permissions,busy:E||y,error:N,onSave:L=>void LV(L),onClose:()=>{E||(k(!1),_(""))}}),o.jsx(mRe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:N,browse:DV,onSave:L=>void PV(L),onClose:()=>{E||(I(!1),_(""))}}),o.jsx(uRe,{open:Bt.threadsOpen,threads:Bt.threads,currentThreadId:p.threadId,loading:Bt.threadsLoading,error:Bt.threadsError,onSelect:L=>void Bt.resumeThread(L),onClose:Bt.closeThreads}),o.jsx(gRe,{approval:$,busy:Y,error:B,onDecision:L=>void BV(L)})]}):null,o.jsx(PRe,{open:Ii,checking:Ds,error:oo,onLogin:()=>void kV()}),xV&&o.jsx("div",{className:"confirm-scrim",onClick:()=>sE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:L=>L.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:()=>sE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{as(null),Ut("menu"),sE(!1)},children:"确定返回"})]})]})})]})}const YD="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(YD)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(YD,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})()||oY.createRoot(document.getElementById("root")).render(o.jsx(Mt.StrictMode,{children:o.jsx(yY,{reducedMotion:"user",children:o.jsx(QZ,{maskOpacity:.9,children:o.jsx(gje,{})})})}));export{s2 as $,R0e as A,j0e as B,g7 as C,o as D,pt as E,Rn as F,Gt as G,Eje as H,Ez as I,Yge as J,Ss as K,b as L,yx as M,Tr as N,vje as O,iz as P,Pp as Q,Mt as R,uu as S,VAe as T,lz as U,Ms as V,lr as W,Au as X,$x as Y,oz as Z,fu as _,Zr as a,r7 as a0,xz as b,WAe as c,NM as d,Tf as e,qs as f,wje as g,GH as h,cc as i,zx as j,jf as k,yke as l,Cje as m,iA as n,Ope as o,Tke as p,Rm as q,en as r,Xge as s,i0e as t,Lpe as u,Of as v,ibe as w,Bge as x,Uge as y,dbe as z}; +`):ut,dt=crypto.randomUUID(),Pt=crypto.randomUUID(),ri=[{role:"user",blocks:it,meta:{localId:dt,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:Pt}}];Q.current=Pt,v(ft=>[...ft,...ri]),x(!0),m(ft=>(ft==null?void 0:ft.id)===le.id?{...ft,busy:!0,workspaceLocked:!0}:ft);try{const ft=await tn.sendMessage({sessionId:le.id,text:Re,skillIds:ee.map(ht=>ht.id)},{signal:Ce.signal,onApproval:ht=>{Pe.current===Ce&&(te(""),R(ht))},onApprovalResolved:ht=>{Pe.current===Ce&&R(Tt=>(Tt==null?void 0:Tt.id)===ht?null:Tt)},onBlocks:ht=>{Pe.current===Ce&&v(Tt=>{const pt=Tt.slice(),on=pt.findIndex(Hs=>{var ai;return((ai=Hs.meta)==null?void 0:ai.localId)===Pt}),bi=pt[on];return(bi==null?void 0:bi.role)==="assistant"&&(pt[on]={...bi,blocks:ht}),pt})},onUsage:ht=>{Pe.current===Ce&&v(Tt=>{const pt=Tt.slice(),on=pt.findIndex(Hs=>{var ai;return((ai=Hs.meta)==null?void 0:ai.localId)===Pt}),bi=pt[on];return(bi==null?void 0:bi.role)==="assistant"&&(pt[on]={...bi,meta:{...bi.meta,sandboxUsage:ht.usage}}),pt})}});if(Pe.current!==Ce)return;v(ht=>{const Tt=ht.slice(),pt=Tt.findIndex(bi=>{var Hs;return((Hs=bi.meta)==null?void 0:Hs.localId)===Pt}),on=Tt[pt];return(on==null?void 0:on.role)==="assistant"&&(Tt[pt]={...on,blocks:ft.blocks,meta:{...on.meta,ts:Date.now()/1e3,...ft.usage?{sandboxUsage:ft.usage.usage}:{}}}),Tt}),vo(U)}catch(ft){if((ft==null?void 0:ft.name)==="AbortError"){vo(U);return}if(Pe.current!==Ce){vo(U);return}v(ht=>ht.filter(Tt=>{var pt,on;return((pt=Tt.meta)==null?void 0:pt.localId)!==dt&&((on=Tt.meta)==null?void 0:on.localId)!==Pt})),Mt(M),Ze(U),Lt.setSelectedSkills(ee),fe(`内置智能体发送失败:${ft instanceof Error?ft.message:String(ft)}`);try{const ht=await tn.getSettings(le.id);m(Tt=>(Tt==null?void 0:Tt.id)===le.id?{...Tt,...ht}:Tt)}catch{}}finally{Pe.current===Ce&&(Pe.current=null,Q.current===Pt&&(Q.current=""),x(!1),R(null),m(ft=>(ft==null?void 0:ft.id)===le.id?{...ft,busy:!1}:ft))}}async function eG(M){if(await Lt.executeSlash(M)||!p||y||Lt.commandBusy)return;const U=Bt,ee=Lt.selectedSkills;Mt(""),Ze([]),Lt.setSelectedSkills([]),await z2(M.trim(),U,ee)}function cl(){po(),fe(""),Zi(e3()),Vt("agent"),Xt(null),Ma(),Qt(!1);const M=a&&Le.length===0&&Bt.length>0?a:"";_t.current="",l(""),_n(null),Ii([]),d(!1),h([]),un(za()),Mu(Bt),Ze([]),M&&il(M)}function tG(){var M;Fu.current=!0,localStorage.removeItem(da.app),a&&((M=bn.current.get(a))==null||M.abort()),c.current=null,cl(),i(""),yt({}),nn(null)}function nG(){Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),cl()}async function iG(M){var U;try{(U=bn.current.get(M))==null||U.abort(),await aS(n,Ve,M),await rS(n,Ve,M);const ee=jn.current.get(M);ee!==void 0&&window.clearTimeout(ee),jn.current.delete(M),Oi(le=>{if(!le.has(M))return le;const we=new Set(le);return we.delete(M),we}),be(le=>{const{[M]:we,...Ce}=le;return Ce}),M===a&&cl(),await n0(n)}catch(ee){fe(String(ee))}}async function Nh(M){if(p&&po(),M!==a&&(_t.current=M,fe(""),d(!1),h([]),Vt("agent"),Xt(null),Ma(),un(za()),_n(null),Ii([]),l(M),ie[M]===void 0)){Hi(!0);try{const U=await Uy(n,Ve,M);gt(M,Wee(U.events??[],U.state))}catch(U){fe(String(U))}finally{Hi(!1)}}}async function sG(M){if(!M.sessionId||!M.messageId){fe("这条案例缺少会话定位信息,无法跳转。");return}zi(!1),Dt(null),Si(!1),zn(!1),os(!1),ne(!1),Ae(n),Nt(M.kind),Qg(M.messageId),await Nh(M.sessionId)}function rG(){const M=pe||n;zi(!1),Dt(null),Si(!1),zn(!1),os(!1),$s(""),Is(M),ho("evaluations"),Ba(tt),ne(!0),Ae(""),Qg("")}function aG(M){const U=new Map,ee=new Map;for(const le of M){if(!le.sessionId||!le.messageId)continue;const we=U.get(le.sessionId)??new Set;if(we.add(le.messageId),U.set(le.sessionId,we),le.runtimeId&&le.userId){const Ce=[le.runtimeId,n,le.userId,le.sessionId].join(":"),it=ee.get(Ce)??{runtimeId:le.runtimeId,appName:n,userId:le.userId,sessionId:le.sessionId,eventIds:new Set};it.eventIds.add(le.messageId),ee.set(Ce,it)}}if(U.size!==0){be(le=>{const we={...le};for(const[Ce,it]of U){const Ge=we[Ce];Ge&&(we[Ce]=Ge.map(st=>{var ut;return(ut=st.meta)!=null&&ut.eventId&&it.has(st.meta.eventId)?{...st,meta:{...st.meta,feedback:void 0}}:st}))}return we}),r(le=>le.map(we=>{const Ce=U.get(we.id);if(!Ce||!we.state)return we;const it={...we.state};for(const Ge of Ce)delete it[`veadk_feedback:${Ge}`];return{...we,state:it}})),at(le=>{const we=new Set(le);for(const Ce of U.values())for(const it of Ce)we.delete(it);return we});for(const le of ee.values())tB({runtimeId:le.runtimeId,appName:le.appName,userId:le.userId,sessionId:le.sessionId,eventIds:[...le.eventIds]});kV(le=>le&&(M.some(we=>we.id===le.id||we.messageId===le.messageId)?null:le))}}async function V2(M=!0){if(a)return a;c.current||(c.current=By(n,Ve));const U=c.current;try{const ee=await U;M&&l(ee);const le=Date.now()/1e3,we={id:ee,lastUpdateTime:le,events:[]};return r(Ce=>[we,...Ce.filter(it=>it.id!==ee)]),ee}finally{c.current===U&&(c.current=null)}}async function oG(M){if(!n||!Ve||!a||!gn)return!1;Un(!0),fe("");try{const U=await lS(n,Ve,a,M,gn.revision);return _n(U),!0}catch(U){return fe(String(U)),!1}finally{Un(!1)}}async function lG(M){if(!(!n||!Ve||!a||!gn)){Un(!0),fe("");try{const U=await SB(n,Ve,a,M,gn.revision);_n(U)}catch(U){fe(String(U))}finally{Un(!1)}}}async function cG(M){fe("");let U;try{U=await V2()}catch(le){fe(String(le));return}const ee=Array.from(M).map(le=>({file:le,attachment:{id:t3(),mimeType:n3(le),name:le.name,sizeBytes:le.size,status:"uploading"}}));Ze(le=>[...le,...ee.map(we=>we.attachment)]),await Promise.all(ee.map(async({file:le,attachment:we})=>{try{const Ce=await xB(n,Ve,U,le);if(vi.current.delete(we.id)){Ce.uri&&await Ib(n,Ce.uri);return}Ze(it=>it.map(Ge=>Ge.id===we.id?Ce:Ge))}catch(Ce){if(vi.current.delete(we.id))return;const it=Ce instanceof Error?Ce.message:String(Ce);Ze(Ge=>Ge.map(st=>st.id===we.id?{...st,status:"error",error:it}:st)),fe(it)}}))}async function G2(M,U=[],ee=za()){if(!M.trim()&&U.length===0||nl||sE||!n||!Ve)return;fe("");const le=[];(ee.skills.length>0||ee.targetAgent)&&le.push({kind:"invocation",value:ee}),U.length&&le.push({kind:"attachment",files:U.map(Re=>({id:Re.id,mimeType:Re.mimeType,data:Re.data,uri:Re.uri,name:Re.name,sizeBytes:Re.sizeBytes}))}),M.trim()&&le.push({kind:"text",text:M});const we=[{role:"user",blocks:le,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Ce=!a;Ce&&(h(we),d(!0));const it=He;let Ge;try{Ge=await V2(!Ce)}catch(Re){Ce&&(h([]),d(!1),Mt(M),un(ee)),fe(String(Re));return}let st=_v(gn);if(it)try{let Re=await oS(n,Ve,Ge);const dt=jNe[it].filter(Pt=>{var ri;return(ri=nt.builtinTools)==null?void 0:ri.includes(Pt)});for(const Pt of[...V$[it],...dt])Re.tools.some(ri=>ri.name===Pt)||(Re=await lS(n,Ve,Ge,{kind:"tool",name:Pt},Re.revision));_n(Re),st=_v(Re)}catch(Re){Ce&&(h([]),d(!1),Mt(M),un(ee)),fe(`任务能力挂载失败:${String(Re)}`);return}gt(Ge,Re=>Ce?we:[...Re,...we]),Ce&&(_t.current=Ge,l(Ge),h([]),d(!1));const ut=new AbortController;bn.current.set(Ge,ut),Fn(Ge,!0),$n(Ge),_t.current=Ge,ia(Re=>({...Re,[Ge]:""})),fc(Re=>({...Re,[Ge]:new Set})),sa(Re=>({...Re,[Ge]:[]}));try{let Re=xa(),dt="",Pt=0,ri=Date.now()/1e3,Js="",ft="";for await(const ht of Em({appName:n,userId:Ve,sessionId:Ge,text:M,attachments:U,invocation:ee,signal:ut.signal,sessionCapabilities:st})){if(ut.signal.aborted)break;const Tt=ht.error??ht.errorMessage??ht.error_message;if(typeof Tt=="string"&&Tt){_t.current===Ge&&fe(Tt);break}Lu(Ge,ht);const pt=ht.author&&ht.author!=="user"?ht.author:"";pt&&pt!==dt&&(dt=pt,Re=xa()),Re=gf(Re,ht);const on=ht.usageMetadata??ht.usage_metadata;on!=null&&on.totalTokenCount&&(Pt=on.totalTokenCount),ht.timestamp&&(ri=ht.timestamp),ht.id&&(Js=ht.id);const bi=ht.invocationId??ht.invocation_id;bi&&(ft=bi);const Hs=Re.blocks,ai={author:dt||void 0,tokens:Pt||void 0,ts:ri,eventId:Js||void 0,invocationId:ft||void 0};gt(Ge,$a=>{var kh;const cs=$a.slice(),en=cs[cs.length-1];return(en==null?void 0:en.role)==="assistant"&&(!((kh=en.meta)!=null&&kh.author)||en.meta.author===dt)?cs[cs.length-1]={...en,blocks:Hs,meta:ai}:cs.push({role:"assistant",blocks:Hs,meta:ai}),cs})}n0(n)}catch(Re){(Re==null?void 0:Re.name)!=="AbortError"&&!ut.signal.aborted&&_t.current===Ge&&fe(String(Re))}finally{bn.current.get(Ge)===ut&&bn.current.delete(Ge),Fn(Ge,!1),yn(Ge),ia(Re=>({...Re,[Ge]:""})),sa(Re=>({...Re,[Ge]:[]}))}}function uG(M,U){var we,Ce;const ee=((we=M==null?void 0:M.event)==null?void 0:we.name)??U.id,le=((Ce=M==null?void 0:M.event)==null?void 0:Ce.context)??{};G2(`[ui-action] ${ee}: ${JSON.stringify(le)}`)}async function dG(M){var st,ut,Re;if(!M.authUri)throw new Error("事件中没有授权地址。");if(!n||!Ve||!a)throw new Error("会话尚未就绪。");const U=a,ee=await Pje(M.authUri),le=Bje(M.authConfig,ee),we=dt=>dt.map(Pt=>Pt.kind==="auth"&&!Pt.done?{...Pt,done:!0}:Pt);gt(U,dt=>{const Pt=dt.slice(),ri=Pt[Pt.length-1];return(ri==null?void 0:ri.role)==="assistant"&&(Pt[Pt.length-1]={...ri,blocks:we(ri.blocks)}),Pt});const Ce=qe[qe.length-1],it=we(Ce&&Ce.role==="assistant"?Ce.blocks:[]),Ge=new AbortController;bn.current.set(U,Ge),Fn(U,!0),$n(U);try{let dt=xa(),Pt=((st=Ce==null?void 0:Ce.meta)==null?void 0:st.author)??"",ri=it,Js=0,ft=Date.now()/1e3,ht=((ut=Ce==null?void 0:Ce.meta)==null?void 0:ut.eventId)??"",Tt=((Re=Ce==null?void 0:Ce.meta)==null?void 0:Re.invocationId)??"";for await(const pt of Em({appName:n,userId:Ve,sessionId:a,text:"",functionResponses:[{id:M.callId,name:"adk_request_credential",response:le}],signal:Ge.signal,sessionCapabilities:_v(gn)})){if(Ge.signal.aborted)break;Lu(U,pt);const on=pt.author&&pt.author!=="user"?pt.author:"";on&&on!==Pt&&(Pt=on,ri=[],dt=xa()),dt=gf(dt,pt);const bi=pt.usageMetadata??pt.usage_metadata;bi!=null&&bi.totalTokenCount&&(Js=bi.totalTokenCount),pt.timestamp&&(ft=pt.timestamp),pt.id&&(ht=pt.id);const Hs=pt.invocationId??pt.invocation_id;Hs&&(Tt=Hs);const ai=[...ri,...dt.blocks];gt(U,$a=>{var eC,tC,nC,iC,sC;const cs=$a.slice(),en=cs[cs.length-1],kh={author:Pt||((eC=en==null?void 0:en.meta)==null?void 0:eC.author),tokens:Js||((tC=en==null?void 0:en.meta)==null?void 0:tC.tokens),ts:ft,eventId:ht||((nC=en==null?void 0:en.meta)==null?void 0:nC.eventId),invocationId:Tt||((iC=en==null?void 0:en.meta)==null?void 0:iC.invocationId)};return(en==null?void 0:en.role)==="assistant"&&(!((sC=en.meta)!=null&&sC.author)||en.meta.author===Pt)?cs[cs.length-1]={...en,blocks:ai,meta:kh}:cs.push({role:"assistant",blocks:ai,meta:kh}),cs})}n0(n)}catch(dt){(dt==null?void 0:dt.name)!=="AbortError"&&!Ge.signal.aborted&&_t.current===U&&fe(String(dt))}finally{bn.current.get(U)===Ge&&bn.current.delete(U),Fn(U,!1),yn(U),ia(dt=>({...dt,[U]:""})),sa(dt=>({...dt,[U]:[]}))}}if(Or)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:Or}),o.jsx("button",{type:"button",onClick:yE,children:"重试"})]});if(dn===null)return o.jsx("div",{className:"boot"});if(dn==="unauthenticated")return o.jsx(dje,{branding:Fe,onUsername:$V});if(!ct)return o.jsx("div",{className:"boot"});const Mr=ct.capabilities.createAgents,K2=ct.capabilities.manageAgents,ul=Mr?La:null,q2=Mr&&Wg,Y2=Mr&&xh,W2=H&&!!(En||L2||D2),X2=u$(e,ol),Th=X2.filter(M=>M.runtimeId&&(j2===null||j2.has(M.runtimeId))).map(M=>{var U;return{...M,canDelete:M.runtimeId?((U=IV[M.runtimeId])==null?void 0:U.canDelete)===!0:!1}}),fG=(()=>{if(Th.length===0)return Th;const M=new Map(Xg.map((U,ee)=>[U,ee]));return[...Th].sort((U,ee)=>{const le=M.get(U.id),we=M.get(ee.id);return le!=null&&we!=null?le-we:le!=null?-1:we!=null?1:Th.indexOf(U)-Th.indexOf(ee)})})(),Q2=M=>{var U;return((U=X2.find(ee=>ee.id===M))==null?void 0:U.label)??M},Tn=ol.find(M=>M.runtimeId&&M.apps.some(U=>Wo(M.id,U)===n)),dl=Tn&&Tn.runtimeId&&Tn.region?{runtimeId:Tn.runtimeId,name:Tn.name,region:Tn.region}:void 0,hG=(dl==null?void 0:dl.runtimeId)??"",gc=Tn?Tn.apps.find(M=>Wo(Tn.id,M)===n)??(Et==null?void 0:Et.appName)??Tn.apps[0]??Tn.name:"",Z2=async(M,U,ee="")=>{var st,ut,Re,dt,Pt,ri,Js,ft;const le=(st=M.meta)==null?void 0:st.eventId,we=a;if(!le||!we||!dl)return;const Ce=Qb(M),it=(ut=M.meta)==null?void 0:ut.feedback,Ge={...it,rating:U,syncStatus:"syncing",updatedAt:Date.now()/1e3};gt(we,ht=>ht.map(Tt=>{var pt;return((pt=Tt.meta)==null?void 0:pt.eventId)===le?{...Tt,meta:{...Tt.meta,feedback:Ge}}:Tt})),at(ht=>new Set(ht).add(le)),Tn!=null&&Tn.runtimeId&&gc&&Cb({runtimeId:Tn.runtimeId,region:Tn.region??"cn-beijing",appName:gc,userId:Ve,sessionId:we,messageId:le,invocationId:(Re=M.meta)==null?void 0:Re.invocationId,rating:U,input:ee,output:Ce,createdAt:(dt=M.meta)!=null&&dt.ts?new Date(M.meta.ts*1e3).toISOString():void 0});try{const ht=await uB({appName:n,userId:Ve,sessionId:we,eventId:le,rating:U});gt(we,Tt=>Tt.map(pt=>{var on;return((on=pt.meta)==null?void 0:on.eventId)===le?{...pt,meta:{...pt.meta,feedback:ht}}:pt})),r(Tt=>Tt.map(pt=>pt.id===we?{...pt,state:{...pt.state??{},[`veadk_feedback:${le}`]:ht}}:pt)),Tn!=null&&Tn.runtimeId&&gc&&(Cb({runtimeId:Tn.runtimeId,region:Tn.region??"cn-beijing",appName:gc,userId:Ve,sessionId:we,messageId:le,invocationId:(Pt=M.meta)==null?void 0:Pt.invocationId,rating:ht.rating,input:ee,output:Ce,createdAt:(ri=M.meta)!=null&&ri.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),hB({runtimeId:Tn.runtimeId,region:Tn.region??"cn-beijing",appName:gc,pageSize:100}))}catch(ht){gt(we,Tt=>Tt.map(pt=>{var on;return((on=pt.meta)==null?void 0:on.eventId)===le?{...pt,meta:{...pt.meta,feedback:it}}:pt})),Tn!=null&&Tn.runtimeId&&gc&&Cb({runtimeId:Tn.runtimeId,region:Tn.region??"cn-beijing",appName:gc,userId:Ve,sessionId:we,messageId:le,invocationId:(Js=M.meta)==null?void 0:Js.invocationId,rating:(it==null?void 0:it.rating)??null,input:ee,output:Ce,createdAt:(ft=M.meta)!=null&&ft.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),_t.current===we&&fe(ht instanceof Error?ht.message:String(ht))}finally{at(ht=>{const Tt=new Set(ht);return Tt.delete(le),Tt})}},i0=async M=>{_h(ga());let U=Je.current.get(M);U||(U=await Uw(M),Je.current.set(M,U)),yt(U),ii(ee=>ee+1),i(M),Zs(null),$s(""),Is(""),gi(!1),ne(!1),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),cl()},pG=async M=>{await i0(M)},mG=M=>{if(!Mr){fe("当前账号没有添加 Agent 的权限。");return}gi(!1),ne(!1),uE(M),ls(null),Dt(null),zn(!0),fe("")},J2=async(M,U=!1)=>{if(M.runtime)try{const ee=await Vb(M.runtime.runtimeId,M.name,M.runtime.region,M.runtime.currentVersion);await i0(ee)}catch(ee){const le=ee instanceof Error?ee.message:String(ee);if(fe(le),U)throw new Error(le)}},gG=M=>{M.runtime&&(Zs(M),$s(""),Is(""),gi(!1),ne(!0),fe(""))},bG=M=>{if(!Mr){fe("当前账号没有创建智能体的权限。");return}H2(M,!0)},vE=()=>{p&&po(),_t.current="",l(""),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),$s(""),Is(""),gi(!0),ra(null),fe("")},yG=()=>{p&&po(),_t.current="",l(""),Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra("catalog"),fe("")},xG=async M=>{if(Ae(""),Qg(""),M.runtimeId&&M.id.startsWith("detail:")){try{const U=await Vb(M.runtimeId,M.label,M.region??"cn-beijing",M.currentVersion);await i0(U)}catch(U){fe(U instanceof Error?U.message:String(U))}return}await i0(M.id)},wE=En!=null&&En.runtime?ol.find(M=>{var U;return M.runtimeId===((U=En.runtime)==null?void 0:U.runtimeId)}):void 0,fl=En!=null&&En.runtime?{id:`detail:${En.runtime.runtimeId}`,label:En.name,app:En.appName??En.name,remote:!0,runtimeApp:wE==null?void 0:wE.apps[0],runtimeId:En.runtime.runtimeId,region:En.runtime.region,currentVersion:En.runtime.currentVersion,canDelete:En.runtime.canDelete}:null,EG=Bu?"applications":Pu?"search":al||H||Qe||ze?"agents":a||La||Du||xh||Wg?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(mte,{branding:Fe,access:ct,features:Zt,sessions:s,currentSessionId:a,activePage:EG,streamingSids:Sn,onNewChat:nG,onSearch:()=>{p&&po(),Dt(null),os(!1),Si(!1),zn(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),zi(!0),fe("")},onQuickCreate:()=>{if(!Mr){fe("当前账号没有添加 Agent 的权限。");return}p&&po(),_t.current="",l(""),os(!1),Si(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),Dt(null),ls(null),uE("cn-beijing"),zn(!0),fe("")},onSkillCenter:()=>{p&&po(),Dt(null),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),os(!0),fe("")},onAddAgent:()=>{if(!Mr){fe("当前账号没有添加 Agent 的权限。");return}p&&po(),_t.current="",Dt(null),os(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),l(""),zn(!1),Si(!0),fe("")},onMyAgents:vE,onApplications:yG,onPickSession:M=>{Dt(null),os(!1),Si(!1),zn(!1),zi(!1),ne(!1),Zs(null),Me(null),Se(null),gi(!1),ra(null),fe(""),Nh(M)},onDeleteSession:iG,userInfo:uo,version:Nn,onLogout:HV}),(()=>{const M=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(TRe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:cl}),p?o.jsx(aje,{appName:n,value:ln,onChange:Mt,onSubmit:U=>void eG(U),disabled:!1,busy:y||Lt.commandBusy,attachments:Bt,onAddFiles:ZV,onRemoveAttachment:JV,actions:{onOpenTerminal:()=>void EE("terminal"),onOpenBrowser:()=>void EE("browser"),onOpenPermissions:()=>{_(""),k(!0)},onOpenWorkspace:()=>{_(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:K||y},models:Lt.models,modelsLoading:Lt.modelsLoading,modelsLoaded:Lt.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Lt.loadModels(),skills:Lt.skills,skillsLoading:Lt.skillsLoading,skillsLoaded:Lt.skillsLoaded,selectedSkills:Lt.selectedSkills,onRequestSkills:()=>void Lt.loadSkills(),onSelectedSkillsChange:Lt.setSelectedSkills}):o.jsx(ONe,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?Q2(n):"Agent",value:ln,onChange:Mt,onSubmit:()=>{if(!p&&kt==="skill-create"){const we=ln.trim();if(!we||St)return;const Ce={id:`pending-${Date.now()}`,prompt:we,status:"provisioning",candidates:KA.map((Ge,st)=>({id:`pending-${st}`,model:Ge,modelLabel:Ge,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};Qt(!0);const it=++Rn.current;fe(""),Xe(Ce),Mt(""),rIe(we,Ge=>{Rn.current===it&&Xe(Ge)}).then(Ge=>{Rn.current===it&&Xe(Ge)}).catch(Ge=>{Rn.current===it&&(Xe(null),Mt(we),fe(Ge instanceof Error?Ge.message:String(Ge)))}).finally(()=>{Rn.current===it&&Qt(!1)});return}const U=ln;if(Mt(""),p){z2(U);return}const ee=Bt,le=cn;Ze([]),un(za()),G2(U,ee,le),vo(ee)},disabled:p?!1:!Ve||kt==="temporary"||kt==="agent"&&!n,busy:p?y:kt==="skill-create"?St:nl,showMeta:qe.length>0&&!p,attachments:p?[]:Bt,skills:p?[]:zg,agents:p?[]:Vg,invocation:p?za():cn,capabilitiesLoading:!p&&Dn,allowAttachments:!p,onInvocationChange:un,onAddFiles:cG,onRemoveAttachment:sl,newChatMode:p?"agent":kt,newChatTask:p?null:He,newChatLayout:!p&&qe.length===0&&ye===null,showAgentPicker:!p&&qe.length===0&&ye===null&&kt==="agent",agentPickerDisabled:!Ve||nl,selectedRuntimeId:dl==null?void 0:dl.runtimeId,runtimeScope:ct.capabilities.runtimeScope,onSelectRuntime:async U=>{var ee;await J2({id:U.runtimeId,name:U.name,description:((ee=U.description)==null?void 0:ee.trim())||"暂无描述",createdAt:U.createdAt??"",specificationLabel:"地域",specification:U.region==="cn-shanghai"?"上海":"北京",isMine:U.isMine,runtime:{runtimeId:U.runtimeId,region:U.region,currentVersion:U.currentVersion,canDelete:U.canDelete}},!0)},onSelectSandboxSession:xE,showModeSelector:!1,temporaryEnabled:ot&&nt.temporaryEnabled,skillCreateEnabled:ot&&nt.skillCreateEnabled,harnessEnabled:ot&&nt.harnessEnabled,builtinTools:ot?nt.builtinTools:[],onModeChange:U=>{if(!(U==="temporary"&&!nt.temporaryEnabled||U==="skill-create"&&!nt.skillCreateEnabled)){if(U==="temporary"){Xt(null),Vt(U),H2();return}if(Vt(U),U!=="agent"&&Xt(null),fe(""),U==="skill-create"){un(za());const ee=a&&Le.length===0&&Bt.length>0?a:"";Mu(Bt),Ze([]),ee&&(_t.current="",l(""),il(ee))}}},onTaskChange:Xt})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[ue&&o.jsx("div",{className:"error",role:"alert",children:ue}),De&&o.jsx("div",{className:"error",role:"alert",children:De}),an&&o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载会话…"]}),pe&&!W2&&!q2&&!Y2&&!Pu&&!Du&&ul===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:rG,children:[o.jsx(hk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),Bu==="feishu"?o.jsx(zSe,{onBack:()=>ra("catalog")}):Bu&&Bu!=="catalog"?o.jsx(LSe,{automation:Bu,onBack:()=>ra("catalog")}):Bu==="catalog"?o.jsx(ISe,{onOpen:ra}):ze?o.jsx(ZRe,{workspace:ze,onBack:vE}):Qe?o.jsx(qRe,{session:Qe,onBack:vE,onOpen:()=>xE(Qe),onDelete:()=>qV(Qe)}):al?o.jsx(aSe,{canCreate:Mr,runtimeScope:ct.capabilities.runtimeScope,onCreateAgent:mG,onUseAgent:J2,onViewAgentDetails:gG,onCreateSandboxAgent:bG,onUseSandboxAgent:xE,onViewSandboxAgentDetails:KV,sandboxRefreshKey:Ne,connectedRuntimeId:hG,hiddenRuntimeIds:RV,drafts:Eh,deploymentTasks:Gg,draftDeploymentTaskIds:oE,onViewDeploymentTask:mE,onEditDraft:U=>{gi(!1),ls(U.draft),Fs(U.id),Cs.current=U,aa(U.deploymentTarget??null),$s(""),Is(""),Dt("custom"),fe("")},onDeleteDraft:U=>P2([U])}):W2?o.jsx(Ywe,{agents:fl?[fl]:fG,drafts:Eh,agentOrder:Xg,selectedAgentId:n,agentInfo:Et,agentInfoAgentId:n,loadingAgentInfo:Dn,canCreate:Mr,canUpdate:Mr||K2,loadingAgents:AV,agentsError:CV,deploymentTasks:Gg,focusedDeploymentTaskId:L2,focusedAgentId:(fl==null?void 0:fl.id)??D2,focusedAgentSection:Ni,focusedCaseKind:xn,feedbackCasePreview:TV,detailOnly:!0,onRetryAgents:()=>void hE(),onAgentOrderChange:MV,onDeleteAgents:LV,onDeleteDrafts:P2,onSelectAgent:pG,onTalkAgent:xG,onOpenFeedbackCase:U=>void sG(U),onFeedbackCasesDeleted:aG,onCreateAgent:()=>{if(!Mr){fe("当前账号没有添加 Agent 的权限。");return}ne(!1),zn(!0),Dt(null),ls(null),aa(null),uE("cn-beijing"),Fs(""),Cs.current=null,$s(""),Is(""),fe("")},onUpdateAgent:(U,ee)=>{var we;if(!K2&&!Mr){fe("当前账号没有管理 Agent 的权限。");return}if(!ee.canUpdate){fe(ee.reason||"当前 Runtime 不支持原地更新。");return}if(!ee.runtime.runtimeId){fe("仅支持更新已部署的云端智能体。");return}if(!ee.runtime.region){fe("Runtime 缺少地域信息,无法更新。");return}if(!((we=ee.agent)!=null&&we.appName)){fe("Runtime 缺少智能体名称,无法更新。");return}ne(!1),ls(U);const le=`runtime-${ee.runtime.runtimeId}`;Fs(le),Cs.current=Eh.find(Ce=>Ce.id===le)??null,$s(""),Is(""),aa({runtimeId:ee.runtime.runtimeId,name:ee.runtime.name||ee.agent.name||U.name,region:ee.runtime.region,appName:ee.agent.appName,currentVersion:ee.runtime.currentVersion}),Dt("custom"),fe("")},onEditDraft:U=>{ne(!1),ls(U.draft),Fs(U.id),Cs.current=U,aa(U.deploymentTarget??null),$s(""),Is(""),Dt("custom"),fe("")}},(fl==null?void 0:fl.id)??"workspace"):q2?o.jsx(G$,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:Aje,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{zn(!1),ls(null),Dt("menu")}},{key:"package",icon:Cje,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{zn(!1),ls(null),Dt("package")}},{key:"migration",icon:Ije,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):Pu?o.jsx(lte,{userId:Ve,appId:n,agentInfo:Et,capabilitiesLoading:Dn,agentLabel:Q2,onOpenSession:zV}):Y2?o.jsx(Nwe,{onAdded:U=>{_h(ga()),Si(!1),i(U)},onCancel:()=>Si(!1)}):Du?o.jsx(vwe,{}):ul!==null&&!qg?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.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):ul==="menu"?o.jsx(XTe,{onSelect:U=>{ls(null),aa(null),$s(""),Is(""),Fs(U==="custom"?`draft-${Date.now().toString(36)}`:""),Cs.current=null,Dt(U)},onImport:U=>{ls(U),aa(null),$s(""),Is(""),Fs(`draft-${Date.now().toString(36)}`),Cs.current=null,Dt("custom")}}):ul==="intelligent"?o.jsx(Vke,{userId:Ve,onBack:()=>Dt("menu"),onCreate:t0,onAgentAdded:pE,onDeploymentTaskChange:yh}):ul==="custom"?o.jsx(jCe,{initialDraft:lE??void 0,onBack:()=>Dt("menu"),onCreate:t0,onAgentAdded:pE,features:Zt,onDeploymentTaskChange:yh,deploymentTarget:Uu??void 0,initialDeployRegion:Jg,onDraftChange:(U,ee)=>{mi&&(ee?OV(mi,U,Uu??void 0):B2(mi))},onDiscard:mi?()=>{B2(mi),Fs(""),Cs.current=null,ls(null),aa(null),$s(""),Is(n),Dt(null),zn(!1),ne(!0),fe("")}:void 0,onDeploymentStarted:U2,onDeploymentComplete:F2},mi||"custom"):ul==="template"?o.jsx(LCe,{onBack:()=>Dt("menu"),onCreate:t0}):ul==="workflow"?o.jsx(zCe,{onBack:()=>Dt("menu"),onCreate:t0}):ul==="package"?o.jsx(YCe,{onBack:()=>{Dt(null),zn(!0)},onAgentAdded:pE,onDeploymentTaskChange:yh,onDeploymentStarted:U2,onDeploymentComplete:F2,initialDeployRegion:Jg}):qe.length===0&&ye?o.jsx(EIe,{initialJob:ye}):qe.length===0&&!ot?o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):qe.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(ERe,{canUpdate:ct.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":kt==="skill-create"?"想创建一个什么 Skill?":fi})]}),M]}),o.jsx(lRe,{})]},`welcome-${nt.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${mh?" is-streaming":""}`,ref:Sh,onScroll:DV,onWheel:PV,onTouchMove:BV,children:qe.map((U,ee)=>{var ft,ht,Tt,pt,on,bi,Hs;const le=ee===qe.length-1;if(U.role==="system")return U.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(kRe,{activity:U.activity,time:ON((ft=U.meta)==null?void 0:ft.ts)})},U.activity.id):null;if(U.role==="user"){const ai=U.blocks.map(en=>en.kind==="text"?en.text:"").join(""),$a=U.blocks.flatMap(en=>en.kind==="attachment"?en.files:[]),cs=U.blocks.find(en=>en.kind==="invocation");return o.jsxs(Jn.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(cs==null?void 0:cs.kind)==="invocation"&&o.jsx(Dx,{value:cs.value}),$a.length>0&&o.jsx(Px,{appName:n,items:$a}),ai&&o.jsx("div",{className:"bubble",children:o.jsx(rh,{text:ai})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((ht=U.meta)==null?void 0:ht.ts)&&o.jsx("span",{className:"meta-text",children:ON(U.meta.ts)}),o.jsx(ZD,{text:ai})]})]},ee)}const we=((Tt=U.meta)==null?void 0:Tt.author)??"",Ce=we&&Ji?jN(Ji,we):void 0,it=!!(we&&Hg.length>0&&!Hg.includes(we)),Ge=(Ce==null?void 0:Ce.name)||we,st=(Ce==null?void 0:Ce.description)||(it?"正在执行主 Agent 移交的任务。":"");if(U.blocks.length>0&&U.blocks.every(ai=>ai.kind==="agent-transfer"))return null;const ut=U.blocks.length===0,Re=((on=(pt=U.meta)==null?void 0:pt.feedback)==null?void 0:on.rating)??null,dt=((bi=U.meta)==null?void 0:bi.eventId)??"",Pt=rt.has(dt),ri=!!(dl&&dt&&Qb(U)),Js=ri?Oje(qe,ee):"";return o.jsxs(Jn.div,{ref:ai=>{dt&&(ai?gE.current.set(dt,ai):gE.current.delete(dt))},className:["turn turn--assistant",it?"turn--subagent":"",wh&&wh===dt?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[it&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(vJ,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:Ge})]}),o.jsx("p",{className:"subagent-run-description",title:st,children:st})]}),ut?le&&fo?o.jsx(z$,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(VA,{appName:n,blocks:U.blocks,streaming:le&&(fo||Oa),onStreamFrame:le?UV:void 0,onAction:uG,onAuth:dG,onArtifactDownload:(ai,$a)=>gB(n,Ve,a,ai,$a),onArtifactPreview:(ai,$a)=>yB(n,Ve,a,ai,$a)}),!(le&&fo)&&!Lje(U)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(le&&fo)&&!Dje(U)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Hs=U.meta)!=null&&Hs.sandboxUsage)?o.jsx(CRe,{usage:U.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[ri&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Re==="good","aria-busy":Pt,title:Re==="good"?"取消点赞":"赞",disabled:Pt,onClick:()=>void Z2(U,Re==="good"?null:"good",Js),children:o.jsx(lje,{className:"icon",filled:Re==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Re==="bad","aria-busy":Pt,title:Re==="bad"?"取消点踩":"踩",disabled:Pt,onClick:()=>void Z2(U,Re==="bad"?null:"bad",Js),children:o.jsx(cje,{className:"icon",filled:Re==="bad"})})]}),!p&&o.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>rn(!0),children:o.jsx(Rje,{})}),o.jsx(ZD,{text:Qb(U)})]}),U.meta&&o.jsx("span",{className:"meta-text",children:jje(U.meta)})]})]})]},ee)})}),!p&&o.jsx(Fde,{appName:n,info:Et,loading:Dn,activeAgent:rE,seenAgents:aE,execPath:$g,capabilities:gn,capabilityLoading:Bn,capabilityMutating:Ri,builtinTools:gs,onAddCapability:oG,onRemoveCapability:U=>void lG(U)}),o.jsx("div",{className:"conversation-composer-slot",children:M})]})]})})})(),sn&&a&&o.jsx(Jz,{appName:n,sessionId:a,onClose:()=>rn(!1)}),o.jsx(NRe,{open:W,state:ce,agentKind:ge,error:_e,onCancel:VV,onConfirm:M=>void GV(M)}),p?o.jsxs(o.Fragment,{children:[o.jsx(BRe,{open:O!==null,kind:O??"terminal",launch:G,loading:F,error:j,onReload:()=>{O&&EE(O)},onClose:()=>{L(null),D(null),A(!1),P("")}}),o.jsx(zRe,{open:T,value:p.permissions,busy:E||y,error:N,onSave:M=>void YV(M),onClose:()=>{E||(k(!1),_(""))}}),o.jsx(VRe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:N,browse:WV,onSave:M=>void XV(M),onClose:()=>{E||(I(!1),_(""))}}),o.jsx(URe,{open:Lt.threadsOpen,threads:Lt.threads,currentThreadId:p.threadId,loading:Lt.threadsLoading,error:Lt.threadsError,onSelect:M=>void Lt.resumeThread(M),onClose:Lt.closeThreads}),o.jsx(GRe,{approval:$,busy:Y,error:B,onDecision:M=>void QV(M)})]}):null,o.jsx(fje,{open:Ut,checking:wi,error:lo,onLogin:()=>void FV()}),jV&&o.jsx("div",{className:"confirm-scrim",onClick:()=>dE(!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:()=>dE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{ls(null),Dt("menu"),dE(!1)},children:"确定返回"})]})]})})]})}const s3="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(s3)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(s3,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})()||EY.createRoot(document.getElementById("root")).render(o.jsx(jt.StrictMode,{children:o.jsx(RY,{reducedMotion:"user",children:o.jsx(uJ,{maskOpacity:.9,children:o.jsx(Gje,{})})})}));export{f2 as $,G0e as A,K0e as B,T7 as C,o as D,mt as E,Ln as F,zt as G,Wje as H,Oz as I,l0e as J,ks as K,b as L,Nx as M,Ar as N,Xje as O,gz as P,$p as Q,jt as R,fu as S,x2e as T,vz as U,Ps as V,ur as W,Iu as X,Yx as Y,Ez as Z,pu as _,ea as a,m7 as a0,jz as b,S2e as c,OM as d,Af as e,Ws as f,Qje as g,sz as h,dc as i,Xx as j,Lf as k,qke as l,sOe as m,dA as n,qpe as o,tAe as p,Lm as q,Jt as r,u0e as s,b0e as t,Wpe as u,Df as v,bbe as w,Zge as x,Jge as y,Nbe as z}; diff --git a/veadk/webui/assets/index.esm-Bao40dC4.js b/veadk/webui/assets/index.esm-Bao40dC4.js new file mode 100644 index 00000000..54ba0d3e --- /dev/null +++ b/veadk/webui/assets/index.esm-Bao40dC4.js @@ -0,0 +1,2 @@ +(function(){var n,t,e;typeof Element>"u"||Element.prototype.addEventListener||(n=[],e=function(r,o){for(var i=0;i=n.length?void 0:n)&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var r,o,i=e.call(n),u=[];try{for(;(t===void 0||0=u&&d.call(this),clearTimeout(c),c=setTimeout(d.bind(this),f)},flush:function(){clearTimeout(c),d.call(this)},getBatchData:function(){return s.length?ae(s):""},clear:function(){clearTimeout(c),s=[]},fail:function(l){t=l},success:function(l){e=l}}}var P=function(){return{}};function kn(n){return n}function N(n){return typeof n=="object"&&n!==null}function Cr(n){return n===void 0}function Mr(n,t){try{return n instanceof t}catch{return!1}}var Kn=Object.prototype;function ut(n){return N(n)?typeof Object.getPrototypeOf!="function"?Kn.toString.call(n)==="[object Object]":(n=Object.getPrototypeOf(n),n===Kn||n===null):!1}function Y(n){return Kn.toString.call(n)==="[object Array]"}function L(n){return typeof n=="function"}function Pr(n){return typeof n=="boolean"}function _n(n){return typeof n=="number"}function F(n){return typeof n=="string"}function Ar(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return n instanceof Error}}function xr(n){return typeof Event<"u"&&Mr(n,Event)}function Or(n){return Object.prototype.toString.call(n)==="[object ErrorEvent]"}function Ir(n){return Object.prototype.toString.call(n)==="[object PromiseRejectionEvent]"}function Nr(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function Lr(){for(var n=[],t=0;t>>((3&e)<<3)&255;return n}function Jr(n){for(var t=[],e=0;e<256;++e)t[e]=(e+256).toString(16).substr(1);var r=0,o=t;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}function zn(){var n=Yr();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,Jr(n)}var Xr=3e5,Kr=function(n,t,e){var r=0;return e===-1?P:function(){if(n())return r&&clearTimeout(r),void(r=0);r===0&&(r=setTimeout(t,e))}},de=function(n,t){var e=[];try{e=t.reduce(function(r,o){try{var i=o(n);typeof i=="function"&&r.push(i)}catch{}return r},[])}catch{}return function(r){return de(r,e)}},zr=function(n){function t(a){r=ct(r,a),i||u()}var e,r=[],o=[],i=!1,u=Kr(function(){return!!r.length},function(){i=!0,e&&e[0](),o.forEach(function(a){return a()}),o.length=0,e=void 0},n=n===void 0?Xr:n);return{next:function(a){return de(a,r)},complete:function(a){o.push(a)},attach:function(a,f){e=[a,f]},subscribe:function(a){if(i)throw new Error("Observer is closed");return r.push(a),e&&e[1]&&e[1](a),u(),function(){return t(a)}},unsubscribe:t}},pe=function(n,t,e){e=zr(e);try{n(e.next,e.attach),t&&e.complete(t)}catch{}return[e.subscribe,e.unsubscribe]},$r=function(n,t){var e=h(n,1)[0];return function(r,o){var i=e(function(u){return Wr(t)(u)?r(u):P});o(function(){i()})}};function Qr(){function n(o){o.length&&o.forEach(function(i){try{i()}catch{}}),o.length=0}function t(o){r[o]&&r[o].forEach(function(i){n(i[1])}),r[o]=void 0}var e=!1,r={};return{set:function(o,i,u){r[o]?r[o].push([i,u]):r[o]=[[i,u]],e&&n(u)},has:function(o){return!!r[o]},remove:t,removeByEvType:function(o){Object.keys(r).forEach(function(i){r[i]&&r[i].forEach(function(u){u[0]===o&&n(u[1])})})},clear:function(){e=!0,Object.keys(r).forEach(function(o){t(o)})}}}var U=function(n,t,e,r){return n.destroyAgent.set(t,e,r)},Zr=500,no=50;function to(n,t,e){t.push(e),t.length([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),i=t.replace(r,"$1").trim());n";function J(n){try{for(var t,e=n,r=[],o=0,i=0,u=3;e&&o++<5&&!((t=To(e))==="html"||1 ")}catch{return be}}function To(n){var t,e,r,o,i=n,u=[];if(!i||!i.tagName)return"";if(u.push(i.tagName.toLowerCase()),i.id)return"#"+i.id;if(n=i.className,n&&F(n))for(e=n.split(/\s+/),f=0;f=w()?i:void 0}catch{return}},Se=function(n,t,e){if(!(e<=0))try{localStorage.setItem(n,Co(JSON.stringify(y(y({},t),{expires:w()+e}))))}catch{}},Ao=7776e6,Re=function(n){return n===!1?0:n!==!0&&n!==void 0&&_n(n)?n:Ao},we=function(n){var t;if(typeof window=="object"&&window.__perfsee__){var e={};return(t=Error.captureStackTrace)!==null&&t!==void 0&&t.call(Error,e,n),e.stack}},Ce="xhr_0",Me=function(){var n=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(t){return n.test(t)}},xo=function(n){return function(){for(var t,e=[],r=0;rn?e(I(I([],h(r),!1),[o],!1),n):I(I([],h(r),!1),[o],!1))}]},ci=function(n,u,a){var f=h(u,2),r=f[0],o=f[1],i=a.maxBreadcrumbs,c=a.onAddBreadcrumb,s=a.onMaxBreadcrumbs,u=a.dom,f=h(ui(100),2),a=f[0],f=f[1],c=h(ai(i,c,s),2),s=c[0],c=c[1];return u&&(u=ii(c),n.push(r[0](a(Rt,qt(u)))),n.push(o[0](f(qt(u))))),[s,c]},wt="breadcrumb",si={maxBreadcrumbs:20,dom:!0};function fi(n,t){var e,r,o,i=z(t,si);i&&(i=(t=h(ci(e=[],[M(n,ti),M(n,oi)],i),2))[0],r=t[1],n.on("report",o=function(u){return u.ev_type===G&&r({type:G,category:u.payload.api,message:"",data:{method:u.payload.request.method,url:u.payload.request.url,status_code:String(u.payload.response.status)},timestamp:u.payload.request.timestamp}),u}),e.push(function(){n.off("report",o)}),U(n,wt,sn,e),n.provide("getBreadcrumbs",i),n.provide("addBreadcrumb",r))}function li(n){n.on("init",function(){var t=(t=n.config())===null||t===void 0?void 0:t.plugins[wt];fi(n,t)})}var di=function(n,o,e){var r=h(o,2),o=r[0],i=r[1],u=e.setTraceHeader,a=e.ignoreUrls,f=e.setContextAtReq,s=e.extractUrl,c=window.Headers,d=window.Request;d&&c&&n.push(o[0](function(g){var p,g=h(g,2),m=g[0],E=g[1],S=yn(m instanceof d?m.url:m);if(!pi(S)||st(a,S))return P;u&&u(S,function(T,D){return vi(T,D,m,E,d,c)});var b=f(),v=w(),_=void 0,R=i()[0](function(T){(S===T.name||p&&p===T.name)&&!_&&(_=T)});return function(T){p=T&&T.url;var D=gi(m,E,T,d,c,e,v),O=Yo(function(A){_&&(A.response.timing=_),De(A,s),b&&b({ev_type:G,payload:A}),R()});setTimeout(function(){O(D)},1e3)}}))},pi=function(e){if(!F(e))return!1;var t=h(e.split(":"),2),e=t[0];return!t[1]||e==="http"||e==="https"},Ct=function(n,t){return n instanceof t},vi=function(n,t,e,r,o,i){Ct(e,o)?e.headers.set(n,t):r.headers instanceof i?r.headers.set(n,t):r.headers=y(y({},r.headers),((r={})[n]=t,r))},ke=function(n,t,e){return t=t&&t.method||"get",(t=Ct(n,e)&&n.method||t).toLowerCase()},Gt=function(n){for(var t=[],e=1;et.frustrating_threshold?2:r>t.satisfying_threshold||e===0?0:1},su=function(){var n=0,t=void 0;return[function(e){e?t&&(n+=w()-t,t=void 0):t=w()},function(){t&&(n+=w()-t);var e=n;return n=0,t=w(),e}]},Jt=function(n,t){return function(e,r){var o=e.payload;switch(e.ev_type){case X:var i=o.name;o.isSupport&&n(r[En],i,o.value);break;case Ne:n(r[En],au,o.duration||0);break;case sn:t(r[Mn],0);break;case G:o.response.is_custom_error||400<=o.response.status?t(r[Mn],1):(i=o.response.timing)&&n(r[Wn],0,i.duration);break;case Tn:t(r[Mn],2);break;case Tt:t(r[Mn],3);break;case yt:n(r[Wn],1,o.duration);break;case hn:o.longtasks.forEach(function(u){n(r[Wn],2,u.duration)})}}},Xt=function(){function n(){t=[0,0,0],e=cu()}var t,e;return n(),[function(r,o,i){var u=r&&r[o];!u||i<=0||(r=i<(u[0].threshold||0)?0:i>(u[1].threshold||0)?2:1,t[r]+=u[r].weight,typeof o=="string"?(i=Ge(o,r),u=e[En][i],e[En][i]=(u||0)+1):r==2&&(e.duration_count[o]+=1))},function(r,o){r&&(t[2]+=r[o],e.error_count[o]+=1)},function(){return[t,e]},n]},fu=function(){var n={start:w(),end:0,time_spent:0,is_bounced:!1,entry:"",exit:"",p_count:0,a_count:0};return[function(o,e){var i=h(o,3),r=i[0],o=i[1],i=i[2];n.end=w(),n.time_spent+=e&&e.time_spent||0,n.last_page=e,n.p_count+=1,n.rank=r,n.apdex=o,n.apdex_detail=i,i=j(),i&&(n.is_bounced=!Fe(i))},function(t,e){n.time_spent+=t.time_spent,n.p_count+=1,n.exit=e},function(){n.a_count+=1},function(t){n.entry=t,n.exit=t},function(){return n}]},lu=function(n,t,e,g){var o,i,u,a=g.sendInit,f=g.initPid,s=g.routeMode,c=g.extractPid,g=g.onPidUpdate,d=nt(s)?function(){return""}:eu(s),l=c||function(){},g=h(ru(uu(n),f||(o=location.href,(i=l(o))!==null&&i!==void 0?i:d(o)),d(location.href),g),2),p=g[0],g=g[1];return nt(s)||(u=h(ou(function(m,E){return p(m,d(E),l(E))},""),1)[0],e.length&&e.forEach(function(m){return t.push(m[0](function(E){return u(s,E)}))})),a&&g(),[p.bind(null,"user_set")]},du=function(n,t,O,E){var m=h(O,2),o=m[0],i=m[1],u=E.apdex===2,a=void 0,f=void 0,s=void 0,c=!1,A=h(Xt(),4),d=A[0],l=A[1],p=A[2],g=A[3],O=h(Xt(),4),m=O[0],E=O[1],S=O[2],b=O[3],A=h(fu(),5),v=A[0],_=A[1],R=A[2],T=A[3],D=A[4],O=h(su(),2),A=O[0],Fn=O[1];t.push(o[0](A)),u||t.push(i[0](function(){var x,k,rn;c&&(x=(rn=h(S(),2))[0],k=rn[1],rn=Yt(x,s),v([rn,x,k],Rn()),n({ev_type:Ie,payload:D()}),b())}));var qn=Jt(d,l),$=Jt(m,E),Rn=function(){var k=h(p(),2),x=k[0],k=k[1];return{start:a[0],pid:a[1],view_id:a[2],end:w(),time_spent:Fn(),apdex:x,rank:Yt(x,s),detail:k}};return t.push(function(){c=!1}),[function(x,k){if(!a)return a=[w(),x,k],T(x),void(c=!(!s||!a));c&&(f=Rn(),_(f,x)),a=[w(),x,k],g()},function(x){c&&(u||($(x,s),x.ev_type===Ne&&R()),x.common.pid===a[1]&&qn(x,s))},function(x){c&&(x.payload.last=f),n(x)},function(x){if(!x)return t.forEach(function(k){return k()}),void(t.length=0);c=!(!(s=x)||!a)}]},Dn="pageview",pu={sendInit:!0,routeMode:"history",apdex:2};function vu(n,t){var e,r,o,i,u,a,f,s,c,d,l=z(t,pu);l&&ve()&&(e=l.routeMode,u=l.apdex,s=n.report.bind(n),f=P,u&&(r=[],t=(o=h(du(n.report.bind(n),r,[M(n,Mt),M(n,Hn)],l),4))[0],i=o[1],u=o[2],a=o[3],s=u,f=t,n.on("send",i),r.push(function(){return n.off("send",i)}),n.on("start",function(){a(n.config().apdex)}),U(n,Dn,Ie,r)),c=h(lu(s,s=[],nt(e)?[]:[n.initSubject(nu),n.initSubject(tu)],y(y({},l),{initPid:(l=n.config())===null||l===void 0?void 0:l.pid,onPidUpdate:function(p){var g=qe(p);f(p,g),n.set({pid:p,viewId:g,actionId:void 0})}})),1)[0],cn(n,[me,Ee(n)],-1),d=function(){c(n.config().pid)},n.on("config",d),s.push(function(){return n.off("config",d)}),U(n,Dn,Oe,s),n.provide("sendPageview",c))}function gu(n){n.on("init",function(){var t=(t=n.config())===null||t===void 0?void 0:t.plugins[Dn];vu(n,t)})}var hu="resource",mu=["xmlhttprequest","fetch","beacon"],Eu=function(n,t,s,r){var o,i,u,a,f=h(s,2),s=f[0],c=f[1],d=K();d&&(f=r.ignoreUrls,o=r.slowSessionThreshold,i=r.ignoreTypes,u=pn(f),a=function(l,p){p===void 0&&(p=!1),V(i||mu,l.initiatorType)||u&&u.test(l.name)||(l={ev_type:yt,payload:l},p&&(l.extra={sample_rate:1}),n(l))},t.push(s[0](function(){var p=h(nn(d),3),l=p[0],p=p[2],g=function(){if(!l)return!1;var m=l.loadEventEnd-l.navigationStart;return owindow.innerHeight||e<=0))?0:o+1+.5*t},na=function(t){var e=h(t===void 0?[]:t),t=e[0],e=e.slice(1);return e&&e.reduce(function(u,o){var a=h(u,2),i=a[0],u=a[1],a=o.score-i.score;return[o,o.time>=i.time&&u.ratee.value?o:e):(n=o.value,t=[o.startTime],o),r(n,e))}]},la=function(c,t,i){var u=h(i,4),r=u[1],o=u[2],i=u[3],u=Z(),a=W(tt,0),f=We(c);if(!u)return a.isSupport=!1,void f(a);var c=h(fa(),2),s=c[0],c=c[1].bind(null,function(d,l){if(d>a.value){a.value=d;try{var p=Du(l);a.extra=p?{element:J(p)}:void 0}catch{}}});t.push(gn(u,c,sa)),r=r(),t.push(r[0](function(d){d&&s()})),i=i(),t.push(i[0](function(d){f(a,d),s(),a=W(tt,0)})),o=o(),t.push(o[0](function(){f(a)}))},Qt=[tt,la],nr="event",et="inp",Zt=10,da=function(n,t){var e=0,r=1/0,o=0;return t.push(gn(n,function(i){i.interactionId&&(r=Math.min(r,i.interactionId),o=Math.max(o,i.interactionId),e=o?(o-r)/7+1:0)},nr,0)),[function(){return e}]},pa=function(n,t,r){var f=h(r,4),r=f[0],o=f[2],i=f[3],u=Z(),a=vo(),f=K(),s=W(et,0),c=We(n);if(!u||!a||!f)return s.isSupport=!1,void c(s);function d(){m=b(),E=[],S={}}function l(_){var R=E[E.length-1],T=S[_.interactionId],D=!E.length||_.duration>E[0].latency;(T||E.lengthR.latency)&&(T?(T.entries.push(_),T.latency=Math.max(T.latency,_.duration),D&&!T.element&&_.target&&(T.element=J(_.target))):(T={id:_.interactionId,latency:_.duration,entries:[_]},D&&_.target&&(T.element=J(_.target)),S[T.id]=T,E.push(T)),E.sort(function(O,A){return A.latency-O.latency}),E.splice(Zt).forEach(function(O){delete S[O.id]}))}function p(){var _=(_=Math.min(E.length-1,Math.floor(v()/50)),E[_]);_&&(s.value=_.latency,_.element?s.extra={element:_.element}:(_=_.entries[0].target)&&(s.extra={element:J(_)}))}function g(_){_.interactionId&&l(_),_.entryType!=="first-input"||E.some(function(R){return R.entries.some(function(T){return _.duration===T.duration&&_.startTime===T.startTime})})||l(_)}var m=0,E=[],S={},b=h(da(u,t),1)[0],v=function(){return b()-m};t.push(r[0](function(){t.push(gn(u,g,nr,40)),"interactionId"in a.prototype&&t.push(gn(u,g,ca));var _=i();t.push(_[0](function(R){p(),c(s,R),d(),s=W(et,0)})),_=o(),t.push(_[0](function(){p(),c(s)})),t.push(d)}))},rt=[et,pa],tr="longtask",va=function(n,t,e){e=h(e,4)[3],t.push(e[0](function(r){n(Ou(r))}))},ga=[tr,va],er="timing",ha=function(n,t,i){var u=h(i,3),r=u[0],o=u[1],i=u[2],u=K(),u=h(nn(u),3),a=u[0],f=u[1],s=u[2],c=Sn(function(l){var p=s("navigation")[0],g=p&&p.responseStart;return(!g||g<=0||g>f())&&(p=void 0),{ev_type:bt,payload:{isBounced:l,timing:a,navigation_timing:p}}},n,t);t.push(i[0](function(){c(!0)}));function d(){function l(){c(!1)}var p=o();t.push(function(){return p[1](l)}),p[0](l)}t.push(function(){return r[1](d)}),r[0](d)},ma=[er,ha];rt[0];var Ea=["SCRIPT","STYLE","META","HEAD"],Yn=[sn,G,Tn],rr=1.5,_a=1e4,ya=8e3,ba=4e3,Ta=1e4,Sa=.1,Ra=4,wa=[X,hn,bt,$n],Ca=function(n){return~wa.indexOf(n.ev_type)},Ma=function(n,t){if(Yn.indexOf(t.ev_type)===-1||t.ev_type===G&&t.payload.response.status<400||n&&Yn.indexOf(n.type)innerHeight||u<=0?0:1/(1<"+u+""}var Pa=function(n){var t=n.cb,e=n.screenshotUrl,r=n.window,o=n.document,i=n.mask,u=n.partialShot,a=n.quality,f=n.rootSelector;if(po()&&r&&o){if(r.html2canvas)return s();n=o.createElement("script"),n.src=e,n.crossOrigin="anonymous",n.onload=s,n.onerror=function(){t()},(e=o.head)!==null&&e!==void 0&&e.appendChild(n)}function s(){bo(r)(function(){r.html2canvas&&r.html2canvas(u&&f&&o.querySelector(f)||o.body,{scale:360/r.innerWidth,mask:i,useCROS:!0}).then(function(c){t(Aa(c.toDataURL("image/jpeg",a)))}).catch(function(){t(cr())})})}};function Aa(n){return n.slice(0,10)==="data:image"?n:cr()}function cr(n,t){n===void 0&&(n=192),t===void 0&&(t=108);var e=document.createElement("canvas");e.width=n,e.height=t;var r=e.getContext("2d");return r&&(r.fillStyle="#ffffff",r.fillRect(0,0,n,t)),e.toDataURL("image/jpeg")}var xa=function(n,t,v,r){function o(B,Cn){wn||(u=kt())&&(wn=!0,t.forEach(function(on){return on()}),t.length=0,n({ev_type:Tt,payload:{timestamp:u[0],score:u[1],screenshot:Cn,error:a,serialized_dom:ar(ne(_))},overrides:{timestamp:B||u[0]}}))}function i(){c&&clearTimeout(c),f&&clearTimeout(f),f=$.setTimeout(function(){s=x(function(){(u=kt())&&yr()})},1e3)}var u,a,f,s,c,d,l,R=h(v,5),p=R[0],g=R[1],m=R[2],E=R[3],S=R[4],b=r.threshold,v=r.screenshot,_=r.rootSelector,R=r.autoDetect,T=r.ssUrl,D=r.quality,O=r.mask,A=r.partialShot,Fn=r.initDetTime,qn=r.runDetTime,$=C(),Rn=j(),x=$.requestAnimationFrame||P,k=$.cancelAnimationFrame||P,rn=h(nn(performance),2)[1],Gn=0,wn=!1,jt=!v,kt=function(){var B=ne(_);if(B)return B=ur(B,0,0,b),B_a?qn:Fn)});return t.push(S[0](function(){a&&o()})),R&&t.push(p[0](function(){var B=g();t.push(B[0](function(){var Cn=h(vt(ft(),i),2),on=Cn[0],Ut=Cn[1];t.push(function(){clearTimeout(f),clearTimeout(c),k(s),Ut&&Ut()}),on((on=j())===null||on===void 0?void 0:on.body,{subtree:!0,childList:!0}),t.push(m()[0](function(){f&&i()})),t.push(E()[0](function(){f&&i()})),i()}))})),[function(B){wn||Ca(B)||(Gn=w(),a&&Gn-a.timestamp>Ta&&(a=void 0),a=Ma(a,B))},i]},Lt="blankScreen";function Oa(n,t){var e,r,o=j(),i=C();o&&i&&(i=[],t=h(xa(n.report.bind(n),i,[M(n,At),function(){return M(n,Ji)},function(){return M(n,_t)},function(){return M(n,bn)},M(n,Hn)],t),2),e=t[0],t=t[1],n.on("report",r=function(u){return e(u),u}),i.push(function(){n.off("report",r)}),U(n,Lt,Tt,i),n.provide("detectBlankScreen",t))}function Ia(n,t){n.on("init",function(){var e={autoDetect:!0,threshold:rr,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!0,quality:Sa,initDetTime:ya,runDetTime:ba},e=t?z(t,e):fn(n,Lt,e);e&&Oa(n,e)})}var Na={entries:[],observer:void 0},xn="performance";function La(n){n.on("init",function(){var t=n.pp||Na;(c=t.observer)!==null&&c!==void 0&&c.disconnect();var e,r,o,i,u,a,f,s,c,d,l,p=fn(n,xn,{});p&&(e=function(){return M(n,At)},r=function(){return M(n,Mt)},o=function(){return M(n,Hn)},i=M(n,Pt),u=M(n,_t),a=void 0,cn(n,[me,Ee(n)],-1)[0](function(g){a=g})(),f=function(g){g=g.ev_type===X&&(g.payload.name===Qt[0]||g.payload.name===rt[0])||g.ev_type===hn?g:y(y({},g),{overrides:a}),n.report(g)},s=function(){return cn(n,[dt,pt(n)])},[Hu,Fu,aa,rt,Qt].forEach(function(g){p[g[0]]!==!1&&(g[1](f,g=[],[e(),r,o,s]),U(n,xn,X,g))}),[ga,ma].forEach(function(g){var m;p[g[0]]!==!1&&(g[1](f,m=[],[i,e,o(),u]),g=g[0]===tr?hn:g[0]===er?bt:X,U(n,xn,g,m))}),c=(d=h(Nu(n.report.bind(n)),2))[0],d=d[1],n.provide("performanceInit",c),n.provide("performanceSend",d),t.entries.length=0,l=function(E){var m=y(y(y({},Ve),E),{isCustom:!0}),E=we(l);E&&Object.assign(m,{stacks:E}),n.report(en(m))},n.provide("sendCustomPerfMetric",l))})}var Da="event",ja="log",ka=function(n){if(n&&N(n)&&n.name&&F(n.name)){var t={name:n.name,type:Da};if("metrics"in n&&N(n.metrics)){var e=n.metrics,r={};for(o in e)_n(e[o])&&(r[o]=e[o]);t.metrics=r}if("categories"in n&&N(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=an(i[o]);t.categories=u}return"attached_log"in n&&F(n.attached_log)&&(t.attached_log=n.attached_log),t}},Ua=function(n){if(n&&N(n)&&n.content&&F(n.content)){var t={content:an(n.content),type:ja,level:"info"};if("level"in n&&(t.level=n.level),"extra"in n&&N(n.extra)){var e,r=n.extra,o={},i={};for(e in r)_n(r[e])?o[e]=r[e]:i[e]=an(r[e]);t.metrics=o,t.categories=i}return"attached_log"in n&&F(n.attached_log)&&(t.attached_log=n.attached_log),t}},Ba=function(n){function t(e){var r=ka(e);r&&((e=we(t))&&(r.stacks=e),n.report({ev_type:$n,payload:r,extra:{timestamp:w()}}))}n.provide("sendEvent",t),n.provide("sendLog",function(e){e=Ua(e),e&&n.report({ev_type:$n,payload:e,extra:{timestamp:w()}})})},Ha=function(n){var t=Eo(),e=Bt(t);t&&(t.onchange=function(){e=Bt(t)}),n.on("report",function(r){return y(y({},r),{extra:y(y({},r.extra||{}),{network_type:e})})})},Pn=function(n,t){var e=n.common||{};return e.sample_rate=t,n.common=e,n},ot=function(n,t,e,r,o){return n?(i=o(r,t),function(){return i}):function(){return e(t)};var i},Fa=function(n,t){return n.map(function(e){switch(t){case"number":return Number(e);case"boolean":return e==="1";default:return String(e)}})},qa=function(n,t,e){switch(e){case"eq":return V(t,n);case"neq":return!V(t,n);case"gt":return n>t[0];case"gte":return n>=t[0];case"lt":return n VeADK Studio - +